Skip to content

Commit

Permalink
feat: remove handling of video only streams
Browse files Browse the repository at this point in the history
  • Loading branch information
migalmoreno committed Dec 29, 2024
1 parent 6ab396b commit 546300e
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 28 deletions.
49 changes: 24 additions & 25 deletions src/frontend/tubo/player/utils.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -8,31 +8,30 @@
(s/replace (s/upper-case str) #"[-_]" "")))

(defn get-video-stream
[{:keys [audio-streams video-streams video-only-streams]} settings]
(let [video-streams (into video-streams video-only-streams)]
(-> (cond (seq video-streams)
(as-> video-streams streams
(if (some #(fmt= % (:default-video-format settings)) streams)
(filter #(fmt= % (:default-video-format settings))
streams)
streams)
(if (some #(= (:resolution %)
(:default-resolution settings))
video-streams)
(filter #(= (:resolution %)
(:default-resolution settings))
streams)
streams)
(first streams))
(seq audio-streams)
(if (some #(fmt= % (:default-audio-format settings))
audio-streams)
(->> audio-streams
(filter #(fmt= % (:default-audio-format settings)))
first)
(first audio-streams))
:else (first video-streams))
:content)))
[{:keys [audio-streams video-streams]} settings]
(-> (cond (seq video-streams)
(as-> video-streams streams
(if (some #(fmt= % (:default-video-format settings)) streams)
(filter #(fmt= % (:default-video-format settings))
streams)
streams)
(if (some #(= (:resolution %)
(:default-resolution settings))
video-streams)
(filter #(= (:resolution %)
(:default-resolution settings))
streams)
streams)
(first streams))
(seq audio-streams)
(if (some #(fmt= % (:default-audio-format settings))
audio-streams)
(->> audio-streams
(filter #(fmt= % (:default-audio-format settings)))
first)
(first audio-streams))
:else (first video-streams))
:content))

(defn get-audio-stream
[{:keys [audio-streams video-streams]} settings]
Expand Down
6 changes: 3 additions & 3 deletions src/frontend/tubo/queue/events.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
[stream]
(select-keys stream
[:type :service-id :url :name :thumbnails :audio-streams
:video-streams :video-only-streams :verified? :uploader-name
:uploader-url :uploader-avatars :upload-date :short-description
:duration :view-count :bookmark-id]))
:video-streams :verified? :uploader-name :uploader-url
:uploader-avatars :upload-date :short-description :duration
:view-count :bookmark-id]))

(rf/reg-event-fx
:queue/show
Expand Down

0 comments on commit 546300e

Please sign in to comment.