Improved fixname, added some dependencies to docs

This commit is contained in:
Anna Rose 2010-03-23 16:31:56 -04:00 committed by Patrick Wiggins
parent fc310df354
commit 1cb4cace9a
2 changed files with 18 additions and 6 deletions

10
INSTALL
View File

@ -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

14
fixname
View File

@ -3,9 +3,9 @@
# File Name Fixer
# usage: fixname <files>
#
# 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 <files>\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