gitoria

tracker

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Commit6e72f9d16e72f9d1Merge hm65-fields: episode boot scan reads three fieldsmre6e72f9d1/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

  • 6e72f9d1Merge hm65-fields: episode boot scan reads three fieldsmre
  • 07a5c883HM65 report measured field projection and complete validationmre
  • 0eab858fRead only catalog date fields during the episode boot scanmre
  • d3179273log: HM65 hl:heap vendoringmre
  • cb78a1a0HM65 report missing heap diagnostic package with repromre
  • 89606a5cHM65 briefmre
  • 096ce0d4log: DP69 live on day48mre
  • b3d8a80bDP69 brief, RV48 mergedmre
  • ce6d7d32Merge rv48: Hybriel day48mre
  • 3da2ea86RV48: report day48 cold starts, gates and cleanupmre
  • 8d9ecdfeRV48: re-vendor Hybriel set day48 (source b6a8f429, bin 660a9524)mre
  • 4a802ae7status: RV48 runningmre
  • 0a5412b6RV48 brief, day48 outmre
  • 56665efelog: CB69 mergedmre
  • 05448a98Merge cb69-imports: appTitle in a dependency-free topicmre
  • e55b379dKeep shared app title independent of the route import graphmre
  • 9a99659blog: hybriel#334, batch waits for day48mre
  • 85fa6c9blog: CB68 result, CB69 startedmre
  • 2f07c1b7log: DP68 boot gate failed, CB68mre
  • 9652782dlog: HM59 merged, DP68 startedmre