Stats: one-time import of StreamElements watch time
seimport.js reads the SE channel from SE_JWT, fetches /kappa/v2/points/<ch>/watchtime (all pages) into watch_import (login, minutes), replacing any previous import. Imported minutes count as watch time and watch points (5 per 5 min, merged by login) on the Stats page, leaderboards and viewer pages. Button on Stats warns that importing again after our own tracking started double-counts those streams. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
c364e7079b
commit
dd0e92c0bb
6 changed files with 95 additions and 5 deletions
|
|
@ -48,6 +48,12 @@ function everyone() {
|
|||
if (has('watch_user')) for (const r of all('SELECT user_id, user_login, user_name, ticks FROM watch_user')) {
|
||||
add(get(r.user_id, r.user_login, r.user_name), 'watching', (r.ticks || 0) * VALUE.watchTick);
|
||||
}
|
||||
// StreamElements watch time imported once (seimport.js): login + minutes, counted like our ticks
|
||||
if (has('watch_import')) for (const r of all('SELECT user_login, minutes FROM watch_import')) {
|
||||
const x = get(null, r.user_login, null);
|
||||
x.importedMinutes = (x.importedMinutes || 0) + r.minutes;
|
||||
add(x, 'watching (StreamElements)', Math.floor(r.minutes / 5) * VALUE.watchTick);
|
||||
}
|
||||
if (has('stream_checkin')) for (const r of all('SELECT user_id, COUNT(*) n FROM stream_checkin GROUP BY user_id')) {
|
||||
add(get(r.user_id, null, null), 'check-ins', r.n * VALUE.checkin);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue