GioF71 / mpd-alsa-docker

Easily run mpd with Alsa or PulseAudio output with Docker. Upsampling 2x 4x 8x with "Goldilocks" settings by Archimago. Scrobbling support.
Apache License 2.0
18 stars 5 forks source link

lastfm scrobble support broken? #392

Open andrewgdunn opened 3 months ago

andrewgdunn commented 3 months ago

Apologies if this isn't broken. I set the envar(s) on my instance and it looks like it's reading from the mpd playback but not submitting to lastfm. During container instancing I see:

b0280688f7bf [last.fm]
b0280688f7bf url = https://post.audioscrobbler.com/
b0280688f7bf username = <EMAIL>
b0280688f7bf password = <PASSWORD
b0280688f7bf journal = /log/mpdscribble-lastfm.journal

I can also see that it's internally seeing the playback:

$ podman exec -it mpd /bin/cat /log/scrobbler.log
2024-04-08T16:20:18+0000 starting mpdscribble (mdc 0.24)
2024-04-08T16:20:18+0000 loaded 0 songs from /log/mpdscribble-lastfm.journal
2024-04-08T16:20:18+0000 waiting 15 seconds before reconnecting
2024-04-08T16:20:34+0000 connected to mpd 0.23.5 at localhost
2024-04-08T16:21:23+0000 new song detected (Old Crow Medicine Show - Elzick’s Farewell), id: 197, pos: 0

However I never see submissions to last.fm? I also noticed that https://post.audioscrobbler.com/ has a text page that suggest redirection to http://www.audioscrobbler.net/ ?

GioF71 commented 3 months ago

Hello, I have to say I have not been using mpdscribble for quite some time now. I currently use yams with my docker image on a daily basis and it works. However, do the files you are playing come from the mpd library or from some other source, like a upnp media server?

GioF71 commented 3 months ago

If you are using upnp, last time I tried, the problem was with missing "duration" of the song. Scrobbling was therefore not possible using mpdscribble. However I just tested the "embedded" mpdscribble with an mpd instance with its own library and I can see my scrobbles. If you are not using upnp, maybe there's some other issue, in this case please post your compose file and/or any relevant information.

andrewgdunn commented 3 months ago

Not using upnp, just mpd. I'm trying to build up a pod with upnp to ultimately play from a subsonic instance (navidrome) and qobuz). Right now I just have mpd in the pod.

[tune@muckle ~]$ cat ~/.config/systemd/user/pod-upmpd.service 
# pod-upmpd.service

[Unit]
Description=Podman pod-upmpd.service
Documentation=man:podman-generate-systemd(1)
Wants=network-online.target
After=network-online.target
RequiresMountsFor=/run/user/3100/containers
Wants=container-mpd.service
Before=container-mpd.service

[Service]
Environment=PODMAN_SYSTEMD_UNIT=%n
Restart=on-failure
TimeoutStopSec=70
ExecStartPre=/usr/bin/podman pod create \
    --infra-conmon-pidfile %t/pod-upmpd.pid \
    --pod-id-file %t/pod-upmpd.pod-id \
    --exit-policy=stop \
    --name upmpd \
    --publish 6600:6600/tcp \
    --replace
ExecStart=/usr/bin/podman pod start \
    --pod-id-file %t/pod-upmpd.pod-id
ExecStop=/usr/bin/podman pod stop \
    --ignore \
    --pod-id-file %t/pod-upmpd.pod-id  \
    -t 10
ExecStopPost=/usr/bin/podman pod rm \
    --ignore \
    -f \
    --pod-id-file %t/pod-upmpd.pod-id
PIDFile=%t/pod-upmpd.pid
Type=forking

[Install]
WantedBy=default.target
[tune@muckle ~]$ cat ~/.config/systemd/user/container-mpd.service 
# container-mpd.service

[Unit]
Description=Podman container-mpd.service
Documentation=man:podman-generate-systemd(1)
Wants=network-online.target
After=network-online.target
RequiresMountsFor=%t/containers
BindsTo=pod-upmpd.service
After=pod-upmpd.service

[Service]
Environment=PODMAN_SYSTEMD_UNIT=%n
Restart=on-failure
TimeoutStopSec=70
ExecStart=/usr/bin/podman run \
    --cidfile=%t/%n.ctr-id \
    --cgroups=no-conmon \
    --rm \
    --pod-id-file %t/pod-upmpd.pod-id \
    --sdnotify=conmon \
    --detach \
    --replace \
    --name=mpd \
    --group-add keep-groups \
    --privileged \
    --device /dev/snd/ \
    --env ALSA_OUTPUT_CREATE=yes \
    --env ALSA_OUTPUT_ENABLED=yes \
    --env ALSA_OUTPUT_DEVICE=hw:Modius \
    --env ALSA_OUTPUT_NAME=Modius \
    --env ALSA_OUTPUT_MIXER_TYPE=hardware \
    --env LASTFM_USERNAME="<EMAIL>" \
    --env LASTFM_PASSWORD="<PASSWORD" \
    --env SCRIBBLE_VERBOSE=2 \
    --volume /zfs/safe/tune/mpd/database:/db:Z \
    --volume /zfs/safe/tune/mpd/playlists:/playlists:Z \
    --mount type=bind,source=/zfs/alten/tune/,destination=/music,ro=true giof71/mpd-alsa
ExecStop=/usr/bin/podman stop \
    --ignore -t 10 \
    --cidfile=%t/%n.ctr-id
ExecStopPost=/usr/bin/podman rm \
    -f \
    --ignore -t 10 \
    --cidfile=%t/%n.ctr-id
Type=notify
NotifyAccess=all

[Install]
WantedBy=default.target
GioF71 commented 3 months ago

Hello, I noticed you correctly set SCRIBBLE_VERBOSE=2. Can you post the mpscribble logs? Also, from inside the mpd container, when playing, can you post the output of

mpc current -f %file%

For docker I would do something like

docker exec -it mpd bash

then send the command from the terminal. I'm sure you know how to do that with your containers (I cannot be sure I would know it with podman)

GioF71 commented 3 months ago

One thing to check, mpdscribble expects to be able to connect to mpd using "localhost" as the address. The port of course can be specified and defaults to 6600. This should be ok with bridged networking as well as with host networking in docker. Do you think this is compatibile with your podman configuration? It currently not configurable.

GioF71 commented 3 months ago

I correct myself, it's configurable using SCROBBLER_MPD_HOSTNAME

GioF71 commented 2 months ago

Hello, did you solve the issue? p.s. I am making progress with the listenbrainz-mpd docker image!

andrewgdunn commented 2 months ago

Apologies for the long delay!

I currently use yams with my docker image on a daily basis and it works.

I'll likely do this, I put in an issue on that project because it seems to exit before I can authenticate.

One thing to check, mpdscribble expects to be able to connect to mpd using "localhost" as the address. The port of course can be specified and defaults to 6600. This should be ok with bridged networking as well as with host networking in docker.

Nearly positive the pod created by podman would facilitate this working.

While playing music:

[tune@muckle mpd]$ podman exec -it mpd mpc current -f %file%
Artists/Ray LaMontagne/Ray LaMontagne - God Willin' & The Creek Don't Rise (2010) [FLAC 16bit 44kHz]/06 This Love Is Over.flac

I correct myself, it's configurable using SCROBBLER_MPD_HOSTNAME

I attempted setting this to mpd (the container name) and to 127.0.0.1 but it doesn't appear to resolve the issue.

I can also see that songs get fully "played" in the logs:

player: played "Artists/Ray LaMontagne/Ray LaMontagne - God Willin' & The Creek Don't Rise (2010) [FLAC 16bit 44kHz]/03 God Willin' & the Creek Don't Rise.flac"
GioF71 commented 2 months ago

Hello, thank you for verifying with mpc. Of course mpdscribble should work, the file is local, I assume it has title and artist tags, so I don't see why it should not work.

The unusual thing of the scrobbler feature included in mpd-alsa-docker is that the script will launch the scrobbler in the background before launching mpd.

Can you verify that a mpdscribble process is actually running?

andrewgdunn commented 2 months ago

Can you verify that a mpdscribble process is actually running?

How would I check? ps and top not in the image right?

GioF71 commented 2 months ago

no they are not available, but you can install them running a bash in the running container and issuing these:

apt-get update apt-get install -y procps

of course this won't work if the app is run with a --user switch or podman equivalent.

anyway, the process should be also visible from the host machine, so just run a

ps aux | grep mpdscribble

from the host, and the process should appear. Double check that a

ps aux | grep mpd

actually returns something.

andrewgdunn commented 2 months ago

Indeed it appears to be running (both mpd and mpdscribble). I'm on discord (navidrome server) if you wanted to interactively troubleshoot.

GioF71 commented 2 months ago

I'm here also. I am quite a noob on discord. Chat me if you find me!

GioF71 commented 2 months ago

For other users watching this thread (if any): we did not talk about this specific issue.

I still can't figure out what is happening. I would ask you two things:

  1. Can you please post the full container log, so we can check the generated configuration files?
  2. From inside the container, can you please verify that a telnet operation to the mpd/port specified on the mpdscribble.conf file are actually reachable?

Thank you