Fix updating play and skip count
This commit is contained in:
parent
dffc46551e
commit
40db9f7020
|
@ -91,6 +91,7 @@ void SCollection::Init() {
|
|||
connect(watcher_, SIGNAL(SubdirsDiscovered(SubdirectoryList)), backend_, SLOT(AddOrUpdateSubdirs(SubdirectoryList)));
|
||||
connect(watcher_, SIGNAL(SubdirsMTimeUpdated(SubdirectoryList)), backend_, SLOT(AddOrUpdateSubdirs(SubdirectoryList)));
|
||||
connect(watcher_, SIGNAL(CompilationsNeedUpdating()), backend_, SLOT(UpdateCompilations()));
|
||||
connect(backend_, SIGNAL(SongsStatisticsChanged(SongList)), SLOT(SongsStatisticsChanged(SongList)));
|
||||
connect(app_->playlist_manager(), SIGNAL(CurrentSongChanged(Song)), SLOT(CurrentSongChanged(Song)));
|
||||
connect(app_->player(), SIGNAL(Stopped()), SLOT(Stopped()));
|
||||
|
||||
|
@ -126,3 +127,6 @@ void SCollection::CurrentSongChanged(const Song &song) { // FIXME
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
void SCollection::SongsStatisticsChanged(const SongList &songs) {
|
||||
}
|
||||
|
|
|
@ -71,6 +71,7 @@ class SCollection : public QObject {
|
|||
void IncrementalScan();
|
||||
|
||||
void CurrentSongChanged(const Song &song);
|
||||
void SongsStatisticsChanged(const SongList& songs);
|
||||
void Stopped();
|
||||
|
||||
private:
|
||||
|
|
|
@ -1068,6 +1068,7 @@ bool CollectionBackend::ExecQuery(CollectionQuery *q) {
|
|||
}
|
||||
|
||||
void CollectionBackend::IncrementPlayCount(int id) {
|
||||
|
||||
if (id == -1) return;
|
||||
|
||||
QMutexLocker l(db_->Mutex());
|
||||
|
@ -1081,6 +1082,7 @@ void CollectionBackend::IncrementPlayCount(int id) {
|
|||
if (db_->CheckErrors(q)) return;
|
||||
|
||||
Song new_song = GetSongById(id, db);
|
||||
emit SongsStatisticsChanged(SongList() << new_song);
|
||||
|
||||
}
|
||||
|
||||
|
@ -1098,6 +1100,7 @@ void CollectionBackend::IncrementSkipCount(int id, float progress) {
|
|||
if (db_->CheckErrors(q)) return;
|
||||
|
||||
Song new_song = GetSongById(id, db);
|
||||
emit SongsStatisticsChanged(SongList() << new_song);
|
||||
|
||||
}
|
||||
|
||||
|
@ -1115,6 +1118,7 @@ void CollectionBackend::ResetStatistics(int id) {
|
|||
if (db_->CheckErrors(q)) return;
|
||||
|
||||
Song new_song = GetSongById(id, db);
|
||||
emit SongsStatisticsChanged(SongList() << new_song);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -202,6 +202,7 @@ signals:
|
|||
|
||||
void SongsDiscovered(const SongList &songs);
|
||||
void SongsDeleted(const SongList &songs);
|
||||
void SongsStatisticsChanged(const SongList& songs);
|
||||
|
||||
void DatabaseReset();
|
||||
|
||||
|
|
|
@ -121,6 +121,7 @@ CollectionModel::CollectionModel(CollectionBackend *backend, Application *app, Q
|
|||
connect(backend_, SIGNAL(TotalSongCountUpdated(int)), SLOT(TotalSongCountUpdatedSlot(int)));
|
||||
connect(backend_, SIGNAL(TotalArtistCountUpdated(int)), SLOT(TotalArtistCountUpdatedSlot(int)));
|
||||
connect(backend_, SIGNAL(TotalAlbumCountUpdated(int)), SLOT(TotalAlbumCountUpdatedSlot(int)));
|
||||
connect(backend_, SIGNAL(SongsStatisticsChanged(SongList)), SLOT(SongsSlightlyChanged(SongList)));
|
||||
|
||||
backend_->UpdateTotalSongCountAsync();
|
||||
backend_->UpdateTotalArtistCountAsync();
|
||||
|
|
|
@ -380,7 +380,7 @@ void Player::TrackEnded() {
|
|||
if (HandleStopAfter()) return;
|
||||
|
||||
if (current_item_ && current_item_->IsLocalCollectionItem() && current_item_->Metadata().id() != -1) {
|
||||
app_->playlist_manager()->collection_backend()->IncrementPlayCountAsync( current_item_->Metadata().id());
|
||||
app_->playlist_manager()->collection_backend()->IncrementPlayCountAsync(current_item_->Metadata().id());
|
||||
}
|
||||
|
||||
NextInternal(Engine::Auto);
|
||||
|
|
|
@ -90,6 +90,7 @@ void PlaylistManager::Init(CollectionBackend *collection_backend, PlaylistBacken
|
|||
playlist_container_ = playlist_container;
|
||||
|
||||
connect(collection_backend_, SIGNAL(SongsDiscovered(SongList)), SLOT(SongsDiscovered(SongList)));
|
||||
connect(collection_backend_, SIGNAL(SongsStatisticsChanged(SongList)), SLOT(SongsDiscovered(SongList)));
|
||||
|
||||
for (const PlaylistBackend::Playlist &p : playlist_backend->GetAllOpenPlaylists()) {
|
||||
AddPlaylist(p.id, p.name, p.special_type, p.ui_path, p.favorite);
|
||||
|
|
Loading…
Reference in New Issue