GioF71 / mpd-subsonic-scrobbler

A Subsonic Scrobbler for Music Player Daemon, written in Python
MIT License
6 stars 0 forks source link

Everything seems fine but no scrobble #22

Closed robinmayol closed 1 year ago

robinmayol commented 1 year ago

Hi!

Thank you for you hard work!

I'm pretty sure I have setup everything correctly. I can run the program and see this output:

subsonic-scrobbler  | mpd-subsonic-scrobbler version 0.2.0
subsonic-scrobbler  | SLEEP_TIME: [1000] msec
subsonic-scrobbler  | MIN_COVERAGE: [10%]
subsonic-scrobbler  | ENOUGH_PLAYBACK_SEC: [10 sec]
subsonic-scrobbler  | VERBOSE: [True]
subsonic-scrobbler  | server[0].friendly_name=[navidrome]
subsonic-scrobbler  | server[0].base_url=[http://192.168.191.61]
subsonic-scrobbler  | server[0].port=[4533]
subsonic-scrobbler  | server[0].user=[****]
subsonic-scrobbler  | server[0].password=[****]
subsonic-scrobbler  | mpd[0].friendly_name=[mpd]
subsonic-scrobbler  | mpd[0].host=[localhost]
subsonic-scrobbler  | mpd[0].port=[6600]
subsonic-scrobbler  | Current mpd state for index 0 [mpd] is [stop]
subsonic-scrobbler  | Current mpd state for index 0 [mpd] is [play]

But Navidrome doesn't update the "recently played" page with what I play via MPD, neither does it show mpd-subsonic-scrobbler in the list of players (not sure if it should). I would also imagine that the scrobbling event should show up in the verbose output when it happens. The only events that seem to be registered are play / pause and stop. When I stop it says

subsonic-scrobbler  | Remove some data from context for index 0 ...
subsonic-scrobbler  | Data removal for index 0 complete.

I have tried to change the subsonic base url to http://localhost but to no avail.

Here is my docker-compose:

---
version: "3"

services:
  scrobbler:
    image: giof71/mpd-subsonic-scrobbler:latest
    container_name: subsonic-scrobbler
    network_mode: "host"
    environment:
      - MPD_FRIENDLY_NAME=mpd
      - MPD_HOST=localhost
      - MPD_PORT=6600
      - SUBSONIC_FRIENDLY_NAME=navidrome
      - SUBSONIC_BASE_URL=http://192.168.191.61
      - SUBSONIC_PORT=4533
      - SUBSONIC_USER=****
      - SUBSONIC_PASSWORD=****
      - MIN_COVERAGE=10
      - ENOUGH_PLAYBACK_SEC=10
      - VERBOSE=1
      - REDACT_CREDENTIALS=0
    restart: unless-stopped

Am I missing something?

GioF71 commented 1 year ago

Hello, thank you for the kind words and for opening the issue with a good amount of information. From what I see from the log, it seems the connection to mpd is valid, but the song url might not contain http://192.168.191.61:4533. So can you also post the upmpdcli configuration for the subsonic server? Maybe you use the network name of the server...

The SUBSONIC_BASE_URL (and _PORT) must be the same in the two components, because the scrobbler analyzes the URL in order to understand if it has to scrobble the track to the appropriate configured subsonic server (there can be more than one, but this is not your case).

About the scrobbler appearing in the "players" list in navidrome: it will appear as soon as at least one scrobble has happened. This will be the first moment when Navidrome notices another client. But, it might be a good idea to call the "ping" api command from time to time, in order to understand if the connection is ok. That might also cause Navidrome to list the scrobbler even before the first scrobble. I will probably add the feature, which might help in troubleshooting. Also, I might add the song URL to the logs (if VERBOSE is set to 1) so that it will be clear if the track has to be scrobbled or not.

robinmayol commented 1 year ago

Hey Gio,

"Bella li" for the quick response and clear diagnostic. Apparently I didn't give you enough info as I realise I might be an edge case: I am running MPD and Navidrome on the same machine (a Pi4) so I don't really have a need for upmpdcli. My mpd instance is just using the same local directory as my Navidrome instance.

I did see upmpdcli mentioned on your README but I didn't think it was an actual dependency. Because of my setup, I was actually confused as to the purpose of upmpdcli. A Youtube search took me to what looks like, one of your videos :) and I understand that it makes sense when using a remote Navidrome instance (or want to use other streaming services with MPD).

mpc -f %file% outputs a relative path starting from my music directory so it's obvious that mpd-subsonic-scrobbler won't have access to the info it needs. I guess I could install upmpdcli if I have no other options but I'd rather not as my Pi is facing the internet and the documentation of upmpdcli mentions security issues.

Is there some sort of environment variable I could use to hard code the rest of the path as I am only using the one substreamer instance?

GioF71 commented 1 year ago

Hello Robin, based on what I understand, in your current scenario you don't need the mpd-subsonic-scrobbler because you are not actually playing from navidrome, but you are playing from the same local files that navidrome uses. In this scenario, you will never see a scrobble to navidrome by mpd and this scrobbler.

You probably just need mpdscribble or yams (I have containers from both), but those will scrobble to last.fm and/or librefm. How do you select the songs to play to your mpd? I assume you are using some mpd client.

The mpd-subsonic-scrobbler is needed when you use upmpdcli with the subsonic plugin, which enables navidrome to be used as a upnp/dlna server. So, in turn, a combination of mpd/upmpdcli can be used as the "renderer". In this scenario the mpd-subsonic-scrobbler is needed because upmpdcli (as the media server) cannot understand when a song is actually played, because it just serves URLs to MPD. See this issue for more details.

Thinking again about what you wrote, I believe you need upmpdcli if you want that MPD will be able to play files served by navidrome. Otherwise this setup will only work as long as mpd has access to the audio files. Or, you won't be able to add other players. You just need to add an instance of upmpdcli, maybe (but not necessarily) on the same host as navidrome. This upmpdcli does not need to access the files, it just needs the parameters to connect to navidrome. Then, considering that the mpd player is allowed to be on a different device, you just need an instance of upmpdcli on top of mpd, which creates a upnp/dlna renderer from mpd. You can create the upmpdcli instance with docker, see here, specifically the renderer configuration. If you do that, you will then need this mpd-subsonic-scrobbler instance if you want that the songs played to upmpdcli/mpd are displayed on Navidrome.

It might be confusing that we are using upmpdcli both as a media server and as a renderer, but that's exactly how it works. See here for media server mode and here for renderer mode. I hope this can help clarifying.

Let me know if you need help with these configurations!

For substreamer, I am not sure I understand what you mean. Substreamer is a player on its own, it does not need mpd and it does not need this mpd-subsonic-scrobber.

GioF71 commented 1 year ago

About your pi4 facing the internet, you can install upmpdcli (as the media server with the subsonic plugin) on a different device, not necessarily along with the navidrome server. I wrote that on the previous answer but I thought it was worth mentioning explicitly here on another reply. Let me know if this helps.

GioF71 commented 1 year ago

One last thing: using this solution makes sense not only if you want to use remote server and players: it also makes sense if you want to properly use some USB DAC or some HAT-based DAC (like hifiberry, Allo, etc) connected to a headless raspberry pi. I use an old Asus Tinkerboard with a USB dac as the player on my desk, for example. Instead, when you play music from the navidrome web gui, everything will be resampled to 44.1kHz or so if the content is hires. You can select a usb dac as the output, but you will be probably running pulseaudio or wasapi on windows and those stacks will resample your music. With the upmpdcli solution, you can control the playback with an app like BubbleUpnp on Android. There are similar apps for iOS also. Another solution when using a desktop (windows, linux or macos) is Supersonic, which will enable to use a device exclusively and should not resample music unless it's needed. See Supersonic here.

robinmayol commented 1 year ago

Wow thank you for all this!

I am not too picky about sound quality. I have exposed my ears to very loud music for a long time (making and listening) and sadly, I really don't think I am able to hear the difference in quality between 44 and 48K or 16 and 24 bits.........

I use Subsonic clients on my phone or laptop when I'm away from home to listen to the music stored on my Pi at home (which is actually a boat).

When I'm home sometimes I start playing tunes from my Subsonic client (Sonixd) on the laptop (via a bt-speaker), then I go have a beer on the deck with my phone and I wish I could change the volume or play something else but as far as I'm aware I cannot remote control my *sonic client.

I used to be able to do that with MPD because I have clients on all my devices so whichever one was playing the music, I could take control from any other.

The problem is that if I play the files using MPD, Navidrome doesn't know about it and I rely heavily on keeping track of what I play to manage my library which I have been curating for about 20 years and has grown quite big (e.g. delete stuff that I don't really listen to anymore).

This is why I was after something that would scrobble my MPD plays to Navidrome. I do scrobble to last.fm as well, maybe I could use the last.fm API to automate deleting suggestions and such for my local library.

I think I have just been adding bits to my stack as I find needs for them and I should rethink the whole thing now that I have an overview of what I want.

You are right, I am confused by the server / rendered duality with upmpdcli. I'll have a look at all these precious links that you provided. While typing this message I also found out about Madsonic which seems to allow for both streaming and "jukebox mode" that I can remote control. That might just be what I'm looking for.

Thank you again immensely for all your help and dedication. I am not very good with Docker, and I had to do quite a bit of research to set up mpd-subsonic-scrobbler. But now that I understand better, I was thinking I could write a bash script to automate the configuration / run process and I could give it to you as a contribution to the project (but that's litterally another issue!).

I guess this one can be closed, if you agree?

All the best,

R

GioF71 commented 1 year ago

Yeah the problem with madsonic, it requires premium subscription for the additional features. But it is interesting.

Yes we can close this of course, feel free to reopen or open other tickets, should you decide to adopt the solutions and/or need some help.

Edit: madsonic is open source (!)

robinmayol commented 1 year ago

Edit: madsonic is open source (!)

Yay! Might install locally :)

Closing for now and I'll update when I have news.