Fix saving of library to XML cache when multiple artist albums are grouped under 'Various Artists' (only save artist attribute once!!)
BUG:47
This commit is contained in:
@@ -16,6 +16,8 @@
|
||||
disconnects from pulse audio, tells cantata that volume is -1, and cantata
|
||||
attempts to set volume to 0.
|
||||
8. When fading on stop, reset original volume immediately before sending stop.
|
||||
9. Fix saving of library to XML cache when multiple artist albums are grouped
|
||||
under 'Various Artists' (only save artist attribute once!!)
|
||||
|
||||
0.8.0
|
||||
-----
|
||||
|
||||
@@ -290,6 +290,7 @@ void MusicLibraryItemRoot::toXML(QXmlStreamWriter &writer, const QDateTime &date
|
||||
}
|
||||
foreach (const MusicLibraryItem *t, album->childItems()) {
|
||||
const MusicLibraryItemSong *track = static_cast<const MusicLibraryItemSong *>(t);
|
||||
bool wroteArtist=false;
|
||||
writer.writeEmptyElement("Track");
|
||||
if (!track->song().title.isEmpty()) {
|
||||
writer.writeAttribute("name", track->song().title);
|
||||
@@ -307,6 +308,7 @@ void MusicLibraryItemRoot::toXML(QXmlStreamWriter &writer, const QDateTime &date
|
||||
}
|
||||
if (!track->song().artist.isEmpty() && track->song().artist!=artist->data()) {
|
||||
writer.writeAttribute("artist", track->song().artist);
|
||||
wroteArtist=true;
|
||||
}
|
||||
if (!track->song().albumartist.isEmpty() && track->song().albumartist!=artist->data()) {
|
||||
writer.writeAttribute("albumartist", track->song().albumartist);
|
||||
@@ -317,7 +319,7 @@ void MusicLibraryItemRoot::toXML(QXmlStreamWriter &writer, const QDateTime &date
|
||||
}
|
||||
if (album->isSingleTracks()) {
|
||||
writer.writeAttribute("album", track->song().album);
|
||||
} else if (album->isMultipleArtists()) {
|
||||
} else if (!wroteArtist && album->isMultipleArtists() && !track->song().artist.isEmpty() && track->song().artist!=artist->data()) {
|
||||
writer.writeAttribute("artist", track->song().artist);
|
||||
}
|
||||
if (Song::Playlist==track->song().type) {
|
||||
@@ -373,14 +375,11 @@ quint32 MusicLibraryItemRoot::fromXML(QXmlStreamReader &reader, const QDateTime
|
||||
if ( version < constVersion || (date.isValid() && xmlDate < date.toTime_t()) || gs!=MPDParseUtils::groupSingle() || gm!=MPDParseUtils::groupMultiple()) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (QLatin1String("Artist")==element) {
|
||||
} else if (QLatin1String("Artist")==element) {
|
||||
song.type=Song::Standard;
|
||||
song.artist=song.albumartist=attributes.value("name").toString();
|
||||
artistItem = createArtist(song);
|
||||
}
|
||||
else if (QLatin1String("Album")==element) {
|
||||
} else if (QLatin1String("Album")==element) {
|
||||
song.album=attributes.value("name").toString();
|
||||
song.year=attributes.value("year").toString().toUInt();
|
||||
song.genre=attributes.value("genre").toString();
|
||||
@@ -397,8 +396,7 @@ quint32 MusicLibraryItemRoot::fromXML(QXmlStreamReader &reader, const QDateTime
|
||||
} else {
|
||||
song.type=Song::Standard;
|
||||
}
|
||||
}
|
||||
else if (QLatin1String("Track")==element) {
|
||||
} else if (QLatin1String("Track")==element) {
|
||||
song.title=attributes.value("name").toString();
|
||||
song.file=attributes.value("file").toString();
|
||||
if (QLatin1String("true")==attributes.value("playlist").toString()) {
|
||||
|
||||
Reference in New Issue
Block a user