[gnome-music] Cleanup artist/author ambiguity



commit 9acc48fa46f51e86fcd0baf0a7f8d051f9776a63
Author: Marinus Schraal <mschraal src gnome org>
Date:   Sat Feb 6 10:25:33 2016 +0100

    Cleanup artist/author ambiguity
    
    Artist and author are confusingly used for the same purpose, fix all use
    of author to use artist instead.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=761625

 gnomemusic/mpris.py   |    2 +-
 gnomemusic/query.py   |    9 ++++-----
 gnomemusic/view.py    |   14 +++++++-------
 gnomemusic/widgets.py |    4 ++--
 4 files changed, 14 insertions(+), 15 deletions(-)
---
diff --git a/gnomemusic/mpris.py b/gnomemusic/mpris.py
index 3bd8587..c2f34a4 100644
--- a/gnomemusic/mpris.py
+++ b/gnomemusic/mpris.py
@@ -325,7 +325,7 @@ class MediaPlayer2Service(Server):
                 assert artist is not None
             except:
                 try:
-                    artist = media.get_author()
+                    artist = media.get_artist()
                     assert artist is not None
                 except (AssertionError, ValueError):
                     artist = _("Unknown Artist")
diff --git a/gnomemusic/query.py b/gnomemusic/query.py
index 80518fe..ca5436e 100644
--- a/gnomemusic/query.py
+++ b/gnomemusic/query.py
@@ -158,7 +158,7 @@ class Query():
     SELECT
         rdf:type(?album)
         tracker:id(?album) AS ?id
-        ?author
+        ?artist
         ?title
         tracker:coalesce((SELECT GROUP_CONCAT(nmm:artistName(?albumArtist), ',') { ?album nmm:albumArtist 
?albumArtist }),
                          (SELECT GROUP_CONCAT(nmm:artistName(?performer), ',') { ?song nmm:performer 
?performer })) AS ?performer
@@ -169,11 +169,10 @@ class Query():
         ?album a nmm:MusicAlbum ;
                nmm:albumArtist ?albumArtist ;
                nie:title ?title .
-        ?albumArtist nmm:artistName ?author .
+        ?albumArtist nmm:artistName ?artist .
         ?song nmm:musicAlbum ?album ;
               nmm:performer ?performer .
-
-        BIND(LCASE(?author) AS ?author_lower) .
+        BIND(LCASE(?artist) AS ?artist_lower) .
         BIND(LCASE(?title) AS ?title_lower) .
         BIND((%(artist_order)s) AS ?artist_collation) .
         BIND((%(album_order)s) AS ?title_collation) .
@@ -185,7 +184,7 @@ class Query():
     '''.replace('\n', ' ').strip() % {
             'where_clause': where_clause.replace('\n', ' ').strip(),
             'music_dir': Query.MUSIC_URI,
-            'artist_order': Query.order_by_statement("?author_lower"),
+            'artist_order': Query.order_by_statement("?artist_lower"),
             'album_order': Query.order_by_statement("?title_lower")
         }
 
diff --git a/gnomemusic/view.py b/gnomemusic/view.py
index d851741..4092d90 100644
--- a/gnomemusic/view.py
+++ b/gnomemusic/view.py
@@ -215,7 +215,7 @@ class ViewContainer(Gtk.Stack):
 
         self._offset += 1
         artist = item.get_string(Grl.METADATA_KEY_ARTIST)\
-            or item.get_author()\
+            or item.get_artist() \
             or _("Unknown Artist")
         title = albumArtCache.get_media_title(item)
         # item.set_title(title)
@@ -475,7 +475,7 @@ class Songs(ViewContainer):
         self._offset += 1
         item.set_title(albumArtCache.get_media_title(item))
         artist = item.get_string(Grl.METADATA_KEY_ARTIST)\
-            or item.get_author()\
+            or item.get_artist() \
             or _("Unknown Artist")
         if item.get_url() is None:
             return
@@ -729,7 +729,7 @@ class Artists (ViewContainer):
             return
         self._offset += 1
         artist = item.get_string(Grl.METADATA_KEY_ARTIST)\
-            or item.get_author()\
+            or item.get_artist()\
             or _("Unknown Artist")
         if not artist.casefold() in self._artists:
             _iter = self.model.insert_with_valuesv(-1, [2], [artist])
@@ -1162,7 +1162,7 @@ class Playlist(ViewContainer):
         title = albumArtCache.get_media_title(item)
         item.set_title(title)
         artist = item.get_string(Grl.METADATA_KEY_ARTIST)\
-            or item.get_author()\
+            or item.get_artist()\
             or _("Unknown Artist")
         model.insert_with_valuesv(
             -1,
@@ -1454,7 +1454,7 @@ class Search(ViewContainer):
             return
 
         artist = item.get_string(Grl.METADATA_KEY_ARTIST) \
-            or item.get_author() \
+            or item.get_artist() \
             or _("Unknown Artist")
         album = item.get_string(Grl.METADATA_KEY_ALBUM) \
             or _("Unknown Album")
@@ -1463,7 +1463,7 @@ class Search(ViewContainer):
         if key not in self._albums:
             self._albums[key] = Grl.Media()
             self._albums[key].set_title(album)
-            self._albums[key].add_author(artist)
+            self._albums[key].add_artist(artist)
             self._albums[key].set_source(source.get_id())
             self._albums[key].tracks = []
             self._add_item(source, None, self._albums[key], 0, [self.model, 'album'])
@@ -1506,7 +1506,7 @@ class Search(ViewContainer):
         title = albumArtCache.get_media_title(item)
         item.set_title(title)
         artist = item.get_string(Grl.METADATA_KEY_ARTIST) \
-            or item.get_author() \
+            or item.get_artist() \
             or _("Unknown Artist")
 
         group = 3
diff --git a/gnomemusic/widgets.py b/gnomemusic/widgets.py
index f6c8492..4d8624f 100644
--- a/gnomemusic/widgets.py
+++ b/gnomemusic/widgets.py
@@ -245,7 +245,7 @@ class AlbumWidget(Gtk.EventBox):
         self.header_bar = header_bar
         self.album = album
         real_artist = item.get_string(Grl.METADATA_KEY_ARTIST)\
-            or item.get_author()\
+            or item.get_artist()\
             or _("Unknown Artist")
         self.ui.get_object('cover').set_from_pixbuf(self.loadingIcon)
         ALBUM_ART_CACHE.lookup(item, 256, 256, self._on_look_up, None, real_artist, album)
@@ -657,7 +657,7 @@ class ArtistAlbumWidget(Gtk.Box):
     @log
     def _update_album_art(self):
         real_artist = self.album.get_string(Grl.METADATA_KEY_ARTIST)\
-            or self.album.get_author()\
+            or self.album.get_artist() \
             or _("Unknown Artist")
         ALBUM_ART_CACHE.lookup(
             self.album, 128, 128, self._get_album_cover, None,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]