WIP
This commit is contained in:
@@ -191,7 +191,7 @@ class AppConfiguration(DataClassJsonMixin):
|
||||
|
||||
if self.version < 6:
|
||||
self.player_config = {
|
||||
"Local Playback": {"Replay Gain": ["no", "track", "album"][self._rg]},
|
||||
"Local Playback": {"Replay Gain": ["Disabled", "Track", "Album"][self._rg]},
|
||||
"Chromecast": {
|
||||
"Serve Local Files to Chromecasts on the LAN": self._sol,
|
||||
"LAN Server Port Number": self._pn,
|
||||
|
@@ -279,6 +279,9 @@ class ArtistDetailPanel(Gtk.Box):
|
||||
self.artist_stats_long = self.make_label(name="artist-stats")
|
||||
artist_stats_squeezer.add(self.artist_stats_long)
|
||||
|
||||
self.artist_stats_medium = self.make_label(name="artist-stats")
|
||||
artist_stats_squeezer.add(self.artist_stats_medium)
|
||||
|
||||
self.artist_stats_short = self.make_label(name="artist-stats")
|
||||
artist_stats_squeezer.add(self.artist_stats_short)
|
||||
|
||||
@@ -360,8 +363,9 @@ class ArtistDetailPanel(Gtk.Box):
|
||||
self.artist_name.set_markup(bleach.clean(f"<b>{artist.name}</b>"))
|
||||
self.artist_name.set_tooltip_text(artist.name)
|
||||
|
||||
self.artist_stats_long.set_markup(self.format_stats(artist, short=False))
|
||||
self.artist_stats_short.set_markup(self.format_stats(artist, short=True))
|
||||
self.artist_stats_long.set_markup(self.format_stats(artist, short_time=False))
|
||||
self.artist_stats_medium.set_markup(self.format_stats(artist, short_time=True))
|
||||
self.artist_stats_short.set_markup(self.format_stats(artist, short_time=True, short_count=True))
|
||||
|
||||
biography = ""
|
||||
if artist.biography:
|
||||
@@ -504,19 +508,27 @@ class ArtistDetailPanel(Gtk.Box):
|
||||
label=text, name=name, halign=Gtk.Align.START, xalign=0, **params
|
||||
)
|
||||
|
||||
def format_stats(self, artist: API.Artist, short=False) -> str:
|
||||
def format_stats(self, artist: API.Artist, short_time=False, short_count=False) -> str:
|
||||
album_count = artist.album_count or len(artist.albums or [])
|
||||
song_count, duration = 0, timedelta(0)
|
||||
for album in artist.albums or []:
|
||||
song_count += album.song_count or 0
|
||||
duration += album.duration or timedelta(0)
|
||||
|
||||
return util.dot_join(
|
||||
"{} {}".format(album_count, util.pluralize("album", album_count)),
|
||||
"{} {}".format(song_count, util.pluralize("song", song_count)),
|
||||
util.format_song_duration(duration)
|
||||
if short else util.format_sequence_duration(duration),
|
||||
)
|
||||
parts = []
|
||||
|
||||
if short_count:
|
||||
parts.append(f"{album_count}/{song_count}")
|
||||
else:
|
||||
parts.append("{} {}".format(album_count, util.pluralize("album", album_count)))
|
||||
parts.append("{} {}".format(song_count, util.pluralize("song", song_count)))
|
||||
|
||||
if short_time:
|
||||
parts.append(util.format_song_duration(duration))
|
||||
else:
|
||||
parts.append(util.format_sequence_duration(duration))
|
||||
|
||||
return util.dot_join(*parts)
|
||||
|
||||
def get_artist_song_ids(self) -> List[str]:
|
||||
try:
|
||||
|
Reference in New Issue
Block a user