Stop iterating if the reason a video stopped is anything except eof.
This commit is contained in:
parent
6eeee7ef04
commit
466af9f1b3
10
src/main.rs
10
src/main.rs
@ -54,7 +54,17 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
mpvctl.play_video(f.path()).await?;
|
||||
if let Some(evt) = end_file_listener.recv().await {
|
||||
println!("end file event {}", evt);
|
||||
if let serde_json::Value::Object(obj) = evt {
|
||||
let reason = obj.get("reason");
|
||||
if let Some(serde_json::Value::String(reason_body)) = reason {
|
||||
if reason_body == "eof" {
|
||||
// Watched the video until the end
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
println!("done {}", client_name);
|
||||
|
Loading…
x
Reference in New Issue
Block a user