Skip to content

Run Mopidy using Docker and play from Tidal and Jellyfin

License

Notifications You must be signed in to change notification settings

GioF71/mopidy-docker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mopidy-docker

Run Mopidy in Docker

Description

I wanted to be able to play from Tidal to my audio devices (typically Raspberry Pi SBCs), directly from a browser, without using Tidal Connect, not available on any device/platform.
Mopidy along with the Mopidy-Tidal plugin offer a very nice interface, and represent a good response to this requirement.
Also, I like Mopidy to be able to connect to Jellyfin for music playback, as I am starting to explore this option.
I have only used it with alsa output, but I will probably add support for PulseAudio soon. Note that this is not terribly important to me, at least when using Tidal, which my main scenario. Using this application with PulseAudio would not offer any particular advantage compared to the Tidal Web Player.

Support

ko-fi
Please see the Goal.
Please note that support goal is limited to cover running costs for subscriptions to music services.

References

PROJECT URL
Mopidy Main site
mopidy-tidal GitHub repo
python-tidal GitHub repo
mopidy-jellyfin GitHub repo

Repositories

Repo Type Link
Source Code GitHub
Docker Images DockerHub

Build

In order to build the docker image, switch to the root directory of the repo and use the following command:

./local-build.sh

Configuration

The configuration if driven by environment variables. You should not need to edit the configuration files directly.

Variables

VARIABLE DESCRIPTION
AUDIO_OUTPUT Audio output configuration
RESTORE_STATE Restore last state on start, defaults to no
TIDAL_ENABLED Enables the Tidal plugin, defaults to no
TIDAL_QUALITY Set quality for the Tidal plugin, defaults to LOSSLESS
TIDAL_LOGIN_METHOD Login method, can be BLOCK (default), AUTO or HACK
TIDAL_AUTH_METHOD Authentication method, can be OAUTH (default) or PKCE
TIDAL_PLAYLIST_CACHE_REFRESH_SECS Playlist content refresh time, defaults to 0
TIDAL_LOGIN_SERVER_PORT Required for PKCE authentication
TIDAL_LAZY Lazy connection, true or false (default)
JELLYFIN_ENABLED Enables the Jellyfin plugin, defaults to no
JELLYFIN_HOSTNAME Hostname for Jellyfin (mandatory)
JELLYFIN_USERNAME Username for Jellyfin
JELLYFIN_PASSWORD Password for Jellyfin
JELLYFIN_USER_ID User Id for Jellyfin
JELLYFIN_TOKEN Token for Jellyfin
JELLYFIN_LIBRARIES Libraries for Jellyfin (optional, defaults to Music)
JELLYFIN_ALBUM_ARTIST_SORT Optional, defaults to false
JELLYFIN_ALBUM_FORMAT Optional, will default to "{Name}"
JELLYFIN_MAX_BITRATE Optional, numeric
FILE_ENABLED Enables the File plugin, defaults to no
LOCAL_ENABLED Enables the Local plugin, defaults to no
SCROBBLER_ENABLED Enables the Scrobbler plugin, defaults to no
SCROBBLER_USERNAME Last.FM username
SCROBBLER_PASSWORD Last.FM password
MPD_ENABLED Enables the MPD plugin, defaults to no
USER_MODE Set to yes to enable user mode
PUID The uid for USER_MODE, defaults to 1000
PGID The gid for USER_MODE, defaults to 1000
AUDIO_GID Group id for USER_MODE, set it to the group id of the group audio if USER_MODE is enabled

Volumes

VOLUME DESCRIPTION
/config Configuration directory
/data Data directory
/cache Cache directory
/music Music directory

Examples

A simple docker-compose.yaml file.
Please note that this assumes your user of choice has uid 1000 and that the audio gid is 29.
Also the selected audio output is the alsa device named D10 (a Topping D10).
The Tidal plugin is enabled with LOSSLESS quality.

---
version: "3.3"

services:
  mopidy:
    image: giof71/mopidy
    container_name: mopidy
    user: "1000:29"
    devices:
      - /dev/snd:/dev/snd
    environment:
      - AUDIO_OUTPUT=alsasink device=hw:D10
      - RESTORE_STATE=yes
      - SCROBBLER_ENABLED=${SCROBBLER_ENABLED:-}
      - SCROBBLER_USERNAME=${SCROBBLER_USERNAME:-}
      - SCROBBLER_PASSWORD=${SCROBBLER_PASSWORD:-}
      - TIDAL_ENABLED=yes
      - TIDAL_QUALITY=${TIDAL_QUALITY:-LOSSLESS}
    ports:
      - 6680:6680
      - 8989:8989
    volumes:
      - ./config:/config
      - ./cache:/cache
      - ./data:/data
    restart: always

In order to correctly set the credentials for Tidal, the first run should be done with this command:

docker-compose run mopidy

Look at the displayed instructions, follow the link and authorize the application on Tidal.
You will need an active Tidal subscription, of course.
After this action, you can stop the container (CTRL-C), and then start it normally using:

docker-compose up -d

The application should be accessible at the host-ip at port 6680.

Change History

Change Data Major Changes
2024-11-13 Rebuild with version v0.3.9
2024-11-10 Rebuild with version v0.3.8
2024-09-08 Add support for the jellyfin plugin
2024-09-05 Fixed user management
2024-09-05 Switch to ubuntu noble
2024-05-22 Enable user mode if PUID is set
2024-05-22 Add support for user mode
2024-03-04 Add configuration options
2024-03-03 Add pkce support for Tidal plugin
2024-02-22 Add support for the MPD plugin
2024-02-21 Review build process
2024-02-21 First working version