gitoria

tracker

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Branchrecords-hm55c9ba258d3|||PR records: HM55b resultTrackerrecords-hm55c/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. seen = {}
  17. tm = {}
  18. let mine = 0
  19. for (sid of s.seasons) {
  20. se = seasonsTable.fetch(sid)
  21. if (se != null && se.mergedInto == null) {
  22. for (eid of se.episodes) {
  23. e = episodesTable.fetch(eid)
  24. if (e != null && e.mergedInto == null) {
  25. 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

  • 9ba258d3|||PR records: HM55b resultTracker
  • 64f2d300Merge branch 'records-hm55b2' into mainTracker
  • ae3b80dc|||PR records: HM55b briefTracker
  • 7ef3cb3bMerge branch 'records-st55' into mainTracker
  • fec2e080|||PR records: STATUS HM55Tracker
  • 8e174918Merge branch 'records-hm55b' into mainTracker
  • b1ecee57|||PR records: HM55 stateTracker
  • 28eab08cMerge branch 'records-hm55' into mainTracker
  • d3edaa05|||PR records: HM55 start, PROCEDURES.mdTracker
  • 3059f86cMerge branch 'records-design-rule' into mainTracker
  • 421a4809|||PR records: his-design rule (Apollo 2026-11-13)Tracker
  • d1390692Merge branch 'records-dp75b' into mainTracker
  • a4d1a7d2|||PR records: later steps checked, branch auditTracker
  • e070e16fMerge branch 'records-dp75' into mainTracker
  • 642b4fa8|||PR records: DP75 day62 live, AP62 briefTracker
  • bfc4ea4dMerge branch 'ap62' into mainTracker
  • 2c95ac46|||PR AP62: re-vendor Hybriel set day62 (source 70341ad2, bin a54f5f08)Tracker
  • b9c7c3c8Merge branch 'records-dp74' into mainTracker
  • 85cfb4ae|||PR records: AP61 day61, DP74 liveTracker
  • b1496147Merge branch 'ap61' into mainTracker