fix: convert duration to i64 to avoid overflow

This can happen with longer playables, e.g. podcast episodes.
This commit is contained in:
Henrik Friedrichsen
2021-01-10 01:52:56 +01:00
parent a216af91ac
commit def01494db

View File

@@ -53,9 +53,9 @@ fn get_metadata(playable: Option<Playable>) -> Metadata {
);
hm.insert(
"mpris:length".to_string(),
Variant(Box::new(i64::from(
playable.map(|t| t.duration() * 1_000).unwrap_or(0),
))),
Variant(Box::new(
playable.map(|t| t.duration() as i64 * 1_000).unwrap_or(0),
)),
);
hm.insert(
"mpris:artUrl".to_string(),