diff --git a/src/playlist/cue/CueParser.cxx b/src/playlist/cue/CueParser.cxx index acdd55483..c61fb09d0 100644 --- a/src/playlist/cue/CueParser.cxx +++ b/src/playlist/cue/CueParser.cxx @@ -229,6 +229,8 @@ CueParser::Feed2(char *p) noexcept } state = TRACK; + ignore_index = false; + current.reset(new DetachedSong(filename)); assert(!current->GetTag().IsDefined()); @@ -238,6 +240,9 @@ CueParser::Feed2(char *p) noexcept } else if (state == IGNORE_TRACK) { return; } else if (state == TRACK && strcmp(command, "INDEX") == 0) { + if (ignore_index) + return; + const char *nr = cue_next_token(&p); if (nr == nullptr) return; @@ -255,7 +260,7 @@ CueParser::Feed2(char *p) noexcept current->SetStartTime(SongTime::FromMS(position_ms)); if(strcmp(nr, "00") != 0 || previous == nullptr) - state = IGNORE_TRACK; + ignore_index = true; } } diff --git a/src/playlist/cue/CueParser.hxx b/src/playlist/cue/CueParser.hxx index 6c84ddd4f..fd368c605 100644 --- a/src/playlist/cue/CueParser.hxx +++ b/src/playlist/cue/CueParser.hxx @@ -87,6 +87,13 @@ class CueParser { */ std::unique_ptr 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 * remaining (partial) results will be delivered by Get().