[gnome-music/wip/jfelder/tracker3-rebased: 13/39] 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/jfelder/tracker3-rebased: 13/39] utils: Add getters for media track number and album disc number
- Date: Wed, 29 Jul 2020 15:06:56 +0000 (UTC)
commit fde4bf6aac5a083f865564d5ad79c5b75db963fa
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 | 26 ++++++++++++++++++++++++++
1 file changed, 26 insertions(+)
---
diff --git a/gnomemusic/utils.py b/gnomemusic/utils.py
index 4aafb27f..1837e44d 100644
--- a/gnomemusic/utils.py
+++ b/gnomemusic/utils.py
@@ -153,6 +153,32 @@ def get_media_year(item, fill_empty=False):
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: str
+ """
+ disc_nr = item.get_album_disc_number()
+ if disc_nr == 0:
+ return ""
+ return str(disc_nr)
+
+
+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: str
+ """
+ track_nr = item.get_track_number()
+ if track_nr == 0:
+ return ""
+ return str(track_nr)
+
+
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]