#!/usr/bin/perl # # Replaces ACC header MPA with MPB # files specified on the command line # #Before using this, convert file to aac and fix your id3 tags $mv = '/bin/mv'; #$op = shift || die("Usage: $0 perlexpr [filenames]\n"); $op = 's/M4A/M4B/g'; print "MP3 to AAC Audiobook convertor\n"; print "by Kevin Lee, www.kevin-lee.co.uk\n"; if (!@ARGV) { @ARGV = ; chop(@ARGV); } foreach $file (@ARGV) { if (!-f $file) { print "Skipping non-regular file: $file\n"; next; } # if (-B $file) { # print "Skipping binary file: $file\n"; # next; # } $outfile = "./$file"; $outfile =~ s/m4a/m4b/; open(FILE, $file) || die("Couldn't open $file: $!\n"); undef $/; $_ = ; close(FILE); if (eval $op) { open(OFILE, "> $outfile") || die("Couldn't open $outfile: $!\n"); print OFILE; close(OFILE); # system($mv, '-f', $file, "$file.bak"); stuff the backups # system($mv, '-f', $outfile, $file); print "File Converted: $file -> $outfile \n"; } else { print "No change to file: $file\n"; } } exit(0);