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

update librespot to 0.6 #1317

Open
wants to merge 14 commits into
base: master
Choose a base branch
from
Open

update librespot to 0.6 #1317

wants to merge 14 commits into from

Conversation

eladyn
Copy link
Member

@eladyn eladyn commented Dec 27, 2024

This upgrades librespot to version 0.6 and reworks the dbus logic to no longer rely on the web API but just use local method calls.

This should hopefully fix #891, reports welcome.

It supersedes and closes #1309.

Note, that it does not yet fix the issue #1293, since OAuth is still not implemented.

TBD:

  • re-implement OpenUri with Spirc::load
  • implement OAuth (probably new PR)

Some of the long-standing librespot issues that are fixed with this upgrade:
Fixes #1246, fixes #522, fixes #788, fixes #1285.

@klh
Copy link

klh commented Dec 30, 2024

Looks good to me +1

@mietzen
Copy link
Contributor

mietzen commented Jan 2, 2025

@eladyn I couldn't give code suggestions on files you didn't edit. So I sent you a PR: eladyn#1

I updated the docker cross compile guide.

* Update docker cross compile guide for librespot 0.6.0 upgrade

- Enhanced log output
- Use latest GH Release
- Corrected compose filename

* use latest rust 1 image
@clstrickland
Copy link

I was testing this PR to see if it solved #706 (which it seems like it did!) but I noticed some issues that I didn't see with the master build.

I noticed that the shuffle status gets "stuck" in a certain state. The Spotify client on another device like my phone or the web player will show Spotify has shuffle on, but mpris will still report it is off:

method call time=1735980483.723316 sender=:1.18 -> destination=org.mpris.MediaPlayer2.spotifyd.instance27084 serial=716 path=/org/mpris/MediaPlayer2; interface=org.freedesktop.DBus.Properties; member=Get
   string "org.mpris.MediaPlayer2.Player"
   string "Shuffle"
method return time=1735980483.723758 sender=:1.11 -> destination=:1.18 serial=1432 reply_serial=716
   variant       boolean false

In spite of my phone and web player showing shuffle is on, it seems like it is not shuffling, as when I send the next song command via mpris, it goes through my playlist in order. This issue is a little hit or miss for me, but it seems like more often than not shuffle is messed up.

The other issue (I guess whether or not this behavior is desired is an opinion since technically there is a period of no audio) I saw is that, when going to the next song, there is a brief period where the mpris metadata returns "NoTrack", which is causing my mpris controller to show as "not playing" for a few seconds every time the next song starts.

Note the timestamps

method call time=1735980046.906653 sender=:1.18 -> destination=org.mpris.MediaPlayer2.spotifyd.instance27084 serial=369 path=/org/mpris/MediaPlayer2; interface=org.freedesktop.DBus.Properties; member=Get
   string "org.mpris.MediaPlayer2.Player"
   string "Metadata"
method return time=1735980046.907190 sender=:1.11 -> destination=:1.18 serial=1030 reply_serial=369
   variant       array [
         dict entry(
            string "mpris:length"
            variant                int64 182479000
         )
         dict entry(
            string "xesam:artist"
            variant                array [
                  string "Angrybaby"
               ]
         )
         dict entry(
            string "xesam:trackNumber"
            variant                uint32 1
         )
         dict entry(
            string "mpris:artUrl"
            variant                string "https://i.scdn.co/image/ab67616d0000b273a9c1761e9a1fc148466390c2"
         )
         dict entry(
            string "xesam:albumArtist"
            variant                array [
                  string "Angrybaby"
               ]
         )
         dict entry(
            string "mpris:trackid"
            variant                object path "/spotify/track/6tXebnSmy1ZEZANFRHRoCO"
         )
         dict entry(
            string "xesam:title"
            variant                string "WASTED ON ME"
         )
         dict entry(
            string "xesam:discNumber"
            variant                uint32 1
         )
         dict entry(
            string "xesam:album"
            variant                string "WASTED ON ME"
         )
         dict entry(
            string "xesam:autoRating"
            variant                double 0.5
         )
      ]
signal time=1735980046.914352 sender=:1.11 -> destination=(null destination) serial=1031 path=/org/mpris/MediaPlayer2; interface=org.freedesktop.DBus.Properties; member=PropertiesChanged
   string "org.mpris.MediaPlayer2.Player"
   array [
      dict entry(
         string "Metadata"
         variant             array [
               dict entry(
                  string "mpris:trackid"
                  variant                      object path "/org/mpris/MediaPlayer2/TrackList/NoTrack"
               )
            ]
      )
   ]
   array [
   ]
signal time=1735980047.186702 sender=:1.11 -> destination=(null destination) serial=1032 path=/org/mpris/MediaPlayer2; interface=org.freedesktop.DBus.Properties; member=PropertiesChanged
   string "org.mpris.MediaPlayer2.Player"
   array [
      dict entry(
         string "Metadata"
         variant             array [
               dict entry(
                  string "xesam:title"
                  variant                      string "Wicked"
               )
               dict entry(
                  string "xesam:album"
                  variant                      string "Good Will Prevail"
               )
               dict entry(
                  string "xesam:autoRating"
                  variant                      double 0.3
               )
               dict entry(
                  string "xesam:trackNumber"
                  variant                      uint32 1
               )
               dict entry(
                  string "xesam:artist"
                  variant                      array [
                        string "GRiZ"
                        string "Eric Krasno"
                     ]
               )
               dict entry(
                  string "mpris:length"
                  variant                      int64 354286000
               )
               dict entry(
                  string "xesam:albumArtist"
                  variant                      array [
                        string "GRiZ"
                     ]
               )
               dict entry(
                  string "xesam:discNumber"
                  variant                      uint32 1
               )
               dict entry(
                  string "mpris:trackid"
                  variant                      object path "/spotify/track/5Kn5DgKUYMmSWpD6XTVtww"
               )
               dict entry(
                  string "mpris:artUrl"
                  variant                      string "https://i.scdn.co/image/ab67616d0000b273bb2fccfc1c079ec32e9b817d"
               )
            ]
      )
   ]
   array [
   ]

It is only for a fraction of a second, but it still throws off my mpris client.

Let me know if there is any more info I can try to gather to help figure this out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment