about summary refs log tree commit diff stats
path: root/src/videos/mod.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/videos/mod.rs')
-rw-r--r--src/videos/mod.rs14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/videos/mod.rs b/src/videos/mod.rs
index 3876bd1..59baa8c 100644
--- a/src/videos/mod.rs
+++ b/src/videos/mod.rs
@@ -9,12 +9,15 @@
 // If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>.
 
 use anyhow::Result;
+use display::{format_video::FormatVideo, FormattedVideo};
 use futures::{stream::FuturesUnordered, TryStreamExt};
 use nucleo_matcher::{
     pattern::{CaseMatching, Normalization, Pattern},
     Matcher,
 };
 
+pub mod display;
+
 use crate::{
     app::App,
     storage::video_database::{getters::get_videos, VideoStatus},
@@ -25,7 +28,7 @@ pub async fn query(app: &App, limit: Option<usize>, search_query: Option<String>
 
     // turn one video to a color display, to pre-warm the hash shrinking cache
     if let Some(val) = all_videos.first() {
-        val.to_color_display(app).await?;
+        val.to_formatted_video(app).await?;
     }
 
     let limit = limit.unwrap_or(all_videos.len());
@@ -33,10 +36,13 @@ pub async fn query(app: &App, limit: Option<usize>, search_query: Option<String>
     let all_video_strings: Vec<String> = all_videos
         .into_iter()
         .take(limit)
-        .map(|vid| vid.to_color_display_owned(app))
+        .map(|vid| vid.to_formatted_video_owned(app))
         .collect::<FuturesUnordered<_>>()
-        .try_collect()
-        .await?;
+        .try_collect::<Vec<FormattedVideo>>()
+        .await?
+        .into_iter()
+        .map(|vid| (&vid.colorize()).to_line_display())
+        .collect();
 
     if let Some(query) = search_query {
         let mut matcher = Matcher::new(nucleo_matcher::Config::DEFAULT.match_paths());