Commit 4dfbbccb authored by Matthieu Gallien's avatar Matthieu Gallien 🎵
Browse files

always restore local files that still exists in playlist

ensure we do not loose tracks in playlist that have a local file as URL
parent 28588557
Pipeline #109445 passed with stage
in 17 seconds
......@@ -336,15 +336,23 @@ void MediaPlayList::enqueueRestoredEntries(const QVariantList &newEntries)
if (newEntry.mEntryType == ElisaUtils::Radio) {
Q_EMIT newEntryInList(newEntry.mId, {}, ElisaUtils::Radio);
} else if (newEntry.mTitle.toString().isEmpty() && newEntry.mTrackUrl.isValid()) {
} else if (newEntry.mTrackUrl.isValid()) {
auto entryURL = newEntry.mTrackUrl.toUrl();
if (entryURL.isLocalFile()) {
auto entryString = entryURL.toLocalFile();
QFileInfo newTrackFile(entryString);
if (newTrackFile.exists()) {
d->mData.last().mIsValid = true;
Q_EMIT newEntryInList(0, entryString, ElisaUtils::FileName);
} else if (newEntry.mTitle.toString().isEmpty()) {
Q_EMIT newEntryInList(0, entryString, ElisaUtils::FileName);
} else {
Q_EMIT newTrackByNameInList(newEntry.mTitle,
newEntry.mArtist,
newEntry.mAlbum,
newEntry.mTrackNumber,
newEntry.mDiscNumber);
}
Q_EMIT newEntryInList(0, entryString, ElisaUtils::FileName);
} else {
d->mData.last().mIsValid = true;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment