Skip to content

GioF71/upnp-scrobbler

Repository files navigation

UPnP Scrobbler

A simple LAST.fm scrobbler for WiiM devices.

References

I started taking the code published in this post as the starting point.
It seems that I cannot get a valid link to the user profile on that board, but anyway the nickname is cc_rider.
A big thank you goes to him/her for the code he/she shared.
I then used pylast, as suggested in that thread, for the actual operations on last.fm.

Links

REPOSITORY TYPE LINK
Git Repository GitHub
Docker Images Docker Hub

Task List

  • Scrobbling to last.fm from a WiiM device, using Tidal Connect
  • Scrobbling to last.fm from a WiiM device, using it as a generic UPnP Renderer
  • Scrobbling to last.fm from gmrenderer-resurrect (Source and Docker image), using it as a generic UPnP Renderer
  • Scrobbling to libre.fm

Build

You can build the docker image by typing:

docker build . -t giof71/upnp-scrobbler

Configuration

Create your API key and secret

Open your browser at this, follow the instruction and accurately store the generated values.
Those will be needed for the configuration.

Environment Variables

NAME DESCRIPTION
DEVICE_URL Device URL of your UPnP Device (example: http://192.168.1.7:49152/description.xml)
LAST_FM_API_KEY Your LAST.fm api key
LAST_FM_SHARED_SECRET Your LAST.fm api key
LAST_FM_USERNAME Your LAST.fm account username
LAST_FM_PASSWORD_HASH Your LAST.fm account password encoded using md5
LAST_FM_PASSWORD Your LAST.fm account password in clear text, used when LAST_FM_PASSWORD_HASH is not provided
ENABLE_NOW_PLAYING Update now playing information if set to yes (default)
DURATION_THRESHOLD Minimum duration required from scrobbling (unless at least half of the duration has elapsed), defaults to 240

Running

The preferred way of running this application is through Docker.

Sample compose file

Here is a simple compose file, valid for a WiiM device:

---
version: "3"

services:
  scrobbler:
    image: giof71/upnp-scrobbler:latest
    container_name: wiim-scrobbler
    network_mode: host
    environment:
      - DEVICE_URL=http://192.168.1.7:49152/description.xml
      - LAST_FM_API_KEY=your-lastfm-api-key
      - LAST_FM_SHARED_SECRET=your-lastfm-api-secret
      - LAST_FM_USERNAME=your-lastfm-username
      - LAST_FM_PASSWORD_HASH=your-lastfm-md5-hashed-password
    restart: unless-stopped

It is advisable to put the variable values in a .env file in the same directory with this docker-compose.yaml file.
Start the container with the following:

docker-compose up -d