Do not increment totalPlayTimeMs of a song if shorter than 2 seconds

This commit is contained in:
vfsfitvnm 2022-09-03 09:44:59 +02:00
parent 78c9950e95
commit 8ae7bd96f5

View file

@ -261,8 +261,12 @@ class PlayerService : InvincibleService(), Player.Listener, PlaybackStatsListene
val mediaItem =
eventTime.timeline.getWindow(eventTime.windowIndex, Timeline.Window()).mediaItem
query {
Database.incrementTotalPlayTimeMs(mediaItem.mediaId, playbackStats.totalPlayTimeMs)
val totalPlayTimeMs = playbackStats.totalPlayTimeMs
if (totalPlayTimeMs > 2000) {
query {
Database.incrementTotalPlayTimeMs(mediaItem.mediaId, totalPlayTimeMs)
}
}
}