=== modified file 'data/ui/collection_panel.ui' --- data/ui/collection_panel.ui 2010-08-14 16:19:14 +0000 +++ data/ui/collection_panel.ui 2010-10-08 12:55:35 +0000 @@ -9,6 +9,9 @@ + Album Artist + + Artist === modified file 'xl/trax/track.py' --- xl/trax/track.py 2010-06-22 18:37:31 +0000 +++ xl/trax/track.py 2010-10-08 22:58:10 +0000 @@ -62,7 +62,7 @@ # Cache these here because calling gettext inside get_tag_display # is two orders of magnitude slower. -_VARIOUSARTISTSSTR = _("Various Artists") +_VARIOUSARTISTSSTR = _("Various Artists (guessed)") _UNKNOWNSTR = _("Unknown") #TRANSLATORS: String multiple tag values will be joined by _JOINSTR = _(u' / ') @@ -485,7 +485,7 @@ single value. :param artist_compilations: If True, automatically handle albumartist and other compilations detections when - tag=="artist". + tag=="artist" and "albumartist". :param extend_title: If the title tag is unknown, try to add some identifying information to it. """ @@ -508,6 +508,19 @@ value = sorttag else: sorttag = None + elif tag == "albumartist" and artist_compilations: + value = self.__tags.get('albumartist') + if not value: + if self.__tags.get('__compilation'): + # supply "various artists" to compilation + value = u"\uffff\uffff\uffff\ufffe" + else: + # supply artist in place of albumartist + sorttag = self.__tags.get('artistsort') + if not sorttag: + value = self.__tags.get('artist', u"\uffff\uffff\uffff\uffff") + else: + value = sorttag elif tag in ('tracknumber', 'discnumber'): value = self.split_numerical(self.__tags.get(tag))[0] elif tag in ('__length', '__playcount'): @@ -518,7 +531,9 @@ else: value = self.__tags.get(tag) - if not value: + if tag == "albumartist" and value and value[0].lower() in ("various artists", "va"): + value = u"\uffff\uffff\uffff\ufffe" # various + elif not value: value = u"\uffff\uffff\uffff\uffff" # unknown if tag == 'title': gloc = gio.File(self.__tags['__loc']) @@ -548,7 +563,7 @@ single value. :param artist_compilations: If True, automatically handle albumartist and other compilations detections when - tag=="artist". + tag=="artist" or "albumartist". :param extend_title: If the title tag is unknown, try to add some identifying information to it. """ @@ -557,7 +572,7 @@ return uri.decode('utf-8') value = None - if tag == "artist": + if tag == "artist" or (tag == "albumartist" and artist_compilations): if artist_compilations and self.__tags.get('__compilation'): value = self.__tags.get('albumartist', _VARIOUSARTISTSSTR) else: @@ -611,7 +626,7 @@ :param format: pre-format into a search query. :param artist_compilations: If True, automatically handle albumartist and other compilations detections when - tag=="artist". + tag=="artist" or "albumartist". :param extend_title: If the title tag is unknown, try to add some identifying information to it. """ @@ -619,10 +634,27 @@ if tag == "artist": if artist_compilations and self.__tags.get('__compilation'): value = self.__tags.get('albumartist', '__null__') + if not isinstance(value, list): + value = [value] + if not format: + value2 = self.__tags.get('artist', '__null__') + # do not use "+=" as we'd be modifying the tag itself + value = value + (isinstance(value2, list) and value2 or [value2]) + else: + extraformat += " " + self.get_tag_search('artist', format=True, artist_compilations=False, extend_title=extend_title) tag = 'albumartist' extraformat += " ! __compilation==__null__" else: value = self.__tags.get('artist') + elif tag == "albumartist" and artist_compilations: + value = self.__tags.get('albumartist') + if not value: + if self.__tags.get('__compilation'): + value = '__null__' + extraformat += " ! __compilation==__null__" + else: + tag = 'artist' + value = self.__tags.get('artist', '__null__') elif tag in ('tracknumber', 'discnumber'): value = self.split_numerical(self.__tags.get(tag))[0] elif tag in ('__length', '__playcount', '__rating'): @@ -648,7 +680,7 @@ elif isinstance(value, list) and format: value = ['"%s"' % self.quoter(val) for val in value] elif format: - value = '"%s"' % self.quoter(value) + value = '"%s"' % (self.quoter(value),) # Join lists if format: === modified file 'xlgui/panel/collection.py' --- xlgui/panel/collection.py 2010-08-14 15:20:06 +0000 +++ xlgui/panel/collection.py 2010-10-08 23:06:26 +0000 @@ -159,6 +159,7 @@ If level is string 'tag', it's the same as (['tag'], [0], [0]) """ orders = ( + ['albumartist', 'album', (['discnumber', 'tracknumber', 'title'], [2], [2])], ['artist', 'album', (['discnumber', 'tracknumber', 'title'], [2], [2])], ['album', (['discnumber', 'tracknumber', 'title'], [2], [2])], ['genre', 'artist', 'album', (['discnumber', 'tracknumber', 'title'], [2], [2])], @@ -320,6 +321,7 @@ """ self.artist_image = gtk.gdk.pixbuf_new_from_file( xdg.get_data_path("images/artist.png")) + self.albumartist_image = self.artist_image self.date_image = gtk.gdk.pixbuf_new_from_file( xdg.get_data_path('images/year.png')) self.album_image = icons.MANAGER.pixbuf_from_stock( @@ -620,10 +622,10 @@ stagvals = [unicode(srtr.track.get_tag_sort(x)) for x in tags] stagval = self.order[depth].printTags(stagvals) if (last_val != stagval or bottom): - tagvals = [srtr.track.get_tag_display(x) for x in tags] + tagvals = [srtr.track.get_tag_display(x, artist_compilations=(x=="albumartist")) for x in tags] tagval = self.order[depth].printTags(tagvals) match_query = " ".join([ - srtr.track.get_tag_search(t, format=True) for t in tags]) + srtr.track.get_tag_search(t, format=True, artist_compilations=(t=="albumartist")) for t in tags]) if bottom: match_query += " " + \ srtr.track.get_tag_search("__loc", format=True)