From 8de3625ec53c0cec8d476e762a5374b1974dafa9 Mon Sep 17 00:00:00 2001 From: RandomNinjaAtk Date: Sat, 30 Jul 2022 21:55:52 -0400 Subject: [PATCH] v1.0.010 - Prevent Duplicate Videos that appear on multiple artists, reduce logging output Only show download errors, first listed artist for a video must have the same musicbrainz artist id as the current lidarr artist to be accepted for download. Previously videos with multiple artists would be downloaded under each individual artist resulting in dupes for apps like kodi/jellyfin/emby. This change will prevent it. --- root/scripts/video.sh | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/root/scripts/video.sh b/root/scripts/video.sh index 9a87c0c..64a10df 100644 --- a/root/scripts/video.sh +++ b/root/scripts/video.sh @@ -1,5 +1,5 @@ #!/usr/bin/env bash -scriptVersion="1.0.009" +scriptVersion="1.0.010" if [ -z "$lidarrUrl" ] || [ -z "$lidarrApiKey" ]; then lidarrUrlBase="$(cat /config/config.xml | xq | jq -r .Config.UrlBase)" @@ -167,6 +167,7 @@ CacheMusicbrainzRecords () { musibrainzVideoTitleClean="$(echo "$musibrainzVideoTitle" | sed -e "s%[^[:alpha:][:digit:]]% %g" -e "s/ */ /g" | sed 's/^[.]*//' | sed 's/[.]*$//g' | sed 's/^ *//g' | sed 's/ *$//g')" musibrainzVideoArtistCredits="$(echo "$musibrainzVideoRecordingData" | jq -r ".\"artist-credit\"[]")" musibrainzVideoArtistCreditsNames="$(echo "$musibrainzVideoArtistCredits" | jq -r ".artist.name")" + musibrainzVideoArtistCreditId="$(echo "$musibrainzVideoArtistCredits" | jq -r ".artist.id" | head -n1)" musibrainzVideoDisambiguation="" musibrainzVideoDisambiguation="$(echo "$musibrainzVideoRecordingData" | jq -r .disambiguation)" if [ ! -z "$musibrainzVideoDisambiguation" ]; then @@ -210,6 +211,11 @@ CacheMusicbrainzRecords () { continue fi + if [ "$musibrainzVideoArtistCreditId" != "$lidarrArtistMusicbrainzId" ]; then + log "$processCount of $lidarrArtistIdsCount :: MBZDB CACHE :: $lidarrArtistName :: ${musibrainzVideoTitle}${musibrainzVideoDisambiguation} :: First artist does not match album arist, skipping..." + continue + fi + if [ -d "$downloadPath/incomplete" ]; then rm -rf "$downloadPath/incomplete" fi @@ -233,7 +239,7 @@ CacheMusicbrainzRecords () { videoImageId="$(echo "$videoData" | jq -r ".imageId")" videoImageIdFix="$(echo "$videoImageId" | sed "s/-/\//g")" videoThumbnail="https://resources.tidal.com/images/$videoImageIdFix/750x500.jpg" - tidal-dl -o "$downloadPath/incomplete" -l "$videoDownloadUrl" + tidal-dl -o "$downloadPath/incomplete" -l "$videoDownloadUrl" 1>/dev/null curl -s "$videoThumbnail" -o "$downloadPath/incomplete/${musibrainzVideoTitleClean}${plexVideoType}.jpg" fi @@ -242,7 +248,7 @@ CacheMusicbrainzRecords () { videoThumbnail="$(echo "$videoData" | jq -r .thumbnail)" videoUploadDate="$(echo "$videoData" | jq -r .upload_date)" videoYear="${videoUploadDate:0:4}" - yt-dlp -o "$downloadPath/incomplete/${musibrainzVideoTitleClean}${plexVideoType}" --embed-subs --sub-lang $youtubeSubtitleLanguage --merge-output-format mkv --remux-video mkv --no-mtime --geo-bypass "$videoDownloadUrl" + yt-dlp -o "$downloadPath/incomplete/${musibrainzVideoTitleClean}${plexVideoType}" --embed-subs --sub-lang $youtubeSubtitleLanguage --merge-output-format mkv --remux-video mkv --no-mtime --geo-bypass "$videoDownloadUrl" 1>/dev/null curl -s "$videoThumbnail" -o "$downloadPath/incomplete/${musibrainzVideoTitleClean}${plexVideoType}.jpg" fi @@ -424,7 +430,7 @@ TidalClientSetup () { TidalClientTest () { log "TIDAL :: tidal-dl client setup verification..." TidaldlStatusCheck - tidal-dl -o $downloadPath/incomplete -l "166356219" + tidal-dl -o $downloadPath/incomplete -l "166356219" 1>/dev/null downloadCount=$(find $downloadPath/incomplete/ -type f -regex ".*/.*\.\(flac\|opus\|m4a\|mp3\)" | wc -l) if [ $downloadCount -le 0 ]; then