When gettnig albums, need to check all tracks if artist!=albumartist
This commit is contained in:
committed by
craig.p.drummond
parent
e620405053
commit
cd3efc8b0d
@@ -111,7 +111,7 @@ private:
|
||||
Song::Type m_type;
|
||||
QSet<QString> m_singleTrackFiles;
|
||||
QString m_imageUrl;
|
||||
// m_artists is used to cache the list of artists in a vraious artists albu
|
||||
// m_artists is used to cache the list of artists in a various artists album
|
||||
// this is built when containsArtist() is called, and is mainly used by the
|
||||
// context view
|
||||
QSet<QString> m_artists;
|
||||
|
||||
@@ -579,26 +579,40 @@ QList<Song> MusicLibraryModel::getAlbumTracks(const Song &s) const
|
||||
|
||||
QList<Song> MusicLibraryModel::getArtistAlbumsFirstTracks(const Song &song) const
|
||||
{
|
||||
QString artist=song.isVariousArtists() ? song.artist : song.albumArtist();
|
||||
//QString artist=song.isVariousArtists() ? song.artist : song.albumArtist();
|
||||
QString basicArtist=song.basicArtist();
|
||||
QList<Song> tracks;
|
||||
bool foundCurrent=false;
|
||||
bool checkAll=!song.isVariousArtists() && song.albumArtist()!=basicArtist;
|
||||
|
||||
foreach (MusicLibraryItem *ar, rootItem->childItems()) {
|
||||
if (static_cast<MusicLibraryItemArtist *>(ar)->isVarious()) {
|
||||
if (static_cast<MusicLibraryItemArtist *>(ar)->isVarious() || checkAll) {
|
||||
foreach (MusicLibraryItem *al, static_cast<MusicLibraryItemContainer *>(ar)->childItems()) {
|
||||
MusicLibraryItemAlbum *a=static_cast<MusicLibraryItemAlbum *>(al);
|
||||
if (a->containsArtist(basicArtist)) {
|
||||
tracks.append(static_cast<MusicLibraryItemSong *>(a->childItems().first())->song());
|
||||
Song first=static_cast<MusicLibraryItemSong *>(a->childItems().first())->song();
|
||||
tracks.append(first);
|
||||
if (!foundCurrent && first.album==song.album && first.albumArtist()==song.albumArtist()) {
|
||||
foundCurrent=true;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (ar->data()==artist || ar->data()==basicArtist) {
|
||||
} else if (ar->data()==basicArtist) { // i.e. album-artist == basic artist (most cases!)
|
||||
foreach (MusicLibraryItem *al, static_cast<MusicLibraryItemContainer *>(ar)->childItems()) {
|
||||
MusicLibraryItemContainer *a=static_cast<MusicLibraryItemContainer *>(al);
|
||||
if (!a->childItems().isEmpty()) {
|
||||
tracks.append(static_cast<MusicLibraryItemSong *>(a->childItems().first())->song());
|
||||
Song first=static_cast<MusicLibraryItemSong *>(a->childItems().first())->song();
|
||||
tracks.append(first);
|
||||
if (!foundCurrent && first.album==song.album && first.albumArtist()==song.albumArtist()) {
|
||||
foundCurrent=true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!foundCurrent) {
|
||||
tracks.append(song);
|
||||
}
|
||||
return tracks;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user