From f2f63a703ee3ca0b613bf58f1e8de19f8018971b Mon Sep 17 00:00:00 2001 From: Robert Marshall Date: Fri, 28 Apr 2023 10:35:42 +0100 Subject: [PATCH] class CueParser Process composer metadata in cue files Use composer as an alternative to songwriter ..and move a misplaced comment --- src/playlistparsers/cueparser.cpp | 10 +++++++++- src/playlistparsers/cueparser.h | 1 + 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/playlistparsers/cueparser.cpp b/src/playlistparsers/cueparser.cpp index f13b3a59d..cfb6b8351 100644 --- a/src/playlistparsers/cueparser.cpp +++ b/src/playlistparsers/cueparser.cpp @@ -48,6 +48,8 @@ const char *CueParser::kIndexRegExp = "(\\d{1,3}):(\\d{2}):(\\d{2})"; const char *CueParser::kPerformer = "performer"; const char *CueParser::kTitle = "title"; const char *CueParser::kSongWriter = "songwriter"; +// composer may be in cue file and is synonym for songwriter +const char *CueParser::kComposer = "composer"; const char *CueParser::kFile = "file"; const char *CueParser::kTrack = "track"; const char *CueParser::kIndex = "index"; @@ -112,6 +114,9 @@ SongList CueParser::Load(QIODevice *device, const QString &playlist_path, const else if (line_name.compare(kSongWriter, Qt::CaseInsensitive) == 0) { album_composer = line_value; } + else if (line_name.compare(kComposer, Qt::CaseInsensitive) == 0) { + album_composer = line_value; + } else if (line_name.compare(kFile, Qt::CaseInsensitive) == 0) { file = QDir::isAbsolutePath(line_value) ? line_value : dir.absoluteFilePath(line_value); if (splitted.size() > 2) { @@ -208,8 +213,11 @@ SongList CueParser::Load(QIODevice *device, const QString &playlist_path, const } else if (line_name.compare(kSongWriter, Qt::CaseInsensitive) == 0) { composer = line_value; - // End of track's for the current file -> parse next one } + else if (line_name.compare(kComposer, Qt::CaseInsensitive) == 0) { + composer = line_value; + } + // End of tracks for the current file -> parse next one else if (line_name.compare(kRem, Qt::CaseInsensitive) == 0 && splitted.size() >= 3) { if (line_value.compare(kGenre, Qt::CaseInsensitive) == 0) { genre = splitted[2]; diff --git a/src/playlistparsers/cueparser.h b/src/playlistparsers/cueparser.h index a78fcb232..325e917c9 100644 --- a/src/playlistparsers/cueparser.h +++ b/src/playlistparsers/cueparser.h @@ -50,6 +50,7 @@ class CueParser : public ParserBase { static const char *kPerformer; static const char *kTitle; static const char *kSongWriter; + static const char *kComposer; static const char *kFile; static const char *kTrack; static const char *kIndex;