Fix GetSongByUrl incorrectly using bytearray instead of string

This commit is contained in:
Jonas Kvinge 2019-03-22 23:14:25 +01:00
parent 7ae0f5e246
commit 71969b88e3
1 changed files with 10 additions and 2 deletions

View File

@ -659,6 +659,7 @@ SongList CollectionBackend::GetSongsById(const QStringList &ids) {
} }
SongList CollectionBackend::GetSongsByForeignId(const QStringList &ids, const QString &table, const QString &column) { SongList CollectionBackend::GetSongsByForeignId(const QStringList &ids, const QString &table, const QString &column) {
QMutexLocker l(db_->Mutex()); QMutexLocker l(db_->Mutex());
QSqlDatabase db(db_->Connect()); QSqlDatabase db(db_->Connect());
@ -678,6 +679,7 @@ SongList CollectionBackend::GetSongsByForeignId(const QStringList &ids, const QS
ret[index].InitFromQuery(q, true); ret[index].InitFromQuery(q, true);
} }
return ret.toList(); return ret.toList();
} }
Song CollectionBackend::GetSongById(int id, QSqlDatabase &db) { Song CollectionBackend::GetSongById(int id, QSqlDatabase &db) {
@ -687,6 +689,7 @@ Song CollectionBackend::GetSongById(int id, QSqlDatabase &db) {
} }
SongList CollectionBackend::GetSongsById(const QStringList &ids, QSqlDatabase &db) { SongList CollectionBackend::GetSongsById(const QStringList &ids, QSqlDatabase &db) {
QString in = ids.join(","); QString in = ids.join(",");
QSqlQuery q(db); QSqlQuery q(db);
@ -701,12 +704,14 @@ SongList CollectionBackend::GetSongsById(const QStringList &ids, QSqlDatabase &d
ret << song; ret << song;
} }
return ret; return ret;
} }
Song CollectionBackend::GetSongByUrl(const QUrl &url, qint64 beginning) { Song CollectionBackend::GetSongByUrl(const QUrl &url, qint64 beginning) {
CollectionQuery query; CollectionQuery query;
query.SetColumnSpec("%songs_table.ROWID, " + Song::kColumnSpec); query.SetColumnSpec("%songs_table.ROWID, " + Song::kColumnSpec);
query.AddWhere("filename", url.toEncoded()); query.AddWhere("filename", url.toString());
query.AddWhere("beginning", beginning); query.AddWhere("beginning", beginning);
Song song; Song song;
@ -714,12 +719,14 @@ Song CollectionBackend::GetSongByUrl(const QUrl &url, qint64 beginning) {
song.InitFromQuery(query, true); song.InitFromQuery(query, true);
} }
return song; return song;
} }
SongList CollectionBackend::GetSongsByUrl(const QUrl &url) { SongList CollectionBackend::GetSongsByUrl(const QUrl &url) {
CollectionQuery query; CollectionQuery query;
query.SetColumnSpec("%songs_table.ROWID, " + Song::kColumnSpec); query.SetColumnSpec("%songs_table.ROWID, " + Song::kColumnSpec);
query.AddWhere("filename", url.toEncoded()); query.AddWhere("filename", url.toString());
SongList songlist; SongList songlist;
if (ExecQuery(&query)) { if (ExecQuery(&query)) {
@ -730,6 +737,7 @@ SongList CollectionBackend::GetSongsByUrl(const QUrl &url) {
} }
} }
return songlist; return songlist;
} }
CollectionBackend::AlbumList CollectionBackend::GetCompilationAlbums(const QueryOptions &opt) { CollectionBackend::AlbumList CollectionBackend::GetCompilationAlbums(const QueryOptions &opt) {