Spotifyd / spotifyd

A spotify daemon
https://spotifyd.rs
GNU General Public License v3.0
9.91k stars 452 forks source link

Can't get dbus support working #161

Closed aetheryx closed 5 years ago

aetheryx commented 6 years ago

Built with pulseaudio and dbus_mpris features. The client itself works beautifully, but I can't connect to the bus. Anyone have any ideas?

image

CrafterSvK commented 6 years ago

Me neither. Compiled with dbus_mpris.

IsaacWoods commented 6 years ago

Near the bottom of the sp script, change this line:

SPOTIFY_PID="$(pidof -s spotify || pidof -s .spotify-wrapped)"

to:

SPOTIFY_PID="$(pidof -s spotifyd)"
CrafterSvK commented 6 years ago

What about playerctl?

ydallilar commented 6 years ago

I have arch linux here. It works fine with 'playerctl' as well. playerctl is just a wrapper around dbus-send so I would be surprised if it wouldn't.

~ playerctl -l
spotifyd
~ playerctl status
Playing
~ playerctl metadata
{'mpris:length': <int64 263573>, 'xesam:album': <"Neverworld's End">, 'xesam:title': <'The Dream Is Still Alive'>, 'xesam:artists': <('Xandria',)>}

But your dbus function for Play, Next, Stop, Previous doesn't work. When I issue one of these I got the error below. Interestingly, PlayPause just works fine! I am not a rust programmer so I cant understand your code. But, is there a particular reason you use librespot for PlayPause but your spotify_api_method for others?

Sep 17 19:29:38 hptower spotifyd[18517]: parameters: Some(Object({}))
Sep 17 19:29:38 hptower spotifyd[18517]: response: Response { url: "https://api.spotify.com/v1/me/player/previous?device_id=Spotifyd@hptower", status: NotFound, headers: {"Content-Type": "application/json; charset=utf-8", "Cache-Control": "private, max-age=0", "Access-Control-Allow-Origin": "*", "Access-Control-Allow-Headers": "Accept, Authorization, Origin, Content-Type, Retry-After", "Access-Control-Allow-Methods": "GET, POST, OPTIONS, PUT, DELETE, PATCH", "Access-Control-Allow-Credentials": "true", "Access-Control-Max-Age": "604800", "Date": "Mon, 17 Sep 2018 23:29:38 GMT", "Via": "1.1 google", "Alt-Svc": "clear", "Transfer-Encoding": "chunked"} }
Sep 17 19:29:38 hptower spotifyd[18517]: content: "{\n  \"error\" : {\n    \"status\" : 404,\n    \"message\" : \"Device not found\"\n  }\n}"

Also, a question in general. Is it possible to get notifications with spotifyd? For example, ncmpcpp offers an option run a custom script in every song change. Edit: found it.

SimonTeixidor commented 6 years ago

But, is there a particular reason you use librespot for PlayPause but your spotify_api_method for others?

I don't remember exactly, but I think that librespot only offered PlayPause when I implemented this, whereas the Spotify API only offered Play and Pause. That may have changed by now though.

ydallilar commented 6 years ago

FYI. I retyped the dbus functions using librespot. Now, it works for me. Only Stop function is missing in librespot. But, meh. Good enough. Thanks for your efforts in this. I like spotifyd. I hope spotify wont screw this up too.

mainrs commented 5 years ago

@pssncp142 It would be really awesome if you create a PR with your re-typed code that using librespot instead of the web API. I would be happy to review and merge it!