47 lines
1.3 KiB
Bash
47 lines
1.3 KiB
Bash
#!/bin/bash
|
|
getDestFile() {
|
|
if [ -n "${destinationrename[$destination]}" ] \
|
|
&& (
|
|
(
|
|
! [[ ${destinationrename[$destination]} =~ %\{album\} ]] \
|
|
|| [ -n "$album" ]
|
|
) && (
|
|
! [[ ${destinationrename[$destination]} =~ %\{albumartist\} ]] \
|
|
|| [ -n "$albumartist" ]
|
|
) && (
|
|
! [[ ${destinationrename[$destination]} =~ %\{artist\} ]] \
|
|
|| [ -n "$artist" ]
|
|
) && (
|
|
! [[ ${destinationrename[$destination]} =~ %\{genre\} ]] \
|
|
|| [ -n "$genre" ]
|
|
) && (
|
|
! [[ ${destinationrename[$destination]} =~ %\{title\} ]] \
|
|
|| [ -n "$title" ]
|
|
) && (
|
|
! [[ ${destinationrename[$destination]} =~ %\{track\} ]] \
|
|
|| [ -n "$track" ]
|
|
) && (
|
|
! [[ ${destinationrename[$destination]} =~ %\{year\} ]] \
|
|
|| [ -n "$year" ]
|
|
) && (
|
|
! [[ ${destinationrename[$destination]} =~ %\{disc\} ]] \
|
|
|| [ -n "$disc" ]
|
|
)
|
|
)
|
|
then
|
|
destfile="${destinationrename[$destination]//%\{album\}/$album}"
|
|
destfile="${destfile//%\{albumartist\}/$albumartist}"
|
|
destfile="${destfile//%\{artist\}/$artist}"
|
|
destfile="${destfile//%\{genre\}/$genre}"
|
|
destfile="${destfile//%\{title\}/$title}"
|
|
tracknumber="${track%/*}"
|
|
destfile="${destfile//%\{track\}/$tracknumber}"
|
|
destfile="${destfile//%\{year\}/$year}"
|
|
destfile="${destfile//%\{disc\}/$disc}"
|
|
else
|
|
destfile="${filename##*/}"
|
|
destfile="${destfile%.*}"
|
|
fi
|
|
destfile=$(sanitizeFile "$destfile")
|
|
}
|