X-Git-Url: https://git.hcoop.net/clinton/abcde.git/blobdiff_plain/9f659adac68c1a038d7c112806aba0d56bccc741..7acef70b718082c76c122caae92aadb4bbb55ef1:/abcde diff --git a/abcde b/abcde index 48490bc..e233a6e 100755 --- a/abcde +++ b/abcde @@ -661,7 +661,7 @@ do_move () ALBUMFILE=$(mungefilename "$DALBUM") ARTISTFILE=$(mungefilename "$TRACKARTIST") TRACKFILE=$(mungefilename "$TRACKNAME") - GENRE=$(echo $CDGENRE | tr "[:upper:]" "[:lower:]") + GENRE=$(mungegenre "$GENRE") YEAR=$(echo $CDYEAR) # If we want to start the tracks with a given number, we need to modify the # TRACKNUM value before evaluation @@ -701,7 +701,7 @@ do_playlist () for LASTTRACK in $TRACKQUEUE; do :; done ALBUMFILE=$(mungefilename "$DALBUM") ARTISTFILE=$(mungefilename "$DARTIST") - GENRE=$(echo $CDGENRE | tr "[:upper:]" "[:lower:]") + GENRE=$(mungegenre "$GENRE") if [ "$VARIOUSARTISTS" = "y" ] ; then PLAYLISTFILE=$(eval echo $VAPLAYLISTFORMAT) else @@ -725,7 +725,11 @@ do_playlist () echo e >&2 ERASEPLAYLIST=e fi - [ "$ERASEPLAYLIST" = "e" -o "$ERASEPLAYLIST" = "E" ] && rm -f "$OUTPUTDIR/$PLAYLISTFILE" + # Once we erase the playlist, we use append to create the new one. + [ "$ERASEPLAYLIST" = "e" -o "$ERASEPLAYLIST" = "E" ] && rm -f "$OUTPUTDIR/$PLAYLISTFILE" && ERASEPLAYLIST=a + else + # The playlist does not exist, so we can safelly use append to create the new list + ERASEPLAYLIST=a fi if [ "$ERASEPLAYLIST" = "a" -o "$ERASEPLAYLIST" = "A" ]; then touch "$OUTPUTDIR/$PLAYLISTFILE" @@ -1760,7 +1764,13 @@ ACTIONS=cddb,read,encode,tag,move,clean # Custom filename munging: mungefilename () { - echo "$@" | sed s,:,\ -,g | sed 's,*,-,g' | tr \ / __ | tr -d \'\"\?\[:cntrl:\] + echo "$@" | sed s,:,\ -,g | tr \ /\* __+ | tr -d \'\"\?\[:cntrl:\] +} + +# Custom genre munging: +mungegenre () +{ + echo $CDGENRE | tr "[:upper:]" "[:lower:]" } # pre_read