Small refactor

This commit is contained in:
emily 2024-11-26 22:00:50 +01:00
parent 6cb4533f4c
commit 69b82a3497
Signed by: emily
GPG key ID: F6F4C66207FCF995
5 changed files with 9 additions and 28 deletions

View file

@ -1,5 +1,4 @@
#!/usr/bin/env bash #!/usr/bin/env bash
scriptVersion="1.2"
scriptName="ArtworkExtractor" scriptName="ArtworkExtractor"
#### Import Settings #### Import Settings

View file

@ -1,6 +1,4 @@
#!/usr/bin/env bash #!/usr/bin/env bash
scriptVersion="3.2"
scriptName="AutoConfig"
### Import Settings ### Import Settings
source /config/extended.conf source /config/extended.conf
@ -36,7 +34,7 @@ fi
if [ "$configureCustomScripts" == "true" ] || [ -z "$configureCustomScripts" ]; then if [ "$configureCustomScripts" == "true" ] || [ -z "$configureCustomScripts" ]; then
log "Configuring Lidarr Custom Scripts" log "Configuring Lidarr Custom Scripts"
if curl -s "$arrUrl/api/v1/notification" -H "X-Api-Key: ${arrApiKey}" | jq -r .[].name | grep "PlexNotify.bash" | read; then if curl -s "$arrUrl/api/v1/notification" -H "X-Api-Key: ${arrApiKey}" | jq -r .[].name | grep "PlexNotify.bash" | read -r; then
log "PlexNotify.bash Already added to Lidarr custom scripts" log "PlexNotify.bash Already added to Lidarr custom scripts"
else else
log "Adding PlexNotify.bash to Lidarr custom scripts" log "Adding PlexNotify.bash to Lidarr custom scripts"
@ -46,7 +44,7 @@ if [ "$configureCustomScripts" == "true" ] || [ -z "$configureCustomScripts" ];
fi fi
if curl -s "$arrUrl/api/v1/notification" -H "X-Api-Key: ${arrApiKey}" | jq -r .[].name | grep "LyricExtractor.bash" | read; then if curl -s "$arrUrl/api/v1/notification" -H "X-Api-Key: ${arrApiKey}" | jq -r .[].name | grep "LyricExtractor.bash" | read -r; then
log "LyricExtractor.bash Already added to Lidarr custom scripts" log "LyricExtractor.bash Already added to Lidarr custom scripts"
else else
log "Adding LyricExtractor.bash to Lidarr custom scripts" log "Adding LyricExtractor.bash to Lidarr custom scripts"
@ -56,7 +54,7 @@ if [ "$configureCustomScripts" == "true" ] || [ -z "$configureCustomScripts" ];
fi fi
if curl -s "$arrUrl/api/v1/notification" -H "X-Api-Key: ${arrApiKey}" | jq -r .[].name | grep "ArtworkExtractor.bash" | read; then if curl -s "$arrUrl/api/v1/notification" -H "X-Api-Key: ${arrApiKey}" | jq -r .[].name | grep "ArtworkExtractor.bash" | read -r; then
log "ArtworkExtractor.bash Already added to Lidarr custom scripts" log "ArtworkExtractor.bash Already added to Lidarr custom scripts"
else else
log "Adding ArtworkExtractor.bash to Lidarr custom scripts" log "Adding ArtworkExtractor.bash to Lidarr custom scripts"
@ -66,7 +64,7 @@ if [ "$configureCustomScripts" == "true" ] || [ -z "$configureCustomScripts" ];
fi fi
if curl -s "$arrUrl/api/v1/notification" -H "X-Api-Key: ${arrApiKey}" | jq -r .[].name | grep "BeetsTagger.bash" | read; then if curl -s "$arrUrl/api/v1/notification" -H "X-Api-Key: ${arrApiKey}" | jq -r .[].name | grep "BeetsTagger.bash" | read -r; then
log "BeetsTagger.bash Already added to Lidarr custom scripts" log "BeetsTagger.bash Already added to Lidarr custom scripts"
else else
log "Adding BeetsTagger.bash to Lidarr custom scripts" log "Adding BeetsTagger.bash to Lidarr custom scripts"

View file

@ -325,7 +325,7 @@ VideoTagProcess () {
if [[ $filenoext.$videoContainer == *.mkv ]]; then if [[ $filenoext.$videoContainer == *.mkv ]]; then
mv "$filenoext.$videoContainer" "$filenoext-temp.$videoContainer" mv "$filenoext.$videoContainer" "$filenoext-temp.$videoContainer"
log "${processCount}/${lidarrArtistIdsCount} :: $lidarrArtistName :: IMVDB :: ${imvdbProcessCount}/${imvdbArtistVideoCount} :: ${1}${2} $3 :: Tagging file" log "${processCount}/${lidarrArtistIdsCount} :: $lidarrArtistName :: IMVDB :: ${imvdbProcessCount}/${imvdbArtistVideoCount} :: ${1}${2} $3 :: Tagging file"
ffmpeg -y \ ffmpeg -y -nostdin \
-i "$filenoext-temp.$videoContainer" \ -i "$filenoext-temp.$videoContainer" \
-c copy \ -c copy \
-metadata TITLE="${1}" \ -metadata TITLE="${1}" \
@ -343,7 +343,7 @@ VideoTagProcess () {
else else
mv "$filenoext.$videoContainer" "$filenoext-temp.$videoContainer" mv "$filenoext.$videoContainer" "$filenoext-temp.$videoContainer"
log "${processCount}/${lidarrArtistIdsCount} :: $lidarrArtistName :: IMVDB :: ${imvdbProcessCount}/${imvdbArtistVideoCount} :: ${1}${2} $3 :: Tagging file" log "${processCount}/${lidarrArtistIdsCount} :: $lidarrArtistName :: IMVDB :: ${imvdbProcessCount}/${imvdbArtistVideoCount} :: ${1}${2} $3 :: Tagging file"
ffmpeg -y \ ffmpeg -y -nostdin \
-i "$filenoext-temp.$videoContainer" \ -i "$filenoext-temp.$videoContainer" \
-i "$videoDownloadPath/incomplete/${1}${2}.jpg" \ -i "$videoDownloadPath/incomplete/${1}${2}.jpg" \
-map 1 \ -map 1 \

View file

@ -1,3 +0,0 @@
#!/usr/bin/with-contenv bash
curl https://raw.githubusercontent.com/RandomNinjaAtk/arr-scripts/main/lidarr/setup.bash | bash
exit

View file

@ -1,19 +1,6 @@
log () { log () {
m_time=`date "+%F %T"` m_time=$(date "+%F %T")
echo $m_time" :: $scriptName :: $scriptVersion :: "$1 echo "$m_time :: $scriptName :: $1"
echo $m_time" :: $scriptName :: $scriptVersion :: "$1 >> "/config/logs/$logFileName"
}
logfileSetup () {
logFileName="$scriptName-$(date +"%Y_%m_%d_%I_%M_%p").txt"
# delete log files older than 5 days
find "/config/logs" -type f -iname "$scriptName-*.txt" -mtime +5 -delete
if [ ! -f "/config/logs/$logFileName" ]; then
echo "" > "/config/logs/$logFileName"
chmod 666 "/config/logs/$logFileName"
fi
} }
getArrAppInfo () { getArrAppInfo () {
@ -45,7 +32,7 @@ verifyApiAccess () {
arrApiVersion="v1" arrApiVersion="v1"
arrApiTest="$(curl -s "$arrUrl/api/$arrApiVersion/system/status?apikey=$arrApiKey" | jq -r .instanceName)" arrApiTest="$(curl -s "$arrUrl/api/$arrApiVersion/system/status?apikey=$arrApiKey" | jq -r .instanceName)"
fi fi
if [ ! -z "$arrApiTest" ]; then if [ -n "$arrApiTest" ]; then
break break
else else
log "$arrName is not ready, sleeping until valid response..." log "$arrName is not ready, sleeping until valid response..."