gitoria

tracker

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Commit44b934e544b934e5log: respawn cleanupmre44b934e5/tests/seed-tmdbfix.hl

4.4 KB

  1. // tests/seed-tmdbfix.hl — GATE FIXTURE for tests/tmdbfix.mjs (tracker#36, mission T36): migrated titles of every group of
  2. // tools/tmdb-fix.hl, with watches / follows / a season / episodes hanging on the records, written into a fresh storage dir
  3. // (TRACKER_STORAGE, absolute) while nothing else uses it. Ids are self-assigned literals, one put() per record.
  4. import { MPackDB } from 'hl:mpackdb'
  5. import { env, exit } from 'hl:proc'
  6. storageDir = env('TRACKER_STORAGE')
  7. if (storageDir == null || !storageDir.startsWith('/')) { hlError('set TRACKER_STORAGE, absolute') }
  8. showsTable = new MPackDB(file = storageDir + '/shows.db', primaryKey = '@id', indexes = ['!oldId'])
  9. seasonsTable = new MPackDB(file = storageDir + '/seasons.db', primaryKey = '@id', indexes = ['!oldId'])
  10. episodesTable = new MPackDB(file = storageDir + '/episodes.db', primaryKey = '@id', indexes = ['!oldId'])
  11. watchesTable = new MPackDB(file = storageDir + '/watches.db', primaryKey = '@id', indexes = ['!oldId'])
  12. followsTable = new MPackDB(file = storageDir + '/follows.db', primaryKey = '@id', indexes = ['!oldId'])
  13. // Gate-only edits simulate changes between planning and applying.
  14. if (env('TMDBFIX_EDIT') != null) {
  15. edit = JSON.parse(env('TMDBFIX_EDIT'))
  16. row = showsTable.fetch(edit.id)
  17. for (key of edit.keys()) { row[key] = edit[key] }
  18. showsTable.update(row.id, row)
  19. showsTable.persist()
  20. exit(0)
  21. }
  22. title = (id, type, name, slug, tmdbId, year, adultCheck) => {
  23. return { id = id type = type title = name urlSegment = slug tmdbId = tmdbId year = year release = null oldId = 'o' + id adult = false
  24. adultCheck = adultCheck summary = null tmdbSummary = null seasons = [] }
  25. }
  26. withRelease = (r, d) => { x = r x.release = d return x }
  27. showsTable.put(title('mYearMissing000001', 'movie', 'Year Missing', 'Year-Missing', 101, null, null))
  28. showsTable.put(withRelease(title('mOtherYear00000002', 'movie', 'Other Year', 'Other-Year', 102, 2002, null), '2002-03-04'))
  29. showsTable.put(title('mTranslated000003', 'movie', 'Translated', 'Translated', 103, 2010, null))
  30. showsTable.put(title('mGoneUnique000004', 'movie', 'Gone Unique', 'Gone-Unique', 104, 2015, 'TMDB 404'))
  31. showsTable.put(title('sGoneSeries000005', 'series', 'Gone Series', 'Gone-Series', 105, 2011, null))
  32. showsTable.put(title('mGoneMany0000006', 'movie', 'Gone Many', 'Gone-Many', 106, 2012, null))
  33. showsTable.put(title('mGoneOtherYr000007', 'movie', 'Gone Other Year', 'Gone-Other-Year', 107, 2013, null))
  34. showsTable.put(title('mGoneTaken000008', 'movie', 'Gone Taken', 'Gone-Taken', 108, 2016, null))
  35. showsTable.put(title('mTakenHolder000009', 'movie', 'Gone Taken', 'Gone-Taken-2', 109, 2016, null))
  36. showsTable.put(title('mBothDiffer000010', 'movie', 'Both Differ', 'Both-Differ', 110, 2000, null))
  37. showsTable.put(title('mFine00000000011', 'movie', 'Fine', 'Fine', 111, 2005, null))
  38. showsTable.put(title('mGoneNoYear000012', 'movie', 'Gone No Year', 'Gone-No-Year', 112, null, null))
  39. // 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 follow
  40. seasonsTable.put({ id = 'sSeason000000001' seasonNumber = 1 title = null release = null summary = null show = 'sGoneSeries000005' episodes = ['eEp1000000000001', 'eEp2000000000002'] oldId = 'os1' })
  41. episodesTable.put({ id = 'eEp1000000000001' episodeNumber = 1 seasonNumber = 1 title = 'One' summary = null release = '2011-01-01' show = 'sGoneSeries000005' season = 'sSeason000000001' oldId = 'oe1' })
  42. episodesTable.put({ id = 'eEp2000000000002' episodeNumber = 2 seasonNumber = 1 title = 'Two' summary = null release = '2011-01-08' show = 'sGoneSeries000005' season = 'sSeason000000001' oldId = 'oe2' })
  43. watchesTable.put({ id = 'wEp1000000000001' targetType = 'episode' target = 'eEp1000000000001' user = 'uUser00000000001' at = 1700000000000 oldId = 'ow1' })
  44. watchesTable.put({ id = 'wSeason00000002' targetType = 'season' target = 'sSeason000000001' user = 'uUser00000000001' at = 1700000000000 oldId = 'ow2' })
  45. watchesTable.put({ id = 'wMovie000000003' targetType = 'movie' target = 'mGoneUnique000004' user = 'uUser00000000001' at = 1700000000000 oldId = 'ow3' })
  46. followsTable.put({ id = 'fSeries00000001' show = 'sGoneSeries000005' user = 'uUser00000000001' at = 1700000000000 oldId = 'of1' })
  47. followsTable.put({ id = 'fMovie000000002' show = 'mGoneUnique000004' user = 'uUser00000000001' at = 1700000000000 oldId = 'of2' })
  48. showsTable.persist()
  49. seasonsTable.persist()
  50. episodesTable.persist()
  51. watchesTable.persist()
  52. followsTable.persist()
  53. console.log('seeded')

Branches

Latest commits

  • 44b934e5log: respawn cleanupmre
  • 03a80097Log: Anton GC A/Bmre
  • c7cdef62Log: Apollo STOP, workers pausedmre
  • d0c083fbLog: usage stopmre
  • c6d464e5Log: Apollo GO backlog, AP56 and BS1 startedmre
  • 1eb6f1a1Missions AP56, BS1mre
  • 4871f8adLog: AP52 live on day52, browser gate greenmre
  • d9bf2988Merge ap52: day52, tracker#58 server argument, #51 modal close rule, #56 keyed season rowsmre
  • c4a60ef2Log: RT52 retest passed, AP52 startedmre
  • 83760a55Browser gate: search results belong to the address form of the typed text (tracker#52 navigate replace)mre
  • 6e951d91AP52: show-page rows are keyed records; closing a season is one upsert and removes (tracker#56, hybriel#331)mre
  • 3bb4ccddAP52: modal close button refers to its nested rule with Style.buttonModalX (tracker#51, hybriel#333)mre
  • ba16933fAP52: login callback and title route are static handlers taking the server as third argument (tracker#58, hybriel#332)mre
  • 85153900AP52: re-vendor Hybriel set day52 (source 77cfca31, bin 0a8ed496)mre
  • 7c051eddLog: hybriel#338 answermre
  • d049b8b8Log: HM50 live, #52 donemre
  • 6d05fa37Log: HM50 Part A mergedmre
  • 1c7dab74HM50: the shell reads the framework's online state, netProbe removed (tracker#55)mre
  • e8b91697HM50: search address follows the text via navigate(path, replace = true) (tracker#52)mre
  • 6fe1896cHM50: re-vendor Hybriel set day50 (source 0ae38232, bin d3ef9d16)mre