Merge remote-tracking branch 'origin/main'

# Conflicts:
#	lidarr/extended.conf
This commit is contained in:
hockeygoalie35 2024-02-06 19:13:43 -05:00
commit 550ebb0620
9 changed files with 153 additions and 158 deletions

View file

@ -1,5 +1,5 @@
#!/usr/bin/with-contenv bash
scriptVersion="2.24"
scriptVersion="2.32"
scriptName="Audio"
### Import Settings
@ -35,6 +35,10 @@ verifyConfig () {
deezerClientTestDownloadId="197472472"
fi
if [ -z "$ignoreInstrumentalRelease" ]; then
ignoreInstrumentalRelease="true"
fi
audioPath="$downloadPath/audio"
}
@ -665,7 +669,7 @@ DownloadProcess () {
fi
albumquality="$(find "$audioPath"/incomplete/ -type f -regex ".*/.*\.\(flac\|opus\|m4a\|mp3\)" | head -n 1 | egrep -i -E -o "\.{1}\w*$" | sed 's/\.//g')"
downloadedAlbumFolder="$lidarrArtistNameSanitized-$downloadedAlbumTitleClean ($3)-${albumquality^^}-$1-$2"
downloadedAlbumFolder="$lidarrArtistNameSanitized-${downloadedAlbumTitleClean:0:100} ($3)-${albumquality^^}-$1-$2"
find "$audioPath/incomplete" -type f -regex ".*/.*\.\(flac\|opus\|m4a\|mp3\)" -print0 | while IFS= read -r -d '' audio; do
file="${audio}"
@ -1232,8 +1236,8 @@ SearchProcess () {
releaseDisambiguation=" ($releaseDisambiguation)"
fi
echo "${releaseTitle}${releaseDisambiguation}" >> /temp-release-list
echo "$lidarrAlbumTitle" >> /temp-release-list
done
echo "$lidarrAlbumTitle" >> /temp-release-list
# Get Release Titles
OLDIFS="$IFS"
@ -1265,12 +1269,26 @@ SearchProcess () {
releaseProcessCount=$(( $releaseProcessCount + 1))
lidarrReleaseTitle="${lidarrReleaseTitles[$title]}"
lidarrAlbumReleaseTitleClean=$(echo "$lidarrReleaseTitle" | sed -e "s%[^[:alpha:][:digit:]]%%g" -e "s/ */ /g" | sed 's/^[.]*//' | sed 's/[.]*$//g' | sed 's/^ *//g' | sed 's/ *$//g')
lidarrAlbumReleaseTitleClean="${lidarrAlbumReleaseTitleClean:0:130}"
lidarrAlbumReleaseTitleSearchClean="$(echo "$lidarrReleaseTitle" | sed -e "s%[^[:alpha:][:digit:]]% %g" -e "s/ */ /g" | sed 's/^[.]*//' | sed 's/[.]*$//g' | sed 's/^ *//g' | sed 's/ *$//g')"
lidarrAlbumReleaseTitleFirstWord="$(echo "$lidarrReleaseTitle" | awk '{ print $1 }')"
lidarrAlbumReleaseTitleFirstWord="${lidarrAlbumReleaseTitleFirstWord:0:3}"
albumTitleSearch="$(jq -R -r @uri <<<"${lidarrAlbumReleaseTitleSearchClean}")"
#echo "Debugging :: $loopCount :: $releaseProcessCount :: $lidarrArtistForeignArtistId :: $lidarrReleaseTitle :: $lidarrAlbumReleasesMinTrackCount-$lidarrAlbumReleasesMaxTrackCount :: $lidarrAlbumReleaseTitleFirstWord :: $albumArtistNameSearch :: $albumTitleSearch"
if echo "$lidarrAlbumTitle" | grep -i "instrumental" | read; then
sleep 0.01
else
# ignore instrumental releases
if [ "$ignoreInstrumentalRelease" == "true" ]; then
if echo "$lidarrReleaseTitle" | grep -i "instrumental" | read; then
log "$page :: $wantedAlbumListSource :: $processNumber of $wantedListAlbumTotal :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: Instrumental Release Found, Skipping..."
continue
fi
fi
fi
# Skip Various Artists album search that is not supported...
if [ "$lidarrArtistForeignArtistId" != "89ad4ac3-39f7-470e-963a-56509c546377" ]; then
@ -1414,21 +1432,11 @@ ArtistDeezerSearch () {
deezerAlbumData="$(echo "$deezerArtistAlbumsData" | jq -r "select(.id==$deezerAlbumID)")"
deezerAlbumTitle="$(echo "$deezerAlbumData" | jq -r ".title")"
deezerAlbumTitleClean="$(echo ${deezerAlbumTitle} | sed -e "s%[^[:alpha:][:digit:]]%%g" -e "s/ */ /g" | sed 's/^[.]*//' | sed 's/[.]*$//g' | sed 's/^ *//g' | sed 's/ *$//g')"
# String Character Count test, quicker than the levenshtein method to allow faster processing
characterMath=$(( ${#deezerAlbumTitleClean} - ${#lidarrAlbumReleaseTitleClean} ))
if [ "$characterMath" -gt "$matchDistance" ]; then
log "$1 :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: Artist Search :: Deezer :: $type :: $lidarrReleaseTitle :: $lidarrAlbumReleaseTitleClean vs $deezerAlbumTitleClean :: Not a match..."
continue
elif [ "$characterMath" -lt "0" ]; then
log "$1 :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: Artist Search :: Deezer :: $type :: $lidarrReleaseTitle :: $lidarrAlbumReleaseTitleClean vs $deezerAlbumTitleClean :: Not a match..."
continue
fi
deezerAlbumTitleClean="${deezerAlbumTitleClean:0:130}"
GetDeezerAlbumInfo "$deezerAlbumID"
deezerAlbumData="$(cat "/config/extended/cache/deezer/$deezerAlbumID.json")"
deezerAlbumTrackCount="$(echo "$deezerAlbumData" | jq -r .nb_tracks)"
deezerAlbumExplicitLyrics="$(echo "$deezerAlbumData" | jq -r .explicit_lyrics)"
deezerAlbumTitle="$(echo "$deezerAlbumData"| jq -r .title)"
deezerAlbumTitleClean="$(echo "$deezerAlbumTitle" | sed -e "s%[^[:alpha:][:digit:]]%%g" -e "s/ */ /g" | sed 's/^[.]*//' | sed 's/[.]*$//g' | sed 's/^ *//g' | sed 's/ *$//g')"
downloadedReleaseDate="$(echo "$deezerAlbumData" | jq -r .release_date)"
downloadedReleaseYear="${downloadedReleaseDate:0:4}"
@ -1443,8 +1451,8 @@ ArtistDeezerSearch () {
fi
log "$1 :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: Artist Search :: Deezer :: $type :: $lidarrReleaseTitle :: $lidarrAlbumReleaseTitleClean vs $deezerAlbumTitleClean :: Checking for Match..."
log "$1 :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: Artist Search :: Deezer :: $type :: $lidarrReleaseTitle :: $lidarrAlbumReleaseTitleClean vs $deezerAlbumTitleClean :: Calculating Similarity..."
diff=$(levenshtein "${lidarrAlbumReleaseTitleClean,,}" "${deezerAlbumTitleClean,,}" 2>/dev/null)
log "$1 :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: Artist Search :: Deezer :: $type :: $lidarrReleaseTitle :: $lidarrAlbumReleaseTitleClean vs $deezerAlbumTitleClean :: Calculating Damerau-Levenshtein distance..."
diff=$(python -c "from pyxdameraulevenshtein import damerau_levenshtein_distance; print(damerau_levenshtein_distance(\"${lidarrAlbumReleaseTitleClean,,}\", \"${deezerAlbumTitleClean,,}\"))" 2>/dev/null)
if [ "$diff" -le "$matchDistance" ]; then
log "$1 :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: Artist Search :: Deezer :: $type :: $lidarrReleaseTitle :: $lidarrAlbumReleaseTitleClean vs $deezerAlbumTitleClean :: Deezer MATCH Found :: Calculated Difference = $diff"
@ -1452,6 +1460,8 @@ ArtistDeezerSearch () {
log "$1 :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: Artist Search :: Deezer :: $type :: $lidarrReleaseTitle :: Downloading $deezerAlbumTrackCount Tracks :: $deezerAlbumTitle ($downloadedReleaseYear)"
DownloadProcess "$deezerAlbumID" "DEEZER" "$downloadedReleaseYear" "$deezerAlbumTitle" "$deezerAlbumTrackCount"
else
log "$1 :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: Artist Search :: Deezer :: $type :: $lidarrReleaseTitle :: $lidarrAlbumReleaseTitleClean vs $deezerAlbumTitleClean :: Deezer Match Not Found :: Calculated Difference ($diff) greater than $matchDistance"
fi
# End search if lidarr was successfully notified for import
@ -1464,7 +1474,7 @@ ArtistDeezerSearch () {
FuzzyDeezerSearch () {
# Required Inputs
# $1 Process ID
# $3 Lyric Type (explicit = true, clean = false)
# $2 Lyric Type (explicit = true, clean = false)
if [ "$2" == "true" ]; then
type="Explicit"
@ -1494,21 +1504,12 @@ FuzzyDeezerSearch () {
deezerAlbumTitle="$(echo "$deezerAlbumData" | jq -r ".title")"
deezerAlbumTitle="$(echo "$deezerAlbumTitle" | head -n1)"
deezerAlbumTitleClean="$(echo "$deezerAlbumTitle" | sed -e "s%[^[:alpha:][:digit:]]%%g" -e "s/ */ /g" | sed 's/^[.]*//' | sed 's/[.]*$//g' | sed 's/^ *//g' | sed 's/ *$//g')"
# String Character Count test, quicker than the levenshtein method to allow faster processing
characterMath=$(( ${#deezerAlbumTitleClean} - ${#lidarrAlbumReleaseTitleClean} ))
if [ "$characterMath" -gt "$matchDistance" ]; then
continue
elif [ "$characterMath" -lt "0" ]; then
continue
fi
deezerAlbumTitleClean="${deezerAlbumTitleClean:0:130}"
GetDeezerAlbumInfo "${deezerAlbumID}"
deezerAlbumData="$(cat "/config/extended/cache/deezer/$deezerAlbumID.json")"
deezerAlbumTrackCount="$(echo "$deezerAlbumData" | jq -r .nb_tracks)"
deezerAlbumExplicitLyrics="$(echo "$deezerAlbumData" | jq -r .explicit_lyrics)"
deezerAlbumTitle="$(echo "$deezerAlbumData"| jq -r .title)"
deezerAlbumTitleClean="$(echo "$deezerAlbumTitle" | sed -e "s%[^[:alpha:][:digit:]]%%g" -e "s/ */ /g" | sed 's/^[.]*//' | sed 's/[.]*$//g' | sed 's/^ *//g' | sed 's/ *$//g')"
downloadedReleaseDate="$(echo "$deezerAlbumData" | jq -r .release_date)"
downloadedReleaseYear="${downloadedReleaseDate:0:4}"
@ -1527,13 +1528,15 @@ FuzzyDeezerSearch () {
fi
log "$1 :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: Fuzzy Search :: Deezer :: $type :: $lidarrReleaseTitle :: $lidarrAlbumReleaseTitleClean vs $deezerAlbumTitleClean :: Checking for Match..."
log "$1 :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: Fuzzy Search :: Deezer :: $type :: $lidarrReleaseTitle :: $lidarrAlbumReleaseTitleClean vs $deezerAlbumTitleClean :: Calculating Similarity..."
diff=$(levenshtein "${lidarrAlbumReleaseTitleClean,,}" "${deezerAlbumTitleClean,,}" 2>/dev/null)
log "$1 :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: Fuzzy Search :: Deezer :: $type :: $lidarrReleaseTitle :: $lidarrAlbumReleaseTitleClean vs $deezerAlbumTitleClean :: Calculating Damerau-Levenshtein distance..."
diff=$(python -c "from pyxdameraulevenshtein import damerau_levenshtein_distance; print(damerau_levenshtein_distance(\"${lidarrAlbumReleaseTitleClean,,}\", \"${deezerAlbumTitleClean,,}\"))" 2>/dev/null)
if [ "$diff" -le "$matchDistance" ]; then
log "$1 :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: Fuzzy Search :: Deezer :: $type :: $lidarrReleaseTitle :: $lidarrAlbumReleaseTitleClean vs $deezerAlbumTitleClean :: Deezer MATCH Found :: Calculated Difference = $diff"
log "$1 :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: Fuzzy Search :: Deezer :: $type :: $lidarrReleaseTitle :: Downloading $deezerAlbumTrackCount Tracks :: $deezerAlbumTitle ($downloadedReleaseYear)"
DownloadProcess "$deezerAlbumID" "DEEZER" "$downloadedReleaseYear" "$deezerAlbumTitle" "$deezerAlbumTrackCount"
else
log "$1 :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: Fuzzy Search :: Deezer :: $type :: $lidarrReleaseTitle :: $lidarrAlbumReleaseTitleClean vs $deezerAlbumTitleClean :: Deezer Match Not Found :: Calculated Difference ($diff) greater than $matchDistance"
fi
# End search if lidarr was successfully notified for import
if [ "$lidarrDownloadImportNotfication" == "true" ]; then
@ -1588,6 +1591,7 @@ ArtistTidalSearch () {
tidalArtistAlbumData=$(echo "$tidalArtistAlbumsData" | jq -r "select(.id=="$tidalArtistAlbumId")")
downloadedAlbumTitle="$(echo ${tidalArtistAlbumData} | jq -r .title)"
tidalAlbumTitleClean=$(echo ${downloadedAlbumTitle} | sed -e "s%[^[:alpha:][:digit:]]%%g" -e "s/ */ /g" | sed 's/^[.]*//' | sed 's/[.]*$//g' | sed 's/^ *//g' | sed 's/ *$//g')
tidalAlbumTitleClean="${tidalAlbumTitleClean:0:130}"
downloadedReleaseDate="$(echo ${tidalArtistAlbumData} | jq -r .releaseDate)"
if [ "$downloadedReleaseDate" == "null" ]; then
downloadedReleaseDate=$(echo $tidalArtistAlbumData | jq -r '.streamStartDate')
@ -1595,19 +1599,9 @@ ArtistTidalSearch () {
downloadedReleaseYear="${downloadedReleaseDate:0:4}"
downloadedTrackCount=$(echo "$tidalArtistAlbumData"| jq -r .numberOfTracks)
# String Character Count test, quicker than the levenshtein method to allow faster processing
characterMath=$(( ${#tidalAlbumTitleClean} - ${#lidarrAlbumReleaseTitleClean} ))
if [ "$characterMath" -gt "$matchDistance" ]; then
log "$1 :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: Artist Search :: Tidal :: $type :: $lidarrReleaseTitle :: $lidarrAlbumReleaseTitleClean vs $tidalAlbumTitleClean :: Not a match..."
continue
elif [ "$characterMath" -lt "0" ]; then
log "$1 :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: Artist Search :: Tidal :: $type :: $lidarrReleaseTitle :: $lidarrAlbumReleaseTitleClean vs $tidalAlbumTitleClean :: Not a match..."
continue
fi
log "$1 :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: Artist Search :: Tidal :: $type :: $lidarrReleaseTitle :: $lidarrAlbumReleaseTitleClean vs $tidalAlbumTitleClean :: Checking for Match..."
log "$1 :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: Artist Search :: Tidal :: $type :: $lidarrReleaseTitle :: $lidarrAlbumReleaseTitleClean vs $tidalAlbumTitleClean :: Calculating Similarity..."
diff=$(levenshtein "${lidarrAlbumReleaseTitleClean,,}" "${tidalAlbumTitleClean,,}" 2>/dev/null)
log "$1 :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: Artist Search :: Tidal :: $type :: $lidarrReleaseTitle :: $lidarrAlbumReleaseTitleClean vs $tidalAlbumTitleClean :: Calculating Damerau-Levenshtein distance..."
diff=$(python -c "from pyxdameraulevenshtein import damerau_levenshtein_distance; print(damerau_levenshtein_distance(\"${lidarrAlbumReleaseTitleClean,,}\", \"${tidalAlbumTitleClean,,}\"))" 2>/dev/null)
if [ "$diff" -le "$matchDistance" ]; then
log "$1 :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: Artist Search :: Tidal :: $type :: $lidarrReleaseTitle :: $lidarrAlbumReleaseTitleClean vs $tidalAlbumTitleClean :: Tidal MATCH Found :: Calculated Difference = $diff"
@ -1620,7 +1614,7 @@ ArtistTidalSearch () {
break
fi
else
log "$1 :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: Artist Search :: Tidal :: $type :: $lidarrReleaseTitle :: $lidarrAlbumReleaseTitleClean vs $tidalAlbumTitleClean :: Tidal Match Not Found :: Calculated Difference ($diff) greater than 5"
log "$1 :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: Artist Search :: Tidal :: $type :: $lidarrReleaseTitle :: $lidarrAlbumReleaseTitleClean vs $tidalAlbumTitleClean :: Tidal Match Not Found :: Calculated Difference ($diff) greater than $matchDistance"
fi
done
@ -1655,6 +1649,7 @@ FuzzyTidalSearch () {
tidalAlbumData="$(echo "$tidalSearch" | jq -r "select(.id==$tidalAlbumID)")"
tidalAlbumTitle=$(echo "$tidalAlbumData"| jq -r .title)
tidalAlbumTitleClean=$(echo ${tidalAlbumTitle} | sed -e "s%[^[:alpha:][:digit:]]%%g" -e "s/ */ /g" | sed 's/^[.]*//' | sed 's/[.]*$//g' | sed 's/^ *//g' | sed 's/ *$//g')
tidalAlbumTitleClean="${tidalAlbumTitleClean:0:130}"
downloadedReleaseDate="$(echo ${tidalAlbumData} | jq -r .releaseDate)"
if [ "$downloadedReleaseDate" == "null" ]; then
downloadedReleaseDate=$(echo $tidalAlbumData | jq -r '.streamStartDate')
@ -1662,19 +1657,9 @@ FuzzyTidalSearch () {
downloadedReleaseYear="${downloadedReleaseDate:0:4}"
downloadedTrackCount=$(echo "$tidalAlbumData"| jq -r .numberOfTracks)
# String Character Count test, quicker than the levenshtein method to allow faster processing
characterMath=$(( ${#tidalAlbumTitleClean} - ${#lidarrAlbumReleaseTitleClean} ))
if [ "$characterMath" -gt "$matchDistance" ]; then
log "$1 :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: Fuzzy Search :: Tidal :: $type :: $lidarrReleaseTitle :: $lidarrAlbumReleaseTitleClean vs $tidalAlbumTitleClean :: Not a match..."
continue
elif [ "$characterMath" -lt "0" ]; then
log "$1 :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: Fuzzy Search :: Tidal :: $type :: $lidarrReleaseTitle :: $lidarrAlbumReleaseTitleClean vs $tidalAlbumTitleClean :: Not a match..."
continue
fi
log "$1 :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: Fuzzy Search :: Tidal :: $type :: $lidarrReleaseTitle :: $lidarrAlbumReleaseTitleClean vs $tidalAlbumTitleClean :: Checking for Match..."
log "$1 :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: Fuzzy Search :: Tidal :: $type :: $lidarrReleaseTitle :: $lidarrAlbumReleaseTitleClean vs $tidalAlbumTitleClean :: Calculating Similarity..."
diff=$(levenshtein "${lidarrAlbumReleaseTitleClean,,}" "${tidalAlbumTitleClean,,}" 2>/dev/null)
log "$1 :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: Fuzzy Search :: Tidal :: $type :: $lidarrReleaseTitle :: $lidarrAlbumReleaseTitleClean vs $tidalAlbumTitleClean :: Calculating Damerau-Levenshtein distance..."
diff=$(python -c "from pyxdameraulevenshtein import damerau_levenshtein_distance; print(damerau_levenshtein_distance(\"${lidarrAlbumReleaseTitleClean,,}\", \"${tidalAlbumTitleClean,,}\"))" 2>/dev/null)
if [ "$diff" -le "$matchDistance" ]; then
log "$1 :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: Fuzzy Search :: Tidal :: $type :: $lidarrReleaseTitle :: $lidarrAlbumReleaseTitleClean vs $tidalAlbumTitleClean :: Tidal MATCH Found :: Calculated Difference = $diff"
log "$1 :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: Fuzzy Search :: Tidal :: $type :: $lidarrReleaseTitle :: Downloading $downloadedTrackCount Tracks :: $tidalAlbumTitle ($downloadedReleaseYear)"
@ -1682,7 +1667,7 @@ FuzzyTidalSearch () {
DownloadProcess "$tidalAlbumID" "TIDAL" "$downloadedReleaseYear" "$tidalAlbumTitle" "$downloadedTrackCount"
else
log "$1 :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: Fuzzy Search :: Tidal :: $type :: $lidarrReleaseTitle :: $lidarrAlbumReleaseTitleClean vs $tidalAlbumTitleClean :: Tidal Match Not Found :: Calculated Difference ($diff) greater than 5"
log "$1 :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: Fuzzy Search :: Tidal :: $type :: $lidarrReleaseTitle :: $lidarrAlbumReleaseTitleClean vs $tidalAlbumTitleClean :: Tidal Match Not Found :: Calculated Difference ($diff) greater than $matchDistance"
fi
# End search if lidarr was successfully notified for import
if [ "$lidarrDownloadImportNotfication" == "true" ]; then
@ -1770,45 +1755,6 @@ LidarrMissingAlbumSearch () {
done
}
function levenshtein {
if [ "$1" == "$2" ]; then
echo 0
else
if (( $# != 2 )); then
echo "Usage: $0 word1 word2" >&2
elif (( ${#1} < ${#2} )); then
levenshtein "$2" "$1"
else
local str1len=${#1}
local str2len=${#2}
local d
for (( i = 0; i <= (str1len+1)*(str2len+1); i++ )); do
d[i]=0
done
for (( i = 0; i <= str1len; i++ )); do
d[i+0*str1len]=$i
done
for (( j = 0; j <= str2len; j++ )); do
d[0+j*(str1len+1)]=$j
done
for (( j = 1; j <= str2len; j++ )); do
for (( i = 1; i <= str1len; i++ )); do
[ "${1:i-1:1}" = "${2:j-1:1}" ] && local cost=0 || local cost=1
del=$(( d[(i-1)+str1len*j]+1 ))
ins=$(( d[i+str1len*(j-1)]+1 ))
alt=$(( d[(i-1)+str1len*(j-1)]+cost ))
d[i+str1len*j]=$( echo -e "$del\n$ins\n$alt" | sort -n | head -1 )
done
done
echo ${d[str1len+str1len*(str2len)]}
fi
fi
}
audioFlacVerification () {
# Test Flac File for errors
# $1 File for verification

View file

@ -1,5 +1,5 @@
#!/usr/bin/with-contenv bash
scriptVersion="1.9"
scriptVersion="2.1"
scriptName="AutoArtistAdder"
### Import Settings
@ -21,6 +21,12 @@ verifyConfig () {
autoArtistAdderInterval="12h"
fi
if [ -z "$autoArtistAdderMonitored" ]; then
autoArtistAdderMonitored="true"
elif [ "$autoArtistAdderMonitored" != "true" ]; then
autoArtistAdderMonitored="false"
fi
}
@ -108,7 +114,7 @@ AddDeezerArtistToLidarr () {
\"foreignArtistId\": \"$foreignId\",
\"qualityProfileId\": $qualityProfileId,
\"metadataProfileId\": $metadataProfileId,
\"monitored\":true,
\"monitored\":$autoArtistAdderMonitored,
\"monitor\":\"all\",
\"rootFolderPath\": \"$path\",
\"addOptions\":{\"searchForMissingAlbums\":$lidarrSearchForMissing}
@ -259,7 +265,7 @@ AddTidalArtistToLidarr () {
\"foreignArtistId\": \"$foreignId\",
\"qualityProfileId\": $qualityProfileId,
\"metadataProfileId\": $metadataProfileId,
\"monitored\":true,
\"monitored\":$autoArtistAdderMonitored,
\"monitor\":\"all\",
\"rootFolderPath\": \"$path\",
\"addOptions\":{\"searchForMissingAlbums\":$lidarrSearchForMissing}

View file

@ -1,5 +1,5 @@
#!/usr/bin/with-contenv bash
scriptVersion="3.5"
scriptVersion="3.6"
scriptName="Video"
### Import Settings
@ -8,14 +8,26 @@ source /config/extended.conf
source /config/extended/functions
verifyConfig () {
videoContainer=mkv
if [ -z "$videoContainer" ]; then
videoContainer="mkv"
fi
if [ -z "$disableImvd" ]; then
disableImvd="fasle"
fi
if [ "$enableVideo" != "true" ]; then
log "Script is not enabled, enable by setting enableVideo to \"true\" by modifying the \"/config/extended.conf\" config file..."
log "Sleeping (infinity)"
sleep infinity
fi
if [ "$disableImvd" = "true" ]; then
log "Script is not enabled, enable by setting disableImvd to \"false\" by modifying the \"/config/extended.conf\" config file..."
log "Sleeping (infinity)"
sleep infinity
fi
if [ -z "$downloadPath" ]; then
downloadPath="/config/extended/downloads"
fi

View file

@ -29,10 +29,11 @@ configureTrackNamingSettings="true"
##### AUDIO SCRIPT
# SEARCH
searchSort="date" # date or album :: Sorts the missing/cutoff list by release date (newest -> oldest) or album type (album -> single) for processing the list
matchDistance="5" # The number of changes required to transform the searched album title into a possible found album title match... (0, requires a perfect match)
lidarrSearchForMissing="true" # true = enabled :: When artists are added, search for them using Lidarr's built in functionality
retryNotFound="90" ## :: Number of days between re-attempting the download of previously notfound albums
searchSort="date" # date or album :: Sorts the missing/cutoff list by release date (newest -> oldest) or album type (album -> single) for processing the list
matchDistance="5" # The number of changes required to transform the searched album title into a possible found album title match... (0, requires a perfect match)
lidarrSearchForMissing="true" # true = enabled :: When artists are added, search for them using Lidarr's built in functionality
retryNotFound="90" ## :: Number of days between re-attempting the download of previously notfound albums
ignoreInstrumentalRelease="false" # true = enabled :: Skips albums releases that have the word "instrumental" in either the title or disambiguation
# CLIENT
dlClientSource="deezer" # deezer, tidal or both :: set to both, to use both clients, tidal requires extra steps, view logging output
@ -60,6 +61,7 @@ addDeezerTopTrackArtists="false" # true = enabled :: Enabling this will
topLimit="3" # This setting controls the amount of Top Artist (Albums/Tracks/Artists) to add to Lidarr from Deezer
addRelatedArtists="false" # true = enabled :: WARNING !!! WARNING !!! Enabling this can cause an endless loop of additional artists.... Enabling this will enable the extended script to automatically add artists that are related to your existing Lidarr artists from Tidal & Deezer
numberOfRelatedArtistsToAddPerArtist="1" # 1-20 :: This will limit the number of related artists to add per artist in your library :: Minimum is 1, Maximum is 20
autoArtistAdderMonitored="true" # true or false :: If true, artists that are added automatically are monitored, when false they are added in an unmonitored state
##### VIDEO SCRIPT
addFeaturedVideoArtists="false" # true = enabled :: WARNING !!! WARNING !!! Enabling this can cause an endless loop of additional artists.... Enabling this will enable the extended Video script to automatically add Music Video Featured Artists to your existing Lidarr artists from IMVDB

View file

@ -1,5 +1,6 @@
#!/usr/bin/with-contenv bash
SMA_PATH="/usr/local/sma"
version="1.1"
echo "*** install packages ***" && \
apk add -U --upgrade --no-cache \
@ -22,11 +23,11 @@ apk add -U --upgrade --no-cache \
echo "*** install freyr client ***" && \
apk add --no-cache -X http://dl-cdn.alpinelinux.org/alpine/edge/testing atomicparsley && \
npm install -g miraclx/freyr-js &&\
echo "*** install beets ***" && \
apk add --no-cache -X http://dl-cdn.alpinelinux.org/alpine/edge/community beets && \
echo "*** install python packages ***" && \
pip install --upgrade --no-cache-dir \
beets \
yq \
pyxDamerauLevenshtein \
pyacoustid \
requests \
pylast \
@ -46,7 +47,7 @@ touch ${SMA_PATH}/config/sma.log && \
chgrp users ${SMA_PATH}/config/sma.log && \
chmod g+w ${SMA_PATH}/config/sma.log && \
echo "************ install pip dependencies ************" && \
python3 -m pip install --upgrade pip && \
python3 -m pip install --upgrade pip && \
pip3 install -r ${SMA_PATH}/setup/requirements.txt
mkdir -p /custom-services.d

View file

@ -1,5 +1,6 @@
#!/usr/bin/with-contenv bash
RAHASHER_PATH="/usr/local/RALibretro"
SKYSCRAPER_PATH="/usr/local/skysource"
echo "************ install dependencies ************"
echo "************ install and upgrade packages ************"
apt-get update
@ -18,6 +19,22 @@ apt-get install -y \
python3-pip \
rclone \
bsdmainutils
echo "************ skyscraper ************"
echo "************ install dependencies ************"
echo "************ install packages ************"
apt-get update
apt-get install -y \
build-essential \
wget \
qt5-default
apt-get purge --auto-remove -y
apt-get clean
echo "************ install skyscraper ************"
mkdir -p ${SKYSCRAPER_PATH}
cd ${SKYSCRAPER_PATH}
wget https://raw.githubusercontent.com/Gemba/skyscraper/master/update_skyscraper.sh
sed -i 's/sudo //g' update_skyscraper.sh
bash update_skyscraper.sh
echo "************ RAHasher installation ************"
mkdir -p ${RAHASHER_PATH}
wget "https://github.com/RetroAchievements/RALibretro/releases/download/1.4.0/RAHasher-x64-Linux-1.6.0.zip" -O "${RAHASHER_PATH}/rahasher.zip"

View file

@ -1,5 +1,5 @@
#!/usr/bin/with-contenv bash
ScriptVersion="1.5"
ScriptVersion="1.7"
scriptName="Audiobook"
#### Import Settings
@ -15,7 +15,7 @@ if [ -z $allowM4b ]; then
fi
if [ -z $allowMp3 ]; then
allowMp3=false
allowMp3=true
fi
set -e
@ -27,57 +27,68 @@ exec &> >(tee -a "/config/scripts/audiobook.txt")
SECONDS=0
log "Processing $1"
log "Searching for audiobook (m4b) files in completed download..."
m4bCount=$(find "$1" -type f -iname "*.m4b" | wc -l)
if [ $m4bCount -gt 0 ]; then
log "$m4bCount M4B files found, removing non m4b files..."
find "$1" -type f -not -iname "*.m4b" -delete
find "$1" -mindepth 2 -type f -exec mv "{}" "$1"/ \;
find "$1" -mindepth 1 -type d -delete
if [ $m4bCount -gt 1 ]; then
log "ERROR: More than 1 M4B file found, performing cleanup..."
find "$1" -type f -iname "m4b" -delete
else
log "None found..."
fi
log "Searching for audiobook (m4b.mp4) files in completed download..."
mp4Count=$(find "$1" -type f -iname "*.m4b.mp4" | wc -l)
if [ $mp4Count -gt 0 ]; then
log "$mp4Count M4B (m4b.mp4) files found, removing non m4b files..."
find "$1" -type f -not -iname "*.m4b.mp4" -delete
find "$1" -mindepth 2 -type f -exec mv "{}" "$1"/ \;
find "$1" -mindepth 1 -type d -delete
log "Renaming m4b.mp4 files to m4b..."
count=0
fileCount=$(find "$1" -type f -iname "*.m4b.mp4"| wc -l)
find "$1" -type f -iname "*.m4b.mp4" -print0 | while IFS= read -r -d '' file; do
count=$(($count+1))
baseFileName="${file%.*}"
fileName="$(basename "$file")"
extension="${fileName##*.}"
log "$count of $fileCount :: Processing $fileName"
if [ -f "$file" ]; then
mv "$file" "$1/${fileName%.*}"
fi
done
log "All files renamed"
else
log "None found..."
fi
log "Searching for audiobook (mp3) files in completed download..."
mp3Count=$(find "$1" -type f -iname "*.mp3" | wc -l)
if [ $mp3Count -gt 0 ]; then
log "$mp3Count MP3 files found, removing non mp3 files..."
find "$1" -type f -not -iname "*.mp3" -delete
find "$1" -mindepth 2 -type f -exec mv "{}" "$1"/ \;
find "$1" -mindepth 1 -type d -delete
if [ $mp3Count -ne 1 ]; then
log "ERROR: More than 1 MP3 file found, performing cleanup..."
find "$1" -type f -iname "*.mp3" -delete
log "Searching for audiobook (m4b) files in completed download..."
if [ $m4bCount -gt 0 ]; then
log "$m4bCount M4B files found, removing non m4b files..."
find "$1" -type f -not -iname "*.m4b" -delete
find "$1" -mindepth 2 -type f -exec mv "{}" "$1"/ \;
find "$1" -mindepth 1 -type d -delete
else
log "None found..."
fi
fi
mp4Count=$(find "$1" -type f -iname "*.m4b.mp4" | wc -l)
if [ $mp4Count -gt 1 ]; then
log "ERROR: More than 1 MP4 file found, performing cleanup..."
find "$1" -type f -iname "*.mp4" -delete
else
log "None found..."
log "Searching for audiobook (m4b.mp4) files in completed download..."
if [ $mp4Count -gt 0 ]; then
log "$mp4Count M4B (m4b.mp4) files found, removing non m4b files..."
find "$1" -type f -not -iname "*.m4b.mp4" -delete
find "$1" -mindepth 2 -type f -exec mv "{}" "$1"/ \;
find "$1" -mindepth 1 -type d -delete
log "Renaming m4b.mp4 files to m4b..."
count=0
fileCount=$(find "$1" -type f -iname "*.m4b.mp4"| wc -l)
find "$1" -type f -iname "*.m4b.mp4" -print0 | while IFS= read -r -d '' file; do
count=$(($count+1))
baseFileName="${file%.*}"
fileName="$(basename "$file")"
extension="${fileName##*.}"
log "$count of $fileCount :: Processing $fileName"
if [ -f "$file" ]; then
mv "$file" "$1/${fileName%.*}"
fi
done
log "All files renamed"
else
log "None found..."
fi
fi
mp3Count=$(find "$1" -type f -iname "*.mp3" | wc -l)
if [ $mp3Count -gt 1 ]; then
log "ERROR: More than 1 MP3 file found, performing cleanup..."
find "$1" -type f -iname "*.mp3" -delete
else
log "Searching for audiobook (mp3) files in completed download..."
if [ $mp3Count -gt 0 ]; then
log "$mp3Count MP3 files found, removing non mp3 files..."
find "$1" -type f -not -iname "*.mp3" -delete
find "$1" -mindepth 2 -type f -exec mv "{}" "$1"/ \;
find "$1" -mindepth 1 -type d -delete
else
log "None found..."
fi
fi
error="false"
bookfound="false"
m4bCount=$(find "$1" -type f -iname "*.m4b" | wc -l)

View file

@ -16,7 +16,7 @@ apk add -U --update --no-cache \
ffmpeg \
yt-dlp
echo "************ install python packages ************"
pip install --upgrade --no-cache-dir -U \
pip install --upgrade --no-cache-dir -U --break-system-packages \
excludarr \
yq
echo "************ setup SMA ************"
@ -32,8 +32,8 @@ echo "************ create logging file ************"
mkdir -p /config/extended/sma/config
touch /config/extended/sma/config/sma.log
echo "************ install pip dependencies ************"
pip install --upgrade pip --no-cache-dir
pip install -r /config/extended/sma/setup/requirements.txt --no-cache-dir
pip install --upgrade pip --no-cache-dir --break-system-packages
pip install -r /config/extended/sma/setup/requirements.txt --no-cache-dir --break-system-packages
chmod 777 -R /config/extended/sma
echo "************ install recyclarr ************"
mkdir -p /recyclarr

View file

@ -22,7 +22,7 @@ getArrAppInfo () {
if [ "$arrUrlBase" == "null" ]; then
arrUrlBase=""
else
arrUrlBase="/$(echo "$arrUrlBase" | sed "s/\///g")"
arrUrlBase="/$(echo "$arrUrlBase" | sed "s/\///")"
fi
arrName="$(cat /config/config.xml | xq | jq -r .Config.InstanceName)"
arrApiKey="$(cat /config/config.xml | xq | jq -r .Config.ApiKey)"