tracker
All repositories: gitoria
4.4 KB
// tests/seed-tmdbfix.hl — GATE FIXTURE for tests/tmdbfix.mjs (tracker#36, mission T36): migrated titles of every group of// tools/tmdb-fix.hl, with watches / follows / a season / episodes hanging on the records, written into a fresh storage dir// (TRACKER_STORAGE, absolute) while nothing else uses it. Ids are self-assigned literals, one put() per record.import { MPackDB } from 'hl:mpackdb'import { env, exit } from 'hl:proc'storageDir = env('TRACKER_STORAGE')if (storageDir == null || !storageDir.startsWith('/')) { hlError('set TRACKER_STORAGE, absolute') }showsTable = new MPackDB(file = storageDir + '/shows.db', primaryKey = '@id', indexes = ['!oldId'])seasonsTable = new MPackDB(file = storageDir + '/seasons.db', primaryKey = '@id', indexes = ['!oldId'])episodesTable = new MPackDB(file = storageDir + '/episodes.db', primaryKey = '@id', indexes = ['!oldId'])watchesTable = new MPackDB(file = storageDir + '/watches.db', primaryKey = '@id', indexes = ['!oldId'])followsTable = new MPackDB(file = storageDir + '/follows.db', primaryKey = '@id', indexes = ['!oldId'])// Gate-only edits simulate changes between planning and applying.if (env('TMDBFIX_EDIT') != null) {edit = JSON.parse(env('TMDBFIX_EDIT'))row = showsTable.fetch(edit.id)for (key of edit.keys()) { row[key] = edit[key] }showsTable.update(row.id, row)showsTable.persist()exit(0)}title = (id, type, name, slug, tmdbId, year, adultCheck) => {return { id = id type = type title = name urlSegment = slug tmdbId = tmdbId year = year release = null oldId = 'o' + id adult = falseadultCheck = adultCheck summary = null tmdbSummary = null seasons = [] }}withRelease = (r, d) => { x = r x.release = d return x }showsTable.put(title('mYearMissing000001', 'movie', 'Year Missing', 'Year-Missing', 101, null, null))showsTable.put(withRelease(title('mOtherYear00000002', 'movie', 'Other Year', 'Other-Year', 102, 2002, null), '2002-03-04'))showsTable.put(title('mTranslated000003', 'movie', 'Translated', 'Translated', 103, 2010, null))showsTable.put(title('mGoneUnique000004', 'movie', 'Gone Unique', 'Gone-Unique', 104, 2015, 'TMDB 404'))showsTable.put(title('sGoneSeries000005', 'series', 'Gone Series', 'Gone-Series', 105, 2011, null))showsTable.put(title('mGoneMany0000006', 'movie', 'Gone Many', 'Gone-Many', 106, 2012, null))showsTable.put(title('mGoneOtherYr000007', 'movie', 'Gone Other Year', 'Gone-Other-Year', 107, 2013, null))showsTable.put(title('mGoneTaken000008', 'movie', 'Gone Taken', 'Gone-Taken', 108, 2016, null))showsTable.put(title('mTakenHolder000009', 'movie', 'Gone Taken', 'Gone-Taken-2', 109, 2016, null))showsTable.put(title('mBothDiffer000010', 'movie', 'Both Differ', 'Both-Differ', 110, 2000, null))showsTable.put(title('mFine00000000011', 'movie', 'Fine', 'Fine', 111, 2005, null))showsTable.put(title('mGoneNoYear000012', 'movie', 'Gone No Year', 'Gone-No-Year', 112, null, null))// the series with a season, 2 episodes, a watch on an episode, a season watch and a follow; the movie with a watch and a followseasonsTable.put({ id = 'sSeason000000001' seasonNumber = 1 title = null release = null summary = null show = 'sGoneSeries000005' episodes = ['eEp1000000000001', 'eEp2000000000002'] oldId = 'os1' })episodesTable.put({ id = 'eEp1000000000001' episodeNumber = 1 seasonNumber = 1 title = 'One' summary = null release = '2011-01-01' show = 'sGoneSeries000005' season = 'sSeason000000001' oldId = 'oe1' })episodesTable.put({ id = 'eEp2000000000002' episodeNumber = 2 seasonNumber = 1 title = 'Two' summary = null release = '2011-01-08' show = 'sGoneSeries000005' season = 'sSeason000000001' oldId = 'oe2' })watchesTable.put({ id = 'wEp1000000000001' targetType = 'episode' target = 'eEp1000000000001' user = 'uUser00000000001' at = 1700000000000 oldId = 'ow1' })watchesTable.put({ id = 'wSeason00000002' targetType = 'season' target = 'sSeason000000001' user = 'uUser00000000001' at = 1700000000000 oldId = 'ow2' })watchesTable.put({ id = 'wMovie000000003' targetType = 'movie' target = 'mGoneUnique000004' user = 'uUser00000000001' at = 1700000000000 oldId = 'ow3' })followsTable.put({ id = 'fSeries00000001' show = 'sGoneSeries000005' user = 'uUser00000000001' at = 1700000000000 oldId = 'of1' })followsTable.put({ id = 'fMovie000000002' show = 'mGoneUnique000004' user = 'uUser00000000001' at = 1700000000000 oldId = 'of2' })showsTable.persist()seasonsTable.persist()episodesTable.persist()watchesTable.persist()followsTable.persist()console.log('seeded')
Branches
Latest commits
- 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
- 2047955bMerge branch 'u12-gateports' into mainTracker
- c8da40f3|||PR AP61: re-vendor Hybriel set day61 (source a05af47c, bin a11042e5)Tracker
- 4e018678|||PR deploy.sh: gates use Tracker's ports 8716-8719 and LC_ALL=C; README: 2 backups keptTracker
- 0b86324aMerge branch 'records-dp73' into mainTracker
- 9ce5f59b|||PR records: DP73 live 613ae0e; deploy.sh keeps 2 backupsTracker
- 613ae0ecMerge branch 'bs3' into mainTracker
- 1383264b|||PR BS3: keep shared synchronous sorting fastTracker
- 63e5ba1a|||PR BS3: guard boot imports and share resumable sort buffersTracker
- 310613f1Merge branch 'records-dp72' into mainTracker
- 6f7b61ba|||PR records: deploy-swap fix live, Kunibert findingsTracker
- c41587d2Merge branch 'bs2' into mainTracker
- 0dd538a6|||PR BS2: finish the boot index in slices so a booting instance keeps answeringTracker
- 019d5cedMerge branch 'records-1110' into mainTracker
- f88ae8b9|||PR records: day56 toggle live, reviewTracker
- b6b3bb4dMerge branch 'ap56e' into mainTracker
- 29a26da9|||PR AP56e: guard hidden show helpers during session syncTracker