From a12cab3619126e3b3264e08b3253b56b9606caa0 Mon Sep 17 00:00:00 2001 From: Erica Z Date: Tue, 5 Nov 2024 10:27:22 +0100 Subject: [PATCH] warn on failed seek --- src/ui/window.rs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/ui/window.rs b/src/ui/window.rs index 997c007..634de28 100644 --- a/src/ui/window.rs +++ b/src/ui/window.rs @@ -436,6 +436,7 @@ use adw::prelude::*; use adw::subclass::prelude::*; use gtk::{gio, glib}; use std::rc::Rc; +use tracing::{event, Level}; glib::wrapper! { pub struct Window(ObjectSubclass) @@ -486,9 +487,15 @@ impl Window { } pub fn seek(&self, new_position: f64) { - self.imp() + match self + .imp() .mpv .command(["seek", &new_position.to_string(), "absolute", "exact"]) - .unwrap(); + { + Ok(()) => {} + // TODO: buffer this on fail (usually happens when the file isn't done loading) + // to repro, mash the seek forward button + Err(err) => event!(Level::ERROR, "could seek to {new_position}: {err}"), + } } }