From 8575626a34113890e06926f04451a01fee43a5bf Mon Sep 17 00:00:00 2001 From: RandomNinjaAtk Date: Wed, 9 Nov 2022 10:41:24 -0500 Subject: [PATCH] Create SMA.bash --- root/scripts/SMA.bash | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 root/scripts/SMA.bash diff --git a/root/scripts/SMA.bash b/root/scripts/SMA.bash new file mode 100644 index 0000000..2340ab6 --- /dev/null +++ b/root/scripts/SMA.bash @@ -0,0 +1,33 @@ +#!/usr/bin/env bash +scriptVersion="1.0.0" +arrEventType="$radarr_eventtype" + +# auto-clean up log file to reduce space usage +if [ -f "/config/logs/SMA.txt" ]; then + find /config/logs -type f -name "SMA.txt" -size +1024k -delete +fi + +touch "/config/logs/SMA.txt" +chmod 666 "/config/logs/SMA.txt" +exec &> >(tee -a "/config/logs/SMA.txt") + +log () { + m_time=`date "+%F %T"` + echo $m_time" :: SMA :: $scriptVersion :: "$1 +} + +if [ "$arrEventType" == "Test" ]; then + log "Tested Successfully" + exit +fi + +log "Processing :: $radarr_moviefile_path" +if python3 /usr/local/sma/manual.py --config "/config/extended/configs/sma.ini" -i "$radarr_moviefile_path" -tmdb $radarr_movie_tmdbid -a; then + sleep 0.01 + log "COMPLETE!" + rm /usr/local/sma/config/*log* +else + log "ERROR :: SMA Processing Error" +fi + +exit