playlist/cue/Parser: parse tags after "INDEX 01"

Instead of setting state=IGNORE_TRACK, ignore only the following
"INDEX" lines.

Correction for commit 8461d71b52.  Closes #227
This commit is contained in:
Max Kellermann 2018-02-24 21:29:16 +01:00
parent 53f5d4c710
commit ebed7e2147
2 changed files with 13 additions and 1 deletions

View File

@ -229,6 +229,8 @@ CueParser::Feed2(char *p) noexcept
} }
state = TRACK; state = TRACK;
ignore_index = false;
current.reset(new DetachedSong(filename)); current.reset(new DetachedSong(filename));
assert(!current->GetTag().IsDefined()); assert(!current->GetTag().IsDefined());
@ -238,6 +240,9 @@ CueParser::Feed2(char *p) noexcept
} else if (state == IGNORE_TRACK) { } else if (state == IGNORE_TRACK) {
return; return;
} else if (state == TRACK && strcmp(command, "INDEX") == 0) { } else if (state == TRACK && strcmp(command, "INDEX") == 0) {
if (ignore_index)
return;
const char *nr = cue_next_token(&p); const char *nr = cue_next_token(&p);
if (nr == nullptr) if (nr == nullptr)
return; return;
@ -255,7 +260,7 @@ CueParser::Feed2(char *p) noexcept
current->SetStartTime(SongTime::FromMS(position_ms)); current->SetStartTime(SongTime::FromMS(position_ms));
if(strcmp(nr, "00") != 0 || previous == nullptr) if(strcmp(nr, "00") != 0 || previous == nullptr)
state = IGNORE_TRACK; ignore_index = true;
} }
} }

View File

@ -87,6 +87,13 @@ class CueParser {
*/ */
std::unique_ptr<DetachedSong> finished; std::unique_ptr<DetachedSong> finished;
/**
* Ignore "INDEX" lines? Only up the first one after "00" is
* used. If there is a pregap (INDEX 00..01), it is assigned
* to the previous song.
*/
bool ignore_index;
/** /**
* Tracks whether Finish() has been called. If true, then all * Tracks whether Finish() has been called. If true, then all
* remaining (partial) results will be delivered by Get(). * remaining (partial) results will be delivered by Get().