abcde: Relax filename munging for Linux filesystems

In the interest of not messing with colons in filenames (among other
characters), this function has been changed to only remove control
characters and convert '/' to '-'. In the future, this should be updated
to check the current filesystem and use the appropriate munging for it.

Ref: https://stackoverflow.com/a/35352640/540162
master
Jordan Atwood 2 years ago
parent e669f0b713
commit f4d7a41eed
Signed by: nightfirecat
GPG Key ID: 615A619C2D73A6DF
  1. 7
      src/.abcde.conf

@ -29,11 +29,12 @@ VAONETRACKOUTPUTFORMAT='${OUTPUT}/Other, Various Artists/${ARTISTFILE} - ${TRACK
# mungefilename receives the CDDB data (artist, track, title, whatever) as $1 # mungefilename receives the CDDB data (artist, track, title, whatever) as $1
# and outputs it on stdout. # and outputs it on stdout.
# This custom function will do the following: # This custom function will do the following:
# * Eat printable ASCII characters which are forbidden in Windows and Linux # * Eat control characters
# (<>:"/\|?*) and control characters # * Convert '/' to '-' to ensure valid filenames on ext2/ext3/ext4 filesystems
# TODO: add checks for other filesystems (FAT32, NFTS for Windows, HFS, HFS+ for MacOS)
mungefilename () mungefilename ()
{ {
echo "$@" | tr -d "<>:\"/\\\\|?*[:cntrl:]" echo "$@" | tr -d '[:cntrl:]' | tr '/' '-'
} }
# Embed album art in addition to default actions # Embed album art in addition to default actions

Loading…
Cancel
Save