diff options
author | Benedikt Peetz <benedikt.peetz@b-peetz.de> | 2024-08-23 18:23:20 +0200 |
---|---|---|
committer | Benedikt Peetz <benedikt.peetz@b-peetz.de> | 2024-08-24 11:45:09 +0200 |
commit | 0f4abc0997625fe4912883947210fbc9f2712396 (patch) | |
tree | 459d6747f58c10df4a3d19307306b0e0345a387e /src/select | |
parent | fix(select/cmds): Accept the watch flags for every command (diff) | |
download | yt-0f4abc0997625fe4912883947210fbc9f2712396.tar.gz yt-0f4abc0997625fe4912883947210fbc9f2712396.zip |
feat(select/display): Also show the video hash when color displaying it
The hash can now be used on the commandline to access video information.
Diffstat (limited to 'src/select')
-rw-r--r-- | src/select/selection_file/display.rs | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/select/selection_file/display.rs b/src/select/selection_file/display.rs index 0a0ce96..23c39d0 100644 --- a/src/select/selection_file/display.rs +++ b/src/select/selection_file/display.rs @@ -69,7 +69,10 @@ impl Video { Ok(f) } - pub fn to_color_display(&self) -> String { + pub async fn to_color_display_owned(self, app: &App) -> Result<String> { + self.to_color_display(app).await + } + pub async fn to_color_display(&self, app: &App) -> Result<String> { let mut f = String::new(); let publish_date = if let Some(date) = self.publish_date { @@ -89,8 +92,9 @@ impl Video { write!( f, - r#"{} {} {} {} {}"#, + r#"{} {} {} {} {} {}"#, c!("31;1", self.status.as_command()), + c!("95;3", self.extractor_hash.into_short_hash(app).await?), c!("32;1", self.title.replace(['"', '„', '”'], "'")), c!("37;1", publish_date), c!("34;1", parent_subscription_name), @@ -98,6 +102,6 @@ impl Video { ) .expect("This write should always work"); - f + Ok(f) } } |