From 43522ef7898c60ffd3e7c5ff056fd765635bbc5c Mon Sep 17 00:00:00 2001 From: Benedikt Peetz Date: Sat, 24 Aug 2024 11:27:31 +0200 Subject: fix(config): Check for wrong keys in the config file --- src/config/definitions.rs | 59 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 src/config/definitions.rs (limited to 'src/config/definitions.rs') diff --git a/src/config/definitions.rs b/src/config/definitions.rs new file mode 100644 index 0000000..d37e6da --- /dev/null +++ b/src/config/definitions.rs @@ -0,0 +1,59 @@ +// yt - A fully featured command line YouTube client +// +// Copyright (C) 2024 Benedikt Peetz +// 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 . + +use std::path::PathBuf; + +use serde::Deserialize; + +#[derive(Debug, Deserialize, PartialEq)] +#[serde(deny_unknown_fields)] +pub struct ConfigFile { + pub select: Option, + pub watch: Option, + pub paths: Option, + pub download: Option, + pub update: Option, +} + +#[derive(Debug, Deserialize, PartialEq, Clone, Copy)] +#[serde(deny_unknown_fields)] +pub struct UpdateConfig { + pub max_backlog: Option, +} + +#[derive(Debug, Deserialize, PartialEq, Clone)] +#[serde(deny_unknown_fields)] +pub struct DownloadConfig { + /// This will then be converted to an u64 + pub max_cache_size: Option, +} + +#[derive(Debug, Deserialize, PartialEq, Clone)] +#[serde(deny_unknown_fields)] +pub struct SelectConfig { + pub playback_speed: Option, + pub subtitle_langs: Option, +} + +#[derive(Debug, Deserialize, PartialEq, Clone, Copy)] +#[serde(deny_unknown_fields)] +pub struct WatchConfig { + pub local_comments_length: Option, +} + +#[derive(Debug, Deserialize, PartialEq, Clone)] +#[serde(deny_unknown_fields)] +pub struct PathsConfig { + pub download_dir: Option, + pub mpv_config_path: Option, + pub mpv_input_path: Option, + pub database_path: Option, + pub last_selection_path: Option, +} -- cgit 1.4.1