about summary refs log tree commit diff stats
path: root/src/config/definitions.rs
blob: d37e6da1c3025b3896664c6cd6ed21e673899bd9 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
// yt - A fully featured command line YouTube client
//
// Copyright (C) 2024 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 struct ConfigFile {
    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 struct UpdateConfig {
    pub max_backlog: Option<u32>,
}

#[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<String>,
}

#[derive(Debug, Deserialize, PartialEq, Clone)]
#[serde(deny_unknown_fields)]
pub struct SelectConfig {
    pub playback_speed: Option<f64>,
    pub subtitle_langs: Option<String>,
}

#[derive(Debug, Deserialize, PartialEq, Clone, Copy)]
#[serde(deny_unknown_fields)]
pub struct WatchConfig {
    pub local_comments_length: Option<usize>,
}

#[derive(Debug, Deserialize, PartialEq, Clone)]
#[serde(deny_unknown_fields)]
pub 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>,
}