|
|
@ -1,5 +1,5 @@
|
|
|
|
#!/usr/bin/env bash
|
|
|
|
#!/usr/bin/env bash
|
|
|
|
scriptVersion="1.0.063"
|
|
|
|
scriptVersion="1.0.064"
|
|
|
|
|
|
|
|
|
|
|
|
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)"
|
|
|
@ -116,18 +116,15 @@ CacheMusicbrainzRecords () {
|
|
|
|
chmod 777 /config/extended/cache/musicbrainz
|
|
|
|
chmod 777 /config/extended/cache/musicbrainz
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
if [ -f "/config/extended/cache/musicbrainz/$lidarrArtistId--$lidarrArtistMusicbrainzId--recordings.json" ]; then
|
|
|
|
|
|
|
|
if ! [[ $(find "/config/extended/cache/musicbrainz" -type f -name "$lidarrArtistId--$lidarrArtistMusicbrainzId--recordings.json" -mtime +7 -print) ]]; then
|
|
|
|
|
|
|
|
log "$processCount of $lidarrArtistIdsCount :: MBZDB :: $lidarrArtistName :: Previously cached, skipping..."
|
|
|
|
|
|
|
|
return
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if [ -f "/config/extended/cache/musicbrainz/$lidarrArtistId--$lidarrArtistMusicbrainzId--recordings.json" ]; then
|
|
|
|
if [ -f "/config/extended/cache/musicbrainz/$lidarrArtistId--$lidarrArtistMusicbrainzId--recordings.json" ]; then
|
|
|
|
musicbrainzArtistDownloadedRecordingsCount=$(cat "/config/extended/cache/musicbrainz/$lidarrArtistId--$lidarrArtistMusicbrainzId--recordings.json" | jq -r .id | wc -l)
|
|
|
|
musicbrainzArtistDownloadedRecordingsCount=$(cat "/config/extended/cache/musicbrainz/$lidarrArtistId--$lidarrArtistMusicbrainzId--recordings.json" | jq -r .id | wc -l)
|
|
|
|
if [ $musicbrainzArtistRecordingsCount -ne $musicbrainzArtistDownloadedRecordingsCount ]; then
|
|
|
|
if [ $musicbrainzArtistRecordingsCount -ne $musicbrainzArtistDownloadedRecordingsCount ]; then
|
|
|
|
log "$processCount of $lidarrArtistIdsCount :: MBZDB :: $lidarrArtistName :: Previously cached, data needs to be updated..."
|
|
|
|
log "$processCount of $lidarrArtistIdsCount :: MBZDB :: $lidarrArtistName :: Previously cached, data needs to be updated..."
|
|
|
|
rm "/config/extended/cache/musicbrainz/$lidarrArtistId--$lidarrArtistMusicbrainzId--recordings.json"
|
|
|
|
rm "/config/extended/cache/musicbrainz/$lidarrArtistId--$lidarrArtistMusicbrainzId--recordings.json"
|
|
|
|
|
|
|
|
if [ -f /config/extended/extended/logs/video/complete/$lidarrArtistMusicbrainzId ]; then
|
|
|
|
|
|
|
|
log "$processCount of $lidarrArtistIdsCount :: MBZDB :: $lidarrArtistName :: Removing Artist completed log file to allow artist re-processing..."
|
|
|
|
|
|
|
|
rm /config/extended/extended/logs/video/complete/$lidarrArtistMusicbrainzId
|
|
|
|
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
@ -265,8 +262,14 @@ ImvdbCache () {
|
|
|
|
if [ "$artistImvdbVideoUrlsCount" == "$cachedArtistImvdbVideoUrlsCount" ]; then
|
|
|
|
if [ "$artistImvdbVideoUrlsCount" == "$cachedArtistImvdbVideoUrlsCount" ]; then
|
|
|
|
log "$processCount of $lidarrArtistIdsCount :: IMVDB :: $lidarrArtistName :: Chache is already up-to-date, skipping..."
|
|
|
|
log "$processCount of $lidarrArtistIdsCount :: IMVDB :: $lidarrArtistName :: Chache is already up-to-date, skipping..."
|
|
|
|
return
|
|
|
|
return
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
if [ -f /config/extended/extended/logs/video/complete/$lidarrArtistMusicbrainzId ]; then
|
|
|
|
|
|
|
|
log "$processCount of $lidarrArtistIdsCount :: IMVDB :: $lidarrArtistName :: Removing Artist completed log file to allow artist re-processing..."
|
|
|
|
|
|
|
|
rm /config/extended/extended/logs/video/complete/$lidarrArtistMusicbrainzId
|
|
|
|
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
sleep 0.5
|
|
|
|
sleep 0.5
|
|
|
|
imvdbProcessCount=0
|
|
|
|
imvdbProcessCount=0
|
|
|
|
for imvdbVideoUrl in $(echo "$artistImvdbVideoUrls"); do
|
|
|
|
for imvdbVideoUrl in $(echo "$artistImvdbVideoUrls"); do
|
|
|
@ -614,13 +617,6 @@ for lidarrArtistId in $(echo $lidarrArtistIds); do
|
|
|
|
continue
|
|
|
|
continue
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
if [ -d /config/extended/logs/video/complete ]; then
|
|
|
|
|
|
|
|
if [ -f "/config/extended/logs/video/complete/$lidarrArtistMusicbrainzId" ]; then
|
|
|
|
|
|
|
|
log "$processCount of $lidarrArtistIdsCount :: $lidarrArtistName :: Music Videos previously downloaded, skipping..."
|
|
|
|
|
|
|
|
continue
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
lidarrArtistPath="$(echo "${lidarrArtistData}" | jq -r " .path")"
|
|
|
|
lidarrArtistPath="$(echo "${lidarrArtistData}" | jq -r " .path")"
|
|
|
|
lidarrArtistFolder="$(basename "${lidarrArtistPath}")"
|
|
|
|
lidarrArtistFolder="$(basename "${lidarrArtistPath}")"
|
|
|
|
lidarrArtistFolderNoDisambig="$(echo "$lidarrArtistFolder" | sed "s/ (.*)$//g" | sed "s/\.$//g")" # Plex Sanitization, remove disambiguation
|
|
|
|
lidarrArtistFolderNoDisambig="$(echo "$lidarrArtistFolder" | sed "s/ (.*)$//g" | sed "s/\.$//g")" # Plex Sanitization, remove disambiguation
|
|
|
@ -645,6 +641,13 @@ for lidarrArtistId in $(echo $lidarrArtistIds); do
|
|
|
|
CacheMusicbrainzRecords
|
|
|
|
CacheMusicbrainzRecords
|
|
|
|
ImvdbCache
|
|
|
|
ImvdbCache
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if [ -d /config/extended/logs/video/complete ]; then
|
|
|
|
|
|
|
|
if [ -f "/config/extended/logs/video/complete/$lidarrArtistMusicbrainzId" ]; then
|
|
|
|
|
|
|
|
log "$processCount of $lidarrArtistIdsCount :: $lidarrArtistName :: Music Videos previously downloaded, skipping..."
|
|
|
|
|
|
|
|
continue
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
log "$processCount of $lidarrArtistIdsCount :: MBZDB :: $lidarrArtistName :: Checking records for videos..."
|
|
|
|
log "$processCount of $lidarrArtistIdsCount :: MBZDB :: $lidarrArtistName :: Checking records for videos..."
|
|
|
|
musicbrainzArtistVideoRecordings=$(cat "/config/extended/cache/musicbrainz/$lidarrArtistId--$lidarrArtistMusicbrainzId--recordings.json" | jq -r "select(.video==true)")
|
|
|
|
musicbrainzArtistVideoRecordings=$(cat "/config/extended/cache/musicbrainz/$lidarrArtistId--$lidarrArtistMusicbrainzId--recordings.json" | jq -r "select(.video==true)")
|
|
|
|
musicbrainzArtistVideoRecordingsCount=$(echo "$musicbrainzArtistVideoRecordings" | jq -r .id | wc -l)
|
|
|
|
musicbrainzArtistVideoRecordingsCount=$(echo "$musicbrainzArtistVideoRecordings" | jq -r .id | wc -l)
|
|
|
|