Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MPRIS PlayerStatus always returning "Stopped" #353

Closed
mainrs opened this issue Oct 3, 2019 · 6 comments · Fixed by #356
Closed

MPRIS PlayerStatus always returning "Stopped" #353

mainrs opened this issue Oct 3, 2019 · 6 comments · Fixed by #356
Labels
bug A functionality or parts of a program that do not work as intended good first issue An easy to implement issue, good for first time contributors or people new to open source reproducibility: easy An issue that is easily reproduced
Milestone

Comments

@mainrs
Copy link
Member

mainrs commented Oct 3, 2019

It looks like the Connect API returns the SHA-1 encoded device_name instead of the raw one. We compare it to the unhashed version. And since that will always fail, the PlayerStatus will always be Stopped.

I am, however, sure that it worked some releases ago 🤔

Relevant lines:

if player.device.id == _device.unwrap() {

player.device.id is the hash, _device.unwrap() is the URL-encoded device name.

fn device_id(name: &str) -> String {

To implement this, the above method should probably be moved to utils.rs

@mainrs mainrs added bug A functionality or parts of a program that do not work as intended good first issue An easy to implement issue, good for first time contributors or people new to open source reproducibility: easy An issue that is easily reproduced labels Oct 3, 2019
@mainrs mainrs added this to the v0.2.19 milestone Oct 3, 2019
@stuarth
Copy link
Contributor

stuarth commented Oct 4, 2019

I'll take this one!

@hifiberry
Copy link

Just had a look and it seems it also doesn't work on 0.2.10 anymore as it was some days ago. Might be a change in the API.

@mainrs
Copy link
Member Author

mainrs commented Oct 4, 2019

That was my guess too. The online API does mention the hash though but I didn't check Google cache or the web archive for an older version.

@mainrs
Copy link
Member Author

mainrs commented Oct 5, 2019

Just checked archive.org's fetches of the API page but even in 2017 the device_id is the hash of the device's name. Looks like my brain is tricking me...
This would mean that the PlayingStatus property actually never ever worked :(

Edit: Ups...

@mainrs mainrs closed this as completed Oct 5, 2019
@mainrs mainrs reopened this Oct 5, 2019
@mainrs
Copy link
Member Author

mainrs commented Oct 5, 2019

@stuarth FYI, https://github.com/ramsayleung/rspotify/blob/master/src/spotify/model/device.rs#L5 is the struct returned by player.device. It has a name field. So it might be enough to compare to player.device.name instead of player.device.id. You might need to url-encode the String in player.device.name as I have no clue if it is encoded or not.

@stuarth
Copy link
Contributor

stuarth commented Oct 5, 2019

@sirwindfield Thanks! Looking into it now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A functionality or parts of a program that do not work as intended good first issue An easy to implement issue, good for first time contributors or people new to open source reproducibility: easy An issue that is easily reproduced
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants