[gnome-music/wip/mschraal/core] corealbum: Add composer & year
- From: Marinus Schraal <mschraal src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-music/wip/mschraal/core] corealbum: Add composer & year
- Date: Thu, 20 Jun 2019 14:54:08 +0000 (UTC)
commit 8e82475339c489a6a1a5ee4854206b2f5f504d5d
Author: Marinus Schraal <mschraal gnome org>
Date: Thu Jun 20 14:17:56 2019 +0200
corealbum: Add composer & year
gnomemusic/corealbum.py | 4 ++++
gnomemusic/utils.py | 4 ++--
gnomemusic/widgets/albumwidget2.py | 11 ++++-------
3 files changed, 10 insertions(+), 9 deletions(-)
---
diff --git a/gnomemusic/corealbum.py b/gnomemusic/corealbum.py
index b9c126de..9fa18a01 100644
--- a/gnomemusic/corealbum.py
+++ b/gnomemusic/corealbum.py
@@ -12,10 +12,12 @@ class CoreAlbum(GObject.GObject):
"""
artist = GObject.Property(type=str)
+ composer = GObject.Property(type=str, default=None)
model = GObject.Property(type=Gio.ListModel, default=None)
media = GObject.Property(type=Grl.Media)
selected = GObject.Property(type=bool, default=False)
title = GObject.Property(type=str)
+ year = GObject.Property(type=str, default="----")
@log
def __init__(self, media):
@@ -27,4 +29,6 @@ class CoreAlbum(GObject.GObject):
def update(self, media):
self.props.media = media
self.props.artist = utils.get_artist_name(media)
+ self.props.composer = media.get_composer()
self.props.title = utils.get_media_title(media)
+ self.props.year = utils.get_media_year(media)
diff --git a/gnomemusic/utils.py b/gnomemusic/utils.py
index fd75fb0f..bd5d67d1 100644
--- a/gnomemusic/utils.py
+++ b/gnomemusic/utils.py
@@ -105,13 +105,13 @@ def get_media_year(item):
"""Returns the year when the media was created.
:param item: A Grilo Media object
- :return: The creation year or None if not defined
+ :return: The creation year or '----' if not defined
:rtype: string
"""
date = item.get_creation_date()
if not date:
- return None
+ return "----"
return str(date.get_year())
diff --git a/gnomemusic/widgets/albumwidget2.py b/gnomemusic/widgets/albumwidget2.py
index 7477d8ad..cf3780d0 100644
--- a/gnomemusic/widgets/albumwidget2.py
+++ b/gnomemusic/widgets/albumwidget2.py
@@ -74,12 +74,9 @@ class AlbumWidget2(Gtk.EventBox):
self._artist_label.props.label = artist
self._artist_label.props.tooltip_text = artist
- year = utils.get_media_year(corealbum.props.media)
- if not year:
- year = '----'
- self._released_info_label.props.label = year
+ self._released_info_label.props.label = corealbum.props.year
- self._set_composer_label(corealbum.props.media)
+ self._set_composer_label(corealbum)
self._album = corealbum.props.media
self._album_model = self._parent_view._window._app._coremodel.get_album_model(self._album)
@@ -104,8 +101,8 @@ class AlbumWidget2(Gtk.EventBox):
return disc_box
@log
- def _set_composer_label(self, album):
- composer = album.get_composer()
+ def _set_composer_label(self, corealbum):
+ composer = corealbum.props.composer
show = False
if composer:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]