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:
Bettehem
2020-07-14 22:30:14 +03:00
committed by GitHub
parent 1b1d392ab8
commit 578d2b2f0c
2 changed files with 10 additions and 5 deletions

2
.gitignore vendored
View File

@@ -7,3 +7,5 @@
**/*.rs.bk **/*.rs.bk
*.log *.log
tags

View File

@@ -37,10 +37,7 @@ fn get_metadata(playable: Option<Playable>) -> Metadata {
Variant(Box::new( Variant(Box::new(
playable playable
.map(|t| { .map(|t| {
format!( t.uri()
"spotify:track:{}",
t.id().unwrap_or_else(|| "0".to_string())
)
}) })
.unwrap_or_default(), .unwrap_or_default(),
)), )),
@@ -118,7 +115,13 @@ fn get_metadata(playable: Option<Playable>) -> Metadata {
); );
hm.insert( hm.insert(
"xesam:url".to_string(), "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 hm