From 94c656ad40a7aae570e5a5fb61ad32632acc6d46 Mon Sep 17 00:00:00 2001 From: Benedikt Peetz Date: Fri, 23 Aug 2024 13:11:09 +0200 Subject: 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. --- src/select/mod.rs | 9 +++------ src/select/selection_file/display.rs | 2 +- 2 files changed, 4 insertions(+), 7 deletions(-) (limited to 'src/select') diff --git a/src/select/mod.rs b/src/select/mod.rs index 6774ce6..2288e1a 100644 --- a/src/select/mod.rs +++ b/src/select/mod.rs @@ -18,7 +18,7 @@ use std::{ use crate::{ app::App, cli::CliArgs, - constants::{last_select, HELP_STR}, + constants::HELP_STR, storage::video_database::{getters::get_videos, VideoStatus}, }; @@ -111,11 +111,8 @@ pub async fn select(app: &App, done: bool) -> Result<()> { } let read_file = temp_file.reopen()?; - fs::copy( - temp_file.path(), - last_select().context("Failed to get the persistent selection file path")?, - ) - .context("Failed to persist selection file")?; + fs::copy(temp_file.path(), &app.config.paths.last_selection_path) + .context("Failed to persist selection file")?; let reader = BufReader::new(&read_file); diff --git a/src/select/selection_file/display.rs b/src/select/selection_file/display.rs index 12d128c..0a0ce96 100644 --- a/src/select/selection_file/display.rs +++ b/src/select/selection_file/display.rs @@ -32,7 +32,7 @@ impl Video { let opts = get_video_opts(app, &self.extractor_hash) .await? - .to_cli_flags(); + .to_cli_flags(&app); let opts_white = if !opts.is_empty() { " " } else { "" }; let publish_date = if let Some(date) = self.publish_date { -- cgit 1.4.1