diff options
author | Benedikt Peetz <benedikt.peetz@b-peetz.de> | 2024-08-23 13:11:09 +0200 |
---|---|---|
committer | Benedikt Peetz <benedikt.peetz@b-peetz.de> | 2024-08-23 13:14:13 +0200 |
commit | 94c656ad40a7aae570e5a5fb61ad32632acc6d46 (patch) | |
tree | 269614af20caf10d76643c302e0115bd36fd2378 /src/download/download_options.rs | |
parent | refactor(yt_dlp): Also move the `crates` subdirectory (diff) | |
download | yt-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/download/download_options.rs')
-rw-r--r-- | src/download/download_options.rs | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/download/download_options.rs b/src/download/download_options.rs index 04c1600..e93170a 100644 --- a/src/download/download_options.rs +++ b/src/download/download_options.rs @@ -10,7 +10,7 @@ use serde_json::{json, Value}; -use crate::{constants, storage::video_database::YtDlpOptions}; +use crate::{app::App, storage::video_database::YtDlpOptions}; // { // "ratelimit": conf.ratelimit if conf.ratelimit > 0 else None, @@ -22,7 +22,10 @@ use crate::{constants, storage::video_database::YtDlpOptions}; // "logger": _ytdl_logger // } -pub fn download_opts(additional_opts: YtDlpOptions) -> serde_json::Map<String, serde_json::Value> { +pub fn download_opts( + app: &App, + additional_opts: YtDlpOptions, +) -> serde_json::Map<String, serde_json::Value> { match json!({ "extract_flat": false, "extractor_args": { @@ -50,7 +53,7 @@ pub fn download_opts(additional_opts: YtDlpOptions) -> serde_json::Map<String, s "writeautomaticsub": true, "outtmpl": { - "default": constants::download_dir(false).expect("We're not creating this dir, thus this function can't error").join("%(channel)s/%(title)s.%(ext)s"), + "default": app.config.paths.download_dir.join("%(channel)s/%(title)s.%(ext)s"), "chapter": "%(title)s - %(section_number)03d %(section_title)s [%(id)s].%(ext)s" }, "compat_opts": {}, |