From e3bf6d1dc6e058ddf499557ea92b532086b64fdc Mon Sep 17 00:00:00 2001 From: Benedikt Peetz Date: Tue, 9 Jun 2026 19:08:36 +0200 Subject: fix(yt/db/insert/playlist): Always delete a video file, even when marked-picked --- crates/yt/src/storage/db/insert/playlist.rs | 10 ++++++---- crates/yt/src/storage/db/insert/video/mod.rs | 10 ---------- 2 files changed, 6 insertions(+), 14 deletions(-) diff --git a/crates/yt/src/storage/db/insert/playlist.rs b/crates/yt/src/storage/db/insert/playlist.rs index 26d5376..dd8a9d2 100644 --- a/crates/yt/src/storage/db/insert/playlist.rs +++ b/crates/yt/src/storage/db/insert/playlist.rs @@ -47,10 +47,12 @@ impl Playlist { current_video.title, new_state ); - match new_state { - VideoTransition::Watched => current_video.set_watched(ops), - VideoTransition::Picked => current_video.set_status(VideoStatus::Pick, ops), - } + let new_state = match new_state { + VideoTransition::Watched => VideoStatus::Watched, + VideoTransition::Picked => VideoStatus::Pick, + }; + current_video.remove_download_path(ops); + current_video.set_status(new_state, ops); self.save_watch_progress(mpv, current_index, ops); diff --git a/crates/yt/src/storage/db/insert/video/mod.rs b/crates/yt/src/storage/db/insert/video/mod.rs index da62e37..3c73ae7 100644 --- a/crates/yt/src/storage/db/insert/video/mod.rs +++ b/crates/yt/src/storage/db/insert/video/mod.rs @@ -597,14 +597,4 @@ impl Video { }); } } - - /// Mark this video watched. - /// This will both set the status to `Watched` and the `cache_path` to Null. - /// - /// # Panics - /// Only if assertions fail. - pub(crate) fn set_watched(&mut self, ops: &mut Operations) { - self.remove_download_path(ops); - self.set_status(VideoStatus::Watched, ops); - } } -- cgit v1.3.1