Improve handling of song source
This commit is contained in:
@@ -245,12 +245,13 @@ PlaylistItemPtr PlaylistBackend::RestoreCueData(PlaylistItemPtr item, std::share
|
||||
|
||||
song_list = cue_parser.Load(&cue, cue_path, QDir(cue_path.section('/', 0, -2)));
|
||||
state->cached_cues_[cue_path] = song_list;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
song_list = state->cached_cues_[cue_path];
|
||||
}
|
||||
}
|
||||
|
||||
for (const Song& from_list : song_list) {
|
||||
for (const Song &from_list : song_list) {
|
||||
if (from_list.url().toEncoded() == song.url().toEncoded() && from_list.beginning_nanosec() == song.beginning_nanosec()) {
|
||||
// we found a matching section; replace the input item with a new one containing CUE metadata
|
||||
return PlaylistItemPtr(new SongPlaylistItem(from_list));
|
||||
|
||||
@@ -45,7 +45,7 @@ PlaylistItem::~PlaylistItem() {}
|
||||
PlaylistItem *PlaylistItem::NewFromSource(const Song::Source &source) {
|
||||
|
||||
switch (source) {
|
||||
case Song::Source_Collection: return new CollectionPlaylistItem(source);
|
||||
case Song::Source_Collection: return new CollectionPlaylistItem();
|
||||
case Song::Source_Tidal:
|
||||
case Song::Source_Stream: return new InternetPlaylistItem(source);
|
||||
default: return new SongPlaylistItem(source);
|
||||
@@ -65,7 +65,7 @@ PlaylistItem *PlaylistItem::NewFromSongsTable(const QString &table, const Song &
|
||||
|
||||
void PlaylistItem::BindToQuery(QSqlQuery *query) const {
|
||||
|
||||
query->bindValue(":type", source());
|
||||
query->bindValue(":type", source_);
|
||||
query->bindValue(":collection_id", DatabaseValue(Column_CollectionId));
|
||||
|
||||
DatabaseSongMetadata().BindToQuery(query);
|
||||
|
||||
@@ -30,9 +30,7 @@
|
||||
#include "songplaylistitem.h"
|
||||
|
||||
SongPlaylistItem::SongPlaylistItem(const Song::Source &source) : PlaylistItem(source) {}
|
||||
|
||||
SongPlaylistItem::SongPlaylistItem(const Song &song)
|
||||
: PlaylistItem(Song::Source_LocalFile), song_(song) {}
|
||||
SongPlaylistItem::SongPlaylistItem(const Song &song) : PlaylistItem(song.source()), song_(song) {}
|
||||
|
||||
bool SongPlaylistItem::InitFromQuery(const SqlRow &query) {
|
||||
song_.InitFromQuery(query, false, (Song::kColumns.count()+1));
|
||||
|
||||
Reference in New Issue
Block a user