about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorBenedikt Peetz <benedikt.peetz@b-peetz.de>2024-08-23 13:23:09 +0200
committerBenedikt Peetz <benedikt.peetz@b-peetz.de>2024-08-23 13:23:09 +0200
commit293b7b2bcf3b6ae6db98eb5dfa0c3496f2a1b2df (patch)
tree1cfbe3c060ad34b58b22f3c55f50d0a8eca9d372
parentfix(storage/setters): Enforce status invariants (diff)
downloadyt-293b7b2bcf3b6ae6db98eb5dfa0c3496f2a1b2df.tar.gz
yt-293b7b2bcf3b6ae6db98eb5dfa0c3496f2a1b2df.zip
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).
-rw-r--r--src/watch/events.rs11
1 files changed, 10 insertions, 1 deletions
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(" "))
                     }