Fix async song load

Fixes #739
This commit is contained in:
Jonas Kvinge 2021-07-28 22:25:33 +02:00
parent 62a5031ccf
commit 553e8baa8b
4 changed files with 4 additions and 2 deletions

View File

@ -367,6 +367,7 @@ bool Song::save_embedded_cover_supported(const FileType filetype) {
const QUrl &Song::stream_url() const { return d->stream_url_; }
const QUrl &Song::effective_stream_url() const { return !d->stream_url_.isEmpty() && d->stream_url_.isValid() ? d->stream_url_ : d->url_; }
const QImage &Song::image() const { return d->image_; }
bool Song::init_from_file() const { return d->init_from_file_; }
const QString &Song::cue_path() const { return d->cue_path_; }
bool Song::has_cue() const { return !d->cue_path_.isEmpty(); }

View File

@ -294,6 +294,7 @@ class Song {
const QUrl &stream_url() const;
const QUrl &effective_stream_url() const;
const QImage &image() const;
bool init_from_file() const;
// Pretty accessors
QString PrettyTitle() const;

View File

@ -339,7 +339,7 @@ void SongLoader::EffectiveSongLoad(Song *song) {
if (!song) return;
if (song->filetype() != Song::FileType_Unknown) {
if (song->init_from_file() && song->filetype() != Song::FileType_Unknown) {
// Maybe we loaded the metadata already, for example from a cuesheet.
return;
}

View File

@ -1190,7 +1190,7 @@ void Playlist::UpdateItems(SongList songs) {
while (it.hasNext()) {
const Song &song = it.next();
const PlaylistItemPtr &item = items_[i];
if (item->Metadata().url() == song.url() && (item->Metadata().filetype() == Song::FileType_Unknown || item->Metadata().filetype() == Song::FileType_Stream || item->Metadata().filetype() == Song::FileType_CDDA)) {
if (item->Metadata().url() == song.url() && (item->Metadata().filetype() == Song::FileType_Unknown || item->Metadata().filetype() == Song::FileType_Stream || item->Metadata().filetype() == Song::FileType_CDDA || !item->Metadata().init_from_file())) {
PlaylistItemPtr new_item;
if (song.is_collection_song()) {
new_item = std::make_shared<CollectionPlaylistItem>(song);