src/app/config/main.rs

2a2a2fa4a5238515d8e2b21c975824c74f72606c
youtube-tui/src/app/config/main.rs history · blame · raw

31 lines · 705 bytes

 1use serde::{Deserialize, Serialize};
 2
 3#[derive(Clone, Debug, Serialize, Deserialize)]
 4pub struct MainConfig {
 5    pub yt_dl: YtDlConfig,
 6    pub max_watch_history: usize,
 7}
 8
 9impl Default for MainConfig {
10    fn default() -> Self {
11        Self {
12            yt_dl: YtDlConfig::default(),
13            max_watch_history: 50,
14        }
15    }
16}
17
18#[derive(Clone, Debug, Serialize, Deserialize)]
19pub struct YtDlConfig {
20    pub video_path: String,
21    pub audio_path: String,
22}
23
24impl Default for YtDlConfig {
25    fn default() -> Self {
26        Self {
27            video_path: String::from("~/Downloads/%(title)s.%(ext)s"),
28            audio_path: String::from("~/Downloads/%(title)s.%(ext)s"),
29        }
30    }
31}