Summary: | random album playback should differentiate artists | ||
---|---|---|---|
Product: | [Applications] juk | Reporter: | Marcelo Vanzin <mmvgroups> |
Component: | general | Assignee: | Scott Wheeler <wheeler> |
Status: | RESOLVED FIXED | ||
Severity: | normal | ||
Priority: | NOR | ||
Version: | unspecified | ||
Target Milestone: | --- | ||
Platform: | openSUSE | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: | ||
Sentry Crash Report: | |||
Attachments: | Proposed patch for bug 120363 |
Description
Marcelo Vanzin
2006-01-18 06:22:47 UTC
Created attachment 14298 [details] Proposed patch for bug 120363 This just adds the "artist" tag to the list of tags used in the search when defining the next album to play; a quick test showed this to work w.r.t. this bug (I haven't checked if that method is used from other parts of Juk). (Attachment is a gzipped text file if you have problems opening it.) Comment on attachment 14298 [details] Proposed patch for bug 120363 Correct mimetype. SVN commit 499931 by mpyne: Fix bug 120363 (JuK should use Artist information in album random play). Previously, only the Album name mattered, which meant that common names like "Greatest Hits" would play different artists. Thanks to the reporter for providing a reference patch. BUG:120363 M +27 -2 tracksequenceiterator.cpp --- branches/KDE/3.5/kdemultimedia/juk/tracksequenceiterator.cpp #499930:499931 @@ -102,14 +102,21 @@ } // This can be null if initAlbumSearch() left the m_albumSearch - // empty because the album text was empty. + // empty because the album text was empty. Since we initAlbumSearch() + // with an item, the matchedItems() should never be empty. if(!m_albumSearch.isNull()) { PlaylistItemList albumMatches = m_albumSearch.matchedItems(); + if(albumMatches.isEmpty()) { + kdError(65432) << "Unable to initialize album random play.\n"; + kdError(65432) << "List of potential results is empty.\n"; + return; // item is still set to random song from a few lines earlier. + } + item = albumMatches[0]; - // Pick first song + // Pick first song remaining in list. for(unsigned i = 0; i < albumMatches.count(); ++i) if(albumMatches[i]->file().tag()->track() < item->file().tag()->track()) @@ -121,6 +128,8 @@ m_albumSearch.search(); } } + else + kdError(65432) << "Unable to perform album random play on " << *item << endl; } else item = m_randomItems[KApplication::random() % m_randomItems.count()]; @@ -279,6 +288,22 @@ PlaylistSearch::Component::Exact) ); + // If there is an Artist tag with the track, match against it as well + // to avoid things like multiple "Greatest Hits" albums matching the + // search. + + if(!searchItem->file().tag()->artist().isEmpty()) { + kdDebug(65432) << "Searching both artist and album.\n"; + columns[0] = PlaylistItem::ArtistColumn; + + m_albumSearch.addComponent(PlaylistSearch::Component( + searchItem->file().tag()->artist(), + true, + columns, + PlaylistSearch::Component::Exact) + ); + } + m_albumSearch.search(); } |