From 82ece3f7b4050c9431309c64eb2decd32ecc1669 Mon Sep 17 00:00:00 2001 From: RandomNinjaAtk Date: Mon, 15 Aug 2022 17:53:47 +0000 Subject: [PATCH] v1.0.029 - Log completed artists, only retry every 7 days This will speed up script runs by only processing new artists on subsequent runs until a 7 day time limit has passed... --- root/scripts/video.sh | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/root/scripts/video.sh b/root/scripts/video.sh index 209f81d..0fdc63f 100644 --- a/root/scripts/video.sh +++ b/root/scripts/video.sh @@ -1,5 +1,5 @@ #!/usr/bin/env bash -scriptVersion="1.0.028" +scriptVersion="1.0.029" if [ -z "$lidarrUrl" ] || [ -z "$lidarrApiKey" ]; then lidarrUrlBase="$(cat /config/config.xml | xq | jq -r .Config.UrlBase)" @@ -560,12 +560,22 @@ for lidarrArtistId in $(echo $lidarrArtistIds); do lidarrArtistNameSanitized="$(echo "$lidarrArtistFolder" | sed 's% (.*)$%%g')" artistImvdbUrl=$(echo $lidarrArtistData | jq -r '.links[] | select(.name=="imvdb") | .url') artistImvdbSlug=$(basename "$artistImvdbUrl") + downloadedVideoCount=0 if [ "$lidarrArtistName" == "Various Artists" ]; then - log "$processCount of $lidarrArtistIdsCount :: MBZDB :: $lidarrArtistName :: Skipping, not processed by design..." + log "$processCount of $lidarrArtistIdsCount :: $lidarrArtistName :: Skipping, not processed by design..." continue fi + 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 + if [ -f "/config/extended/logs/video/complete/$lidarrArtistFolder" ]; then + downloadedVideoCount=$(find "/music-videos/$lidarrArtistFolder" -type f -iname "*.mkv" | wc -l) + log "$processCount of $lidarrArtistIdsCount :: $lidarrArtistName :: All $downloadedVideoCount Artist Music Videos previously downloaded, skipping..." + continue + fi + fi + CacheMusicbrainzRecords ImvdbCache @@ -770,6 +780,21 @@ for lidarrArtistId in $(echo $lidarrArtistIds); do mv $downloadPath/incomplete/* "/music-videos/$lidarrArtistFolder"/ done + + if [ ! -d /config/extended/logs/video ]; then + mkdir -p /config/extended/logs/video + chmod 777 /config/extended/logs/video + chown abc:abc /config/extended/logs/video + fi + + if [ ! -d /config/extended/logs/video/complete ]; then + mkdir -p /config/extended/logs/video/complete + chmod 777 /config/extended/logs/video/complete + chown abc:abc /config/extended/logs/video/complete + fi + + touch "/config/extended/logs/video/complete/$lidarrArtistFolder" + done #CacheMusicbrainzRecords