hifiberry / hifiberry-os

Linux distribution optimized for audio playback
MIT License
998 stars 125 forks source link

LMS on non-standard port breaks album art #570

Closed scbash closed 2 weeks ago

scbash commented 3 weeks ago

Note: I originally diagnosed this bug and created a pull request in lmspris with the fix several months ago, but realized recently no one had seen it. I'm creating a bug report here for visibility, but sadly now my memory of the details are fuzzy and having moved on from HifiBerryOS I don't have a repro case in front of me... Sorry!

Describe the bug Running Slimserver (Logitech/Lyrion Media Server) on a non-standard port breaks album art in HifiBerryOS.

HiFiBerryOS version Last tested in April 2024, so I don't have the exact version, but I was able to reproduce the bug with both 32 and 64 bit versions.

HiFiBerry sound card DAC+ Pro

To Reproduce I'm running the LMS Docker container, so this is may be easier or harder than running LMS directly depending on your setup.

  1. Start the LMS container:
    sudo docker run -itd \
      -v "/volume1/music/general":"/music":ro \
      -e HTTP_PORT=9002 \
      --network host \
      --restart unless-stopped \
      --name slimserver \
      lmscommunity/logitechmediaserver:stable
  2. Connect HifiBerryOS to LMS (I had to specify the IP address in the settings, possibly because of the non-standard port?)
  3. Play music from LMS.
  4. Observe the album art in the browser will not populate (or will be stuck at whatever the previous music server provided).
    • If you check the Javascript console I believe you'll find several refused/failed connections to port 9000 of the LMS server

Expected behavior Album art should update as tracks play.

Screenshots (would have been helpful, but didn't capture them at the time)

Browser (if applicable)

Additional context Summary from my pull request:

I run LMS/Slimserver on a Synology NAS, and Synology reserves ports 9000 and 9001 for their own applications, so I am forced to run the Slimserver web UI on port 9002. This breaks album art in HifiBerryOS/BeoCreate because lmsmpris always uses the default value (9000).

Luckily the discovery packet sent by lmsmpris already requests the web UI port via the JSON key (technically used to discover the JSON RPC port, but JSON RPC just runs on a path of the web UI), so by parsing the full response we can get the necessary port.

In the process of fixing this, I also discovered that in certain cases Slimserver can respond to discovery requests with EIPAD... rather than ENAME... which would break the original discovery logic (details are in the commit message, but the key lines in Slimserver are here and here), but this new "full parse" logic handles this case.

hifiberry commented 2 weeks ago

PR has been merged