This commit is contained in:
Youe Graillot 2022-07-15 01:04:14 +02:00
commit a5ef6efd4d
9 changed files with 261 additions and 0 deletions

3
.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
config/
config_deemix/
downloads/

3
.gitmodules vendored Normal file
View File

@ -0,0 +1,3 @@
[submodule "lidarr-flac2mp3"]
path = lidarr-flac2mp3
url = https://github.com/youegraillot/lidarr-flac2mp3.git

19
docker-compose.yml Normal file
View File

@ -0,0 +1,19 @@
version: '3.4'
services:
lidarr-onsteroids:
image: lidarr-onsteroids
build:
context: .
environment:
- PUID=1000
- PGID=100
- AUTOCONFIG=true
ports:
- "8686:8686"
- "6595:6595"
volumes:
- ./config:/config
- ./config_deemix:/config_deemix
- ./downloads:/downloads
restart: unless-stopped

21
dockerfile Normal file
View File

@ -0,0 +1,21 @@
FROM cr.hotio.dev/hotio/lidarr:pr-plugins
LABEL maintainer="youegraillot"
ENV DEEMIX_SINGLE_USER=true
ENV AUTOCONFIG=true
# flac2mp3
COPY lidarr-flac2mp3/root/usr /usr
RUN apk add --no-cache ffmpeg && \
rm -rf /var/lib/apt/lists/*
# deemix
COPY --from=registry.gitlab.com/bockiii/deemix-docker:latest /deemix-server /deemix-server
RUN chmod +x /deemix-server
VOLUME [ "/config_deemix" "/downloads" ]
EXPOSE 6595
COPY root /
VOLUME "/config"
EXPOSE 6595 8686

1
lidarr-flac2mp3 Submodule

@ -0,0 +1 @@
Subproject commit 48aced2c6e02d0fffcbba5f2d50cc2eb0fcc57f8

View File

@ -0,0 +1,82 @@
{
"downloadLocation": "/downloads/",
"tracknameTemplate": "%artist% - %title%",
"albumTracknameTemplate": "%tracknumber% - %title%",
"playlistTracknameTemplate": "%position% - %artist% - %title%",
"createPlaylistFolder": true,
"playlistNameTemplate": "%playlist%",
"createArtistFolder": true,
"artistNameTemplate": "%artist%",
"createAlbumFolder": true,
"albumNameTemplate": "%artist% - %album%",
"createCDFolder": true,
"createStructurePlaylist": true,
"createSingleFolder": true,
"padTracks": true,
"paddingSize": "0",
"illegalCharacterReplacer": "_",
"queueConcurrency": 3,
"maxBitrate": "9",
"feelingLucky": true,
"fallbackBitrate": true,
"fallbackSearch": false,
"fallbackISRC": false,
"logErrors": true,
"logSearched": false,
"overwriteFile": "n",
"createM3U8File": false,
"playlistFilenameTemplate": "playlist",
"syncedLyrics": false,
"embeddedArtworkSize": 800,
"embeddedArtworkPNG": false,
"localArtworkSize": 1200,
"localArtworkFormat": "jpg",
"saveArtwork": true,
"coverImageTemplate": "cover",
"saveArtworkArtist": false,
"artistImageTemplate": "folder",
"jpegImageQuality": 90,
"dateFormat": "Y-M-D",
"albumVariousArtists": true,
"removeAlbumVersion": false,
"removeDuplicateArtists": true,
"featuredToTitle": "0",
"titleCasing": "nothing",
"artistCasing": "nothing",
"executeCommand": "",
"tags": {
"title": true,
"artist": true,
"artists": true,
"album": true,
"cover": true,
"trackNumber": true,
"trackTotal": true,
"discNumber": true,
"discTotal": true,
"albumArtist": true,
"genre": true,
"year": true,
"date": true,
"explicit": true,
"isrc": true,
"length": true,
"barcode": true,
"bpm": true,
"replayGain": true,
"label": true,
"lyrics": true,
"syncedLyrics": true,
"copyright": true,
"composer": true,
"involvedPeople": true,
"source": true,
"rating": false,
"savePlaylistAsCompilation": false,
"useNullSeparator": false,
"saveID3v1": true,
"multiArtistSeparator": "default",
"singleAlbumArtist": false,
"coverDescriptionUTF8": false
}
}

View File

@ -0,0 +1,33 @@
#!/usr/bin/with-contenv bash
# shellcheck shell=bash
UMASK_SET=${UMASK_SET:-022}
umask "$UMASK_SET"
cd /
# Check if an alternative port was defined, set it to it or default
if [ -n "${INTPORT}" ]; then
port=$INTPORT
else
port=6595
fi
# Check if the ARL environment var is set to anything. This enables legacy behavior
if [ -n "${ARL}" ]; then
export DEEMIX_SINGLE_USER=true
fi
export DEEMIX_DATA_DIR=/config_deemix/
export DEEMIX_MUSIC_DIR=/downloads/
export DEEMIX_SERVER_PORT=$port
export DEEMIX_HOST=0.0.0.0
if [ ! -f $DEEMIX_DATA_DIR/config.json ] && [ "$AUTOCONFIG" = "true" ]; then
echo "[services.d] Copying deemix configuration"
cp -f /etc/services.d/deemix/config.json $DEEMIX_DATA_DIR/config.json
fi
chown -R "$PUID:$PGID" /config_deemix
echo "[services.d] Starting Deemix"
s6-setuidgid "$PUID:$PGID" /deemix-server

View File

@ -0,0 +1,10 @@
#!/usr/bin/with-contenv sh
# shellcheck shell=sh
SUPERVISED_DIR=/var/run/s6/services
# hack: this is run-once service
# stop the s6-supervise process and ensure that its not started again
s6-svc -x ${SUPERVISED_DIR}/setup
rm -rf ${SUPERVISED_DIR}/setup
s6-svscanctl -a ${SUPERVISED_DIR}

View File

@ -0,0 +1,89 @@
#!/usr/bin/with-contenv sh
# shellcheck shell=sh
echo "
----------------------------------------------------------------------
Flac2MP3 SETUP
----------------------------------------------------------------------
PUID=$PUID
PGID=$PGID
----------------------------------------------------------------------
"
if [ "$(stat -c '%g' /usr/local/bin/flac2mp3.sh)" != "$PGUID" ]; then
echo "Changing ownership on scripts."
chown "$PUID:$PGID" /usr/local/bin/flac2*.sh
fi
if [ ! -x /usr/local/bin/flac2mp3.sh ]; then
echo "Making scripts executable."
chmod +x /usr/local/bin/flac2*.sh
fi
echo "
----------------------------------------------------------------------
LIDARR SETUP
----------------------------------------------------------------------
Source=$urlPlugin
----------------------------------------------------------------------
"
url="http://localhost:8686"
urlPlugin="https://github.com/ta264/Lidarr.Plugin.Deemix"
# string, route
isPresent() {
apiCall "GET" "$2" | grep -q "$1"
}
# method, route, payload
apiCall() {
curl \
-sS \
-X "$1" \
-H "Content-Type: application/json" \
-H "X-Api-Key: $apiKey" \
-d "$3" \
$url/api/v1/"$2"
return 0
}
apiKey="$(curl \
-sS \
--retry-all-errors \
--retry 10 \
$url/initialize.js |
sed -n "s/apiKey: '\(.*\)'.*/\1/p")"
if isPresent $urlPlugin "system/plugins"; then
echo "Plugin already installed"
else
echo "Installing plugin"
apiCall "POST" "command" '{"name":"InstallPlugin","githubUrl":"'$urlPlugin'"}'
fi
if [ "$AUTOCONFIG" = "true" ]; then
loginPath="/config_deemix/login.json"
echo "Waiting for $loginPath to be filled..."
while [ -z "$arl" ]; do
sleep 1
arl=$(sed -n 's/.*arl.*"\(.*\)"/\1/p' "$loginPath" 2>/dev/null)
done
if [ "$(apiCall "GET" "delayprofile" | jq .[0].items[2].allowed)" = "false" ]; then
echo "Allowing Deemix in default delay profile"
apiCall "PUT" "delayprofile/1" \
'{"name":"Default","items":[{"name":"Usenet","protocol":"UsenetDownloadProtocol","allowed":true,"delay":0},{"name":"Torrent","protocol":"TorrentDownloadProtocol","allowed":true,"delay":0},{"name":"Deemix","protocol":"DeemixDownloadProtocol","allowed":true,"delay":0}],"tags":[],"id":1}'
fi
if ! isPresent "Deemix" "indexer"; then
loginPath="/config_deemix/login.json"
echo "Updating indexer"
apiCall "POST" "indexer" \
'{"enableRss":true,"enableAutomaticSearch":true,"enableInteractiveSearch":true,"supportsRss":true,"supportsSearch":true,"protocol":"DeemixDownloadProtocol","priority":25,"downloadClientId":0,"name":"Deemix","fields":[{"name":"baseUrl","value":"http://localhost:6595"},{"name":"arl","value":"'"$arl"'"},{"name":"earlyReleaseLimit"}],"implementationName":"Deemix","implementation":"Deemix","configContract":"DeemixIndexerSettings","infoLink":"https://wiki.servarr.com/lidarr/supported#deemix","tags":[]}'
fi
if ! isPresent "Deemix" "downloadclient"; then
echo "Updating download client"
apiCall "POST" "downloadclient" \
'{"enable":true,"protocol":"DeemixDownloadProtocol","priority":1,"removeCompletedDownloads":true,"removeFailedDownloads":true,"name":"Deemix","fields":[{"name":"host","value":"localhost"},{"name":"port","value":6595},{"name":"urlBase"},{"name":"useSsl","value":false},{"name":"arl","value":"'"$arl"'"}],"implementationName":"Deemix","implementation":"Deemix","configContract":"DeemixSettings","infoLink":"https://wiki.servarr.com/lidarr/supported#deemix","tags":[]}'
fi
echo "Configuration is up to date"
fi