CappielloAntonio / tempo

An open source and lightweight music client for Subsonic, designed and built natively for Android.
GNU General Public License v3.0
865 stars 39 forks source link

[BUG] - "Now Playing" implementation still has similar behavior as before. #160

Closed caiocotts closed 4 months ago

caiocotts commented 5 months ago

Describe the bug

"Now Playing" scobbles are only sent out when the onIsPlayingChanged method is called. So they are only sent out when the first song in a queue of songs is selected to play, and then when the last song is finished playing (that is, if you don't pause and unpause between those two conditions).

Expected behavior

"Now Playing" should be sent out for each song that starts playing.

To Reproduce

  1. Click play on the first song in an album.
  2. Do not pause as the song plays.
  3. When the next song begins, no "now playing" scrobble" will be sent.

Environment

Additional context

Thank you so much for merging PR #155 in a such a timely manner. When you refactored my code I thought that it would have the same functionality but be better optimized for the app and also follow your conventions. However, I had chosen to put MediaManager.scrobble(player.currentMediaItem, false) inside of the onTracksChanged method precisely so that it would get called whenever a new song started playing (first song in the queue and all subsequent songs). I also thought of putting it inside of onIsPlayingChanged as you did, but doing so this causes this bug. If calling the scrobble from inside of onTracksChanged is incorrect, we need to come up with an alternative, perhaps scrobbling inside of both methods?

CappielloAntonio commented 4 months ago

Yes, you're absolutely correct. I don't like the fact that the event is called several times, but it shouldn't be a problem because the submission is "now playing" type. Forgive me if I edited your PR last time, I was hoping to do something different but equally clean, but that wasn't the case.

CappielloAntonio commented 4 months ago

Anyway, I've pushed your edit and it will be included in the next release.

caiocotts commented 4 months ago

Hey man, no need to apologize. Thank you for creating Tempo, and for actively working on it :) .

Looking forward to the next release!