Implemented scobble action

This commit is contained in:
CappielloAntonio 2021-07-29 15:17:07 +02:00
parent 4fc29b47be
commit 6f1046b137
5 changed files with 136 additions and 4 deletions

View file

@ -381,6 +381,8 @@ public class MusicService extends Service implements Playback.PlaybackCallbacks
nextPosition = getNextPosition();
playback.queueDataSource(getSongAt(nextPosition));
}
increaseSongCount();
}
public void initNotification() {
@ -637,7 +639,6 @@ public class MusicService extends Service implements Playback.PlaybackCallbacks
saveProgress();
break;
case QUEUE_CHANGED:
// because playing queue size might have changed
updateMediaSessionMetadata();
saveState();
if (playingQueue.size() > 0) {
@ -659,6 +660,11 @@ public class MusicService extends Service implements Playback.PlaybackCallbacks
}
}
private void increaseSongCount() {
SongRepository songRepository = new SongRepository(App.getInstance());
songRepository.scrobble(getCurrentSong().getId());
}
@Override
public void onStateChanged(int state) {
notifyChange(STATE_CHANGED);