diff options
author | Max Kellermann <max@duempel.org> | 2010-11-08 20:16:26 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2010-11-08 20:16:26 +0100 |
commit | 46ab8d18e2539359eadb48b323ee9cace8b3a65b (patch) | |
tree | 9976d592035d0594a91df4a171531d85e9f88b8b /src | |
parent | f384f8da9303c48bcb932398905a3389c8d83295 (diff) | |
download | mpd-46ab8d18e2539359eadb48b323ee9cace8b3a65b.tar.gz mpd-46ab8d18e2539359eadb48b323ee9cace8b3a65b.tar.xz mpd-46ab8d18e2539359eadb48b323ee9cace8b3a65b.zip |
playlist_song: calculate duration of last CUE track
Diffstat (limited to 'src')
-rw-r--r-- | src/playlist_song.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/playlist_song.c b/src/playlist_song.c index 20fac59d8..1e8e98795 100644 --- a/src/playlist_song.c +++ b/src/playlist_song.c @@ -72,6 +72,14 @@ apply_song_metadata(struct song *dest, const struct song *src) song_free(dest); } + if (dest->tag != NULL && dest->tag->time > 0 && + src->start_ms > 0 && src->end_ms == 0 && + src->start_ms / 1000 < (unsigned)dest->tag->time) + /* the range is open-ended, and the playlist plugin + did not know the total length of the song file + (e.g. last track on a CUE file); fix it up here */ + tmp->tag->time = dest->tag->time - src->start_ms / 1000; + return tmp; } |