about summary refs log tree commit diff stats
path: root/crates/yt/src/config/definitions.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/yt/src/config/definitions.rs')
-rw-r--r--crates/yt/src/config/definitions.rs67
1 files changed, 67 insertions, 0 deletions
diff --git a/crates/yt/src/config/definitions.rs b/crates/yt/src/config/definitions.rs
new file mode 100644
index 0000000..ce8c0d4
--- /dev/null
+++ b/crates/yt/src/config/definitions.rs
@@ -0,0 +1,67 @@
+// yt - A fully featured command line YouTube client
+//
+// Copyright (C) 2024 Benedikt Peetz <benedikt.peetz@b-peetz.de>
+// Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de>
+// SPDX-License-Identifier: GPL-3.0-or-later
+//
+// This file is part of Yt.
+//
+// You should have received a copy of the License along with this program.
+// If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>.
+
+use std::path::PathBuf;
+
+use serde::Deserialize;
+
+#[derive(Debug, Deserialize, PartialEq)]
+#[serde(deny_unknown_fields)]
+pub(crate) struct ConfigFile {
+    pub global: Option<GlobalConfig>,
+    pub select: Option<SelectConfig>,
+    pub watch: Option<WatchConfig>,
+    pub paths: Option<PathsConfig>,
+    pub download: Option<DownloadConfig>,
+    pub update: Option<UpdateConfig>,
+}
+
+#[derive(Debug, Deserialize, PartialEq, Clone, Copy)]
+#[serde(deny_unknown_fields)]
+pub(crate) struct GlobalConfig {
+    pub display_colors: Option<bool>,
+}
+
+#[derive(Debug, Deserialize, PartialEq, Clone, Copy)]
+#[serde(deny_unknown_fields)]
+pub(crate) struct UpdateConfig {
+    pub max_backlog: Option<usize>,
+}
+
+#[derive(Debug, Deserialize, PartialEq, Clone)]
+#[serde(deny_unknown_fields)]
+pub(crate) struct DownloadConfig {
+    /// This will then be converted to an u64
+    pub max_cache_size: Option<String>,
+}
+
+#[derive(Debug, Deserialize, PartialEq, Clone)]
+#[serde(deny_unknown_fields)]
+pub(crate) struct SelectConfig {
+    pub playback_speed: Option<f64>,
+    pub subtitle_langs: Option<String>,
+}
+
+#[derive(Debug, Deserialize, PartialEq, Clone, Copy)]
+#[serde(deny_unknown_fields)]
+pub(crate) struct WatchConfig {
+    pub local_displays_length: Option<usize>,
+}
+
+#[derive(Debug, Deserialize, PartialEq, Clone)]
+#[serde(deny_unknown_fields)]
+pub(crate) struct PathsConfig {
+    pub download_dir: Option<PathBuf>,
+    pub mpv_config_path: Option<PathBuf>,
+    pub mpv_input_path: Option<PathBuf>,
+    pub database_path: Option<PathBuf>,
+    pub last_selection_path: Option<PathBuf>,
+}