@ -14,77 +14,50 @@ mkdir -p /config/xdg
DArtistAlbumList ( ) {
DArtistAlbumList ( ) {
touch -d "168 hours ago" /config/extended/cache/cache-info-check
if [ -f /config/cache/artists/$artistid /checked ] ; then
if find /config/cache/artists/$artistid -type f -iname "checked" -not -newer "/config/cache/cache-info-check" | read; then
rm /config/cache/artists/$artistid /checked
if [ -f /config/cache/artists/$artistid /albumlist.json ] ; then
rm /config/cache/artists/$artistid /albumlist.json
fi
if [ -f /config/cache/artists/$artistid /albumlistlower.json ] ; then
rm /config/cache/artists/$artistid /albumlistlower.json
fi
else
log " $logheader :: Cached info good "
fi
fi
rm /config/cache/cache-info-check
if [ ! -f /config/cache/artists/$artistid /checked ] ; then
albumcount = " $( python3 /config/extended/scripts/discography.py " $1 " | sort -u | wc -l) "
albumcount = " $( python3 /scripts/artist_discograpy.py " $artistid " | sort -u | wc -l) "
if [ -d /config/cache/artists/$artistid /albums ] ; then
log " :: $processNumber of $wantedListAlbumTotal :: $lidarrArtistNameSanitized :: $lidarrAlbumTitle :: Searching for All Albums.... "
cachecount = $( ls /config/cache/artists/$artistid /albums/* | wc -l)
log " :: $processNumber of $wantedListAlbumTotal :: $lidarrArtistNameSanitized :: $lidarrAlbumTitle :: $albumcount Albums found! "
else
albumids = ( $( python3 /config/extended/scripts/discography.py " $1 " | sort -u) )
cachecount = 0
fi
if [ $albumcount != $cachecount ] ; then
log " $logheader :: Searching for All Albums.... "
log " $logheader :: $albumcount Albums found! "
albumids = ( $( python3 /scripts/artist_discograpy.py " $artistid " | sort -u) )
if [ ! -d "/config/temp" ] ; then
mkdir "/config/temp"
fi
for id in ${ !albumids[@] } ; do
for id in ${ !albumids[@] } ; do
currentprocess = $(( $id + 1 ))
currentprocess = $(( $id + 1 ))
albumid = " ${ albumids [ $id ] } "
albumid = " ${ albumids [ $id ] } "
if [ ! -d /config/cache/artists/$artistid /albums ] ; then
if [ ! -d /config/extended/cache/deezer/ ] ; then
mkdir -p /config/cache/artists/$artistid /albums
mkdir -p /config/extended/cache/deezer
chmod $FolderPermissions /config/cache/artists/$artistid
chmod 777 /config/extended/cache/deezer
chmod $FolderPermissions /config/cache/artists/$artistid /albums
chown -R abc:abc /config/extended/cache/deezer
chown -R abc:abc /config/cache/artists/$artistid
fi
fi
if [ -f /config/cache/artists/$artistid /albums/${ albumid } -reg.json ] ; then
if [ ! -f /config/extended/cache/deezer/${ albumid } .json ] ; then
rm /config/cache/artists/$artistid /albums/${ albumid } .json
if wget " https://api.deezer.com/album/ ${ albumid } " -O " /config/extended/cache/deezer/ ${ albumid } .json " -q; then
fi
log " :: $processNumber of $wantedListAlbumTotal :: $lidarrArtistNameSanitized :: $lidarrAlbumTitle :: $currentprocess of $albumcount :: Downloading Album info... "
if [ ! -f /config/cache/artists/$artistid /albums/${ albumid } -reg.json ] ; then
chmod 666 /config/extended/cache/deezer/${ albumid } .json
if wget " https://api.deezer.com/album/ ${ albumid } " -O " /config/temp/ ${ albumid } .json " -q; then
chown abc:abc /config/extended/cache/deezer/${ albumid } .json
log " $logheader :: $currentprocess of $albumcount :: Downloading Album info... "
mv /config/temp/${ albumid } .json /config/cache/artists/$artistid /albums/${ albumid } -reg.json
chmod $FilePermissions /config/cache/artists/$artistid /albums/${ albumid } -reg.json
albumdata = $( cat /config/cache/artists/$artistid /albums/${ albumid } -reg.json)
converttofilelower = ${ albumdata ,, }
echo " $converttofilelower " > /config/cache/artists/$artistid /albums/${ albumid } -lower.json
chmod $FilePermissions /config/cache/artists/$artistid /albums/${ albumid } -lower.json
else
else
log " $logheader :: $currentprocess of $albumcount :: Error getting album information "
log " :: $processNumber of $wantedListAlbumTotal :: $lidarrArtistNameSanitized :: $lidarrAlbumTitle :: $currentprocess of $albumcount :: Error getting album information "
fi
fi
else
else
log " $logheader :: $currentprocess of $albumcount :: Album info already downloaded "
log " :: $processNumber of $wantedListAlbumTotal :: $lidarrArtistNameSanitized :: $lidarrAlbumTitle :: $currentprocess of $albumcount :: Album info already downloaded "
fi
fi
done
done
touch /config/cache/artists/$artistid /checked
if [ -f /config/extended/cache/deezer/$1 -albums.json ] ; then
chmod $FilePermissions /config/cache/artists/$artistid /checked
rm /config/extended/cache/deezer/$1 -albums.json
chown -R abc:abc /config/cache/artists/$artistid
if [ -d "/config/temp" ] ; then
rm -rf "/config/temp"
fi
else
touch /config/cache/artists/$artistid /checked
chmod $FilePermissions /config/cache/artists/$artistid /checked
chown -R abc:abc /config/cache/artists/$artistid
fi
fi
if [ -f /config/extended/cache/deezer/$1 -albums-temp.json ] ; then
rm /config/extended/cache/deezer/$1 -albums-temp.json
fi
fi
echo "[" >> /config/extended/cache/deezer/$1 -albums-temp.json
for id in ${ !albumids[@] } ; do
albumid = " ${ albumids [ $id ] } "
cat " /config/extended/cache/deezer/ ${ albumid } .json " | jq -r | sed 's/^/ /' | sed '$s/}/},/g' >> /config/extended/cache/deezer/$1 -albums-temp.json
done
cat /config/extended/cache/deezer/$1 -albums-temp.json | sed '$ d' >> /config/extended/cache/deezer/$1 -albums.json
echo " }" >> /config/extended/cache/deezer/$1 -albums.json
echo "]" >> /config/extended/cache/deezer/$1 -albums.json
rm /config/extended/cache/deezer/$1 -albums-temp.json
}
}
TidalClientSetup ( ) {
TidalClientSetup ( ) {
@ -330,9 +303,7 @@ SearchProcess () {
if [ ! -d /config/extended/cache/deezer ] ; then
if [ ! -d /config/extended/cache/deezer ] ; then
mkdir -p /config/extended/cache/deezer
mkdir -p /config/extended/cache/deezer
fi
fi
if [ ! -f /config/extended/cache/deezer/$deezeArtistId -albums.json ] ; then
DArtistAlbumList " $deezeArtistId "
curl -s " https://api.deezer.com/artist/ $deezeArtistId /albums?limit=1000 " > /config/extended/cache/deezer/$deezeArtistId -albums.json
fi
done
done
fi
fi
@ -366,7 +337,7 @@ SearchProcess () {
if [ " $skipDeezer " = "false" ] ; then
if [ " $skipDeezer " = "false" ] ; then
for dId in ${ !deezeArtistIds[@] } ; do
for dId in ${ !deezeArtistIds[@] } ; do
deezeArtistId = " ${ deezeArtistIds [ $dId ] } "
deezeArtistId = " ${ deezeArtistIds [ $dId ] } "
deezerArtistAlbumsData = $( cat " /config/extended/cache/deezer/ $deezeArtistId -albums.json " | jq -r " .data | sort_by(.release_date) | sort_by(.explicit_lyrics) | reverse | .[]")
deezerArtistAlbumsData = $( cat " /config/extended/cache/deezer/ $deezeArtistId -albums.json " | jq -r " sort_by(.release_date) | sort_by(.explicit_lyrics) | reverse | .[]")
deezerArtistAlbumsIds = ( $( echo " ${ deezerArtistAlbumsData } " | jq -r "select(.explicit_lyrics==" true") | .id" ) )
deezerArtistAlbumsIds = ( $( echo " ${ deezerArtistAlbumsData } " | jq -r "select(.explicit_lyrics==" true") | .id" ) )
done
done
fi
fi
@ -381,7 +352,7 @@ SearchProcess () {
if [ " $skipDeezer " = "false" ] ; then
if [ " $skipDeezer " = "false" ] ; then
for dId in ${ !deezeArtistIds[@] } ; do
for dId in ${ !deezeArtistIds[@] } ; do
deezeArtistId = " ${ deezeArtistIds [ $dId ] } "
deezeArtistId = " ${ deezeArtistIds [ $dId ] } "
deezerArtistAlbumsData = $( cat " /config/extended/cache/deezer/ $deezeArtistId -albums.json " | jq -r " .data | sort_by(.release_date) | sort_by(.explicit_lyrics) | reverse | .[]")
deezerArtistAlbumsData = $( cat " /config/extended/cache/deezer/ $deezeArtistId -albums.json " | jq -r " sort_by(.release_date) | sort_by(.explicit_lyrics) | reverse | .[]")
deezerArtistAlbumsIds = ( $( echo " ${ deezerArtistAlbumsData } " | jq -r "select(.explicit_lyrics==" true") | .id" ) )
deezerArtistAlbumsIds = ( $( echo " ${ deezerArtistAlbumsData } " | jq -r "select(.explicit_lyrics==" true") | .id" ) )
if echo " ${ deezerArtistAlbumsData } " | jq -r .title | grep -i " ^ $lidarrAlbumTitle " | read; then
if echo " ${ deezerArtistAlbumsData } " | jq -r .title | grep -i " ^ $lidarrAlbumTitle " | read; then
@ -455,7 +426,7 @@ SearchProcess () {
if [ " $skipDeezer " = "false" ] ; then
if [ " $skipDeezer " = "false" ] ; then
for dId in ${ !deezeArtistIds[@] } ; do
for dId in ${ !deezeArtistIds[@] } ; do
deezeArtistId = " ${ deezeArtistIds [ $dId ] } "
deezeArtistId = " ${ deezeArtistIds [ $dId ] } "
deezerArtistAlbumsData = $( cat " /config/extended/cache/deezer/ $deezeArtistId -albums.json " | jq -r " .data | sort_by(.release_date) | sort_by(.explicit_lyrics) | reverse | .[]")
deezerArtistAlbumsData = $( cat " /config/extended/cache/deezer/ $deezeArtistId -albums.json " | jq -r " sort_by(.release_date) | sort_by(.explicit_lyrics) | reverse | .[]")
deezerArtistAlbumsIds = ( $( echo " ${ deezerArtistAlbumsData } " | jq -r "select(.explicit_lyrics==" false") | .id" ) )
deezerArtistAlbumsIds = ( $( echo " ${ deezerArtistAlbumsData } " | jq -r "select(.explicit_lyrics==" false") | .id" ) )
if echo " ${ deezerArtistAlbumsData } " | jq -r .title | grep -i " ^ $lidarrAlbumTitle " | read; then
if echo " ${ deezerArtistAlbumsData } " | jq -r .title | grep -i " ^ $lidarrAlbumTitle " | read; then