Replies: 8 comments
-
Why do you have to request the API every second and not only when something relevant changes? You could listen to PropertiesChanged event/signal on the DBus and only request new information when the track changes e.g. And the DBus interface is a general MediaPlayer standard: Maybe in the metadata of the PropertiesChanged signal is also the informatio you need. If not that would mean adding info beyond the standard somewhere. |
Beta Was this translation helpful? Give feedback.
-
@Drexel2k Thank you for link to the DBus documentation, I didn't work with DBus so far and I thought it's more generic, like sockets and allows apps to use their own interfaces. Anyway, I don't want to rely on DBus, my client should work with any device and there are no websockets in Spotify API, so without spotifyd I have to do these requests all the time (that's sad). However I can use DBus if I'm sure spotifyd connection is available. Oh, and one more thing, I use RaspberryPi and I've read there are problems with efficiency of spotifyd DBus. Is it still the case? Was it somehow fixed or it's something that can't be solved? |
Beta Was this translation helpful? Give feedback.
-
I am new to Linux and Raspberry also, but from my understanding DBus is one standard way of Linux for inter process communication. It works via file links or sockets. I really think all the information you needs IS in the Metadata of the properties changed Event,e.g: ` ('org.mpris.MediaPlayer2.Player', |
Beta Was this translation helpful? Give feedback.
-
I also do not really understand what is being proposed / requested here?
I do not understand this. You opened this issue in the spotifyd project, so it makes sense to assume that you have connection to a running version of spotifyd, right?
I use it on the super old Pi 1B that has only 220 MB RAM available and it works fast on that old machine (I experienced a stability issue though #1246) fast enough to e.g. poll the playback position 1-2 times a second see e.g. this
|
Beta Was this translation helpful? Give feedback.
-
@JJ-Author I wasn't aware what is and what isn't available in this protocol, but if you say there is no track / context id, name, information about the type of the context (playlist, artist, album - I use these, maybe there are more types), etc., it would be very nice to have it in metadata delivered from the spotifyd. In other case I have to use Spotify API to get these data for my client. And HTTP request is not as responsive as using local protocol. If such data is already available localy in spotifyd, why duplicate this funcionality? In general I think all the metadata available in spotifyd should be shared and available from a client. In this or another way (like sockets). I will write my app in a way where DBus is optional (because I already started without it), but if someone writes something that may work only with spotifyd device, than it would be good strategy. |
Beta Was this translation helpful? Give feedback.
-
As @Drexel2k already wrote the trackid is available. But for other data, you could try to open a "fresh and clean" issue specifying that you would like to have more spotify context metadata on MPRIS or DBUS I personally would do it like this (assuming your client is running on the same device/dbus).
I would consider adding some stability features
here is an example command that subscribes to every MPRIS capable player (also non-spotify ones) for changed properties (e.g. playback status, metadata change)
|
Beta Was this translation helpful? Give feedback.
-
@JJ-Author In general, I totally agree with your write-up. That sounds like the right thing to do.
However, this is something I would strongly recommend against using, since we (unfortunately) rely on the Spotify API as well, to get the playback position. 😅 So you'll most likely run into 429s when doing this too often. The recommended strategy is:
|
Beta Was this translation helpful? Give feedback.
-
In the upgrade to |
Beta Was this translation helpful? Give feedback.
-
Is your feature request related to a problem? Please describe.
I'm working on a client that has to be as responsible as possible (manual knobs, button and UI on the screen of a device). Number of requests sent to API is limited and I have to send requests about current track every second to get this info and update UI.
Describe the solution you'd like
Daemon have info about current track already and uses D-Bus to notify about currently playing track / context:
But I need something more, spotify id of a track / context and type (I'm not sure here, but probably you have different types of contexts). It would be wise to not send these requests from both daemon and client.
Describe alternatives you've considered
I don't know if D-Bus isn't to narrow, sockets might be more universal.
Beta Was this translation helpful? Give feedback.
All reactions