[gnome-music] Use utils functions where applicable
- From: Marinus Schraal <mschraal src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-music] Use utils functions where applicable
- Date: Thu, 3 Nov 2016 07:25:39 +0000 (UTC)
commit 2601c2d9244952bab06233bc49fa51475c893cf3
Author: Marinus Schraal <mschraal src gnome org>
Date: Thu Nov 3 08:19:56 2016 +0100
Use utils functions where applicable
gnomemusic/mpris.py | 14 +++-----------
gnomemusic/player.py | 7 -------
gnomemusic/views/playlistview.py | 4 ++--
gnomemusic/views/searchview.py | 2 +-
gnomemusic/views/songsview.py | 2 +-
5 files changed, 7 insertions(+), 22 deletions(-)
---
diff --git a/gnomemusic/mpris.py b/gnomemusic/mpris.py
index fe450de..995e579 100644
--- a/gnomemusic/mpris.py
+++ b/gnomemusic/mpris.py
@@ -303,17 +303,9 @@ class MediaPlayer2Service(Server):
except:
pass
- try:
- album = media.get_album()
- assert album is not None
- except:
- try:
- album = media.get_album()
- assert album is not None
- except:
- album = _("Unknown Album")
- finally:
- metadata['xesam:album'] = GLib.Variant('s', album)
+
+ album = utils.get_album_title(media)
+ metadata['xesam:album'] = GLib.Variant('s', album)
artist = utils.get_artist_name(media)
metadata['xesam:artist'] = GLib.Variant('as', [artist])
diff --git a/gnomemusic/player.py b/gnomemusic/player.py
index 72cf133..640b7e8 100644
--- a/gnomemusic/player.py
+++ b/gnomemusic/player.py
@@ -600,13 +600,6 @@ class Player(GObject.GObject):
self.artistLabel.set_label(artist)
self._currentArtist = artist
- album = _("Unknown Album")
- try:
- assert media.get_album() is not None
- album = media.get_album()
- except:
- self._currentAlbum = album
-
self.coverImg.set_from_surface(self._loading_icon_surface)
self.cache.lookup(media, ArtSize.xsmall, self._on_cache_lookup, None)
diff --git a/gnomemusic/views/playlistview.py b/gnomemusic/views/playlistview.py
index 3da51f1..f2d5acc 100644
--- a/gnomemusic/views/playlistview.py
+++ b/gnomemusic/views/playlistview.py
@@ -221,7 +221,7 @@ class PlaylistView(BaseView):
item = model.get_value(_iter, 5)
if item:
- cell.set_property('text', item.get_album() or _("Unknown Album"))
+ cell.set_property('text', utils.get_album_title(item))
def _on_list_widget_icon_render(self, col, cell, model, _iter, data):
if not self.player.currentTrackUri:
@@ -399,7 +399,7 @@ class PlaylistView(BaseView):
self._offset += 1
title = utils.get_media_title(item)
item.set_title(title)
- artist = item.get_artist() or _("Unknown Artist")
+ artist = utils.get_album_title(item)
model.insert_with_valuesv(
-1,
[2, 3, 5, 9],
diff --git a/gnomemusic/views/searchview.py b/gnomemusic/views/searchview.py
index e7cbfa4..3114629 100644
--- a/gnomemusic/views/searchview.py
+++ b/gnomemusic/views/searchview.py
@@ -169,7 +169,7 @@ class SearchView(BaseView):
return
artist = utils.get_artist_name(item)
- album = item.get_album() or _("Unknown Album")
+ album = utils.get_album_title(item)
composer = item.get_composer()
key = '%s-%s' % (artist, album)
diff --git a/gnomemusic/views/songsview.py b/gnomemusic/views/songsview.py
index daaae05..d7e8092 100644
--- a/gnomemusic/views/songsview.py
+++ b/gnomemusic/views/songsview.py
@@ -203,7 +203,7 @@ class SongsView(BaseView):
def _on_list_widget_type_render(self, coll, cell, model, _iter, data):
item = model.get_value(_iter, 5)
if item:
- cell.set_property('text', item.get_album() or _("Unknown Album"))
+ cell.set_property('text', utils.get_album_title(item))
def _on_list_widget_icon_render(self, col, cell, model, _iter, data):
if not self.player.currentTrackUri:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]