From 452ccfd567f79126e108f69bb7ebca07b5993bdd Mon Sep 17 00:00:00 2001 From: Miguel Ángel Moreno Date: Mon, 21 Nov 2022 17:55:28 +0100 Subject: feat: Initial commit --- src/backend/tau/api/service.clj | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 src/backend/tau/api/service.clj (limited to 'src/backend/tau/api/service.clj') diff --git a/src/backend/tau/api/service.clj b/src/backend/tau/api/service.clj new file mode 100644 index 0000000..de2e994 --- /dev/null +++ b/src/backend/tau/api/service.clj @@ -0,0 +1,24 @@ +(ns tau.api.service + (:require + [clojure.java.data :as j] + [tau.api.kiosk :as kiosk]) + (:import + org.schabi.newpipe.extractor.NewPipe + org.schabi.newpipe.extractor.kiosk.KioskList + org.schabi.newpipe.extractor.StreamingService)) + +(defrecord Service + [id info base-url kiosk-list]) + +(defn get-service-info + [service] + (map->Service + {:id (.getServiceId service) + :info (j/from-java (.getServiceInfo service)) + :base-url (.getBaseUrl service) + :kiosk-list (map #(kiosk/get-kiosk-info % (.getServiceId service)) + (.getAvailableKiosks (.getKioskList service)))})) + +(defn get-service-list-info + [] + (map #(get-service-info %) (NewPipe/getServices))) -- cgit v1.2.3