Last.fm last played date import: change date if it is newer than the … (#625)

* Last.fm last played date import: change date if it is newer than the one in database

* Last.fm lastplayed: make it more consistent with the code
This commit is contained in:
Edgar Salgado 2021-01-04 19:43:43 +00:00 committed by GitHub
parent b4c2ae251b
commit 18a67e1f20
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 0 deletions

View File

@ -1380,6 +1380,9 @@ void CollectionBackend::UpdateLastPlayed(const QString &artist, const QString &a
QSqlDatabase db(db_->Connect());
for (const Song &song : songs) {
if (song.lastplayed() >= lastplayed) {
continue;
}
QSqlQuery q(db);
q.prepare(QString("UPDATE %1 SET lastplayed = :lastplayed WHERE ROWID = :id").arg(songs_table_));
q.bindValue(":lastplayed", lastplayed);