Skip to content
This repository has been archived by the owner on Jul 12, 2023. It is now read-only.

Commit

Permalink
1.0.062 - Bug fix - Make last change work... enhanced logging...
Browse files Browse the repository at this point in the history
  • Loading branch information
RandomNinjaAtk authored Dec 6, 2022
1 parent 76417c2 commit 57a7e86
Showing 1 changed file with 23 additions and 16 deletions.
39 changes: 23 additions & 16 deletions root/scripts/Video.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env bash
scriptVersion="1.0.061"
scriptVersion="1.0.062"

if [ -z "$lidarrUrl" ] || [ -z "$lidarrApiKey" ]; then
lidarrUrlBase="$(cat /config/config.xml | xq | jq -r .Config.UrlBase)"
Expand Down Expand Up @@ -625,16 +625,23 @@ for lidarrArtistId in $(echo $lidarrArtistIds); do
lidarrArtistFolder="$(basename "${lidarrArtistPath}")"
lidarrArtistFolderNoDisambig="$(echo "$lidarrArtistFolder" | sed "s/ (.*)$//g" | sed "s/\.$//g")" # Plex Sanitization, remove disambiguation
lidarrArtistNameSanitized="$(echo "$lidarrArtistFolderNoDisambig" | sed 's% (.*)$%%g')"
log "$processCount of $lidarrArtistIdsCount :: $lidarrArtistName :: Checking for IMVDB Slug"
artistImvdbUrl=$(echo $lidarrArtistData | jq -r '.links[] | select(.name=="imvdb") | .url')
artistImvdbSlug=$(basename "$artistImvdbUrl")

if [ -z "$artistImvdbUrl" ]; then
tempmbzartistinfo="$(curl -s -A "$agent" "$musicbrainzMirror/ws/2/artist/$lidarrArtistId?inc=url-rels+genres&fmt=json")"
sleep 1
artistImvdbUrl="$(echo "$tempmbzartistinfo" | jq -r ".relations | .[] | .url | select(.resource | contains(\"imvdb\")) | .resource")"
artistImvdbSlug=$(basename "$artistImvdbUrl")
if [ -z "$artistImvdbSlug" ]; then
log "$processCount of $lidarrArtistIdsCount :: $lidarrArtistName :: IMVDB Slug Not Found..."
log "$processCount of $lidarrArtistIdsCount :: $lidarrArtistName :: Fallback to Musicbrainz for IMVDB Slug"
tempmbzartistinfo="$(curl -s -A "$agent" "$musicbrainzMirror/ws/2/artist/$lidarrArtistMusicbrainzId?inc=url-rels+genres&fmt=json")"
sleep 1
artistImvdbUrl="$(echo "$tempmbzartistinfo" | jq -r ".relations | .[] | .url | select(.resource | contains(\"imvdb\")) | .resource")"
artistImvdbSlug=$(basename "$artistImvdbUrl")
fi

if [ ! -z "$artistImvdbSlug" ]; then
log "$processCount of $lidarrArtistIdsCount :: $lidarrArtistName :: IMVDB Slug :: $artistImvdbSlug"
fi

CacheMusicbrainzRecords
ImvdbCache

Expand Down Expand Up @@ -743,16 +750,16 @@ for lidarrArtistId in $(echo $lidarrArtistIds); do

if [ -z "$artistImvdbSlug" ]; then
log "$processCount of $lidarrArtistIdsCount :: IMVDB :: $lidarrArtistName :: No IMVDB artist link found, skipping..."
# Create log of missing IMVDB url...
if [ ! -d "/config/extended/logs/video/imvdb-link-missing" ]; then
mkdir -p "/config/extended/logs/video/imvdb-link-missing"
chmod 777 "/config/extended/logs/video"
chmod 777 "/config/extended/logs/video/imvdb-link-missing"
fi
if [ -d "/config/extended/logs/video/imvdb-link-missing" ]; then
log "$processCount of $lidarrArtistIdsCount :: IMVDB :: $lidarrArtistName :: Logging missing IMVDB artist in folder: /config/extended/logs/video/imvdb-link-missing"
touch "/config/extended/logs/video/imvdb-link-missing/${lidarrArtistFolderNoDisambig}--mbid-${lidarrArtistMusicbrainzId}"
fi
# Create log of missing IMVDB url...
if [ ! -d "/config/extended/logs/video/imvdb-link-missing" ]; then
mkdir -p "/config/extended/logs/video/imvdb-link-missing"
chmod 777 "/config/extended/logs/video"
chmod 777 "/config/extended/logs/video/imvdb-link-missing"
fi
if [ -d "/config/extended/logs/video/imvdb-link-missing" ]; then
log "$processCount of $lidarrArtistIdsCount :: IMVDB :: $lidarrArtistName :: Logging missing IMVDB artist in folder: /config/extended/logs/video/imvdb-link-missing"
touch "/config/extended/logs/video/imvdb-link-missing/${lidarrArtistFolderNoDisambig}--mbid-${lidarrArtistMusicbrainzId}"
fi
else
# Remove missing IMVDB log file, now that it is found...
if [ -f "/config/extended/logs/video/imvdb-link-missing/${lidarrArtistFolderNoDisambig}--mbid-${lidarrArtistMusicbrainzId}" ]; then
Expand Down

0 comments on commit 57a7e86

Please sign in to comment.