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
commit 704fa3278a
6 changed files with 35 additions and 18 deletions

View file

@ -66,6 +66,13 @@ class Utils:
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):
title = track.get_title()
if track.get_artists():

View file

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