From 293b7b2bcf3b6ae6db98eb5dfa0c3496f2a1b2df Mon Sep 17 00:00:00 2001 From: Benedikt Peetz Date: Fri, 23 Aug 2024 13:23:09 +0200 Subject: feat(watch/events): Add further understood script-messages They make it possible to force check for new available videos and to remove the currently playing video from the playlist to free cache space (otherwise you would have to quit the whole playlist). --- src/watch/events.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/watch/events.rs b/src/watch/events.rs index df414ff..9ba26cd 100644 --- a/src/watch/events.rs +++ b/src/watch/events.rs @@ -148,7 +148,7 @@ impl MpvEventHandler { return Ok(true); } EndFileReason::Error => { - unreachable!("This have raised a separate error") + unreachable!("This will be raised as a separate error") } EndFileReason::Redirect => { todo!("We probably need to handle this somehow"); @@ -226,6 +226,15 @@ impl MpvEventHandler { mpv.execute("write-watch-later-config", &[])?; mpv.execute("playlist-remove", &["current"])?; } + &["yt-mark-done-and-go-next"] => { + self.mark_cvideo_inactive(app).await?; + self.mark_cvideo_watched(app).await?; + + mpv.execute("playlist-remove", &["current"])?; + } + &["yt-check-new-videos"] => { + self.possibly_add_new_videos(app, mpv).await?; + } other => { debug!("Unknown message: {}", other.join(" ")) } -- cgit 1.4.1