From d387d04730a9a0f52bf5139c0bcf05d1534ec4ac Mon Sep 17 00:00:00 2001 From: Benedikt Peetz Date: Fri, 8 Nov 2024 16:59:24 +0100 Subject: fix(yt/select/add): Avoid crash on adding a video Currently, it expects the video to be already added to the database, as it requires looking up it's hash from it. Re-ordering the statements is not the cleanest solution, but it works. --- yt/src/select/cmds.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/yt/src/select/cmds.rs b/yt/src/select/cmds.rs index db3685a..0d06bd5 100644 --- a/yt/src/select/cmds.rs +++ b/yt/src/select/cmds.rs @@ -48,11 +48,12 @@ pub async fn handle_select_cmd( entry: yt_dlp::wrapper::info_json::InfoJson, ) -> Result<()> { let video = video_entry_to_video(entry, None)?; + add_video(app, video.clone()).await?; + println!( "{}", (&video.to_formatted_video(app).await?.colorize()).to_line_display() ); - add_video(app, video).await?; Ok(()) } -- cgit 1.4.1