Properly playing the files in the list instead of hard-coded paths.

This commit is contained in:
Tom Alexander 2022-02-21 18:50:28 -05:00
parent 860f5759c1
commit 6eeee7ef04
Signed by: talexander
GPG Key ID: D3A179C9A53C0EDE

View File

@ -41,9 +41,6 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
.await?; .await?;
sqlx::migrate!("./migrations").run(&pool).await?; sqlx::migrate!("./migrations").run(&pool).await?;
for f in files {
println!("Launching {}", f.path().display());
}
launch_mpv().await?; launch_mpv().await?;
// TODO: Figure out a better way to wait for the socket to exist and be connectable // TODO: Figure out a better way to wait for the socket to exist and be connectable
@ -52,16 +49,13 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
let mut mpvctl = MpvCtl::connect("/tmp/recordwatchsocket").await?; let mut mpvctl = MpvCtl::connect("/tmp/recordwatchsocket").await?;
let mut end_file_listener = mpvctl.listen(&["end-file"])?; let mut end_file_listener = mpvctl.listen(&["end-file"])?;
let client_name = mpvctl.get_client_name().await?; let client_name = mpvctl.get_client_name().await?;
let _ = mpvctl for f in files {
.play_video("/home/talexander/Downloads/test.mp4") println!("Launching {}", f.path().display());
.await?; mpvctl.play_video(f.path()).await?;
if let Some(evt) = end_file_listener.recv().await {
while let Some(evt) = end_file_listener.recv().await {
println!("end file event {}", evt); println!("end file event {}", evt);
} }
}
sleep(Duration::from_secs(50)).await;
let client_name = mpvctl.get_client_name().await?;
println!("done {}", client_name); println!("done {}", client_name);