[gnome-music/wip/mschraal/tageditor: 1/16] utils: Add getters for media track number and album disc number
- From: Marinus Schraal <mschraal src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-music/wip/mschraal/tageditor: 1/16] utils: Add getters for media track number and album disc number
- Date: Fri, 22 Nov 2019 15:35:25 +0000 (UTC)
commit 75b5aac607e75e522b0b94909c458a850283c424
Author: Sumaid Syed <sumaidsyed gmail com>
Date: Sun Aug 4 22:05:49 2019 +0530
utils: Add getters for media track number and album disc number
Based on the patches by Jean Felder
https://gitlab.gnome.org/GNOME/gnome-music/issues/293
gnomemusic/utils.py | 28 +++++++++++++++++++++++++++-
1 file changed, 27 insertions(+), 1 deletion(-)
---
diff --git a/gnomemusic/utils.py b/gnomemusic/utils.py
index 76310cb6..c6a59ec8 100644
--- a/gnomemusic/utils.py
+++ b/gnomemusic/utils.py
@@ -117,11 +117,37 @@ def get_media_year(item):
date = item.get_creation_date()
if not date:
- return "----"
+ return ""
return str(date.get_year())
+def get_album_disc_nr(item):
+ """Returns the album song number associated with the media item
+
+ :param Grl.Media item: song
+ :return: The album disc number
+ :rtype: string
+ """
+ track_number = item.get_album_disc_number()
+ if track_number == 0:
+ track_number = ""
+ return str(track_number)
+
+
+def get_media_track_nr(item):
+ """Returns the track number of the media item.
+
+ :param Grl.Media item: song
+ :return: The song track number
+ :rtype: string
+ """
+ track_number = item.get_track_number()
+ if track_number == 0:
+ return ""
+ return str(track_number)
+
+
def seconds_to_string(duration):
"""Convert a time in seconds to a mm:ss string
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]