|
|
@ -1,5 +1,5 @@
|
|
|
|
#!/usr/bin/env bash
|
|
|
|
#!/usr/bin/env bash
|
|
|
|
scriptVersion=1.0.011
|
|
|
|
scriptVersion=1.0.012
|
|
|
|
if [ -z "$lidarrUrl" ] || [ -z "$lidarrApiKey" ]; then
|
|
|
|
if [ -z "$lidarrUrl" ] || [ -z "$lidarrApiKey" ]; then
|
|
|
|
lidarrUrlBase="$(cat /config/config.xml | xq | jq -r .Config.UrlBase)"
|
|
|
|
lidarrUrlBase="$(cat /config/config.xml | xq | jq -r .Config.UrlBase)"
|
|
|
|
if [ "$lidarrUrlBase" == "null" ]; then
|
|
|
|
if [ "$lidarrUrlBase" == "null" ]; then
|
|
|
@ -46,6 +46,11 @@ else
|
|
|
|
exit
|
|
|
|
exit
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ls "$getFolderPath" | grep "lrc" | read; then
|
|
|
|
|
|
|
|
log "Removing existing lrc files"
|
|
|
|
|
|
|
|
find "$getFolderPath" -type f -iname "*.lrc" -delete
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
find "$getFolderPath" -type f -regex ".*/.*\.\(flac\|opus\|m4a\|mp3\)" -print0 | while IFS= read -r -d '' file; do
|
|
|
|
find "$getFolderPath" -type f -regex ".*/.*\.\(flac\|opus\|m4a\|mp3\)" -print0 | while IFS= read -r -d '' file; do
|
|
|
|
fileName=$(basename -- "$file")
|
|
|
|
fileName=$(basename -- "$file")
|
|
|
|
fileExt="${fileName##*.}"
|
|
|
|
fileExt="${fileName##*.}"
|
|
|
@ -58,11 +63,6 @@ find "$getFolderPath" -type f -regex ".*/.*\.\(flac\|opus\|m4a\|mp3\)" -print0 |
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
if ls "$getFolderPath" | grep "lrc" | read; then
|
|
|
|
|
|
|
|
log "Removing existing lrc files"
|
|
|
|
|
|
|
|
find "$getFolderPath" -type f -iname "*.lrc" -delete
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if [ "$fileExt" == "flac" ]; then
|
|
|
|
if [ "$fileExt" == "flac" ]; then
|
|
|
|
getLyrics="$(ffprobe -loglevel 0 -print_format json -show_format -show_streams "$file" | jq -r ".format.tags.LYRICS" | sed "s/null//g" | sed "/^$/d")"
|
|
|
|
getLyrics="$(ffprobe -loglevel 0 -print_format json -show_format -show_streams "$file" | jq -r ".format.tags.LYRICS" | sed "s/null//g" | sed "/^$/d")"
|
|
|
|
getArtistCredit="$(ffprobe -loglevel 0 -print_format json -show_format -show_streams "$file" | jq -r ".format.tags.ARTIST_CREDIT" | sed "s/null//g" | sed "/^$/d")"
|
|
|
|
getArtistCredit="$(ffprobe -loglevel 0 -print_format json -show_format -show_streams "$file" | jq -r ".format.tags.ARTIST_CREDIT" | sed "s/null//g" | sed "/^$/d")"
|
|
|
|