move sanity check

This commit is contained in:
Erica Z 2024-11-04 13:54:30 +01:00
parent f18c413457
commit daff4e7dbd

View file

@ -150,12 +150,6 @@ mod imp {
Event::StartFile(_) => {
window.notify("song");
// TODO: load cover art
// sanity check
assert_eq!(
window.song().unwrap().stream_url(),
window.imp().mpv.get_property::<String>("path").unwrap()
);
}
Event::Hook(event) => match event.reply_userdata {
@ -332,14 +326,20 @@ mod imp {
if self.obj().playlist_pos() < 0 {
None
} else {
Some(
self.obj()
.playlist_model()
.item(self.obj().playlist_pos() as u32)
.unwrap()
.dynamic_cast()
.unwrap(),
)
let song: PlaybinSong = self
.obj()
.playlist_model()
.item(self.obj().playlist_pos() as u32)
.unwrap()
.dynamic_cast()
.unwrap();
// sanity check
assert_eq!(
song.stream_url(),
self.mpv.get_property::<String>("path").unwrap()
);
Some(song)
}
}
}