gitoria

jukebox

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Commit2a4cfc552a4cfc55jukebox: library screens (songs, artists, albums, artist, album, search, favourites), compact player bar, /stream with Range, thumbnails, virtual list vendored, ui gate and real-library checkmre2a4cfc55/components/artist.hl

2.0 KB

  1. // components/artist.hl — `/artists/<id>`: one artist, with a switch between their albums and their songs (both are long lists for some artists, so both are virtual lists).
  2. parent './main.hl'
  3. import { navigate } from 'hl:web'
  4. import VirtualList from './virtual-list/virtual-list.hl'
  5. import { rowsFor, artistInfo } from '../lib/rows.hl'
  6. id = null
  7. info = artistInfo(id)
  8. __title = info.name + ' · Jukebox'
  9. String tab = info.albums > 1 ? 'albums' : 'songs'
  10. Hybrid artistCtx = { kind = info.albums > 1 ? 'artist-albums' : 'artist-songs' artist = id sort = 'artist' }
  11. Hybrid firstRows = rowsFor({ kind = info.albums > 1 ? 'artist-albums' : 'artist-songs' artist = id sort = 'artist' }, 0, 100)
  12. Number listTotal = firstRows.total
  13. Hybrid chunk = firstRows.rows
  14. Number chunkFrom = 0
  15. String playingId = ''
  16. String albumsClass = tab == 'albums' ? 'on' : ''
  17. String songsClass = tab == 'songs' ? 'on' : ''
  18. on artistLoad(first, wanted) {
  19. let start = first - 20
  20. if (start < 0) { start = 0 }
  21. r = emit server jbRows(artistCtx, start, 100)
  22. listTotal = r.total
  23. chunk = r.rows
  24. chunkFrom = r.offset
  25. return null
  26. }
  27. loadRange = (first, wanted) => { emit artistLoad(first, wanted) }
  28. picked = (rowId, index) => {
  29. if (tab == 'albums') { navigate('/albums/' + rowId) } else {
  30. playingId = rowId
  31. emit jbPlay(artistCtx, index)
  32. }
  33. }
  34. on artistTab(e) {
  35. tab = e.target.getAttribute('data-tab')
  36. artistCtx = { kind = tab == 'albums' ? 'artist-albums' : 'artist-songs' artist = id sort = 'artist' }
  37. r = emit server jbRows(artistCtx, 0, 100)
  38. listTotal = r.total
  39. chunk = r.rows
  40. chunkFrom = 0
  41. emit vlTop()
  42. return null
  43. }
  44. View {
  45. jbScreen {
  46. jbTabs {
  47. button { type = "button" class = albumsClass 'data-tab' = "albums" on click(e) { emit artistTab(e) } "Albums" }
  48. button { type = "button" class = songsClass 'data-tab' = "songs" on click(e) { emit artistTab(e) } "Songs" }
  49. }
  50. VirtualList { itemCount = listTotal rowHeight = 56 loaded = chunk loadedFrom = chunkFrom onRange = loadRange onPick = picked selectedId = playingId listLabel = "Artist"
  51. jbHead { h1 { id = "name" info.name } p { info.line } }
  52. }
  53. }
  54. }

Branches

Latest commits

  • 2a4cfc55jukebox: library screens (songs, artists, albums, artist, album, search, favourites), compact player bar, /stream with Range, thumbnails, virtual list vendored, ui gate and real-library checkmre
  • 93a44212jukebox: report, numbers of the full scan, notes on the index key rulemre
  • bf5167dajukebox: index keys without commas (mpackdb loses them after a reopen), comma fixture and gate checksmre
  • 28a82fa2jukebox: README, STATUS, LOG, DECISIONSmre
  • d13987dfjukebox: library scanner, ID3 reader, mpackdb database and JSON API, with fixtures and a gatemre