jukebox
All repositories: gitoria
1.3 KB
// lib/background.hl — THE STARTUP STEPS AND BACKGROUND EVENT WIRING, run once by `new Background()` in project.hl (the map// stays clean): the storage folders (lib/settings.hl), the key migration with its catalog rebuild and log line// (lib/migrate.hl, lib/catalog.hl), arming the first scan, the one-second ticker that runs lib/schedule.hl's `tick`,// the scan child process's progress/exit lines, and the error handler.import { every } from 'hl:time'import { exit } from 'hl:proc'import { ensureStorage } from './settings.hl'import { needsFix, fixKeys } from './migrate.hl'import { rebuildCatalog } from './catalog.hl'import { armFirst, tick, applyLine, finished } from './schedule.hl'ensureStorage()if (needsFix()) {fixed = fixKeys()rebuilt = rebuildCatalog()console.log('keys fixed on ' + fixed + ' songs; ' + rebuilt.albums + ' albums, ' + rebuilt.artists + ' artists')}armFirst()// once a second the scheduler looks whether a scan is due or asked for (lib/schedule.hl)// the scan runs in a child process; its progress lines and its end come back hereticker = every(1)on ticker.tick() {child = tick()if (child != null) {on child.line({ line, stream }) { applyLine(line) }on child.exit({ exit, pid }) { finished(exit) }}}on Error(Hybrid e) {if (e.phase == 'startup') { console.log('jukebox: startup error: ' + e.message) exit(1) }console.log('error absorbed: ' + e.message)}
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