diff options
author | Max Kellermann <max@musicpd.org> | 2021-01-21 13:47:13 +0100 |
---|---|---|
committer | Max Kellermann <max@musicpd.org> | 2021-01-21 13:52:00 +0100 |
commit | fee282f49c6a998cf37ee4050971c20239f98056 (patch) | |
tree | d8b55b23e120208c79039273d3845dc391c1825b /src/SongPrint.cxx | |
parent | 07d2bc6898e9af5c343a36113154f497a7f65695 (diff) |
SongPrint: use LightSong::GetDuration()
This properly prints the "Time"/"duration" values for songs in virtual
CUE folders.
This is loosely related to
https://github.com/MusicPlayerDaemon/MPD/issues/1048
Diffstat (limited to 'src/SongPrint.cxx')
-rw-r--r-- | src/SongPrint.cxx | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/SongPrint.cxx b/src/SongPrint.cxx index 7e8729ad0..5ad300081 100644 --- a/src/SongPrint.cxx +++ b/src/SongPrint.cxx @@ -91,7 +91,14 @@ song_print_info(Response &r, const LightSong &song, bool base) noexcept if (song.audio_format.IsDefined()) r.Format("Format: %s\n", ToString(song.audio_format).c_str()); - tag_print(r, song.tag); + tag_print_values(r, song.tag); + + const auto duration = song.GetDuration(); + if (!duration.IsNegative()) + r.Format("Time: %i\n" + "duration: %1.3f\n", + duration.RoundS(), + duration.ToDoubleS()); } void |