From eeaea4ab8537faf18c0108acf39beb9dd5d9712c Mon Sep 17 00:00:00 2001 From: RandomNinjaAtk Date: Sun, 10 Jul 2022 17:50:02 -0400 Subject: [PATCH] New Lidarr MetadataPostProcess.bash Post Processing Script Only extracts artwork at this time... --- root/scripts/MetadataPostProcess.bash | 38 +++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 root/scripts/MetadataPostProcess.bash diff --git a/root/scripts/MetadataPostProcess.bash b/root/scripts/MetadataPostProcess.bash new file mode 100644 index 0000000..d1a52db --- /dev/null +++ b/root/scripts/MetadataPostProcess.bash @@ -0,0 +1,38 @@ +#!/usr/bin/env bash +version=1.0.001 +if [ -z "$lidarr_artist_path" ]; then + lidarr_artist_path="$1" + notfidedBy=Extended_Script +else + notfidedBy=Lidarr +fi + +exec &>> "/config/logs/MetadataPostProcess.txt" +chmod 777 "/config/logs/MetadataPostProcess.txt" + +log () { + m_time=`date "+%F %T"` + echo $m_time" :: $notfidedBy :: "$1 +} + +if [ "$lidarr_eventtype" == "Test" ]; then + log "Tested Successfully" + exit 0 +fi + +log "Processing :: $lidarr_trackfile_path" +albumFolder=$(dirname "$lidarr_trackfile_path") +if [ -d "$albumFolder" ]; then + if [ -f "$albumFolder/folder.jpg" ]; then + log "Processing :: $albumFolder :: Albunm Artwork Found" + else + ffmpeg -i "$lidarr_trackfile_path" -an -vcodec copy "$albumFolder/folder.jpg" &> /dev/null + if [ -f "$albumFolder/folder.jpg" ]; then + log "Processing :: $albumFolder :: Album Artwork Extracted to: $albumFolder/folder.jpg" + fi + fi +else + log "Processing :: ERROR :: $albumFolder :: folder missing..." +fi + +exit