From 145a776039248a9460e9473e4bc9ef3d533b60c1 Mon Sep 17 00:00:00 2001 From: Benedikt Peetz Date: Mon, 14 Oct 2024 12:32:23 +0200 Subject: feat(videos): Provide a consistent display for the `Video` struct Before, `Video`s where colourized differently, just because the colourization was not standardized. It now is. --- src/select/mod.rs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'src/select/mod.rs') diff --git a/src/select/mod.rs b/src/select/mod.rs index 2663a04..ca7a203 100644 --- a/src/select/mod.rs +++ b/src/select/mod.rs @@ -20,6 +20,7 @@ use crate::{ cli::CliArgs, constants::HELP_STR, storage::video_database::{getters::get_videos, VideoStatus}, + videos::display::format_video::FormatVideo, }; use anyhow::{bail, Context, Result}; @@ -63,23 +64,24 @@ pub async fn select(app: &App, done: bool, use_last_selection: bool) -> Result<( // Warmup the cache for the display rendering of the videos. // Otherwise the futures would all try to warm it up at the same time. if let Some(vid) = matching_videos.first() { - let _ = vid.to_select_file_display(app).await?; + let _ = vid.to_formatted_video(app).await?; } let mut edit_file = BufWriter::new(&temp_file); join_all( matching_videos - .iter() - .map(|vid| async { vid.to_select_file_display(app).await }) + .into_iter() + .map(|vid| async { vid.to_formatted_video_owned(app).await }) .collect::>(), ) .await .into_iter() .try_for_each(|line| -> Result<()> { - let line = line?; + let formatted_line = (&line?).to_select_file_display(); + edit_file - .write_all(line.as_bytes()) + .write_all(formatted_line.as_bytes()) .expect("This write should not fail"); Ok(()) -- cgit 1.4.1