about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorBenedikt Peetz <benedikt.peetz@b-peetz.de>2024-11-08 16:59:24 +0100
committerBenedikt Peetz <benedikt.peetz@b-peetz.de>2024-11-08 16:59:24 +0100
commitd387d04730a9a0f52bf5139c0bcf05d1534ec4ac (patch)
tree6db65fb9ab605553e5c572c5cc9421be3af98523
parentchore(version): v1.3.2 (diff)
downloadyt-d387d04730a9a0f52bf5139c0bcf05d1534ec4ac.tar.gz
yt-d387d04730a9a0f52bf5139c0bcf05d1534ec4ac.zip
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.
-rw-r--r--yt/src/select/cmds.rs3
1 files changed, 2 insertions, 1 deletions
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(())
                 }