about summary refs log tree commit diff stats
path: root/src/storage/video_database/mod.rs
diff options
context:
space:
mode:
authorBenedikt Peetz <benedikt.peetz@b-peetz.de>2024-08-23 13:11:09 +0200
committerBenedikt Peetz <benedikt.peetz@b-peetz.de>2024-08-23 13:14:13 +0200
commit94c656ad40a7aae570e5a5fb61ad32632acc6d46 (patch)
tree269614af20caf10d76643c302e0115bd36fd2378 /src/storage/video_database/mod.rs
parentrefactor(yt_dlp): Also move the `crates` subdirectory (diff)
downloadyt-94c656ad40a7aae570e5a5fb61ad32632acc6d46.tar.gz
yt-94c656ad40a7aae570e5a5fb61ad32632acc6d46.zip
feat(treewide): Use a configuration file
This allows use to avoid duplication of default values in the codebase
and obviously also facilitates changing these without having to
re-compile.
Diffstat (limited to 'src/storage/video_database/mod.rs')
-rw-r--r--src/storage/video_database/mod.rs11
1 files changed, 4 insertions, 7 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");
         }