diff options
Diffstat (limited to '')
-rw-r--r-- | pkgs/by-name/yt/yt/src/cache/mod.rs | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/pkgs/by-name/yt/yt/src/cache/mod.rs b/pkgs/by-name/yt/yt/src/cache/mod.rs index 87f42604..6aa3a161 100644 --- a/pkgs/by-name/yt/yt/src/cache/mod.rs +++ b/pkgs/by-name/yt/yt/src/cache/mod.rs @@ -5,7 +5,8 @@ use tokio::fs; use crate::{ app::App, storage::video_database::{ - downloader::set_video_cache_path, getters::get_videos, Video, VideoStatus, + downloader::set_video_cache_path, getters::get_videos, setters::set_state_change, Video, + VideoStatus, }, }; @@ -25,7 +26,7 @@ async fn invalidate_video(app: &App, video: &Video, hard: bool) -> Result<()> { } pub async fn invalidate(app: &App, hard: bool) -> Result<()> { - let all_cached_things = get_videos(app, &[VideoStatus::Cached]).await?; + let all_cached_things = get_videos(app, &[VideoStatus::Cached], None).await?; info!("Got videos to invalidate: '{}'", all_cached_things.len()); @@ -52,7 +53,7 @@ pub async fn maintain(app: &App, all: bool) -> Result<()> { vec![VideoStatus::Watch, VideoStatus::Cached] }; - let cached_videos = get_videos(app, domain.as_slice()).await?; + let cached_videos = get_videos(app, domain.as_slice(), None).await?; for vid in cached_videos { if let Some(path) = vid.cache_path.as_ref() { @@ -61,6 +62,10 @@ pub async fn maintain(app: &App, all: bool) -> Result<()> { invalidate_video(app, &vid, false).await?; } } + if vid.status_change { + info!("Video '{}' has it's changing bit set. This is probably the result of an unexpectet exit. Clearing it", vid.title); + set_state_change(app, &vid.extractor_hash, false).await?; + } } Ok(()) |