1
0
mirror of https://github.com/strawberrymusicplayer/strawberry synced 2024-12-23 23:11:19 +01:00

Fix bug in albumcovermanager not updating album cover in DB.

This commit is contained in:
Jonas Kvinge 2018-03-04 03:10:07 +01:00
parent 438bac9357
commit b7466b7fb1
4 changed files with 48 additions and 46 deletions

View File

@ -856,11 +856,11 @@ CollectionBackend::AlbumList CollectionBackend::GetAlbums(const QString &artist,
if (compilation) { if (compilation) {
query.AddCompilationRequirement(true); query.AddCompilationRequirement(true);
} }
else if (!album_artist.isNull()) { else if (!album_artist.isNull() && !album_artist.isEmpty()) {
query.AddCompilationRequirement(false); query.AddCompilationRequirement(false);
query.AddWhere("albumartist", album_artist); query.AddWhere("albumartist", album_artist);
} }
else if (!artist.isNull()) { else if (!artist.isNull() && !artist.isEmpty()) {
query.AddCompilationRequirement(false); query.AddCompilationRequirement(false);
query.AddWhere("artist", artist); query.AddWhere("artist", artist);
} }
@ -944,7 +944,7 @@ void CollectionBackend::UpdateManualAlbumArt(const QString &artist, const QStrin
query.SetColumnSpec("ROWID, " + Song::kColumnSpec); query.SetColumnSpec("ROWID, " + Song::kColumnSpec);
query.AddWhere("album", album); query.AddWhere("album", album);
if (!albumartist.isNull()) { if (!albumartist.isNull() && !albumartist.isEmpty()) {
query.AddWhere("albumartist", albumartist); query.AddWhere("albumartist", albumartist);
} }
else if (!artist.isNull()) { else if (!artist.isNull()) {
@ -963,7 +963,7 @@ void CollectionBackend::UpdateManualAlbumArt(const QString &artist, const QStrin
// Update the songs // Update the songs
QString sql(QString("UPDATE %1 SET art_manual = :art WHERE album = :album AND unavailable = 0").arg(songs_table_)); QString sql(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"; sql += " AND albumartist = :albumartist";
} }
else if (!artist.isNull()) { else if (!artist.isNull()) {
@ -974,7 +974,7 @@ void CollectionBackend::UpdateManualAlbumArt(const QString &artist, const QStrin
q.prepare(sql); q.prepare(sql);
q.bindValue(":art", art); q.bindValue(":art", art);
q.bindValue(":album", album); q.bindValue(":album", album);
if (!albumartist.isNull()) { if (!albumartist.isNull() && !albumartist.isEmpty()) {
q.bindValue(":albumartist", albumartist); q.bindValue(":albumartist", albumartist);
} }
else if (!artist.isNull()) { else if (!artist.isNull()) {
@ -1012,7 +1012,7 @@ void CollectionBackend::ForceCompilation(const QString &album, const QList<QStri
CollectionQuery query; CollectionQuery query;
query.SetColumnSpec("ROWID, " + Song::kColumnSpec); query.SetColumnSpec("ROWID, " + Song::kColumnSpec);
query.AddWhere("album", album); query.AddWhere("album", album);
if (!artist.isNull()) query.AddWhere("artist", artist); if (!artist.isNull() && !artist.isEmpty()) query.AddWhere("artist", artist);
if (!ExecQuery(&query)) return; if (!ExecQuery(&query)) return;

View File

@ -762,7 +762,7 @@ void AlbumCoverManager::LoadSelectedToPlaylist() {
void AlbumCoverManager::SaveAndSetCover(QListWidgetItem *item, const QImage &image) { void AlbumCoverManager::SaveAndSetCover(QListWidgetItem *item, const QImage &image) {
const QString artist = item->data(Role_ArtistName).toString(); 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(); const QString album = item->data(Role_AlbumName).toString();
QString path = album_cover_choice_controller_->SaveCoverInCache(artist, album, image); QString path = album_cover_choice_controller_->SaveCoverInCache(artist, album, image);

View File

@ -23,6 +23,8 @@
#include "ui_backendsettingspage.h" #include "ui_backendsettingspage.h"
#include <QVariant> #include <QVariant>
#include <QString>
#include <QSettings>
#include <QMessageBox> #include <QMessageBox>
#include <QErrorMessage> #include <QErrorMessage>