gitoriaLog in with ident

tracker

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Commit65c694a865c694a8tracker#14: search — header magnifier, /search/<text> (in-memory word-prefix index over titles + people), Fetch from web (TMDB search/multi, ours left out), Add = import via syncShow; gate +25 checks, real-data scriptmre65c694a8/tools/sync-tmdb.hl

2.3 KB

  1. // tools/sync-tmdb.hl — THE TMDB SYNC FROM THE COMMAND LINE (tracker.worldapi.org#9): the same per-show sync
  2. // the app runs every day (tmdbsync.hl), for every followed show, one after the other, waiting between shows
  3. // so TMDB's 40 requests / 10 s (and TVmaze's 20 / 10 s) are never exceeded. Idempotent: a second run adds nothing (prints 0 new).
  4. //
  5. // STOP THE APP FIRST (or run it on a COPY): hl:mpackdb does not coordinate two processes on one storage
  6. // directory (hybriel#21). The running app does this itself every day (project.hl `syncTick`) — this tool is
  7. // for tests, the real-data proof and a manual catch-up.
  8. //
  9. // set -a; . ./.env; set +a # TMDB_READ_TOKEN — never print it
  10. // TRACKER_STORAGE=/abs/path/storage/mpackdb ./bin/hybriel tools/sync-tmdb.hl [--limit N]
  11. //
  12. // Prints one line per show and the totals: shows, newSeasons, newEpisodes, updatedEpisodes, updatedSeasons,
  13. // posters, ids (external ids filled, tracker.worldapi.org#12), requests, tvmazeRequests, errors, seconds.
  14. import { env, args, exit } from 'hl:proc'
  15. import { now, sleep } from 'hl:time'
  16. import { syncEnabled, syncShow, persistSync, emptyTotals, addTotals, totalsLine, pauseMsAfter } from '../tmdbsync.hl'
  17. import { allFollowedShowIds } from '../follows.hl'
  18. storageDir = env('TRACKER_STORAGE')
  19. if (storageDir == null || !storageDir.startsWith('/')) { console.log('REFUSED: set TRACKER_STORAGE, absolute (app stopped, or a copy)') exit(2) }
  20. if (!syncEnabled) { console.log('REFUSED: TMDB_READ_TOKEN is not set') exit(2) }
  21. limit = -1
  22. argv = args()
  23. i = 0
  24. while (i < argv.length) {
  25. if (argv[i] == '--limit' && i + 1 < argv.length) { limit = toNumber(argv[i + 1]) }
  26. i = i + 1
  27. }
  28. ids = allFollowedShowIds()
  29. started = now()
  30. totals = emptyTotals()
  31. console.log('tmdb sync: ' + ids.length + ' followed shows' + (limit >= 0 ? ', limit ' + limit : ''))
  32. for (id of ids) {
  33. if (limit < 0 || totals.shows < limit) {
  34. let r = syncShow(id)
  35. totals = addTotals(totals, r)
  36. console.log(' ' + id + ': +' + r.newSeasons + ' seasons +' + r.newEpisodes + ' episodes ~' + r.updatedEpisodes + ' updated, poster ' + r.posters + ', ids +' + r.ids + (r.error != '' ? ' ERROR ' + r.error : ''))
  37. if (totals.shows % 10 == 0) { persistSync() }
  38. sleep(pauseMsAfter(r) / 1000)
  39. }
  40. }
  41. persistSync()
  42. console.log('tmdb sync done: ' + totalsLine(totals) + ' seconds=' + ((now() - started) / 1000))
  43. on Error(e) { console.log(' error absorbed: ' + e.message) }

Branches

Latest commits

  • 65c694a8tracker#14: search — header magnifier, /search/<text> (in-memory word-prefix index over titles + people), Fetch from web (TMDB search/multi, ours left out), Add = import via syncShow; gate +25 checks, real-data scriptmre
  • cbdc4ea7tracker#12: link icons TMDB/IMDb/TVDB/TVmaze; sync fills missing ids (TVmaze lookup); movies fetched via /movie/mre
  • b105bcd8tracker#11: Hybriel master ff51cf46 (checks no longer vanish), mobile-first styles, carets, follow button, sign-in modal, inverted check, orange castmre
  • 31b758aatracker#10: installable app (manifest, service worker, offline shell), own icon + faviconmre
  • 2fa9d997tracker#9: TMDB sync (followed shows: seasons, episodes, posters), tools/sync-tmdb.hl + daily run 04:00 UTC, fake TMDB in gatemre
  • 49e1f61edeploy.sh: back up live storage/.sessions/.env before every deploy (newest 5 kept)mre
  • 54070a4etracker#8: /my/unwatched + /my/schedule (301 from old), S01E01, title (year), 1 episode, watched-set lookup (unwatched 15s -> 1s)mre
  • 3251488atracker#7: /my/shows (followed shows, newest follow first, poster, title, last watched SxxEyy); gate can take screenshots (TRACKER_GATE_SHOTS)mre
  • 44b7d9f9tracker#6: /schedule — upcoming episodes of followed shows, soonest firstmre
  • 91c9fc8ctracker#5: /unwatched — unwatched released episodes of followed shows, newest firstmre
  • a97c0295tracker#4: show page /shows/:slug (header, seasons, episodes, watch checks) + tools/relink-episode-seasons.hlmre
  • 05f407c5tracker: no border on any button except inverted ones (Log out, ident status and identities too); header brand weight 100mre
  • 17375427tracker#2: tools/migrate.hl + tools/verify.hl — old MongoDB data into mpackdb with new idsmre
  • 31aac936tracker#3: no border on the header and on filled buttons; inverted buttons keep theirsmre
  • 2ad9d29ctracker#1: login exactly like calendar (identity selector in the header, empty homepage)mre
  • 3691e176tracker#1: empty tracker with the ident login (state of 2026-09-27)mre