diff options
Diffstat (limited to '')
-rw-r--r-- | src/storage/video_database/mod.rs | 11 | ||||
-rw-r--r-- | src/storage/video_database/setters.rs | 9 |
2 files changed, 10 insertions, 10 deletions
diff --git a/src/storage/video_database/mod.rs b/src/storage/video_database/mod.rs index 28263ca..da08f8f 100644 --- a/src/storage/video_database/mod.rs +++ b/src/storage/video_database/mod.rs @@ -12,10 +12,7 @@ use std::{fmt::Write, path::PathBuf}; use url::Url; -use crate::{ - constants::{DEFAULT_MPV_PLAYBACK_SPEED, DEFAULT_SUBTITLE_LANGS}, - storage::video_database::extractor_hash::ExtractorHash, -}; +use crate::{app::App, storage::video_database::extractor_hash::ExtractorHash}; pub mod downloader; pub mod extractor_hash; @@ -55,13 +52,13 @@ impl VideoOptions { /// This will write out the options that are different from the defaults. /// Beware, that this does not set the priority. - pub fn to_cli_flags(self) -> String { + pub fn to_cli_flags(self, app: &App) -> String { let mut f = String::new(); - if self.mpv.playback_speed != DEFAULT_MPV_PLAYBACK_SPEED { + if self.mpv.playback_speed != app.config.select.playback_speed { write!(f, " --speed '{}'", self.mpv.playback_speed).expect("Works"); } - if self.yt_dlp.subtitle_langs != DEFAULT_SUBTITLE_LANGS { + if self.yt_dlp.subtitle_langs != app.config.select.subtitle_langs { write!(f, " --subtitle-langs '{}'", self.yt_dlp.subtitle_langs).expect("Works"); } diff --git a/src/storage/video_database/setters.rs b/src/storage/video_database/setters.rs index 42875ce..e2b38e6 100644 --- a/src/storage/video_database/setters.rs +++ b/src/storage/video_database/setters.rs @@ -16,7 +16,10 @@ use log::debug; use sqlx::query; use tokio::fs; -use crate::{app::App, constants, storage::video_database::extractor_hash::ExtractorHash}; +use crate::{ + app::App, + storage::video_database::extractor_hash::ExtractorHash, +}; use super::{Video, VideoOptions, VideoStatus}; @@ -213,8 +216,8 @@ pub async fn add_video(app: &App, video: Video) -> Result<()> { let url = video.url.to_string(); let extractor_hash = video.extractor_hash.hash().to_string(); - let default_subtitle_langs = constants::DEFAULT_SUBTITLE_LANGS; - let default_mpv_playback_speed = constants::DEFAULT_MPV_PLAYBACK_SPEED; + let default_subtitle_langs = &app.config.select.subtitle_langs; + let default_mpv_playback_speed = app.config.select.playback_speed; query!( r#" |