tracker
All repositories: gitoria
1.9 KB
// tools/count-duplicate-episodes.hl — tracker#39 (mission 032): DOUBLE EPISODES — live episodes of one series that share season +// episode number (merge.hl merges them at the app's start). Read-only; run with the app STOPPED or on a copy (hybriel#21).// TRACKER_STORAGE=<mpackdb> ./bin/hybriel tools/count-duplicate-episodes.hl [--list]// → `duplicate episodes: extra=N (season 0: M) in K series; same tmdbId twice in a series: T; merged episode tombstones: X`// (extra = episodes beyond the first of each number); --list adds one line per series: `DUP <title> (<shortId>) <n> extra`import { args } from 'hl:proc'import { showsTable, seasonsTable, episodesTable } from '../lib/shows.hl'list = args().includes('--list')let extra = 0let extra0 = 0let series = 0let sameTmdb = 0let tombstones = 0for (s of showsTable.iterate(null, null)) {if (s.type == 'series' && s.mergedInto == null && s.seasons != null) {let seen = {}let tm = {}let mine = 0for (sid of s.seasons) {let se = seasonsTable.fetch(sid)if (se != null && se.mergedInto == null) {for (eid of se.episodes) {let e = episodesTable.fetch(eid)if (e != null && e.mergedInto == null) {let k = se.seasonNumber + 'x' + e.episodeNumberif (seen[k] == true) {mine = mine + 1if (se.seasonNumber == 0) { extra0 = extra0 + 1 }} else { seen[k] = true }if (e.tmdbId != null) {if (tm['' + e.tmdbId] == true) { sameTmdb = sameTmdb + 1 }tm['' + e.tmdbId] = true}}}}}if (mine > 0) {extra = extra + mineseries = series + 1if (list) { console.log('DUP ' + s.title + ' (' + s.shortId + ') ' + mine + ' extra') }}}}for (e of episodesTable.iterate(null, null)) { if (e.mergedInto != null) { tombstones = tombstones + 1 } }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
- bb2ebc67log: #64 live, #53 mergedmre
- 27cde42fMerge hm53-dom: tracker#53 inputs bound to membersmre
- 2156cc7flog: HM54 reviewmre
- 9fb82efclog: HM54 gap, fill continuesmre
- b632eb8dlog: HM53 done, HM54 startedmre
- ccb1a263tracker#53: bind editor drafts and use key event focus targetmre
- 3356fcfclog: #52 blocked, HM53 startedmre
- 833dcfc9Merge hm52-search: report only, tracker#52 blocked by framework gapmre
- 73010cc0HM52: report replace-navigation search draft regressionmre
- 1742e92bstatus: DP64 and HM52 runningmre
- 29ad5b58log: #64 merged, DP64 and HM52 startedmre
- fafddbf9Merge hm64-catalog: tracker#64 catalog from packed entriesmre
- b2e2206dlog: #63 livemre
- 5831e0e0log: HM64 donemre
- 4042b923Flatten catalog membership rows into paired slotsmre
- ea8a759elog: #61 #62 live, DP63 and HM64 startedmre
- 40439456Merge hm63-searchtext: tracker#63 packed search textmre
- b7e6b48ePack normalized search text behind numeric offsetsmre
- b35f53e1log: DP62 stale runtime decisionmre
- f9593602log: Apollo deploy rule correctionmre