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 OpenUri fails due to incorrect device_name #705

Closed
4 of 6 tasks
timlag1305 opened this issue Oct 31, 2020 · 4 comments
Closed
4 of 6 tasks

MPRIS OpenUri fails due to incorrect device_name #705

timlag1305 opened this issue Oct 31, 2020 · 4 comments
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 help wanted Issues that need help since the assigned person has little to no knowledge about the topic pinned Apply to make stale bot ignore issue/PR. reproducibility: easy An issue that is easily reproduced

Comments

@timlag1305
Copy link

timlag1305 commented Oct 31, 2020

Description
When I run dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotifyd /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.OpenUri "string:https://open.spotify.com/track/5OmIZhbwxGD1BwozQJe0t8?si=0pSNgfWySnqWPp8pf5MWTQ", spotifyd logs show that it receives and handles the OpenUri call. However, when I debug, I see that device_name of the current device is different than what the Spotify web API returns. Where Spotify web API returns an @ character, the local spotifyd config encodes that as %40d (e.g. Spotifyd@hostname vs Spotifyd%40dhostname). This prevents any device from being selected on the following line:

match device_payload.devices.into_iter().find(|d| d.is_active && d.name == device_name) {

This is especially problematic because the default device_name has an @.

To Reproduce

  1. Make spotifyd player the active device
  2. Run command dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotifyd /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.OpenUri "string:https://open.spotify.com/track/5OmIZhbwxGD1BwozQJe0t8?si=0pSNgfWySnqWPp8pf5MWTQ"
  3. Notice the song doesn't change/start playing

Expected behavior
Song should play after that dbus-send command.

Logs
The entire log was way too long to include so I just included a snippet where you can see the MPRIS call.

Click to show logs ``` event Readable Token(33554437) loop process - 1 events, 0.000s event Readable Token(33554437) D-Bus i/o poll ready: 59 is Ready(Readable) D-Bus i/o unix ready: 59 is Readable | Aio loop process - 1 events, 0.000s event Readable Token(33554437) loop process - 1 events, 0.000s handle_msgs: (MethodCall, Some("/org/mpris/MediaPlayer2"), Some("org.mpris.MediaPlayer2.Player"), Some("OpenUri")) loop poll - 29.283066ms loop time - Instant { tv_sec: 5545, tv_nsec: 23818785 } loop process, 11.562µs Polling message stream msgstream found Ok(Ready(Some((MethodCall, Some("/org/mpris/MediaPlayer2"), Some("org.mpris.MediaPlayer2.Player"), Some("OpenUri"))))) Polling message stream msgstream found Ok(NotReady) D-Bus i/o poll ready: 59 is Ready(Readable) D-Bus i/o unix ready: 59 is Readable | Aio scheduling Read for: 5 loop poll - 71.173µs loop time - Instant { tv_sec: 5545, tv_nsec: 24148965 } loop process, 9.779µs take? ("https", api.spotify.com): expiration = Some(90s) reuse idle connection for ("https", api.spotify.com) Client::encode method=GET, body=None flushed 398 bytes flushed({role=client}): State { reading: Init, writing: KeepAlive, keep_alive: Busy } event Readable | Writable Token(29360132) loop process - 1 events, 0.000s attempting to decode a frame frame decoded from buffer attempting to decode a frame frame decoded from buffer ```

Compilation flags

  • dbus_mpris
  • dbus_keyring
  • alsa_backend
  • portaudio_backend
  • pulseaudio_backend
  • rodio_backend

Versions (please complete the following information):

  • OS: Linux arch 5.9.2
  • Spotifyd: 0.2.24
  • cargo: 1.42.0

I think it's really only possible to see the error when debugging. I might be able to create a PR to fix this but I don't really know rust. I'm sure someone that knows rust could fix this easily.

@timlag1305 timlag1305 added the bug A functionality or parts of a program that do not work as intended label Oct 31, 2020
@robinvd robinvd added good first issue An easy to implement issue, good for first time contributors or people new to open source help wanted Issues that need help since the assigned person has little to no knowledge about the topic reproducibility: easy An issue that is easily reproduced labels Nov 16, 2020
@xtenduke
Copy link

xtenduke commented Dec 28, 2020

Done a bit of debugging...
I resolved the issue with the @ -> %40 percent encoding easily enough, but now getting 400s from the api when giving URI as https://open.spotify.com....
when passing in "string:spotify:track:225xvV8r1yKMHErSWivnow" works fine, but I think this is a separate issue...

@xtenduke
Copy link

Ignore previous, wildly incorrect.
Playback fails as API returns 400 because the track URI is incorrect.

Playback/context URIs should be specified in format
"spotify:track:1301WleyT98MSxVHPZCA6M"

https://developer.spotify.com/documentation/web-api/reference/player/start-a-users-playback/

@stale
Copy link

stale bot commented Mar 29, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix Issues that will not be fixed under any circumstances label Mar 29, 2021
@robinvd robinvd added the pinned Apply to make stale bot ignore issue/PR. label Mar 29, 2021
@stale stale bot removed the wontfix Issues that will not be fixed under any circumstances label Mar 29, 2021
@eladyn
Copy link
Member

eladyn commented Sep 9, 2022

I think that at least with #1079, this issue should be resolved. @timlag1305, feel free to reopen, if this isn't the case.

@eladyn eladyn closed this as completed Sep 9, 2022
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 help wanted Issues that need help since the assigned person has little to no knowledge about the topic pinned Apply to make stale bot ignore issue/PR. reproducibility: easy An issue that is easily reproduced
Projects
None yet
Development

No branches or pull requests

4 participants