Fix duration of last track for split CUE files.

Issue #901
This commit is contained in:
Craig Drummond
2016-10-29 09:55:46 +01:00
parent 96a3155e82
commit c578309523
2 changed files with 5 additions and 1 deletions

View File

@@ -46,6 +46,7 @@
32. If file has embedded cover, save this to the cache folder - so that this
file path can be used with MPRIS.
33. Fix scrobbling when Album is empty.
34. Fix duration of last track for split CUE files.
2.0.1
-----

View File

@@ -668,6 +668,7 @@ void MPDParseUtils::parseDirItems(const QByteArray &data, const QString &mpdDir,
DBUG << "Original files:" << origFiles.keys();
bool setTimeFromSource=origFiles.size()==cueSongs.size();
DBUG << "setTimeFromSource" << setTimeFromSource << "at" << albumTime << "#c" << cueFiles.size();
quint32 usedAlbumTime=0;
foreach (const Song &orig, cueSongs) {
Song s=orig;
@@ -696,6 +697,7 @@ void MPDParseUtils::parseDirItems(const QByteArray &data, const QString &mpdDir,
if (0==s.time && setTimeFromSource) {
s.time=albumSong.time;
} else if (0!=albumTime && 1==cueFiles.size()) {
DBUG << s.title << s.time << albumTime << usedAlbumTime;
// Try to set duration of last track by subtracting previous track durations from album duration...
if (0==s.time) {
s.time=albumTime-usedAlbumTime;
@@ -703,6 +705,7 @@ void MPDParseUtils::parseDirItems(const QByteArray &data, const QString &mpdDir,
usedAlbumTime+=s.time;
}
}
DBUG << s.title << s.time;
fixedCueSongs.append(s);
}
canUseCueFileTracks=true;
@@ -726,7 +729,7 @@ void MPDParseUtils::parseDirItems(const QByteArray &data, const QString &mpdDir,
}
if (canUseCueFileTracks) {
songs=cueSongs;
songs = fixedCueSongs;
}
continue;
}