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
scriptVersion="1.2"
scriptName="ArtworkExtractor"
#### Import Settings

View file

@ -1,6 +1,4 @@
#!/usr/bin/env bash
scriptVersion="3.2"
scriptName="AutoConfig"
### Import Settings
source /config/extended.conf
@ -36,7 +34,7 @@ fi
if [ "$configureCustomScripts" == "true" ] || [ -z "$configureCustomScripts" ]; then
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"
else
log "Adding PlexNotify.bash to Lidarr custom scripts"
@ -46,7 +44,7 @@ if [ "$configureCustomScripts" == "true" ] || [ -z "$configureCustomScripts" ];
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"
else
log "Adding LyricExtractor.bash to Lidarr custom scripts"
@ -56,7 +54,7 @@ if [ "$configureCustomScripts" == "true" ] || [ -z "$configureCustomScripts" ];
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"
else
log "Adding ArtworkExtractor.bash to Lidarr custom scripts"
@ -66,7 +64,7 @@ if [ "$configureCustomScripts" == "true" ] || [ -z "$configureCustomScripts" ];
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"
else
log "Adding BeetsTagger.bash to Lidarr custom scripts"

View file

@ -325,7 +325,7 @@ VideoTagProcess () {
if [[ $filenoext.$videoContainer == *.mkv ]]; then
mv "$filenoext.$videoContainer" "$filenoext-temp.$videoContainer"
log "${processCount}/${lidarrArtistIdsCount} :: $lidarrArtistName :: IMVDB :: ${imvdbProcessCount}/${imvdbArtistVideoCount} :: ${1}${2} $3 :: Tagging file"
ffmpeg -y \
ffmpeg -y -nostdin \
-i "$filenoext-temp.$videoContainer" \
-c copy \
-metadata TITLE="${1}" \
@ -343,7 +343,7 @@ VideoTagProcess () {
else
mv "$filenoext.$videoContainer" "$filenoext-temp.$videoContainer"
log "${processCount}/${lidarrArtistIdsCount} :: $lidarrArtistName :: IMVDB :: ${imvdbProcessCount}/${imvdbArtistVideoCount} :: ${1}${2} $3 :: Tagging file"
ffmpeg -y \
ffmpeg -y -nostdin \
-i "$filenoext-temp.$videoContainer" \
-i "$videoDownloadPath/incomplete/${1}${2}.jpg" \
-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 () {
m_time=`date "+%F %T"`
echo $m_time" :: $scriptName :: $scriptVersion :: "$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
m_time=$(date "+%F %T")
echo "$m_time :: $scriptName :: $1"
}
getArrAppInfo () {
@ -45,7 +32,7 @@ verifyApiAccess () {
arrApiVersion="v1"
arrApiTest="$(curl -s "$arrUrl/api/$arrApiVersion/system/status?apikey=$arrApiKey" | jq -r .instanceName)"
fi
if [ ! -z "$arrApiTest" ]; then
if [ -n "$arrApiTest" ]; then
break
else
log "$arrName is not ready, sleeping until valid response..."