aboutsummaryrefslogtreecommitdiff
path: root/src/backend/tau/api/stream.clj
diff options
context:
space:
mode:
authorMiguel Ángel Moreno <mail@migalmoreno.com>2022-12-29 01:53:08 +0100
committerMiguel Ángel Moreno <mail@migalmoreno.com>2022-12-29 01:53:08 +0100
commitdfcc61063822dfb0fe699896da312249e93d5439 (patch)
treec1dc29de45cfe4ae67f104510dc3c4b6d858aa46 /src/backend/tau/api/stream.clj
parent6382ec24c5bbbf93ced1e587103a52b3a63e6045 (diff)
feat(backend): Remove records and simplify API
Diffstat (limited to 'src/backend/tau/api/stream.clj')
-rw-r--r--src/backend/tau/api/stream.clj45
1 files changed, 0 insertions, 45 deletions
diff --git a/src/backend/tau/api/stream.clj b/src/backend/tau/api/stream.clj
deleted file mode 100644
index d935a6f..0000000
--- a/src/backend/tau/api/stream.clj
+++ /dev/null
@@ -1,45 +0,0 @@
-(ns tau.api.stream
- (:require
- [clojure.java.data :as j]
- [ring.util.codec :refer [url-decode]]
- [tau.api.result :as result])
- (:import
- org.schabi.newpipe.extractor.stream.StreamInfo
- org.schabi.newpipe.extractor.NewPipe
- org.schabi.newpipe.extractor.localization.DateWrapper
- java.time.Instant))
-
-(defrecord Stream
- [name description upload-date
- upload-author upload-url upload-avatar
- thumbnail-url service-id duration view-count like-count
- dislike-count subscriber-count upload-verified? hls-url
- dash-mpd-url category tags audio-streams video-streams
- related-streams])
-
-(defn get-info
- [url]
- (let [info (StreamInfo/getInfo (url-decode url))]
- (map->Stream
- {:name (.getName info)
- :url (.getUrl info)
- :description (.. info (getDescription) (getContent))
- :upload-date (.getTextualUploadDate info)
- :upload-author (.getUploaderName info)
- :upload-url (.getUploaderUrl info)
- :upload-avatar (.getUploaderAvatarUrl info)
- :upload-verified? (.isUploaderVerified info)
- :service-id (.getServiceId info)
- :thumbnail-url (.getThumbnailUrl info)
- :duration (.getDuration info)
- :tags (.getTags info)
- :category (.getCategory info)
- :view-count (.getViewCount info)
- :like-count (if (= (.getLikeCount info) -1) nil (.getLikeCount info))
- :dislike-count (if (= (.getDislikeCount info) -1) nil (.getDislikeCount info))
- :subscriber-count (if (= (.getUploaderSubscriberCount info) -1) nil (.getUploaderSubscriberCount info))
- :audio-streams (j/from-java (.getAudioStreams info))
- :video-streams (j/from-java (.getVideoStreams info))
- :hls-url (.getHlsUrl info)
- :dash-mpd-url (.getDashMpdUrl info)
- :related-streams (result/get-results (.getRelatedStreams info))})))