gitoria

tracker

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Commitb4c8d3a9b4c8d3a9Document tracker#62 fixed-index migration and GC proofmreb4c8d3a9/tools/count-external-ids.hl

1.6 KB

  1. // tools/count-external-ids.hl — tracker.worldapi.org#12: how many shows (all / followed) have each external id (tmdbId,
  2. // imdbId, tvdbId, tvmzId), per `type`. ONLY on a COPY or the stopped app (opening a table rewrites its files):
  3. // TRACKER_STORAGE=$PWD/.scratch/realdata/storage/mpackdb ./bin/hybriel tools/count-external-ids.hl
  4. import { env } from 'hl:proc'
  5. import { showsTable } from '../lib/shows.hl'
  6. import { allFollowedShowIds } from '../lib/follows.hl'
  7. followed = {}
  8. for (id of allFollowedShowIds()) { followed[id] = true }
  9. has = (&v) => { return v != null && ('' + v).trim() != '' }
  10. counts = {}
  11. samples = {}
  12. bump = (&key, &show) => {
  13. let c = counts[key] != null ? counts[key] : { shows = 0 tmdbId = 0 imdbId = 0 tvdbId = 0 tvmzId = 0 }
  14. c.shows = c.shows + 1
  15. if (has(&show.tmdbId)) { c.tmdbId = c.tmdbId + 1 }
  16. if (has(&show.imdbId)) { c.imdbId = c.imdbId + 1 }
  17. if (has(&show.tvdbId)) { c.tvdbId = c.tvdbId + 1 }
  18. if (has(&show.tvmzId)) { c.tvmzId = c.tvmzId + 1 }
  19. counts[key] = c
  20. return null
  21. }
  22. for (s of showsTable.find(null, null)) {
  23. let t = s.type != null ? '' + s.type : 'null'
  24. bump('all ' + t, &s)
  25. if (followed[s.id] == true) { bump('followed ' + t, &s) }
  26. if (samples[t] == null) { samples[t] = 'tmdbId=' + s.tmdbId + ' (' + hlTypeName(s.tmdbId) + ') imdbId=' + s.imdbId + ' (' + hlTypeName(s.imdbId) + ') tvdbId=' + s.tvdbId + ' (' + hlTypeName(s.tvdbId) + ') tvmzId=' + s.tvmzId + ' (' + hlTypeName(s.tvmzId) + ')' }
  27. }
  28. for (k of counts.keys()) {
  29. let c = counts[k]
  30. print(k + ': shows=' + c.shows + ' tmdbId=' + c.tmdbId + ' imdbId=' + c.imdbId + ' tvdbId=' + c.tvdbId + ' tvmzId=' + c.tvmzId)
  31. }
  32. for (k of samples.keys()) { print('sample ' + k + ': ' + samples[k]) }

Branches

Latest commits

  • b4c8d3a9Document tracker#62 fixed-index migration and GC proofmre
  • 66f83de3WIP tracker#62 native person indexes blocked by schema migration gapmre
  • 380ba349Merge packed people order for tracker#62mre
  • b5357ac4Pack the people order and release completed startup arraysmre
  • 90734c6cMerge branch 'hm60-shortids'mre
  • e0db0d1bHM60 report: tracker#60 packed short-ID ownersmre
  • 3c79b576Pack short-ID ownership into byte buffersmre
  • e822524bstatus wordingmre
  • 1c7f0480log: HM60/HM61 startedmre
  • 2841d215missions HM60 HM61mre
  • 289c6ce4HM1 report: heap object breakdownmre
  • 2e7d6257log: HM1 startedmre
  • 2f790465mission HM1: heap object breakdownmre
  • a18957falog: evening re-measure after CBmre
  • aac9a98dlog: evening re-measure startmre
  • 45163bd4log: person/tmdb error hypothesismre
  • cb38de2blog: swap 503 causemre
  • fd10c3d5log: CB livemre
  • 7557c025log: CB deploy try 2mre
  • 06a7534aMerge branch 'cb'mre