Aylur / ags

A customizable and extensible shell
GNU General Public License v3.0
1.74k stars 94 forks source link

MPRIS service `players` occasionally contains incorrect properties with Spotify #482

Open nakulsoneji opened 2 days ago

nakulsoneji commented 2 days ago

Simple test config:

const mpris = await Service.import("mpris")

mpris.connect("changed", m => {
  console.log(m.players)
})

export {}

Steps to reproduce:

  1. Run the test config
  2. Repeatedly open and close Spotify to trigger the "changed" signal and print out the players object
  3. Observe the terminal output after each time the app is opened, and check if there are any missing properties

Sometimes, it happens on the first lauch of the app, and other times it takes a few opening/closing cycles.

In my case, after an arbitrary amount of opening and closing, the following output from below can be noticed from Spotify's Player object (this happens after opening Spotify and before closing it). Below, most of the missing properties are labeled with arrows (there are also some unlabeled metadata properties that are missing as well):

image

Below is how the Player object should look with no missing properties. This is what I usually observed, except for the occasional case seen above. Some of properties that are correctly shown compared to the previous image are labeled with arrows (more metadata properties are present as well, but they are unlabeled):

image

While experimenting with the test config, I had Firefox music open in the background, and noticed more incorrect output, this time from playerctld's Player object. Additionally, this output had mismatched properties, rather than missing ones. I got this output when I closed Spotify right after I saw the incorrect output. I have underlined some of the mismatched properties, as can be seen below:

image

As Spotify was closed (no tray icon, and I used pkill spotify to close it), the entry and identity properties should contain "firefox" and "Mozilla Firefox" respectively.

I'm pretty confident that this is just a Spotify issue, as I do not observe the same behavior with MPV, but I wanted to double check to see if anything could be done to fix it.