mpd: add option "time_format" to module

This commit is contained in:
Franziska Kunsmann 2021-06-18 08:48:51 +02:00 committed by enkore
parent 177a00b874
commit cfd60a6bb0
2 changed files with 5 additions and 2 deletions

View File

@ -22,6 +22,7 @@ Erik Johnson
enkore enkore
facetoe facetoe
Frank Tackitt Frank Tackitt
Franziska Kunsmann
gacekjk gacekjk
Georg Sieber Georg Sieber
Goran Mekić Goran Mekić

View File

@ -75,6 +75,7 @@ fields, if truncated, ellipsis are appended as indicator. It's applied \
fields specefied in truncate_fields are truncated equaly. If truncated, \ fields specefied in truncate_fields are truncated equaly. If truncated, \
ellipsis are appended as indicator. It's applied *after* max_field_len. Value \ ellipsis are appended as indicator. It's applied *after* max_field_len. Value \
of 0 disables this."), of 0 disables this."),
("time_format", "format string for 'pos' and 'len' fields"),
("truncate_fields", "fields that will be truncated if exceeding \ ("truncate_fields", "fields that will be truncated if exceeding \
max_field_len or max_len."), max_field_len or max_len."),
("hide_inactive", "Hides status information when MPD is not running"), ("hide_inactive", "Hides status information when MPD is not running"),
@ -96,6 +97,7 @@ cleartext to the server.)"),
color_map = {} color_map = {}
max_field_len = 25 max_field_len = 25
max_len = 100 max_len = 100
time_format = "%M:MS"
truncate_fields = ("title", "album", "artist", "album_artist") truncate_fields = ("title", "album", "artist", "album_artist")
hide_inactive = False hide_inactive = False
on_leftclick = "switch_playpause" on_leftclick = "switch_playpause"
@ -156,8 +158,8 @@ cleartext to the server.)"),
"album": currentsong.get("Album", ""), "album": currentsong.get("Album", ""),
"artist": currentsong.get("Artist", ""), "artist": currentsong.get("Artist", ""),
"album_artist": currentsong.get("AlbumArtist", ""), "album_artist": currentsong.get("AlbumArtist", ""),
"song_length": TimeWrapper(currentsong.get("Time", 0)), "song_length": TimeWrapper(currentsong.get("Time", 0), default_format=self.time_format),
"song_elapsed": TimeWrapper(float(status.get("elapsed", 0))), "song_elapsed": TimeWrapper(float(status.get("elapsed", 0)), default_format=self.time_format),
"bitrate": int(status.get("bitrate", 0)), "bitrate": int(status.get("bitrate", 0)),
} }