Last active
December 15, 2016 21:08
-
-
Save RecursiveForest/85f46666812a12241bcbf7f377df6265 to your computer and use it in GitHub Desktop.
fixcue - replace FILE ... WAVE lines in cuefile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
use strict; | |
use Fcntl qw/SEEK_SET/; | |
if ($#ARGV == -1) { | |
print "fixcue CUEFILE TRACK [TRACK ...]\n"; | |
print " replace FILE ... WAVE lines in cuefile\n"; | |
exit 1; | |
} | |
my $cue = shift @ARGV; | |
my $f = open(CUE, $cue) or die "Cannae open $cue: $!"; | |
my $t = 0; | |
while (<CUE>) { | |
$t++ if m/^FILE/; | |
} | |
die "number of tracks in cue does not match passed\n" if ($t != scalar(@ARGV)); | |
seek(CUE, 0, SEEK_SET); | |
while (<CUE>) { | |
if (m/^FILE/) { | |
print "FILE \"" . (shift @ARGV) . "\" WAVE\n"; | |
} else { | |
print; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment