mirror of
https://github.com/strawberrymusicplayer/strawberry
synced 2025-01-08 06:14:10 +01:00
parent
384e7dedb5
commit
3d4c98d981
@ -400,7 +400,7 @@ bool Playlist::setData(const QModelIndex &idx, const QVariant &value, int role)
|
|||||||
QPersistentModelIndex persistent_index = QPersistentModelIndex(idx);
|
QPersistentModelIndex persistent_index = QPersistentModelIndex(idx);
|
||||||
QObject::connect(reply, &TagReaderReply::Finished, this, [this, reply, persistent_index, item]() { SongSaveComplete(reply, persistent_index, item->OriginalMetadata()); }, Qt::QueuedConnection);
|
QObject::connect(reply, &TagReaderReply::Finished, this, [this, reply, persistent_index, item]() { SongSaveComplete(reply, persistent_index, item->OriginalMetadata()); }, Qt::QueuedConnection);
|
||||||
}
|
}
|
||||||
else if (song.source() == Song::Source_Stream) {
|
else if (song.is_radio()) {
|
||||||
item->SetMetadata(song);
|
item->SetMetadata(song);
|
||||||
ScheduleSave();
|
ScheduleSave();
|
||||||
}
|
}
|
||||||
@ -1135,11 +1135,21 @@ void Playlist::InsertSongsOrCollectionItems(const SongList &songs, const int pos
|
|||||||
|
|
||||||
PlaylistItemList items;
|
PlaylistItemList items;
|
||||||
for (const Song &song : songs) {
|
for (const Song &song : songs) {
|
||||||
if (song.is_collection_song()) {
|
if (song.url().isLocalFile()) {
|
||||||
items << std::make_shared<CollectionPlaylistItem>(song);
|
if (song.is_collection_song()) {
|
||||||
|
items << std::make_shared<CollectionPlaylistItem>(song);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
items << std::make_shared<SongPlaylistItem>(song);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
items << std::make_shared<SongPlaylistItem>(song);
|
if (song.is_radio()) {
|
||||||
|
items << std::make_shared<RadioPlaylistItem>(song);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
items << std::make_shared<InternetPlaylistItem>(song);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
InsertItems(items, pos, play_now, enqueue, enqueue_next);
|
InsertItems(items, pos, play_now, enqueue, enqueue_next);
|
||||||
@ -1188,13 +1198,23 @@ void Playlist::UpdateItems(SongList songs) {
|
|||||||
const PlaylistItemPtr &item = items_[i];
|
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 || !item->Metadata().init_from_file())) {
|
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;
|
PlaylistItemPtr new_item;
|
||||||
if (song.is_collection_song()) {
|
if (song.url().isLocalFile()) {
|
||||||
new_item = std::make_shared<CollectionPlaylistItem>(song);
|
if (song.is_collection_song()) {
|
||||||
if (collection_items_by_id_.contains(song.id(), item)) collection_items_by_id_.remove(song.id(), item);
|
new_item = std::make_shared<CollectionPlaylistItem>(song);
|
||||||
collection_items_by_id_.insert(song.id(), new_item);
|
if (collection_items_by_id_.contains(song.id(), item)) collection_items_by_id_.remove(song.id(), item);
|
||||||
|
collection_items_by_id_.insert(song.id(), new_item);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
new_item = std::make_shared<SongPlaylistItem>(song);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
new_item = std::make_shared<SongPlaylistItem>(song);
|
if (song.is_radio()) {
|
||||||
|
new_item = std::make_shared<RadioPlaylistItem>(song);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
new_item = std::make_shared<InternetPlaylistItem>(song);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
items_[i] = new_item;
|
items_[i] = new_item;
|
||||||
emit dataChanged(index(i, 0), index(i, ColumnCount - 1));
|
emit dataChanged(index(i, 0), index(i, ColumnCount - 1));
|
||||||
|
Loading…
Reference in New Issue
Block a user