fix mpris metadata returing Spotify URI instead of an url in xesam:url field (#222)
* Added OpenUri D-BUS MPRIS support. Removed "user:" from URIType check because Spotify doesn't always provide it. * Added tags to .gitignore * Changed mpris metadata to actually return the track's url instead of the Spotify URI so that it matches the functionality of the official Spotify client. * Changed mpris:trackid and xesam:url to not use static naming so it can support podcasts. * Changed xesam:url to default to an empty string instead of "0"
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -7,3 +7,5 @@
|
||||
**/*.rs.bk
|
||||
|
||||
*.log
|
||||
|
||||
tags
|
||||
|
||||
13
src/mpris.rs
13
src/mpris.rs
@@ -37,10 +37,7 @@ fn get_metadata(playable: Option<Playable>) -> Metadata {
|
||||
Variant(Box::new(
|
||||
playable
|
||||
.map(|t| {
|
||||
format!(
|
||||
"spotify:track:{}",
|
||||
t.id().unwrap_or_else(|| "0".to_string())
|
||||
)
|
||||
t.uri()
|
||||
})
|
||||
.unwrap_or_default(),
|
||||
)),
|
||||
@@ -118,7 +115,13 @@ fn get_metadata(playable: Option<Playable>) -> Metadata {
|
||||
);
|
||||
hm.insert(
|
||||
"xesam:url".to_string(),
|
||||
Variant(Box::new(playable.map(|t| t.uri()).unwrap_or_default())),
|
||||
Variant(Box::new(
|
||||
playable
|
||||
.map(|t| {
|
||||
t.share_url().unwrap_or_default()
|
||||
})
|
||||
.unwrap_or_default(),
|
||||
)),
|
||||
);
|
||||
|
||||
hm
|
||||
|
||||
Reference in New Issue
Block a user