move sanity check, again
This commit is contained in:
parent
5e62838371
commit
fec04928b8
1 changed files with 13 additions and 10 deletions
|
@ -71,6 +71,7 @@ mod imp {
|
|||
mpv.observe_property(5, "time-pos").unwrap();
|
||||
mpv.observe_property(6, "playlist-count").unwrap();
|
||||
mpv.observe_property(7, "duration").unwrap();
|
||||
mpv.observe_property(8, "path").unwrap();
|
||||
|
||||
// "Useful to drain property changes before a new file is loaded."
|
||||
mpv.add_hook(0, "on_before_start_file", 0).unwrap();
|
||||
|
@ -171,6 +172,18 @@ mod imp {
|
|||
window.notify("duration");
|
||||
}
|
||||
|
||||
8 => {
|
||||
assert_eq!(event.name, "path");
|
||||
// sanity check
|
||||
match window.imp().mpv.get_property::<String>("path") {
|
||||
Ok(path) => {
|
||||
assert_eq!(path, window.song().unwrap().stream_url())
|
||||
}
|
||||
Err(err) if err.is_property_unavailable() => {}
|
||||
Err(err) => Err(err).unwrap(),
|
||||
}
|
||||
}
|
||||
|
||||
_ => unreachable!(),
|
||||
},
|
||||
|
||||
|
@ -402,16 +415,6 @@ mod imp {
|
|||
.dynamic_cast()
|
||||
.unwrap();
|
||||
|
||||
// sanity check
|
||||
match self.mpv.get_property::<String>("path") {
|
||||
Ok(path) => assert_eq!(song.stream_url(), path),
|
||||
Err(err) if err.is_property_unavailable() => {
|
||||
// NOTE: this happens between EndFile and StartFile
|
||||
event!(Level::WARN, "can't do sanity check, path is unavailable")
|
||||
}
|
||||
Err(err) => Err(err).unwrap(),
|
||||
};
|
||||
|
||||
Some(song)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue