Skip to content

Commit

Permalink
Merge pull request #3 from GioF71/2-feature-add-support-for-jellyfin
Browse files Browse the repository at this point in the history
Add support for Jellyfin #2
  • Loading branch information
GioF71 authored Sep 8, 2024
2 parents d6a052e + 21cb589 commit 18a31e7
Show file tree
Hide file tree
Showing 3 changed files with 97 additions and 19 deletions.
45 changes: 26 additions & 19 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ RUN python3 -m pip install --target /opt/mopidy-venv --upgrade Mopidy-Tidal
RUN python3 -m pip install --target /opt/mopidy-venv --upgrade Mopidy-Local
RUN python3 -m pip install --target /opt/mopidy-venv --upgrade Mopidy-Scrobbler
RUN python3 -m pip install --target /opt/mopidy-venv --upgrade Mopidy-MPD
RUN python3 -m pip install --target /opt/mopidy-venv --upgrade mopidy-jellyfin

RUN apt-get install -y gstreamer1.0-plugins-bad

Expand All @@ -48,31 +49,37 @@ VOLUME /cache
VOLUME /data
VOLUME /music

ENV USER_MODE ""
ENV PUID ""
ENV PGID ""
ENV AUDIO_GID ""
ENV USER_MODE=""
ENV PUID=""
ENV PGID=""
ENV AUDIO_GID=""

ENV RESTORE_STATE ""
ENV RESTORE_STATE=""

ENV AUDIO_OUTPUT ""
ENV AUDIO_OUTPUT=""

ENV SCROBBLER_ENABLED ""
ENV SCROBBLER_USERNAME ""
ENV SCROBBLER_PASSWORD ""
ENV SCROBBLER_ENABLED=""
ENV SCROBBLER_USERNAME=""
ENV SCROBBLER_PASSWORD=""

ENV TIDAL_ENABLED ""
ENV TIDAL_QUALITY ""
ENV TIDAL_LOGIN_SERVER_PORT ""
ENV TIDAL_LOGIN_METHOD ""
ENV TIDAL_AUTH_METHOD ""
ENV TIDAL_PLAYLIST_CACHE_REFRESH_SECS ""
ENV TIDAL_LAZY ""
ENV TIDAL_ENABLED=""
ENV TIDAL_QUALITY=""
ENV TIDAL_LOGIN_SERVER_PORT=""
ENV TIDAL_LOGIN_METHOD=""
ENV TIDAL_AUTH_METHOD=""
ENV TIDAL_PLAYLIST_CACHE_REFRESH_SECS=""
ENV TIDAL_LAZY=""

ENV FILE_ENABLED ""
ENV LOCAL_ENABLED ""
ENV JELLYFIN_ENABLED=""
ENV JELLYFIN_HOSTNAME=""
ENV JELLYFIN_USERNAME=""
ENV JELLYFIN_PASSWORD=""
ENV JELLYFIN_LIBRARIES=""

ENV MPD_ENABLED ""
ENV FILE_ENABLED=""
ENV LOCAL_ENABLED=""

ENV MPD_ENABLED=""

COPY app/bin/entrypoint.sh /app/bin/
RUN chmod +x /app/bin/entrypoint.sh
Expand Down
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ Run Mopidy in Docker

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](https://mopidy.com/) along with the [Mopidy-Tidal plugin](https://github.com/tehkillerbee/mopidy-tidal) offer a very nice interface, and represent a good response to this requirement.
Also, I like Mopidy to be able to connect to [Jellyfin](https://jellyfin.org/) 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
Expand All @@ -21,6 +22,7 @@ PROJECT|URL
Mopidy|[Main site](https://mopidy.com/)
mopidy-tidal|[GitHub repo](https://github.com/tehkillerbee/mopidy-tidal)
python-tidal|[GitHub repo](https://github.com/tamland/python-tidal)
mopidy-jellyfin|[GitHub repo](https://github.com/jellyfin/mopidy-jellyfin)

## Repositories

Expand Down Expand Up @@ -52,6 +54,16 @@ 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`
Expand Down Expand Up @@ -124,6 +136,7 @@ The application should be accessible at the host-ip at port 6680.

Change Data|Major Changes
:---|:---
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
Expand Down
58 changes: 58 additions & 0 deletions app/bin/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,64 @@ if [[ -n "${AUDIO_OUTPUT}" ]]; then
echo "output = ${AUDIO_OUTPUT}" >> $CONFIG_DIR/audio.conf
fi

ENABLE_JELLYFIN=0
if [[ -z "${JELLYFIN_ENABLED}" ]]; then
ENABLE_JELLYFIN=0
else
if [[ "${JELLYFIN_ENABLED^^}" == "YES" ]] || [[ "${JELLYFIN_ENABLED^^}" == "Y" ]]; then
ENABLE_JELLYFIN=1
elif [[ "${JELLYFIN_ENABLED^^}" != "NO" ]] && [[ "${JELLYFIN_ENABLED^^}" != "N" ]]; then
echo "Invalid JELLYFIN_ENABLED=[$JELLYFIN_ENABLED]"
exit 1
fi
fi

if [[ $ENABLE_JELLYFIN -eq 1 ]]; then
echo "[jellyfin]" > $CONFIG_DIR/jellyfin.conf
echo "enabled = true" >> $CONFIG_DIR/jellyfin.conf

if [[ -n "${JELLYFIN_HOSTNAME}" ]]; then
echo "hostname = ${JELLYFIN_HOSTNAME}" >> $CONFIG_DIR/jellyfin.conf
else
echo "Hostname not specified for Jellyfin plugin!"
exit 1
fi
if [[ -n "${JELLYFIN_USERNAME}" ]]; then
echo "username = ${JELLYFIN_USERNAME}" >> $CONFIG_DIR/jellyfin.conf
else
echo "Username not specified for Jellyfin plugin!"
fi
if [[ -n "${JELLYFIN_PASSWORD}" ]]; then
echo "password = ${JELLYFIN_PASSWORD}" >> $CONFIG_DIR/jellyfin.conf
else
echo "Password not specified for Jellyfin plugin!"
fi
if [[ -n "${JELLYFIN_USER_ID}" ]]; then
echo "user_id = ${JELLYFIN_USER_ID}" >> $CONFIG_DIR/jellyfin.conf
else
echo "User id not specified for Jellyfin plugin!"
fi
if [[ -n "${JELLYFIN_TOKEN}" ]]; then
echo "token = ${JELLYFIN_TOKEN}" >> $CONFIG_DIR/jellyfin.conf
else
echo "Token not specified for Jellyfin plugin!"
fi
if [[ -n "${JELLYFIN_LIBRARIES}" ]]; then
echo "libraries = ${JELLYFIN_LIBRARIES}" >> $CONFIG_DIR/jellyfin.conf
else
echo "Libraries not specified for Jellyfin plugin, will use the default ""Music"""
fi
if [[ -n "${JELLYFIN_ALBUM_ARTIST_SORT}" ]]; then
echo "albumartistsort = ${JELLYFIN_ALBUM_ARTIST_SORT}" >> $CONFIG_DIR/jellyfin.conf
fi
if [[ -n "${JELLYFIN_ALBUM_FORMAT}" ]]; then
echo "album_format = ${JELLYFIN_ALBUM_FORMAT}" >> $CONFIG_DIR/jellyfin.conf
fi
if [[ -n "${JELLYFIN_MAX_BITRATE}" ]]; then
echo "max_bitrate = ${JELLYFIN_MAX_BITRATE}" >> $CONFIG_DIR/jellyfin.conf
fi
fi

ENABLE_TIDAL=0
if [[ -z "${TIDAL_ENABLED}" ]]; then
ENABLE_TIDAL=0
Expand Down

0 comments on commit 18a31e7

Please sign in to comment.