Subject: | Indexes aren't properly handled (patch included) |
Date: | Fri, 23 May 2014 23:53:26 -0400 |
To: | bug-audio-cuefile-parser [...] rt.cpan.org |
From: | Aaron Miller <me [...] aaron-miller.me> |
The currently distributed version of Audio::Cuefile::Parser handles only
INDEX 01 for each track, which is fine if the track has no pregap, but
problematic otherwise.
I've patched the module to read all of the index entries, rather than
just INDEX 01 (or, more accurately, the last index for a given track),
and include them in the track struct via a new
Audio::Cuefile::Parser::Index subclass. The patch follows inline:
----- begin Parser.pm.multiple-indexes.patch -----
--- /root/.cpan/build/Audio-Cuefile-Parser/lib/Audio/Cuefile/Parser.pm
2010-03-31 22:07:39.000000000 -0400
+++ Audio-Cuefile-Parser/lib/Audio/Cuefile/Parser.pm 2014-05-23
23:35:08.000000000 -0400
@@ -57,11 +57,16 @@
};
struct 'Audio::Cuefile::Parser::Track' => {
- index => '$',
+ indexes => '@',
performer => '$',
position => '$',
title => '$',
};
+
+ struct 'Audio::Cuefile::Parser::Index' => {
+ number => '$',
+ offset => '$'
+ };
}
{
@@ -197,8 +202,10 @@
and $tracks[-1]->performer($1);
# INDEX 01 06:32:20
- $line =~ /\A INDEX \s+ (?: \d+ \s+) ([\d:]+) \z/xms
- and $tracks[-1]->index($1);
+ $line =~ /\A INDEX \s+ (\d+?) \s+? ([\d:]+) \z/xms
+ and push @{ $tracks[-1]->indexes },
+ Audio::Cuefile::Parser::Index->new(number => $1,
+ offset => $2);
}
# Store them for safe keeping
----- end Parser.pm.multiple-indexes.patch -----
(I've also attached it as a separate file, in case that works when
reporting bugs via CPAN RT.)
Message body is not shown because sender requested not to inline it.