gitoria

tracker

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Commit5965963a5965963adeploy: backup copies index files first and *.mpack data last (hot-copy skew, hybriel #203)mre5965963a/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

  • 5965963adeploy: backup copies index files first and *.mpack data last (hot-copy skew, hybriel #203)mre
  • 9b3828aemission 046a: report, LOGmre
  • 4b37356emission 046: franchise seed supersedeCollections reads the curated timelines once (10 s one-tick block at the end of boot)mre
  • ac6268e3mission 046a: re-vendor Hybriel 528bc89f (integration 6): plugins mpackdb/time/web (bin/ git-ignored)mre
  • 322b3293mission 046: photoQueue guard for non-row fetch results (damaged persons index)mre
  • e5b99aecmission 046: photoQueue in slices (people.hl photoQueueStart/Step, jobs.hl photoTick), tests/photoqueue.hlmre
  • 31dcf2admission 045: report, LOGmre
  • 9c3971d0tests/persons-skip-count.hlmre
  • 4d72e365mission 045mre
  • b9cae4c9slices: skip and count non-row values from range(); merge persons pass falls back to iterate; guard testmre
  • 3db7dc31merge w44-jobs-slices into w43-trkmemmre
  • 593dab6fmission 043: report, LOGmre
  • 1a5a4818boot scans back to iterate (slices measured slower: titles 114 s, episodes 141 s, persons failed); lambda per rowmre
  • 03d29893boot scans read primary-key slices (lib/slices.hl from mission 044): iterate is eager too; people view log line back; allShows/allEpisodes stay for toolsmre
  • 23375c58mission 044: report, LOG, STATUSmre
  • c6fd928emission 044: 4096 slices for tables over 200 K rows, 15 ms budget, TRACKER_SLICE_DEPTH for testsmre
  • fb057680mission 044: jobs.hl imports mergeLeft (gate found it), mission file, slices benchmre
  • 0d6293ebmission 043: mission filemre
  • d25bd14amission 044: sliced merge prepare + sliced collections prepare; jobs-dump old/new check + bulk fixturemre
  • 633ee210mission 044: sliced table scans (slices.hl, pk-range slices) for the adult/kind/status/art/credits/details-repair queuesmre