Skip to content

Commit

Permalink
autoconfigure flac2custom
Browse files Browse the repository at this point in the history
  • Loading branch information
youegraillot committed Jul 16, 2022
1 parent aa641d2 commit a9442bc
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 23 deletions.
Binary file modified .assets/lidarr-custom-script.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 6 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ This allows an easy deployment, with the advantage of having a direct control ov

### Docker Run

```shell
```sh
docker run \
--name lidarr \
-p 8686:8686 \
Expand Down Expand Up @@ -75,20 +75,23 @@ The only manual manipulation you'll have to do is filling your Deezer credential
- Delay profile allowing Deemix to be used by automatic search
- Deemix as an indexer
- Deemix as a download client
- Flac2Custom script connection if `FLAC2CUSTOM_ARGS` is set

In case you don't want the automagical part (which is really the only value of this image), just set `AUTOCONFIG` environment variable to `false`.

## Audio files conversion

The image uses a modded version of lidarr-flac2mp3 allowing conversion from any format.

To enable conversion on Lidarr import, create a new Connection to a Custom Script. You can also provide your own custom conversion script here, see [lidarr-flac2mp3](https://github.com/youegraillot/lidarr-flac2mp3) for mode information.
To enable conversion on Lidarr import, create a new Connection to a Custom Script. You can also provide your own custom conversion script, see [lidarr-flac2mp3](https://github.com/youegraillot/lidarr-flac2mp3) for more information.

If `AUTOCONFIG` is set to `true` (default) and you have set `FLAC2CUSTOM_ARGS`, this step done for you :

!["Lidarr custom script settings"](https://github.com/youegraillot/lidarr-on-steroids/raw/main/.assets/lidarr-custom-script.png "Lidarr custom script settings")

## Acknowledgment

This project is just a compilation of various tools made possible by those projects :
This project is just a compilation of various tools made possible by these projects :

- [Lidarr](https://github.com/Lidarr/Lidarr) and especially [ta264](https://github.com/ta264) for the plugin integration
- [lidarr-flac2mp3](https://github.com/TheCaptain989/lidarr-flac2mp3) for the format conversion script
Expand Down
50 changes: 30 additions & 20 deletions root/etc/services.d/setup/run
Original file line number Diff line number Diff line change
Expand Up @@ -21,26 +21,6 @@ apiCall() {
return 0
}

echo "
----------------------------------------------------------------------
Flac2MP3 SETUP
----------------------------------------------------------------------
PUID=$PUID
PGID=$PGID
FLAC2CUSTOM_ARGS=$FLAC2CUSTOM_ARGS
----------------------------------------------------------------------
"

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
Expand Down Expand Up @@ -92,3 +72,33 @@ if [ "$AUTOCONFIG" = "true" ]; then
fi
echo "[autoconfig] Configuration is up to date"
fi

echo "
----------------------------------------------------------------------
Flac2MP3 SETUP
----------------------------------------------------------------------
PUID=$PUID
PGID=$PGID
FLAC2CUSTOM_ARGS=$FLAC2CUSTOM_ARGS
----------------------------------------------------------------------
"

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

if [ "$AUTOCONFIG" = "true" ]; then
if [ -n "$FLAC2CUSTOM_ARGS" ]; then
echo "[autoconfig] FLAC2CUSTOM_ARGS is set"
if ! isPresent "flac2" "notification"; then
echo "[autoconfig] Configuring flac2custom.sh custom script"
apiCall "POST" "notification" '{"onGrab":false,"onReleaseImport":true,"onUpgrade":true,"onRename":false,"onHealthIssue":false,"onDownloadFailure":false,"onImportFailure":false,"onTrackRetag":false,"onApplicationUpdate":false,"supportsOnGrab":true,"supportsOnReleaseImport":true,"supportsOnUpgrade":true,"supportsOnRename":true,"supportsOnHealthIssue":true,"includeHealthWarnings":false,"supportsOnDownloadFailure":false,"supportsOnImportFailure":false,"supportsOnTrackRetag":true,"supportsOnApplicationUpdate":true,"name":"Flac2Custom","fields":[{"name":"path","value":"/usr/local/bin/flac2custom.sh"},{"name":"arguments"}],"implementationName":"Custom Script","implementation":"CustomScript","configContract":"CustomScriptSettings","infoLink":"https://wiki.servarr.com/lidarr/supported#customscript","message":{"message":"Testing will execute the script with the EventType set to Test, ensure your script handles this correctly","type":"warning"},"tags":[]}'
fi
fi
fi

0 comments on commit a9442bc

Please sign in to comment.