Added -0 passthrough to cdripper

This commit is contained in:
Anna Rose 2009-03-27 18:02:36 -04:00 committed by Patrick Wiggins
parent 0e54174dd7
commit fc310df354

View File

@ -1,7 +1,7 @@
#!/usr/bin/perl #!/usr/bin/perl
# #
# CD Ripper # CD Ripper
# usage: cdripper [-o num] [--no-cddb] [-T] [-a] [-y] [target_directory] # usage: cdripper [-o num] [--no-cddb] [-T] [-0] [-a] [-y] [target_directory]
# #
# Rips the contents of an audio CD into Ogg Vorbis files # Rips the contents of an audio CD into Ogg Vorbis files
# Puts the files in target_directory/artist/album_name/ # Puts the files in target_directory/artist/album_name/
@ -12,6 +12,7 @@
# Changelog: # Changelog:
# 0.2.4: Fixed bug - files should get tagged again # 0.2.4: Fixed bug - files should get tagged again
# Added support for -T option # Added support for -T option
# Added support for -0 option
# 0.2: Aligned version with ds-audiotools # 0.2: Aligned version with ds-audiotools
# Implemented CDDB support (disabled with --no-cddb) # Implemented CDDB support (disabled with --no-cddb)
# Ability to preview and edit all text before it's used # Ability to preview and edit all text before it's used
@ -36,12 +37,13 @@ use CDDB_get qw( get_cddb );
$VERSION = "0.2.4"; $VERSION = "0.2.4";
$HELP_MSG = "# CD Ripper v$VERSION\n\tusage: cdripper [--no-cddb] [-a] " . $HELP_MSG = "# CD Ripper v$VERSION\n\tusage: cdripper [--no-cddb] [-a] " .
"[-y] [-o num] [target_directory]\n\n" . "[-y] [-T] [-0] [-o num] [target_directory]\n\n" .
"Options:\n-a:\t\tAsk users about multiple CDDB options\n" . "Options:\n-a:\t\tAsk users about multiple CDDB options\n" .
"-o [num]:\tOffset track numbers by num. The first track will be num+1\n" . "-o [num]:\tOffset track numbers by num. The first track will be num+1\n" .
"-y:\t\tDon't prompt for user confirmation of CDDB information\n\t\t(assume defaults are okay).\n" . "-y:\t\tDon't prompt for user confirmation of CDDB information\n\t\t(assume defaults are okay).\n" .
"--no-cddb:\tDon't use CDDB. Prompt the user for all information.\n" . "--no-cddb:\tDon't use CDDB. Prompt the user for all information.\n" .
"-T:\t\tWrite uppercase tag names. Passes -T to tagfromfilename\n"; "-T:\t\tWrite uppercase tag names. Passes -T to tagfromfilename\n" .
"-0:\t\tPreserve leading 0 in track numbers\n";
$CDPARANOIA_FORMAT = 'track*.cdda'; $CDPARANOIA_FORMAT = 'track*.cdda';
$TRACK_ZERO = 'track00'; $TRACK_ZERO = 'track00';
@ -53,6 +55,8 @@ $useCDDB = 1;
$noInput = 0; $noInput = 0;
$askCDDB = 0; $askCDDB = 0;
$tagoptions = '';
foreach (@ARGV) foreach (@ARGV)
{ {
if ($offsetOnNext) if ($offsetOnNext)
@ -67,7 +71,8 @@ foreach (@ARGV)
elsif (/^--no-cddb$/) { $useCDDB = 0; } elsif (/^--no-cddb$/) { $useCDDB = 0; }
elsif (/^-f$/) { $noInput = 1; } elsif (/^-f$/) { $noInput = 1; }
elsif (/^-a$/) { $askCDDB = 1; } elsif (/^-a$/) { $askCDDB = 1; }
elsif (/^-T$/) { $uppertags = '-T'; } elsif (/^-T$/) { $tagoptions .= ' -T'; }
elsif (/^-0$/) { $tagoptions .= ' -0'; }
else else
{ {
$target_directory = $_; $target_directory = $_;
@ -104,7 +109,7 @@ chdir($final_location);
warn "Some files were not automatically named." if $unhandledFiles; warn "Some files were not automatically named." if $unhandledFiles;
# Add vorbiscomment data # Add vorbiscomment data
system('tagfromfilename', $uppertags, @new_tracks); system('tagfromfilename', $tagoptions, @new_tracks);
# Clean up # Clean up
chdir($orig_dir); chdir($orig_dir);