mirror of
https://github.com/heyarne/airsonic-ui.git
synced 2026-05-07 02:33:39 +02:00
Refactor playlist to use a sorted-map
This commit is contained in:
parent
c715e5025c
commit
644939c618
9 changed files with 206 additions and 229 deletions
|
|
@ -6,8 +6,6 @@
|
|||
[airsonic-ui.audio.playlist :as playlist]
|
||||
[goog.functions :refer [throttle]]))
|
||||
|
||||
;; TODO: Manage buffering
|
||||
|
||||
(defonce audio (atom nil))
|
||||
|
||||
(defn normalize-time-ranges [time-ranges]
|
||||
|
|
@ -28,7 +26,6 @@
|
|||
|
||||
; explanation of these events: https://developer.mozilla.org/en-US/Apps/Fundamentals/Audio_and_video_delivery/Cross-browser_audio_basics
|
||||
|
||||
|
||||
(defn attach-listeners! [el]
|
||||
(let [emit-audio-update (throttle #(rf/dispatch [:audio/update (->status el)]) 16)]
|
||||
(doseq [event ["loadstart" "progress" "play" "timeupdate" "pause" "volumechange"]]
|
||||
|
|
@ -116,7 +113,9 @@
|
|||
"Gives us information about the currently played song as presented by
|
||||
the airsonic api"
|
||||
[playlist _]
|
||||
(playlist/peek playlist))
|
||||
(when-not (empty? playlist)
|
||||
(playlist/current-song playlist)))
|
||||
|
||||
|
||||
(rf/reg-sub
|
||||
:audio/current-song
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue