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