From 1cb4cace9a07ddf25435f69630fea282e5b35a26 Mon Sep 17 00:00:00 2001 From: Anna Wiggins Date: Tue, 23 Mar 2010 16:31:56 -0400 Subject: [PATCH] Improved fixname, added some dependencies to docs --- INSTALL | 10 +++++++++- fixname | 14 +++++++++----- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/INSTALL b/INSTALL index 9bdb549..5f7728f 100644 --- a/INSTALL +++ b/INSTALL @@ -9,9 +9,17 @@ export PATH=$PATH:~/bin Install ALL of the scripts, since some of them depend on others. -cdripper requires the CDDB and CDDB_get perl modules. +You will need the following perl modules: + +CDDB (for cdripper) +CDDB_get (for cdripper) +Music::Tag::OGG (for tagfromfilename) +Music::Tag::FLAC (for tagfromfilename) +Music::Tag::MusicBrainz (for tagfromfilename) + You will also need the following programs: + cdparanoia mplayer, mpg321, or mpg123 oggenc diff --git a/fixname b/fixname index 008b86f..0f516be 100755 --- a/fixname +++ b/fixname @@ -3,9 +3,9 @@ # File Name Fixer # usage: fixname # -# Renames files to comply with darkside's arbitrary standard +# Renames files to comply with pwiggi's arbitrary standard # -# This is darkside's standard: +# This is pwiggi's standard: # 1) all letters are lowercase # 2) Whitespace becomes underscore # 3) Never more than one consecutive underscore @@ -13,6 +13,7 @@ # 4) Never more than one consecutive dash # # ChangeLog: +# 0.2.4: More robust stripping of special characters # 0.2: Made everything more robust - better at multiple spaces and special # characters now. Also now renumbering along with ds-audiotools # 0.1.4: Added -o option, which prints to stdout instead of renaming the file @@ -25,7 +26,7 @@ # 0.0.2: Takes command-line arguments instead of parsing entire directory # 0.0.1: basic code in place -$VERSION = "0.2.3"; +$VERSION = "0.2.4"; $HELP_MSG = "# Filename fixer v$VERSION\n\tusage: fixname \n\t fixname -o \"name\"\n"; die $HELP_MSG if ($#ARGV < 0); @@ -45,10 +46,13 @@ foreach (@ARGV) my $oldname = $_; s/(.*)/lc($1)/e; # Lowercase it - s/[^\w\s\.-]//g; # Remove odd characters + s/[()\[\]{}!@#\$%^*,;:\'~]//g; # Remove odd characters that could break bash + + s/[&]/and/g; # & to 'and' s/\s/_/g; # Change whitespace to _ s/_+/_/g; # Squash multiple spaces + s/\.+/\./g; # Squash multiple dots s/^_*//; # Remove leading space s/_*$//; # Remove trailing space s/_*(-|\.)_*/$1/g; # Remove space flanking a - or . @@ -58,7 +62,7 @@ foreach (@ARGV) } -# Copyright (c) 2004 - 2007 John Wiggins +# Copyright (c) 2004 - 2010 John Wiggins # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by