mirror of
https://github.com/heyarne/airsonic-ui.git
synced 2026-05-07 10:43:39 +02:00
Consistently use "current queue" to avoid confusion
This commit is contained in:
parent
7eeceb2786
commit
b4992bccf7
6 changed files with 61 additions and 59 deletions
|
|
@ -10,43 +10,43 @@
|
|||
(let [playlist (-> (playlist/->playlist songs :playback-mode :linear :repeat-mode :repeat-all)
|
||||
(playlist/set-current-song start-idx))]
|
||||
{:audio/play (api/stream-url (:credentials db) (playlist/peek playlist))
|
||||
:db (assoc-in db [:audio :playlist] playlist)})))
|
||||
:db (assoc-in db [:audio :current-queue] playlist)})))
|
||||
|
||||
(rf/reg-event-db
|
||||
:audio-player/set-playback-mode
|
||||
(fn [db [_ playback-mode]]
|
||||
(update-in db [:audio :playlist] #(playlist/set-playback-mode % playback-mode))))
|
||||
(update-in db [:audio :current-queue] #(playlist/set-playback-mode % playback-mode))))
|
||||
|
||||
(rf/reg-event-db
|
||||
:audio-player/set-repeat-mode
|
||||
(fn [db [_ repeat-mode]]
|
||||
(update-in db [:audio :playlist] #(playlist/set-repeat-mode % repeat-mode))))
|
||||
(update-in db [:audio :current-queue] #(playlist/set-repeat-mode % repeat-mode))))
|
||||
|
||||
(rf/reg-event-fx
|
||||
:audio-player/next-song
|
||||
(fn [{:keys [db]} _]
|
||||
(let [db (update-in db [:audio :playlist] playlist/next-song)
|
||||
next (playlist/peek (get-in db [:audio :playlist]))]
|
||||
(let [db (update-in db [:audio :current-queue] playlist/next-song)
|
||||
next (playlist/peek (get-in db [:audio :current-queue]))]
|
||||
{:db db
|
||||
:audio/play (api/stream-url (:credentials db) next)})))
|
||||
|
||||
(rf/reg-event-fx
|
||||
:audio-player/previous-song
|
||||
(fn [{:keys [db]} _]
|
||||
(let [db (update-in db [:audio :playlist] playlist/previous-song)
|
||||
prev (playlist/peek (get-in db [:audio :playlist]))]
|
||||
(let [db (update-in db [:audio :current-queue] playlist/previous-song)
|
||||
prev (playlist/peek (get-in db [:audio :current-queue]))]
|
||||
{:db db
|
||||
:audio/play (api/stream-url (:credentials db) prev)})))
|
||||
|
||||
(rf/reg-event-db
|
||||
:audio-player/enqueue-next
|
||||
(fn [db [_ song]]
|
||||
(update-in db [:audio :playlist] #(playlist/enqueue-next % song))))
|
||||
(update-in db [:audio :current-queue] #(playlist/enqueue-next % song))))
|
||||
|
||||
(rf/reg-event-db
|
||||
:audio-player/enqueue-last
|
||||
(fn [db [_ song]]
|
||||
(update-in db [:audio :playlist] #(playlist/enqueue-last % song))))
|
||||
(update-in db [:audio :current-queue] #(playlist/enqueue-last % song))))
|
||||
|
||||
(rf/reg-event-fx
|
||||
:audio-player/toggle-play-pause
|
||||
|
|
@ -65,7 +65,7 @@
|
|||
(rf/reg-event-fx
|
||||
:audio-player/seek
|
||||
(fn [{:keys [db]} [_ percentage]]
|
||||
(let [duration (:duration (playlist/peek (get-in db [:audio :playlist])))]
|
||||
(let [duration (:duration (playlist/peek (get-in db [:audio :current-queue])))]
|
||||
{:audio/seek [percentage duration]})))
|
||||
|
||||
(rf/reg-event-fx
|
||||
|
|
|
|||
|
|
@ -142,7 +142,7 @@
|
|||
|
||||
(defn audio-player []
|
||||
(let [current-song @(subscribe [:audio/current-song])
|
||||
playlist @(subscribe [:audio/playlist])
|
||||
current-queue @(subscribe [:audio/current-queue])
|
||||
playback-status @(subscribe [:audio/playback-status])
|
||||
is-playing? @(subscribe [:audio/is-playing?])]
|
||||
[:nav.audio-player
|
||||
|
|
@ -153,6 +153,6 @@
|
|||
[progress-indicators current-song playback-status]
|
||||
[playback-controls is-playing?]
|
||||
[volume-controls playback-status]
|
||||
[playback-mode-controls playlist]]
|
||||
[playback-mode-controls current-queue]]
|
||||
;; not playing anything
|
||||
[:p.navbar-item.idle-notification "No audio playing"])]))
|
||||
|
|
|
|||
|
|
@ -8,7 +8,9 @@
|
|||
[:section.section>div.container
|
||||
[:h1.title "Current Queue"]
|
||||
[sortable/sortable-component]
|
||||
(if-let [playlist @(subscribe [:audio/playlist])]
|
||||
[song/listing (:queue playlist)]
|
||||
[:p "You are currently not playing anything. Use the search or go to your "
|
||||
[:a {:href (r/url-for ::r/library)} "Library"] " to start playing some music."])])
|
||||
(let [current-queue @(subscribe [:audio/current-queue])
|
||||
#_#_ current-song @(subscribe [:audio/current-song])]
|
||||
(if (some? current-queue)
|
||||
[song/listing (:items current-queue)]
|
||||
[:p "You are currently not playing anything. Use the search or go to your "
|
||||
[:a {:href (r/url-for ::r/library)} "Library"] " to start playing some music."]))])
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue