From f4d7a41eed4467892e88146acb0ed91574673b21 Mon Sep 17 00:00:00 2001 From: Jordan Atwood Date: Wed, 11 May 2022 20:55:53 -0700 Subject: [PATCH] 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 --- src/.abcde.conf | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/.abcde.conf b/src/.abcde.conf index 8b5d4ae..7f55984 100644 --- a/src/.abcde.conf +++ b/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 # and outputs it on stdout. # This custom function will do the following: -# * Eat printable ASCII characters which are forbidden in Windows and Linux -# (<>:"/\|?*) and control characters +# * Eat 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 () { - echo "$@" | tr -d "<>:\"/\\\\|?*[:cntrl:]" + echo "$@" | tr -d '[:cntrl:]' | tr '/' '-' } # Embed album art in addition to default actions