don't rename if tags missing

This commit is contained in:
Vincent Riquer 2013-04-30 13:32:47 +02:00
parent 1764b8afea
commit 048693ec8c
2 changed files with 56 additions and 2 deletions

View File

@ -1,7 +1,34 @@
#!/bin/bash
getDestDir() {
destdir="${destinationpath[$destination]}/"
if [ -n "${destinationrenamepath[$destination]}" ]
if [ -n "${destinationrenamepath[$destination]}" ] \
&& (
(
! [[ ${destinationrenamepath[$destination]} =~ %{album} ]] \
|| [ -n "$album" ]
) && (
! [[ ${destinationrenamepath[$destination]} =~ %{albumartist} ]] \
|| [ -n "$albumartist" ]
) && (
! [[ ${destinationrenamepath[$destination]} =~ %{artist} ]] \
|| [ -n "$artist" ]
) && (
! [[ ${destinationrenamepath[$destination]} =~ %{genre} ]] \
|| [ -n "$genre" ]
) && (
! [[ ${destinationrenamepath[$destination]} =~ %{title} ]] \
|| [ -n "$title" ]
) && (
! [[ ${destinationrenamepath[$destination]} =~ %{track} ]] \
|| [ -n "$track" ]
) && (
! [[ ${destinationrenamepath[$destination]} =~ %{year} ]] \
|| [ -n "$year" ]
) && (
! [[ ${destinationrenamepath[$destination]} =~ %{disc} ]] \
|| [ -n "$disc" ]
)
)
then
replace=$(sanitizeFile "$album" dir)
destdir+="${destinationrenamepath[$destination]//%\{album\}/$replace}"

View File

@ -1,6 +1,33 @@
#!/bin/bash
getDestFile() {
if [ -n "${destinationrename[$destination]}" ]
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}"