jukebox
All repositories: gitoria
1.1 KB
// lib/remember.hl — WHAT THE LISTENER LAST CHOSE, kept in storage/ui.json: the sort of the Songs screen (artist, title, album, plays).// The screen opens the way it was left. Its own file, apart from settings.json (that one holds the library paths and is written whole by the settings call).import { readFile, writeFile, exists, mkDir } from 'hl:fs'import { storageRoot, storageDir } from './util.hl'static uiFile = storageRoot + '/ui.json'static sorts = ['artist', 'title', 'album', 'plays']// the sort the Songs screen was left with ('artist' when nothing was saved or the file says something else)static lastSort = () => {if (!exists(uiFile)) { return 'artist' }text = readFile(uiFile)if (text == null || !text.trim().startsWith('{')) { return 'artist' }j = JSON.parse(text)if (j == null || j.sort == null || !sorts.includes(j.sort)) { return 'artist' }return j.sort}// the listener chose a sort: keep it for the next visit; a name that is no sort is ignoredstatic rememberSort = (sort) => {if (sort == null || !sorts.includes(sort)) { return null }mkDir(storageRoot)writeFile(uiFile, JSON.stringify({ sort = sort }), 420)return sort}
Branches
Latest commits
- e0b75951Records: L1 merged and pushed, restart waits for an open connectionmre
- f2b5db98styles: format styles with nested rules and bare queriesmre
- f036bab4search: format styles with nested rules and bare queriesmre
- ef9a9d4asongs: format styles with nested rules and bare queriesmre
- f22f9aacmain: format styles with nested rules and bare queriesmre
- f56cd7c7Sync icons from 8176eb1 and verify mixed component sourcesmre
- d56e5054Sync theme and shared tokens from layouts 17e0f03mre
- b1362547Re-vendor to Hybriel set day35mre
- 89e10f08Records: mission 002 rollback wordingmre
- 9485dee7Records: mission 002 brief (live step)mre
- 9ba68fe7Records: S1b reviewedmre
- 193dfff1Records: S1 result, S1b startedmre
- 028ed776Records: mission 001 continuation S1bmre
- 1838d7e8Records: S1 startedmre
- a43fca3fRecords: mission 001 decided pointsmre
- 41773828Records: statusmre
- a82c0805Records: mission 001 brief (Style form)mre
- a4bce6d1Records: ticket push subscriptionmre
- 14abde3bjukebox: records: Atlas's records moved to worldapi-conductor/archivemre
- 0433e9a8jukebox: records: gitoria remote added and pushedmre