gitoria

tracker

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Commitb0412957b0412957Tracker: RV28b handed overmreb0412957/tools/count-duplicate-episodes.hl

1.9 KB

  1. // tools/count-duplicate-episodes.hl — tracker#39 (mission 032): DOUBLE EPISODES — live episodes of one series that share season +
  2. // episode number (merge.hl merges them at the app's start). Read-only; run with the app STOPPED or on a copy (hybriel#21).
  3. // TRACKER_STORAGE=<mpackdb> ./bin/hybriel tools/count-duplicate-episodes.hl [--list]
  4. // → `duplicate episodes: extra=N (season 0: M) in K series; same tmdbId twice in a series: T; merged episode tombstones: X`
  5. // (extra = episodes beyond the first of each number); --list adds one line per series: `DUP <title> (<shortId>) <n> extra`
  6. import { args } from 'hl:proc'
  7. import { showsTable, seasonsTable, episodesTable } from '../lib/shows.hl'
  8. list = args().includes('--list')
  9. let extra = 0
  10. let extra0 = 0
  11. let series = 0
  12. let sameTmdb = 0
  13. let tombstones = 0
  14. for (s of showsTable.iterate(null, null)) {
  15. if (s.type == 'series' && s.mergedInto == null && s.seasons != null) {
  16. let seen = {}
  17. let tm = {}
  18. let mine = 0
  19. for (sid of s.seasons) {
  20. let se = seasonsTable.fetch(sid)
  21. if (se != null && se.mergedInto == null) {
  22. for (eid of se.episodes) {
  23. let e = episodesTable.fetch(eid)
  24. if (e != null && e.mergedInto == null) {
  25. let k = se.seasonNumber + 'x' + e.episodeNumber
  26. if (seen[k] == true) {
  27. mine = mine + 1
  28. if (se.seasonNumber == 0) { extra0 = extra0 + 1 }
  29. } else { seen[k] = true }
  30. if (e.tmdbId != null) {
  31. if (tm['' + e.tmdbId] == true) { sameTmdb = sameTmdb + 1 }
  32. tm['' + e.tmdbId] = true
  33. }
  34. }
  35. }
  36. }
  37. }
  38. if (mine > 0) {
  39. extra = extra + mine
  40. series = series + 1
  41. if (list) { console.log('DUP ' + s.title + ' (' + s.shortId + ') ' + mine + ' extra') }
  42. }
  43. }
  44. }
  45. for (e of episodesTable.iterate(null, null)) { if (e.mergedInto != null) { tombstones = tombstones + 1 } }
  46. console.log('duplicate episodes: extra=' + extra + ' (season 0: ' + extra0 + ') in ' + series + ' series; same tmdbId twice in a series: ' + sameTmdb + '; merged episode tombstones: ' + tombstones)

Branches

Latest commits

  • b0412957Tracker: RV28b handed overmre
  • 456940c8Tracker: RULINGS pathmre
  • b87a8fdcTracker: worldapi-conductor paths backmre
  • 641f3b54Tracker: Apollo answermre
  • 8b3cbddaTracker: status, TR7 fix livemre
  • ec30162aTracker: TR7 fix livemre
  • 54cbec80compose: ignore SIGPIPE (TR7 crash loop, exit 141)mre
  • 3e164b63Tracker: status after CL1mre
  • 9d686bb3Tracker: CL1 reviewedmre
  • b8bba562CL1: crash loop report (SIGPIPE confirmed, trap wrapper option)mre
  • 298785f2Tracker: CL1 startedmre
  • 36b22710Tracker: port slot, CL1 briefmre
  • a401190fTracker: GO for the crash loopmre
  • e195d372Tracker: token pathsmre
  • 7f541d11Tracker conductor: CONDUCTOR.md, short STATUS.md, old status + decisions archive to archive/2026-10-31mre
  • 8dd423f7README: login.js stays by caramboleyo's explicit rulemre
  • d8df1493tracker: standby service on port 45018 and a gap-free hand-over in deploy.sh step 4mre
  • 36dd1686ident#31: the selector's sign-in returns to the page the user started on (return attribute = the login callback with next), gate checkmre
  • ff9b838etracker: the Ended status pill uses the same red as layouts (pill danger); gate updatedmre
  • 40d9719eTP2: LOG line and report for the tracker pillsmre