cueparser: Be more lenient when parsing indexes.

Most specs have mm:ss:ff as the index time format, but cue files have
been found with single digit minutes. e.g. 0:00:00 instead of 00:00:00

Reference: https://www.gnu.org/software/ccd2cue/manual/html_node/CUE-sheet-format.html
This commit is contained in:
Jim Broadus 2021-06-11 19:58:35 -07:00 committed by John Maguire
parent 2bf8f1388b
commit ffdaeba09f
1 changed files with 3 additions and 1 deletions

View File

@ -31,7 +31,8 @@
const char* CueParser::kFileLineRegExp =
"(\\S+)\\s+(?:\"([^\"]+)\"|(\\S+))\\s*(?:\"([^\"]+)\"|(\\S+))?";
const char* CueParser::kIndexRegExp = "(\\d{2,3}):(\\d{2}):(\\d{2})";
// Most cue specs specify mm:ss:ff, but we can be more flexible here.
const char* CueParser::kIndexRegExp = "(\\d{1,3}):(\\d{2}):(\\d{2})";
const char* CueParser::kPerformer = "performer";
const char* CueParser::kTitle = "title";
@ -336,6 +337,7 @@ bool CueParser::UpdateLastSong(const CueEntry& entry, Song* song) const {
qint64 CueParser::IndexToMarker(const QString& index) const {
QRegExp index_regexp(kIndexRegExp);
if (!index_regexp.exactMatch(index)) {
qLog(Warning) << "Could not parse index" << index;
return -1;
}