diff --git a/src/collection/collection.cpp b/src/collection/collection.cpp index f1a616168..919db09ad 100644 --- a/src/collection/collection.cpp +++ b/src/collection/collection.cpp @@ -110,7 +110,7 @@ void SCollection::Init() { connect(app_->playlist_manager(), SIGNAL(CurrentSongChanged(Song)), SLOT(CurrentSongChanged(Song))); connect(app_->player(), SIGNAL(Stopped()), SLOT(Stopped())); - connect(app_->lastfm_import(), SIGNAL(UpdateLastPlayed(QString, QString, QString, int)), backend_, SLOT(UpdateLastPlayed(QString, QString, QString, int))); + connect(app_->lastfm_import(), SIGNAL(UpdateLastPlayed(QString, QString, QString, qint64)), backend_, SLOT(UpdateLastPlayed(QString, QString, QString, qint64))); connect(app_->lastfm_import(), SIGNAL(UpdatePlayCount(QString, QString, int)), backend_, SLOT(UpdatePlayCount(QString, QString, int))); // This will start the watcher checking for updates diff --git a/src/collection/collectionbackend.cpp b/src/collection/collectionbackend.cpp index d7975a45a..83f1afa7d 100644 --- a/src/collection/collectionbackend.cpp +++ b/src/collection/collectionbackend.cpp @@ -1368,7 +1368,7 @@ SongList CollectionBackend::GetSongsBy(const QString &artist, const QString &alb } -void CollectionBackend::UpdateLastPlayed(const QString &artist, const QString &album, const QString &title, const int lastplayed) { +void CollectionBackend::UpdateLastPlayed(const QString &artist, const QString &album, const QString &title, const qint64 lastplayed) { SongList songs = GetSongsBy(artist, album, title); if (songs.isEmpty()) { diff --git a/src/collection/collectionbackend.h b/src/collection/collectionbackend.h index 6ba823da5..0403ef336 100644 --- a/src/collection/collectionbackend.h +++ b/src/collection/collectionbackend.h @@ -213,7 +213,7 @@ class CollectionBackend : public CollectionBackendInterface { void SongPathChanged(const Song &song, const QFileInfo &new_file); SongList GetSongsBy(const QString &artist, const QString &album, const QString &title); - void UpdateLastPlayed(const QString &artist, const QString &album, const QString &title, const int lastplayed); + void UpdateLastPlayed(const QString &artist, const QString &album, const QString &title, const qint64 lastplayed); void UpdatePlayCount(const QString &artist, const QString &title, const int playcount); void UpdateSongRating(const int id, const float rating); diff --git a/src/scrobbler/lastfmimport.cpp b/src/scrobbler/lastfmimport.cpp index 637428aca..7f475cb31 100644 --- a/src/scrobbler/lastfmimport.cpp +++ b/src/scrobbler/lastfmimport.cpp @@ -389,6 +389,8 @@ void LastFMImport::GetRecentTracksRequestFinished(QNetworkReply *reply, const in QString title = obj_track["name"].toString(); QDateTime datetime = QDateTime::fromString(date, "dd MMM yyyy, hh:mm"); + if (!datetime.isValid()) continue; + emit UpdateLastPlayed(artist, album, title, datetime.toSecsSinceEpoch()); UpdateProgress(); diff --git a/src/scrobbler/lastfmimport.h b/src/scrobbler/lastfmimport.h index 9ed60a194..c1aa6df34 100644 --- a/src/scrobbler/lastfmimport.h +++ b/src/scrobbler/lastfmimport.h @@ -80,7 +80,7 @@ class LastFMImport : public QObject { signals: void UpdatePlayCount(QString, QString, int); - void UpdateLastPlayed(QString, QString, QString, int); + void UpdateLastPlayed(QString, QString, QString, qint64); void UpdateTotal(int, int); void UpdateProgress(int, int); void Finished();