@ -1,5 +1,5 @@
#!/usr/bin/env bash
#!/usr/bin/env bash
scriptVersion = "1.0.03 4 "
scriptVersion = "1.0.03 5 "
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) "
@ -581,8 +581,11 @@ for lidarrArtistId in $(echo $lidarrArtistIds); do
if [ -d /config/extended/logs/video/complete ] ; then
if [ -d /config/extended/logs/video/complete ] ; then
find /config/extended/logs/video/complete -type f -mtime +7 -delete # Remove Files older than 7 days to allow re-processing artist for new videos
find /config/extended/logs/video/complete -type f -mtime +7 -delete # Remove Files older than 7 days to allow re-processing artist for new videos
if [ -f " /config/extended/logs/video/complete/ $lidarrArtistMusicbrainzId " ] ; then
if [ -f " /config/extended/logs/video/complete/ $lidarrArtistMusicbrainzId " ] ; then
downloadedVideoCount = 0
if [ -d " $videoPath / $lidarrArtistFolder " ] ; then
downloadedVideoCount = $( find " $videoPath / $lidarrArtistFolder " -type f -iname "*.mkv" | wc -l)
downloadedVideoCount = $( find " $videoPath / $lidarrArtistFolder " -type f -iname "*.mkv" | wc -l)
log " $processCount of $lidarrArtistIdsCount :: $lidarrArtistName :: All $downloadedVideoCount Artist Music Videos previously downloaded, skipping... "
fi
log " $processCount of $lidarrArtistIdsCount :: $lidarrArtistName :: $downloadedVideoCount Artist Music Videos previously downloaded, skipping... "
continue
continue
fi
fi
fi
fi
@ -596,11 +599,11 @@ for lidarrArtistId in $(echo $lidarrArtistIds); do
log " $processCount of $lidarrArtistIdsCount :: MBZDB :: $lidarrArtistName :: $musicbrainzArtistVideoRecordingsCount videos found... "
log " $processCount of $lidarrArtistIdsCount :: MBZDB :: $lidarrArtistName :: $musicbrainzArtistVideoRecordingsCount videos found... "
musicbrainzArtistVideoRecordingsDataWithUrl = $( echo " $musicbrainzArtistVideoRecordings " | jq -r "select(.relations[].url)" | jq -s "." | jq -r "unique | .[] | select(.disambiguation | test(\"official\";\"i\"))" )
musicbrainzArtistVideoRecordingsDataWithUrl = $( echo " $musicbrainzArtistVideoRecordings " | jq -r "select(.relations[].url)" | jq -s "." | jq -r "unique | .[] | select(.disambiguation | test(\"official\";\"i\"))" )
musicbrainzArtistVideoRecordingsDataWithUrlIds = $( echo " $musicbrainzArtistVideoRecordingsDataWithUrl " | jq -r ".id" )
musicbrainzArtistVideoRecordingsDataWithUrlIds = $( echo " $musicbrainzArtistVideoRecordingsDataWithUrl " | jq -r ".id" )
musicbrainzArtistVideoRecordingsDataWithUrlIdsCount = $( echo " $musicbrainzArtistVideoRecordingsDataWithUrlIds " | wc -l)
musicbrainzArtistVideoRecordingsDataWithUrlIdsCount = $( echo -n " $musicbrainzArtistVideoRecordingsDataWithUrlIds " | wc -l)
log " $processCount of $lidarrArtistIdsCount :: MBZDB :: $lidarrArtistName :: $musicbrainzArtistVideoRecordingsDataWithUrlIdsCount \"Official\" videos found with URL... "
log " $processCount of $lidarrArtistIdsCount :: MBZDB :: $lidarrArtistName :: $musicbrainzArtistVideoRecordingsDataWithUrlIdsCount \"Official\" videos found with URL... "
if [ $musicbrainzArtistVideoRecordingsDataWithUrlIdsCount = 0 ] ; then
if [ $musicbrainzArtistVideoRecordingsDataWithUrlIdsCount = 0 ] ; then
log " $processCount of $lidarrArtistIdsCount :: MBZDB :: $lidarrArtistName :: ERROR :: No vidoes with URLs to process, skipping..."
log " $processCount of $lidarrArtistIdsCount :: MBZDB :: $lidarrArtistName :: No vidoes with URLs to process, skipping..."
else
else
for musicbrainzVideoId in $( echo " $musicbrainzArtistVideoRecordingsDataWithUrlIds " ) ; do
for musicbrainzVideoId in $( echo " $musicbrainzArtistVideoRecordingsDataWithUrlIds " ) ; do
@ -700,14 +703,14 @@ for lidarrArtistId in $(echo $lidarrArtistIds); do
if [ -z " $artistImvdbSlug " ] ; then
if [ -z " $artistImvdbSlug " ] ; then
log " $processCount of $lidarrArtistIdsCount :: IMVDB :: $lidarrArtistName :: No IMVDB artist link found, skipping... "
log " $processCount of $lidarrArtistIdsCount :: IMVDB :: $lidarrArtistName :: No IMVDB artist link found, skipping... "
continue
fi
else
imvdbArtistVideoCount = $( ls /config/extended/cache/imvdb/$lidarrArtistMusicbrainzId --*.json | wc -l)
imvdbArtistVideoCount = $( ls /config/extended/cache/imvdb/$lidarrArtistMusicbrainzId --*.json | wc -l)
if [ $imvdbArtistVideoCount = 0 ] ; then
if [ $imvdbArtistVideoCount = 0 ] ; then
log " $processCount of $lidarrArtistIdsCount :: IMVDB :: $lidarrArtistName :: No videos found, skipping... "
log " $processCount of $lidarrArtistIdsCount :: IMVDB :: $lidarrArtistName :: No videos found, skipping... "
continue
fi
else
log " $processCount of $lidarrArtistIdsCount :: IMVDB :: $lidarrArtistName :: Processing $imvdbArtistVideoCount Videos! "
log " $processCount of $lidarrArtistIdsCount :: IMVDB :: $lidarrArtistName :: Processing $imvdbArtistVideoCount Videos! "
find /config/extended/cache/imvdb -type f -empty -delete # delete empty files
find /config/extended/cache/imvdb -type f -empty -delete # delete empty files
@ -788,6 +791,10 @@ for lidarrArtistId in $(echo $lidarrArtistIds); do
mv $downloadPath /incomplete/* " $videoPath / $lidarrArtistFolder " /
mv $downloadPath /incomplete/* " $videoPath / $lidarrArtistFolder " /
done
done
fi
fi
if [ ! -d /config/extended/logs/video ] ; then
if [ ! -d /config/extended/logs/video ] ; then
mkdir -p /config/extended/logs/video
mkdir -p /config/extended/logs/video
chmod 777 /config/extended/logs/video
chmod 777 /config/extended/logs/video