-
Notifications
You must be signed in to change notification settings - Fork 160
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixed some more problems with song statistics #5251
base: master
Are you sure you want to change the base?
Conversation
- Problem: on API 31 and up, Exoplayer already adds `MediaMetricsListener` (which also triggers our code code as callback) - disabled adding of `PlaybackStatsListener` for Android 12 and up
- Problem: duplicate playback-events (fixed for the future with a previous commit), main problem: was using listening time of the song for all time (instead of selected period) - fix (here): new method that can collect playtime for the duration. - added method `songsPlaytimeMostPlayedByPeriod` to database - added data class `SongPlaytime` for Song with playtime (used by `songsPlaytimeMostPlayedByPeriod`)
- Root problem seems to be found: `PlaybackStatsListener` was added twice - disabled the second `PlaybackStatsListener` - also disabled the second `PlayerServiceModern` listener - re-enabled the first `PlaybackStatsListener` for all Android versions
It seems that the main problem was that |
- added methods `decrementTotalPlayTimeMs`, `deleteDuplicateEvents`, `delete(Event)` to database - added button in QuickPicsSettings for removing of duplicated events (created by "duplicate playback-events" bug) - `deleteDuplicateEvents`: - finds duplicated entries (they are located next to each) - removes them - reduces playtime of a song by that of the duplicated event (was also added twice) - 100 ms as threshold (more would probably also be possible), but should be enough
This code is not ready yet. Maybe the "duplicate event" removing is not yet working correctly. Because I found in a test that there where songs with negative relative playtime (because somehow the Edit: I could confirm that the problem is created by |
MediaMetricsListener
(which also triggers our code as callback) (this is the duplicate playback-event problem)PlaybackStatsListener
(one of them)Related reports: #5127, #5172