mirror of
https://github.com/clementine-player/Clementine
synced 2025-01-12 09:54:40 +01:00
Merge pull request #5079 from zluca/master
Makes Clementine read "REM DISCNUMBER" from CUE.
This commit is contained in:
commit
b36b20f5f4
@ -42,6 +42,7 @@ const char* CueParser::kAudioTrackType = "audio";
|
||||
const char* CueParser::kRem = "rem";
|
||||
const char* CueParser::kGenre = "genre";
|
||||
const char* CueParser::kDate = "date";
|
||||
const char* CueParser::kDisc = "discnumber";
|
||||
|
||||
CueParser::CueParser(LibraryBackendInterface* library, QObject* parent)
|
||||
: ParserBase(library, parent) {}
|
||||
@ -70,6 +71,7 @@ SongList CueParser::Load(QIODevice* device, const QString& playlist_path,
|
||||
QString file_type;
|
||||
QString genre;
|
||||
QString date;
|
||||
QString disc;
|
||||
|
||||
// -- FILE section
|
||||
do {
|
||||
@ -118,8 +120,12 @@ SongList CueParser::Load(QIODevice* device, const QString& playlist_path,
|
||||
// REM DATE
|
||||
} else if (line_value.toLower() == kDate) {
|
||||
date = splitted[2];
|
||||
|
||||
// REM DISC
|
||||
} else if (line_value.toLower() == kDisc) {
|
||||
disc = splitted[2];
|
||||
}
|
||||
|
||||
|
||||
// end of the header -> go into the track mode
|
||||
} else if (line_name == kTrack) {
|
||||
files++;
|
||||
@ -169,7 +175,7 @@ SongList CueParser::Load(QIODevice* device, const QString& playlist_path,
|
||||
(track_type.isEmpty() || track_type == kAudioTrackType)) {
|
||||
entries.append(CueEntry(file, index, title, artist, album_artist,
|
||||
album, composer, album_composer, genre,
|
||||
date));
|
||||
date, disc));
|
||||
}
|
||||
|
||||
// clear the state
|
||||
@ -210,7 +216,7 @@ SongList CueParser::Load(QIODevice* device, const QString& playlist_path,
|
||||
if (valid_file && !index.isEmpty() &&
|
||||
(track_type.isEmpty() || track_type == kAudioTrackType)) {
|
||||
entries.append(CueEntry(file, index, title, artist, album_artist, album,
|
||||
composer, album_composer, genre, date));
|
||||
composer, album_composer, genre, date, disc));
|
||||
}
|
||||
}
|
||||
|
||||
@ -291,7 +297,8 @@ bool CueParser::UpdateSong(const CueEntry& entry, const QString& next_index,
|
||||
song->set_composer(entry.PrettyComposer());
|
||||
song->set_genre(entry.genre);
|
||||
song->set_year(entry.date.toInt());
|
||||
|
||||
song->set_disc(entry.disc.toInt());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -316,7 +323,8 @@ bool CueParser::UpdateLastSong(const CueEntry& entry, Song* song) const {
|
||||
song->set_genre(entry.genre);
|
||||
song->set_year(entry.date.toInt());
|
||||
song->set_composer(entry.PrettyComposer());
|
||||
|
||||
song->set_disc(entry.disc.toInt());
|
||||
|
||||
// we don't do anything with the end here because it's already set to
|
||||
// the end of the media file (if it exists)
|
||||
song->set_beginning_nanosec(beginning);
|
||||
|
@ -42,7 +42,8 @@ class CueParser : public ParserBase {
|
||||
static const char* kRem;
|
||||
static const char* kGenre;
|
||||
static const char* kDate;
|
||||
|
||||
static const char* kDisc;
|
||||
|
||||
CueParser(LibraryBackendInterface* library, QObject* parent = nullptr);
|
||||
|
||||
QString name() const { return "CUE"; }
|
||||
@ -73,6 +74,7 @@ class CueParser : public ParserBase {
|
||||
|
||||
QString genre;
|
||||
QString date;
|
||||
QString disc;
|
||||
|
||||
QString PrettyArtist() const {
|
||||
return artist.isEmpty() ? album_artist : artist;
|
||||
@ -83,7 +85,7 @@ class CueParser : public ParserBase {
|
||||
|
||||
CueEntry(QString& file, QString& index, QString& title, QString& artist,
|
||||
QString& album_artist, QString& album, QString& composer,
|
||||
QString& album_composer, QString& genre, QString& date) {
|
||||
QString& album_composer, QString& genre, QString& date, QString& disc) {
|
||||
this->file = file;
|
||||
this->index = index;
|
||||
this->title = title;
|
||||
@ -94,6 +96,7 @@ class CueParser : public ParserBase {
|
||||
this->album_composer = album_composer;
|
||||
this->genre = genre;
|
||||
this->date = date;
|
||||
this->disc = disc;
|
||||
}
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user