gitoria

jukebox

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Commita557ac53a557ac53jukebox#10 review fixes: README file map names lib/background.hl, on Error(Hybrid e) per L10mrea557ac53/lib/background.hl

1.3 KB

  1. // lib/background.hl — THE STARTUP STEPS AND BACKGROUND EVENT WIRING, run once by `new Background()` in project.hl (the map
  2. // stays clean): the storage folders (lib/settings.hl), the key migration with its catalog rebuild and log line
  3. // (lib/migrate.hl, lib/catalog.hl), arming the first scan, the one-second ticker that runs lib/schedule.hl's `tick`,
  4. // the scan child process's progress/exit lines, and the error handler.
  5. import { every } from 'hl:time'
  6. import { exit } from 'hl:proc'
  7. import { ensureStorage } from './settings.hl'
  8. import { needsFix, fixKeys } from './migrate.hl'
  9. import { rebuildCatalog } from './catalog.hl'
  10. import { armFirst, tick, applyLine, finished } from './schedule.hl'
  11. ensureStorage()
  12. if (needsFix()) {
  13. fixed = fixKeys()
  14. rebuilt = rebuildCatalog()
  15. console.log('keys fixed on ' + fixed + ' songs; ' + rebuilt.albums + ' albums, ' + rebuilt.artists + ' artists')
  16. }
  17. armFirst()
  18. // once a second the scheduler looks whether a scan is due or asked for (lib/schedule.hl)
  19. // the scan runs in a child process; its progress lines and its end come back here
  20. ticker = every(1)
  21. on ticker.tick() {
  22. child = tick()
  23. if (child != null) {
  24. on child.line({ line, stream }) { applyLine(line) }
  25. on child.exit({ exit, pid }) { finished(exit) }
  26. }
  27. }
  28. on Error(Hybrid e) {
  29. if (e.phase == 'startup') { console.log('jukebox: startup error: ' + e.message) exit(1) }
  30. console.log('error absorbed: ' + e.message)
  31. }

Branches

Latest commits

  • a557ac53jukebox#10 review fixes: README file map names lib/background.hl, on Error(Hybrid e) per L10mre
  • 3503b648|||PR jukebox#10: move startup and scan wiring out of project.hl into lib/background.hlmre
  • 536d7c58Merge branch 'playing-row' into mainJukebox
  • 05c3578c|||PR Keep each playing row bound to the shell song on day76mre
  • eaa7e6d6Vendor Hybriel day76 for live parent member readsmre
  • 0923398bMerge branch 'records-1124d' into mainJukebox
  • 78f0cc86|||PR records 2026-11-24: inbox-thread rule, "Not playing" confirmed and closedmre
  • c1b153c4Merge branch 'records-1124c' into mainJukebox
  • d7b5e780|||PR Records 2026-11-24 (2): live day72, PR #19 merge, #10 newsmre
  • 43b564dbMerge branch 'records-1124b' into mainJukebox
  • fa86b08c|||PR Records 2026-11-24: LOG, STATUS, missions 020-023mre
  • 0a2ae3daMerge remote-tracking branch 'origin/records-1123' into records-1124mre
  • 9a48cfcaMerge branch 'vendor-theme' into mainJukebox
  • 170d3735Merge branch 'code-order-2' into mainJukebox
  • 3f1918a7|||PR Re-sync layouts theme 4099e64 with Segoe UI firstmre
  • 2e7f6a43Vendor virtual-list 489afcf from components.hybrielmre
  • 0ba85799Merge branch 'reset-classes' into mainJukebox
  • 502eeed5jukebox#20: vendor virtual-list initial resetKey baseline fixmre
  • 6d5ce287|||PR jukebox#9 Centralize songs table reads and writes in db.hlmre
  • dcca21abjukebox#8 Move copies and queue logic into their topicsmre