From 6b00378d9d18163d0b3a7f95d44c88fa225ea752 Mon Sep 17 00:00:00 2001 From: Miguel Ángel Moreno Date: Mon, 29 Apr 2024 01:35:14 +0200 Subject: feat: revert to using a stream URL for fetch-audio-player-stream --- src/frontend/tubo/events.cljs | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/frontend/tubo/events.cljs b/src/frontend/tubo/events.cljs index 5a8bd9a..4980ab5 100644 --- a/src/frontend/tubo/events.cljs +++ b/src/frontend/tubo/events.cljs @@ -428,7 +428,7 @@ (assoc :media-queue-pos idx) (assoc-in [:media-queue idx :stream] "")) :store (assoc store :media-queue-pos idx) - :fx [[:dispatch [::fetch-audio-player-stream stream idx true]]]})))) + :fx [[:dispatch [::fetch-audio-player-stream (:url stream) idx true]]]})))) (rf/reg-event-fx ::change-media-queue-stream @@ -465,7 +465,7 @@ :store (-> store (assoc :show-audio-player true) (assoc :media-queue (:media-queue updated-db))) - :fx [[:dispatch [::fetch-audio-player-stream stream idx (= (count (:media-queue db)) 0)]]]}))) + :fx [[:dispatch [::fetch-audio-player-stream (:url stream) idx (= (count (:media-queue db)) 0)]]]}))) (rf/reg-event-fx ::start-stream-radio @@ -481,10 +481,9 @@ (fn [{:keys [db store]} [_ streams]] {:db (assoc db :show-audio-player true) :store (assoc store :show-audio-player true) - :fx (into [] (conj - (map #(identity [:dispatch [::add-to-media-queue %]]) streams) - [:dispatch [::fetch-audio-player-stream (first streams) - (count (:media-queue db)) (= (count (:media-queue db)) 0)]]))})) + :fx (conj (map (fn [s] [:dispatch [::add-to-media-queue s]]) streams) + [:dispatch [::fetch-audio-player-stream (-> streams first :url) + (count (:media-queue db)) (= (count (:media-queue db)) 0)]])})) (rf/reg-event-db ::modal @@ -916,9 +915,9 @@ (rf/reg-event-fx ::fetch-audio-player-stream - (fn [{:keys [db]} [_ stream idx play?]] + (fn [{:keys [db]} [_ uri idx play?]] (assoc - (api/get-request (str "/streams/" (js/encodeURIComponent (:url stream))) + (api/get-request (str "/streams/" (js/encodeURIComponent uri)) [::load-audio-player-stream idx play?] [::audio-player-stream-failure play?]) :db (assoc db :show-audio-player-loading true)))) -- cgit v1.2.3