Fix bug in covermanager not saving album cover to DB. (#6011)

* Fix bug in covermanager not saving album cover to DB.
This commit is contained in:
Jonas Kvinge 2018-03-04 15:13:34 +01:00 committed by John Maguire
parent 1732e56fe6
commit c9d954f8a3
2 changed files with 4 additions and 4 deletions

View File

@ -967,7 +967,7 @@ void LibraryBackend::UpdateManualAlbumArt(const QString& artist,
query.SetColumnSpec("ROWID, " + Song::kColumnSpec);
query.AddWhere("album", album);
if (!albumartist.isNull()) {
if (!albumartist.isNull() && !albumartist.isEmpty()) {
query.AddWhere("albumartist", albumartist);
} else if (!artist.isNull()) {
query.AddWhere("artist", artist);
@ -987,7 +987,7 @@ void LibraryBackend::UpdateManualAlbumArt(const QString& artist,
QString(
"UPDATE %1 SET art_manual = :art"
" WHERE album = :album AND unavailable = 0").arg(songs_table_));
if (!albumartist.isNull()) {
if (!albumartist.isNull() && !albumartist.isEmpty()) {
sql += " AND albumartist = :albumartist";
} else if (!artist.isNull()) {
sql += " AND artist = :artist";
@ -996,7 +996,7 @@ void LibraryBackend::UpdateManualAlbumArt(const QString& artist,
QSqlQuery q(sql, db);
q.bindValue(":art", art);
q.bindValue(":album", album);
if (!albumartist.isNull()) {
if (!albumartist.isNull() && !albumartist.isEmpty()) {
q.bindValue(":albumartist", albumartist);
} else if (!artist.isNull()) {
q.bindValue(":artist", artist);

View File

@ -750,7 +750,7 @@ void AlbumCoverManager::LoadSelectedToPlaylist() {
void AlbumCoverManager::SaveAndSetCover(QListWidgetItem* item,
const QImage& image) {
const QString artist = item->data(Role_ArtistName).toString();
const QString albumartist = item->data(Role_ArtistName).toString();
const QString albumartist = item->data(Role_AlbumArtistName).toString();
const QString album = item->data(Role_AlbumName).toString();
QString path =