From ec99e0ffce1e275949226b7eef87eda85054ec33 Mon Sep 17 00:00:00 2001 From: Vincent Riquer Date: Mon, 10 Feb 2025 01:47:54 +0100 Subject: [PATCH] releasecountry: renamepattern --- lib/files/getDestDir | 8 ++++++++ lib/files/getDestFile | 5 +++++ 2 files changed, 13 insertions(+) diff --git a/lib/files/getDestDir b/lib/files/getDestDir index fd031b0..2bf0073 100644 --- a/lib/files/getDestDir +++ b/lib/files/getDestDir @@ -10,6 +10,10 @@ getDestDir() { [[ ${destinationrenamepath[$destination]} == \ *?([^[])%\{albumartist\}?([^\]])* ]] \ && [ -n "$albumartist" ] + ) || ( + [[ ${destinationrenamepath[$destination]} == \ + *?([^[])%\{releasecountry\}?([^\]])* ]] \ + && [ -n "$releasecountry" ] ) || ( [[ ${destinationrenamepath[$destination]} == \ *?([^[])%\{artist\}?([^\]])* ]] \ @@ -44,6 +48,8 @@ getDestDir() { read -r -u${toascii[0]} album echo "$albumartist" >&${toascii[1]} read -r -u${toascii[0]} albumartist + echo "$releasecountry" >&${toascii[1]} + read -r -u${toascii[0]} releasecountry echo "$artist" >&${toascii[1]} read -r -u${toascii[0]} artist echo "$genre" >&${toascii[1]} @@ -61,6 +67,8 @@ getDestDir() { destdir+="${destinationrenamepath[$destination]//?(\[)%\{album\}?(\])/$replace}" replace=$(sanitizeFile "$albumartist" dir) destdir="${destdir//?(\[)%\{albumartist\}?(\])/$replace}" + replace=$(sanitizeFile "$releasecountry" dir) + destdir="${destdir//?(\[)%\{releasecountry\}?(\])/$releasecountry}" replace=$(sanitizeFile "$artist" dir) destdir="${destdir//?(\[)%\{artist\}?(\])/$replace}" replace=$(sanitizeFile "$genre" dir) diff --git a/lib/files/getDestFile b/lib/files/getDestFile index aae78b8..03f4e53 100644 --- a/lib/files/getDestFile +++ b/lib/files/getDestFile @@ -10,6 +10,10 @@ getDestFile() { [[ ${destinationrename[$destination]} == \ *?([^[])%\{albumartist\}?([^\]])* ]] \ && [ -n "$albumartist" ] + ) || ( + [[ ${destinationrenamepath[$destination]} == \ + *?([^[])%\{releasecountry\}?([^\]])* ]] \ + && [ -n "$releasecountry" ] ) || ( [[ ${destinationrename[$destination]} == \ *?([^[])%\{artist\}?([^\]])* ]] \ @@ -39,6 +43,7 @@ getDestFile() { then destfile="${destinationrename[$destination]//?(\[)%\{album\}?(\])/$album}" destfile="${destfile//?(\[)%\{albumartist\}?(\])/$albumartist}" + destfile="${destfile//?(\[)%\{releasecountry\}?(\])/$releasecountry}" destfile="${destfile//?(\[)%\{artist\}?(\])/$artist}" destfile="${destfile//?(\[)%\{genre\}?(\])/$genre}" destfile="${destfile//?(\[)%\{title\}?(\])/$title}"