mirror of
https://github.com/strawberrymusicplayer/strawberry
synced 2025-02-01 10:06:43 +01:00
Declare song using source
This commit is contained in:
parent
c4f7054ca6
commit
1862e70628
@ -350,7 +350,7 @@ SongList CollectionBackend::FindSongsInDirectory(int id) {
|
||||
|
||||
SongList ret;
|
||||
while (q.next()) {
|
||||
Song song;
|
||||
Song song(source_);
|
||||
song.InitFromQuery(q, true);
|
||||
ret << song;
|
||||
}
|
||||
@ -698,7 +698,7 @@ SongList CollectionBackend::ExecCollectionQuery(CollectionQuery *query) {
|
||||
|
||||
SongList ret;
|
||||
while (query->Next()) {
|
||||
Song song;
|
||||
Song song(source_);
|
||||
song.InitFromQuery(*query, true);
|
||||
ret << song;
|
||||
}
|
||||
@ -772,7 +772,7 @@ SongList CollectionBackend::GetSongsById(const QStringList &ids, QSqlDatabase &d
|
||||
|
||||
SongList ret;
|
||||
while (q.next()) {
|
||||
Song song;
|
||||
Song song(source_);
|
||||
song.InitFromQuery(q, true);
|
||||
ret << song;
|
||||
}
|
||||
@ -787,7 +787,7 @@ Song CollectionBackend::GetSongByUrl(const QUrl &url, qint64 beginning) {
|
||||
query.AddWhere("url", url.toString());
|
||||
query.AddWhere("beginning", beginning);
|
||||
|
||||
Song song;
|
||||
Song song(source_);
|
||||
if (ExecQuery(&query) && query.Next()) {
|
||||
song.InitFromQuery(query, true);
|
||||
}
|
||||
@ -804,7 +804,7 @@ SongList CollectionBackend::GetSongsByUrl(const QUrl &url) {
|
||||
SongList songlist;
|
||||
if (ExecQuery(&query)) {
|
||||
while (query.Next()) {
|
||||
Song song;
|
||||
Song song(source_);
|
||||
song.InitFromQuery(query, true);
|
||||
songlist << song;
|
||||
}
|
||||
@ -856,7 +856,7 @@ SongList CollectionBackend::GetSongsBySongId(const QStringList &song_ids, QSqlDa
|
||||
|
||||
SongList ret;
|
||||
while (q.next()) {
|
||||
Song song;
|
||||
Song song(source_);
|
||||
song.InitFromQuery(q, true);
|
||||
ret << song;
|
||||
}
|
||||
@ -880,7 +880,7 @@ SongList CollectionBackend::GetCompilationSongs(const QString &album, const Quer
|
||||
|
||||
SongList ret;
|
||||
while (query.Next()) {
|
||||
Song song;
|
||||
Song song(source_);
|
||||
song.InitFromQuery(query, true);
|
||||
ret << song;
|
||||
}
|
||||
@ -967,7 +967,7 @@ void CollectionBackend::UpdateCompilations(QSqlQuery &find_song, QSqlQuery &upda
|
||||
find_song.bindValue(":compilation_detected", int(!compilation_detected));
|
||||
find_song.exec();
|
||||
while (find_song.next()) {
|
||||
Song song(Song::Source_Collection);
|
||||
Song song(source_);
|
||||
song.InitFromQuery(find_song, true);
|
||||
deleted_songs << song;
|
||||
song.set_compilation_detected(compilation_detected);
|
||||
@ -1102,7 +1102,7 @@ void CollectionBackend::UpdateManualAlbumArt(const QString &artist, const QStrin
|
||||
|
||||
SongList deleted_songs;
|
||||
while (query.Next()) {
|
||||
Song song;
|
||||
Song song(source_);
|
||||
song.InitFromQuery(query, true);
|
||||
deleted_songs << song;
|
||||
}
|
||||
@ -1136,7 +1136,7 @@ void CollectionBackend::UpdateManualAlbumArt(const QString &artist, const QStrin
|
||||
|
||||
SongList added_songs;
|
||||
while (query.Next()) {
|
||||
Song song;
|
||||
Song song(source_);
|
||||
song.InitFromQuery(query, true);
|
||||
added_songs << song;
|
||||
}
|
||||
@ -1164,7 +1164,7 @@ void CollectionBackend::ForceCompilation(const QString &album, const QList<QStri
|
||||
if (!ExecQuery(&query)) return;
|
||||
|
||||
while (query.Next()) {
|
||||
Song song;
|
||||
Song song(source_);
|
||||
song.InitFromQuery(query, true);
|
||||
deleted_songs << song;
|
||||
}
|
||||
@ -1187,7 +1187,7 @@ void CollectionBackend::ForceCompilation(const QString &album, const QList<QStri
|
||||
if (!ExecQuery(&query)) return;
|
||||
|
||||
while (query.Next()) {
|
||||
Song song;
|
||||
Song song(source_);
|
||||
song.InitFromQuery(query, true);
|
||||
added_songs << song;
|
||||
}
|
||||
|
@ -167,7 +167,7 @@ SongLoader::Result SongLoader::LoadLocalPartial(const QString &filename) {
|
||||
LoadLocalDirectory(filename);
|
||||
return Success;
|
||||
}
|
||||
Song song;
|
||||
Song song(Song::Source_LocalFile);
|
||||
song.InitFromFilePartial(filename);
|
||||
if (song.is_valid()) {
|
||||
songs_ << song;
|
||||
@ -228,7 +228,7 @@ SongLoader::Result SongLoader::LoadLocal(const QString &filename) {
|
||||
if (collection_->ExecQuery(&query) && query.Next()) {
|
||||
// We may have many results when the file has many sections
|
||||
do {
|
||||
Song song;
|
||||
Song song(Song::Source_LocalFile);
|
||||
song.InitFromQuery(query, true);
|
||||
|
||||
if (song.is_valid()) {
|
||||
@ -289,7 +289,7 @@ SongLoader::Result SongLoader::LoadLocalAsync(const QString &filename) {
|
||||
}
|
||||
|
||||
// Assume it's just a normal file
|
||||
Song song;
|
||||
Song song(Song::Source_LocalFile);
|
||||
song.InitFromFilePartial(filename);
|
||||
if (song.is_valid()) {
|
||||
songs_ << song;
|
||||
|
@ -107,10 +107,9 @@ void CddaSongLoader::LoadSongs() {
|
||||
SongList songs;
|
||||
for (int track_number = 1; track_number <= num_tracks; track_number++) {
|
||||
// Init song
|
||||
Song song;
|
||||
Song song(Song::Source_CDDA);
|
||||
song.set_id(track_number);
|
||||
song.set_valid(true);
|
||||
song.set_source(Song::Source_CDDA);
|
||||
song.set_filetype(Song::FileType_CDDA);
|
||||
song.set_url(GetUrlFromTrack(track_number));
|
||||
song.set_title(QString("Track %1").arg(track_number));
|
||||
@ -200,7 +199,7 @@ void CddaSongLoader::AudioCDTagsLoaded(const QString &artist, const QString &alb
|
||||
if (results.empty()) return;
|
||||
int track_number = 1;
|
||||
for (const MusicBrainzClient::Result &ret : results) {
|
||||
Song song;
|
||||
Song song(Song::Source_CDDA);
|
||||
song.set_artist(artist);
|
||||
song.set_album(album);
|
||||
song.set_title(ret.title_);
|
||||
@ -208,7 +207,6 @@ void CddaSongLoader::AudioCDTagsLoaded(const QString &artist, const QString &alb
|
||||
song.set_track(track_number);
|
||||
song.set_year(ret.year_);
|
||||
song.set_id(track_number);
|
||||
song.set_source(Song::Source_CDDA);
|
||||
song.set_filetype(Song::FileType_CDDA);
|
||||
song.set_valid(true);
|
||||
// We need to set url: that's how playlist will find the correct item to update
|
||||
|
@ -876,7 +876,7 @@ void QobuzRequest::SongsReceived(QNetworkReply *reply, const qint64 artist_id_re
|
||||
QJsonObject json_obj = value.toObject();
|
||||
|
||||
++songs_received;
|
||||
Song song;
|
||||
Song song(Song::Source_Qobuz);
|
||||
ParseSong(song, json_obj, artist_id, album_id, album_artist, album, cover_url);
|
||||
if (!song.is_valid()) continue;
|
||||
if (song.disc() >= 2) multidisc = true;
|
||||
|
@ -435,7 +435,7 @@ void SubsonicRequest::AlbumSongsReplyReceived(QNetworkReply *reply, const qint64
|
||||
QJsonObject json_obj = value.toObject();
|
||||
|
||||
++songs_received;
|
||||
Song song;
|
||||
Song song(Song::Source_Subsonic);
|
||||
ParseSong(song, json_obj, artist_id, album_id, album_artist);
|
||||
if (!song.is_valid()) continue;
|
||||
if (song.disc() >= 2) multidisc = true;
|
||||
|
@ -834,7 +834,7 @@ void TidalRequest::SongsReceived(QNetworkReply *reply, const qint64 artist_id, c
|
||||
}
|
||||
|
||||
++songs_received;
|
||||
Song song;
|
||||
Song song(Song::Source_Tidal);
|
||||
ParseSong(song, json_obj, artist_id, album_id, album_artist);
|
||||
if (!song.is_valid()) continue;
|
||||
if (song.disc() >= 2) multidisc = true;
|
||||
|
Loading…
x
Reference in New Issue
Block a user