Skip to content

Instantly share code, notes, and snippets.

@RecursiveForest
Last active December 15, 2016 21:08
Show Gist options
  • Save RecursiveForest/85f46666812a12241bcbf7f377df6265 to your computer and use it in GitHub Desktop.
Save RecursiveForest/85f46666812a12241bcbf7f377df6265 to your computer and use it in GitHub Desktop.
fixcue - replace FILE ... WAVE lines in cuefile
#!/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