aboutsummaryrefslogtreecommitdiffstats
path: root/src/watch/mod.rs
diff options
context:
space:
mode:
authorBenedikt Peetz <benedikt.peetz@b-peetz.de>2024-08-24 11:43:59 +0200
committerBenedikt Peetz <benedikt.peetz@b-peetz.de>2024-08-24 11:45:36 +0200
commit020c6e2ed2f424f997d0f124f7ae1aabb8a020dc (patch)
treefec2a2232a40374fcf1297d0844911c98244d207 /src/watch/mod.rs
parentfix(update_raw.py): Only return the needed fields to rust (diff)
downloadyt-020c6e2ed2f424f997d0f124f7ae1aabb8a020dc.zip
feat(watch): Idle until new videos are available instead of exiting
Diffstat (limited to 'src/watch/mod.rs')
-rw-r--r--src/watch/mod.rs7
1 files changed, 2 insertions, 5 deletions
diff --git a/src/watch/mod.rs b/src/watch/mod.rs
index 815e208..9eb1c18 100644
--- a/src/watch/mod.rs
+++ b/src/watch/mod.rs
@@ -77,11 +77,6 @@ pub async fn watch(app: &App) -> Result<()> {
play_things.len()
);
- // There is nothing to watch
- if play_things.len() == 0 {
- return Ok(());
- }
-
let mut playlist_cache: Vec<ExtractorHash> = Vec::with_capacity(play_things.len());
for play_thing in play_things {
@@ -100,6 +95,8 @@ pub async fn watch(app: &App) -> Result<()> {
let mut mpv_event_handler = MpvEventHandler::from_playlist(playlist_cache);
loop {
+ while mpv_event_handler.check_idle(&app, &mpv).await? {}
+
if let Some(ev) = ev_ctx.wait_event(600.) {
match ev {
Ok(event) => {