"Listening time this week" summed the full duration of every track whose
stream ticket was issued, so pressing play and skipping counted the whole
song. Playback is now measured on the client and reported to the API.
Backend:
- ListeningHistory gains PlayedSeconds, LastProgressAt and IsCounted
(migration TrackPlayedSeconds marks existing rows as counted).
- /tracks/{id}/stream returns a listenId; new
PUT /tracks/listens/{listenId}/progress stores the accumulated seconds,
capped by track duration and elapsed wall-clock time, monotonic and
owner-only.
- A listen counts once it reaches min(30s, 50% of the track). Weekly
stats, streak, recent history/albums, mixes and listensCount only use
counted listens; seconds sum PlayedSeconds.
- ListeningHistoryCleanupJob (daily) deletes uncounted listens older
than 8 days.
web-player:
- ListenTracker accumulates played time (seeks are ignored) and flushes
on pause, track change, ended, every 30s, and on pagehide.
- Proxy route /api/listens/[id]/progress; repeat starts a new listen per
loop.
The counted-listen tests lived in one catch-all UncountedListensTests
file. Each now sits next to the handler it covers, and the cleanup
handler gets its own test file.
NotS1mp
merged commit 920dcc6779 into master2026-09-23 22:15:10 +00:00
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
"Listening time this week" summed the full duration of every track whose stream ticket was issued, so pressing play and skipping counted the whole song. Playback is now measured on the client and reported to the API. Backend: - ListeningHistory gains PlayedSeconds, LastProgressAt and IsCounted (migration TrackPlayedSeconds marks existing rows as counted). - /tracks/{id}/stream returns a listenId; new PUT /tracks/listens/{listenId}/progress stores the accumulated seconds, capped by track duration and elapsed wall-clock time, monotonic and owner-only. - A listen counts once it reaches min(30s, 50% of the track). Weekly stats, streak, recent history/albums, mixes and listensCount only use counted listens; seconds sum PlayedSeconds. - ListeningHistoryCleanupJob (daily) deletes uncounted listens older than 8 days. web-player: - ListenTracker accumulates played time (seeks are ignored) and flushes on pause, track change, ended, every 30s, and on pagehide. - Proxy route /api/listens/[id]/progress; repeat starts a new listen per loop.