Show album length on Playlist and Library panel (close #57)

Show the length of an album in the tooltip on the Playlist and the
Library panel.
This commit is contained in:
coderkun 2020-03-22 00:43:20 +01:00
parent 477f89cc0b
commit 704fa3278a
6 changed files with 35 additions and 18 deletions

Binary file not shown.

View file

@ -1,8 +1,8 @@
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: CoverGrid (mcg)\n" "Project-Id-Version: CoverGrid (mcg)\n"
"POT-Creation-Date: 2020-03-22 00:15+0100\n" "POT-Creation-Date: 2020-03-22 11:18+0100\n"
"PO-Revision-Date: 2020-03-22 00:16+0100\n" "PO-Revision-Date: 2020-03-22 11:18+0100\n"
"Last-Translator: coderkun <olli@suruatoel.xyz>\n" "Last-Translator: coderkun <olli@suruatoel.xyz>\n"
"Language-Team: \n" "Language-Team: \n"
"Language: de\n" "Language: de\n"
@ -262,27 +262,31 @@ msgstr "Cover-Paneel"
msgid "Library Panel" msgid "Library Panel"
msgstr "Bibliothekspaneel" msgstr "Bibliothekspaneel"
#: mcg/utils.py:62 mcg/utils.py:72 #: mcg/utils.py:62 mcg/utils.py:79
msgid "{} feat. {}" msgid "{} feat. {}"
msgstr "{} mit {}" msgstr "{} mit {}"
#: mcg/widgets.py:1281 mcg/widgets.py:1621 #: mcg/utils.py:73
msgid "{}:{} minutes"
msgstr "{}:{} Minuten"
#: mcg/widgets.py:1279 mcg/widgets.py:1620
msgid "cancel" msgid "cancel"
msgstr "abbrechen" msgstr "abbrechen"
#: mcg/widgets.py:1298 mcg/widgets.py:1638 #: mcg/widgets.py:1296 mcg/widgets.py:1637
msgid "play" msgid "play"
msgstr "abspielen" msgstr "abspielen"
#: mcg/widgets.py:1301 #: mcg/widgets.py:1299
msgid "remove" msgid "remove"
msgstr "entfernen" msgstr "entfernen"
#: mcg/widgets.py:1624 mcg/widgets.py:1641 #: mcg/widgets.py:1623 mcg/widgets.py:1640
msgid "queue" msgid "queue"
msgstr "einreihen" msgstr "einreihen"
#: mcg/widgets.py:1873 #: mcg/widgets.py:1872
msgid "Loading albums" msgid "Loading albums"
msgstr "Alben werden geladen" msgstr "Alben werden geladen"

Binary file not shown.

View file

@ -1,8 +1,8 @@
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: CoverGrid (mcg)\n" "Project-Id-Version: CoverGrid (mcg)\n"
"POT-Creation-Date: 2020-03-22 00:16+0100\n" "POT-Creation-Date: 2020-03-22 11:18+0100\n"
"PO-Revision-Date: 2020-03-22 00:16+0100\n" "PO-Revision-Date: 2020-03-22 11:18+0100\n"
"Last-Translator: coderkun <olli@suruatoel.xyz>\n" "Last-Translator: coderkun <olli@suruatoel.xyz>\n"
"Language-Team: \n" "Language-Team: \n"
"Language: en\n" "Language: en\n"
@ -261,27 +261,31 @@ msgstr "Cover Panel"
msgid "Library Panel" msgid "Library Panel"
msgstr "Library Panel" msgstr "Library Panel"
#: mcg/utils.py:62 mcg/utils.py:72 #: mcg/utils.py:62 mcg/utils.py:79
msgid "{} feat. {}" msgid "{} feat. {}"
msgstr "{} feat. {}" msgstr "{} feat. {}"
#: mcg/widgets.py:1281 mcg/widgets.py:1621 #: mcg/utils.py:73
msgid "{}:{} minutes"
msgstr "{}:{} minutes"
#: mcg/widgets.py:1279 mcg/widgets.py:1620
msgid "cancel" msgid "cancel"
msgstr "cancel" msgstr "cancel"
#: mcg/widgets.py:1298 mcg/widgets.py:1638 #: mcg/widgets.py:1296 mcg/widgets.py:1637
msgid "play" msgid "play"
msgstr "play" msgstr "play"
#: mcg/widgets.py:1301 #: mcg/widgets.py:1299
msgid "remove" msgid "remove"
msgstr "remove" msgstr "remove"
#: mcg/widgets.py:1624 mcg/widgets.py:1641 #: mcg/widgets.py:1623 mcg/widgets.py:1640
msgid "queue" msgid "queue"
msgstr "queue" msgstr "queue"
#: mcg/widgets.py:1873 #: mcg/widgets.py:1872
msgid "Loading albums" msgid "Loading albums"
msgstr "Loading albums" msgstr "Loading albums"

View file

@ -66,6 +66,13 @@ class Utils:
return label return label
def create_length_label(album):
minutes = album.get_length() // 60
seconds = album.get_length() - minutes * 60
return locale.gettext("{}:{} minutes").format(minutes, seconds)
def create_track_title(track): def create_track_title(track):
title = track.get_title() title = track.get_title()
if track.get_artists(): if track.get_artists():

View file

@ -1454,7 +1454,8 @@ class PlaylistPanel(GObject.GObject):
GObject.markup_escape_text("\n".join([ GObject.markup_escape_text("\n".join([
album.get_title(), album.get_title(),
', '.join(album.get_dates()), ', '.join(album.get_dates()),
Utils.create_artists_label(album) Utils.create_artists_label(album),
Utils.create_length_label(album)
])), ])),
album.get_id() album.get_id()
]) ])
@ -1942,7 +1943,8 @@ class LibraryPanel(GObject.GObject):
GObject.markup_escape_text("\n".join([ GObject.markup_escape_text("\n".join([
album.get_title(), album.get_title(),
', '.join(album.get_dates()), ', '.join(album.get_dates()),
Utils.create_artists_label(album) Utils.create_artists_label(album),
Utils.create_length_label(album)
])), ])),
album_id album_id
]) ])