Add config option for human vs raw track duration

* Add "format_raw_length" global configuration option to allow the user to
toggle between human-readable (default) or raw formatting of track durations.
This commit is contained in:
Diego Moreda 2015-12-05 13:28:56 +01:00
parent 67eb0ed54c
commit 8d2fda790b
2 changed files with 6 additions and 1 deletions

View file

@ -65,6 +65,7 @@ ui:
format_item: $artist - $album - $title
format_album: $albumartist - $album
time_format: '%Y-%m-%d %H:%M:%S'
format_raw_length: no
sort_album: albumartist+ album+
sort_item: artist+ album+ disc+ track+

View file

@ -200,7 +200,11 @@ class DurationType(types.Float):
query = dbcore.query.DurationQuery
def format(self, value):
return beets.ui.human_seconds_short(value or 0.0)
# TODO: decide if documenting format_raw_length
if not beets.config['format_raw_length'].get(bool):
return beets.ui.human_seconds_short(value or 0.0)
else:
return value
def parse(self, string):
try: