gitoriaLog in with ident

tracker

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Commite7305014e7305014tracker: report 032 (art + photos)mree7305014/tests/seed-show.hl

12.5 KB

  1. // tests/seed-show.hl — GATE FIXTURE for tracker.worldapi.org#4/#5: one small show with two seasons and
  2. // three episodes, written directly into a fresh storage/mpackdb/ (given as TRACKER_STORAGE) before the
  3. // gate server starts. Not the real migrated data (tests/browser.mjs does not run the real migration —
  4. // too slow for a gate) — just enough to drive the show page's and /unwatched's own checks.
  5. //
  6. // tracker.worldapi.org#5: episode 1 and 2 carry a PAST release date (so /unwatched shows them),
  7. // episode 3 a FAR FUTURE one (so /unwatched proves it excludes not-yet-released episodes). If
  8. // TRACKER_SEED_IDENTITY is set (the gate learns it from a throwaway ident exchange, since the real
  9. // login flow's `ensureUser` matches an EXISTING users.db row by `identity`, reusing its id rather than
  10. // minting a new one), a fixed user + a follow of this show for that user are seeded too — that is the
  11. // only way to give /unwatched a known, pre-followed show before the browser ever signs in.
  12. //
  13. // IDS ARE SELF-ASSIGNED (fixed literals, one put() per record — never update()), the same rule
  14. // tools/migrate.hl follows for its real two-way references (Show.seasons/Season.show, Episode.show/
  15. // season): hl:mpackdb's update() can lose rows across a reopen in a fresh process (hybriel#113) — and
  16. // the gate DOES reopen this same storage dir in a fresh process right after this script exits.
  17. import { MPackDB } from 'hl:mpackdb'
  18. import { env } from 'hl:proc'
  19. import { now } from 'hl:time'
  20. storageDir = env('TRACKER_STORAGE')
  21. if (storageDir == null || !storageDir.startsWith('/')) { hlError('set TRACKER_STORAGE, absolute') }
  22. genresTable = new MPackDB(file = storageDir + '/genres.db', primaryKey = '@id', indexes = ['!oldId'])
  23. personsTable = new MPackDB(file = storageDir + '/persons.db', primaryKey = '@id', indexes = ['!oldId'])
  24. showsTable = new MPackDB(file = storageDir + '/shows.db', primaryKey = '@id', indexes = ['!oldId'])
  25. seasonsTable = new MPackDB(file = storageDir + '/seasons.db', primaryKey = '@id', indexes = ['!oldId'])
  26. episodesTable = new MPackDB(file = storageDir + '/episodes.db', primaryKey = '@id', indexes = ['!oldId'])
  27. watchesTable = new MPackDB(file = storageDir + '/watches.db', primaryKey = '@id', indexes = ['!oldId'])
  28. usersTable = new MPackDB(file = storageDir + '/users.db', primaryKey = '@id', indexes = ['!identity'])
  29. followsTable = new MPackDB(file = storageDir + '/follows.db', primaryKey = '@id', indexes = ['!oldId'])
  30. genreId = 'g0000000000000g1'
  31. personId = 'p0000000000000p1'
  32. showId = 'sh00000000000sh1'
  33. season1Id = 'se000000000se0s1'
  34. season2Id = 'se000000000se0s2'
  35. ep1Id = 'ep0000000000ep0e1'
  36. ep2Id = 'ep0000000000ep0e2'
  37. ep3Id = 'ep0000000000ep0e3'
  38. genresTable.put({ id = genreId name = 'Drama' urlSegment = 'Drama' tmdbId = 18 oldId = 'g1' })
  39. // mission 058 (tracker#25, /genres/Action): the 30 Pager Movies, Pager Future Movie, Pager Older Series (a SERIES, newest released
  40. // episode 2021-01-01) and Hidden Action Film (ADULT: never listed) are Action → 32 public titles = 2 pages of 24
  41. actionId = 'g0000000000000g2'
  42. genresTable.put({ id = actionId name = 'Action' urlSegment = 'Action' tmdbId = 28 oldId = 'g2' })
  43. // tracker.worldapi.org#16: Test Actor (the cast link of show 1) has a tmdbId → its page fetches the filmography from the fake TMDB
  44. personsTable.put({ id = personId name = 'Test Actor' urlSegment = 'Test-Actor' tmdbId = 3002 oldId = 'p1' })
  45. seasonsTable.put({ id = season1Id seasonNumber = 1 title = null release = null summary = null show = showId episodes = [ep1Id, ep2Id] oldId = 's1' })
  46. seasonsTable.put({ id = season2Id seasonNumber = 2 title = null release = null summary = null show = showId episodes = [ep3Id] oldId = 's2' })
  47. episodesTable.put({ id = ep1Id episodeNumber = 1 seasonNumber = 1 title = 'Pilot' summary = null release = '2020-01-01' show = showId season = season1Id oldId = 'ep1' })
  48. episodesTable.put({ id = ep2Id episodeNumber = 2 seasonNumber = 1 title = 'Second' summary = null release = '2020-06-15' show = showId season = season1Id oldId = 'ep2' })
  49. episodesTable.put({ id = ep3Id episodeNumber = 1 seasonNumber = 2 title = 'Season Two Opener' summary = null release = '2099-01-01' show = showId season = season2Id oldId = 'ep3' })
  50. showsTable.put({
  51. adult = false id = showId title = 'Gate Test Show' summary = 'a fixture show for the gate' tmdbSummary = null tmdbId = 1001
  52. language = 'en' type = 'series' release = null year = 2024 image = 'png' urlSegment = 'gate-test-show'
  53. episodesCount = 3 homepage = null imdbId = 'tt0000001' seasonsCount = 2 status = 'Ended' tagline = null
  54. tvdbId = null tvmzId = null genres = [genreId] cast = [{ person = personId character = 'Someone' actor = 'Test Actor' }]
  55. seasons = [season1Id, season2Id] oldId = 'sh1' tmdbSync = 1
  56. })
  57. show2Id = 'sh00000000000sh2'
  58. showsTable.put({
  59. adult = false id = show2Id title = 'Unwatched Gate Show' summary = null tmdbSummary = null tmdbId = 1002
  60. language = 'en' type = 'series' release = '2025-03-01' year = null image = null urlSegment = 'unwatched-gate-show'
  61. episodesCount = 0 homepage = null imdbId = null seasonsCount = 0 status = 'Ended' tagline = null
  62. tvdbId = 4002 tvmzId = null genres = [] cast = [] seasons = [] oldId = 'sh2' tmdbSync = 1
  63. })
  64. // tracker.worldapi.org#12 (link icons, external ids): show 1 has an imdbId only, show 2 a tvdbId only — the sync must fill
  65. // the missing ones (TMDB external_ids, TVmaze lookup) and never overwrite these. A MOVIE (tmdbId 1003, no imdbId):
  66. // TMDB + IMDb icons only, synced via /movie/, never /tv/ — followed by ANOTHER user (below), so alice's lists stay as they are.
  67. // tracker.worldapi.org#18: its `summary` is a COPY of tmdbSummary (as the migration made them) — cleared at the first start
  68. show3Id = 'sh00000000000sh3'
  69. showsTable.put({
  70. adult = false id = show3Id title = 'Gate Test Movie' summary = 'a fixture movie' tmdbSummary = 'a fixture movie' tmdbId = 1003
  71. language = 'en' type = 'movie' release = '1996-11-18' year = 1996 image = null urlSegment = 'gate-test-movie'
  72. episodesCount = null homepage = null imdbId = null seasonsCount = null status = 'Released' tagline = null
  73. tvdbId = null tvmzId = null genres = [] cast = [] seasons = [] oldId = 'sh3' tmdbSync = 1
  74. })
  75. // tracker.worldapi.org#13 (the homepage rows, /movies, /shows): 32 more movies, never followed — 'Pager Movie 01'…'30'
  76. // (released 2001-01-01 … 2001-01-30), 'Pager Future Movie' (2099-06-01: first on /movies, never in the homepage's "latest
  77. // released") and 'Pager Undated Movie' (no release: last) → 33 movies with the one above = 2 pages of 24. And a series
  78. // whose newest released episode (2021-01-01) is newer than show 1's (2020-06-15) but older than the S3E1 (2021-05-05) the
  79. // TMDB sync brings show 1 — so /shows reorders after the sync.
  80. // (Named 'Pager …', not 'Gate …', since the #13/#14 merge: the search checks (#14) expect exactly the 'gate' titles.)
  81. let mi = 1
  82. while (mi <= 30) {
  83. let nn = mi < 10 ? '0' + mi : '' + mi
  84. showsTable.put({
  85. adult = false id = 'mv00000000000m' + nn title = 'Pager Movie ' + nn summary = null tmdbSummary = null tmdbId = null
  86. language = 'en' type = 'movie' release = '2001-01-' + nn year = 2001 image = null urlSegment = 'pager-movie-' + nn
  87. episodesCount = null homepage = null imdbId = null seasonsCount = null status = null tagline = null
  88. tvdbId = null tvmzId = null genres = [actionId] cast = [] seasons = [] oldId = 'mv' + nn
  89. })
  90. mi = mi + 1
  91. }
  92. showsTable.put({
  93. adult = false id = 'mv00000000000mfu' title = 'Pager Future Movie' summary = null tmdbSummary = null tmdbId = null
  94. language = 'en' type = 'movie' release = '2099-06-01' year = 2099 image = null urlSegment = 'pager-future-movie'
  95. episodesCount = null homepage = null imdbId = null seasonsCount = null status = null tagline = null
  96. tvdbId = null tvmzId = null genres = [actionId] cast = [] seasons = [] oldId = 'mvfu'
  97. })
  98. showsTable.put({
  99. adult = true id = 'mv00000000000mha' title = 'Hidden Action Film' summary = null tmdbSummary = null tmdbId = null
  100. language = 'en' type = 'movie' release = '2050-01-01' year = 2050 image = null urlSegment = 'hidden-action-film'
  101. episodesCount = null homepage = null imdbId = null seasonsCount = null status = null tagline = null
  102. tvdbId = null tvmzId = null genres = [actionId] cast = [] seasons = [] oldId = 'mvha'
  103. })
  104. showsTable.put({
  105. adult = false id = 'mv00000000000mun' title = 'Pager Undated Movie' summary = null tmdbSummary = null tmdbId = null
  106. language = 'en' type = 'movie' release = null year = null image = null urlSegment = 'pager-undated-movie'
  107. episodesCount = null homepage = null imdbId = null seasonsCount = null status = null tagline = null
  108. tvdbId = null tvmzId = null genres = [] cast = [] seasons = [] oldId = 'mvun'
  109. })
  110. show4Id = 'sh00000000000sh4'
  111. season4Id = 'se000000000se0s4'
  112. ep4Id = 'ep0000000000ep0e4'
  113. seasonsTable.put({ id = season4Id seasonNumber = 1 title = null release = null summary = null show = show4Id episodes = [ep4Id] oldId = 's4' })
  114. episodesTable.put({ id = ep4Id episodeNumber = 1 seasonNumber = 1 title = 'Older Pilot' summary = null release = '2021-01-01' show = show4Id season = season4Id oldId = 'ep4' })
  115. showsTable.put({
  116. adult = false id = show4Id title = 'Pager Older Series' summary = null tmdbSummary = null tmdbId = null
  117. language = 'en' type = 'series' release = '2019-01-01' year = 2019 image = null urlSegment = 'pager-older-series'
  118. episodesCount = 1 homepage = null imdbId = null seasonsCount = 1 status = 'Ended' tagline = null
  119. tvdbId = null tvmzId = null genres = [actionId] cast = [] seasons = [season4Id] oldId = 'sh4'
  120. })
  121. // mission 054: every fixture title above is KNOWN non-adult (`adult = false`) — unknown or adult titles are hidden from the
  122. // public lists and the search; the adult block of the gate adds those itself (tests/seed-adult.hl)
  123. // tracker.worldapi.org#16 (person pages): a COMPLETE person (filmographyAt set: shown at once, TMDB never asked) with two credits
  124. // and the facts; a second INCOMPLETE one whose TMDB credits are titles the first fill (Test Actor) adds → linked, nothing added
  125. personsTable.put({ id = 'p0000000000000p2' name = 'Complete Person' urlSegment = 'Complete-Person' tmdbId = 3001 gender = 1
  126. birthDate = '1950-02-03' birthPlace = 'Gate City' deathDate = '2020-01-01' biography = 'A fixture person who is complete.' image = null
  127. shows = [{ show = showId character = 'Old Role' }, { show = show3Id character = 'Movie Role' }] filmographyAt = now() oldId = 'p2' })
  128. personsTable.put({ id = 'p0000000000000p3' name = 'Second Actor' urlSegment = 'Second-Actor' tmdbId = 3003 shows = [] oldId = 'p3' })
  129. // tracker#33 (mission 029): shows 1–3 stand for titles the app has synced before (`tmdbSync`) — without it a title with a TMDB
  130. // id counts as never synced (shows.hl isIncomplete) and its page would complete it from the fake TMDB on the first open.
  131. // tracker.worldapi.org#9: both shows carry a tmdbId (1001, 1002) — the gate's fake TMDB (tests/faketmdb.mjs)
  132. // answers for exactly these two; the fixture episodes have no tmdbId, so the sync must match them by S/E number
  133. // tracker.worldapi.org#8: show 1 has a poster FILE (the gate writes posters/sh1.png) and a `year`; show 2 has
  134. // neither — its year comes from `release` (shows.hl showYear), its poster is the placeholder URL /posters/none
  135. identity = env('TRACKER_SEED_IDENTITY')
  136. userId = 'gateu0000000000u1'
  137. if (identity != null && identity != '') {
  138. usersTable.put({ id = userId identity = identity created = now() })
  139. // tracker.worldapi.org#7 (/my/shows, newest follow first): the fixture show was followed a day ago, a
  140. // second show (no seasons, no poster name, never watched) just now — stored AFTER it, so the page's
  141. // order has to come from `at`, not from the table's own order
  142. followsTable.put({ id = 'gatef000000000f1' show = showId user = userId at = now() - 86400000 oldId = 'gate-follow-1' })
  143. followsTable.put({ id = 'gatef000000000f2' show = show2Id user = userId at = now() oldId = 'gate-follow-2' })
  144. followsTable.put({ id = 'gatef000000000f3' show = show3Id user = 'gateu0000000000u2' at = now() oldId = 'gate-follow-3' })
  145. }
  146. genresTable.persist()
  147. personsTable.persist()
  148. showsTable.persist()
  149. seasonsTable.persist()
  150. episodesTable.persist()
  151. watchesTable.persist()
  152. usersTable.persist()
  153. followsTable.persist()
  154. console.log('seed: show ' + showId + ' (gate-test-show), seasons ' + season1Id + ',' + season2Id + ', episodes ' + ep1Id + ',' + ep2Id + ',' + ep3Id + (identity != null && identity != '' ? ', user ' + userId + ' follows it (and ' + show2Id + ')' : ', no follow (no identity given)'))

Branches

Latest commits

  • e7305014tracker: report 032 (art + photos)mre
  • fbb903cctracker#33/#37 (mission 032): a title without a TMDB poster gets its backdrop (w780, posterFromBackdrop, shown 2:3 centre-cropped); movies store runtime, the page shows release date + runtime; art backfill (public titles without poster file / movies without runtime) and person photo backfill (tmdbProfile / photoCheck) as the last start jobs (TRACKER_ART, TRACKER_PHOTOS; off in every gate start); gates 379/0, 32/0, 53/0, 229/0, 26/0, check-theme 0; live copy: art 4977 titles in 42 min (115 posters, 15 backdrops, 4609 runtimes), The Remaining shows its backdrop + 7 minmre
  • 4ecc67b2tracker: STATUS/LOG for the t38 + t40 merge (gates 374/0, 32/0, 53/0, 229/0, 26/0, check-theme 0; live copy checks)mre
  • e5945d2fMerge t40 (tracker#40 curated franchises, Franchises menu, superseded collections) into main: deploy.sh lists all six gates (browser, kinds, franchises, pager, franchiseseed, check-theme); search.hl keeps #37's personPhotoOf + #40's importWithCredits; pager gate runs with TRACKER_FRANCHISE_SEED=0; gates 374/0, 32/0, 53/0, 229/0, 26/0, check-theme 0mre
  • b638e99dMerge t38 (tracker#38 pagination, #35 Returning/Airing label) into main: LOG/STATUS keep both sides; pager gate follows #37's /people (everyone, last updated first: seed updatedAt); gates pager 229/0, browser 374/0mre
  • f8ffa4dbtracker: report 032 + The Remaining + #39mre
  • 7565a863tracker: LOG timemre
  • b10f00c8tracker#39: double episodes — migrated episodes whose TMDB id TMDB replaced are adopted by their number in the sync (old id -> migratedTmdbId); merge.hl step 3 merges each season's doubles at start (keeper: most watches > synced > first; watches moved/parked; tombstones into mergedEpisodes, nothing deleted); tools/count-duplicate-episodes.hl; gate fixture + paths-m039; live copy 850 -> 0 in 64 s; gates 373/0, 32/0, 52/0mre
  • 8f1d4542tracker#40: superseded collections — a TMDB collection timeline whose titles are all in one curated timeline is hidden (supersededBy; kept: own page + editor finder), set by the collection seed when it makes one and by the curated build (lifted when the cover is gone); partly covered ones join that franchise; no second widget (First Contact: only Star Trek — Prime); gate franchiseseed 26/0, browser 365/0, kinds 32/0, franchises 53/0, check-theme 0; real copy 24 supersededmre
  • 9448d643tracker#35 follow-up (mission 033): TVmaze 'Running' is labelled 'Returning', or 'Airing' while a non-special episode of the two newest seasons is released within today +-7 days (data unchanged); gate fixtures Running/Airing/Aired + a special; browser 366/0, kinds 32/0, franchises 52/0, pager 229/0, check-theme 0mre
  • 7d4b293dtracker#40: "Franchises" in the main menu (desktop header after People, phone sidebar) → /franchises, marked on franchise and timeline pages; gates 365/0, 32/0, 53/0, 24/0, check-theme 0mre
  • 8751adb8tracker: report 032mre
  • 9bce1f65tracker mission 032: STATUS gate files + the hour-boundary flakemre
  • 718bfb89tracker#37 (mission 032): /people = everyone, last updated first (updatedAt stamped by the person fill; view built at boot, touched people first at once), photo + name tiles (person colour) with the /movies pagination, /people/<letter> removed; photo = our file, tmdbProfile, a cast/crew entry's profile (in-memory map at boot), else the new 'no photo' placeholder; new cast/crew/created_by people keep tmdbProfile; search people rows with the photo; /settings = the heading only; util.hl sortDesc starts from sorted runs (same result, 105k: 1.6 s -> 0.15 s); gates 369/0, 32/0, 52/0, check-theme 0; README/STATUS/LOGmre
  • 93dfb0batracker#40 (mission 034): the curated franchises — data/franchises.json (17 franchises, 31 timelines, 285 TMDB titles, movies + series, in-universe/release order, 12 TMDB collections attached); lib/franchiseseed.hl + jobs.hl franchiseSeedTick (last start job, imports missing titles via details.hl importWithCredits = the search's Add, one per step paced, then one build; franchiseseed.db: editor changes win, the creator's same-name franchise adopted / timeline left alone, 404 remembered, resumable, idempotent); timeline heads 'N titles · in-universe order' (orderKind) and wrap on a phone; series pages show the widget; new gate tests/franchiseseed.mjs (5th in deploy.sh), the others run with TRACKER_FRANCHISE_SEED=0; gates 365/0, 32/0, 52/0, 24/0, check-theme 0; real copy 196 imported, 0 failed, 7 min, restart unchanged=31mre
  • 03ec792ftracker#38 (mission 033): pagination goes exactly to the clicked page — tilelist read the clicked button's text after pagination.hl's own handler had rebuilt the buttons (real clicks only); now li.current, else the button's own text; new gate tests/pager.mjs (5 lists x 11 pages, 390/1280, real + script clicks, Back/Forward) 229/0; browser 365/0, kinds 32/0, franchises 52/0, check-theme 0mre
  • 96ba683adeploy.sh: a gate without a 'passed,' line (check-theme) no longer ends the scriptmre
  • eb3b9205tracker: report 031mre
  • 9b5d2e89tracker mission 031: README (What it does, Test: four gates + the #32 checks, Files: theme/, new pages), STATUS (real copy, A/B load, how to repeat, open points), LOGmre
  • 39950e4ctracker#32 (mission 031): the WorldAPI theme (theme/ vendored verbatim from layouts.worldapi.org 85b5654; styles.hl inherits it: accent green-dark, type colours 1-6; own base/header rules, row lines, genre-pill and inverted-button frames removed, the season foldable keeps its line; check-theme 21 -> 0, 4th deploy gate; main actions class primary) and the #32 header (theme AppHeader/MainMenu/UserMenu/Sidebar/ContentFirst: desktop brand, search, Series|Shows|Movies|Genres|People, user icon with Unwatched..Settings, Logout; signed out the ident selector, phone the iD icon dropdown; phone menu in the sidebar overlay; marked entry by :has); /find -> /search/<q>, /genres, /people(/<letter>), /settings; main { ContentFirst { slot } } works around the hl:web one-line slot bug; gates 365/0, 32/0, 52/0, check-theme 0mre