aboutsummaryrefslogtreecommitdiff
path: root/src/backend/tau/api/service.clj
blob: b9f0e1d1b75b8ba2f2c98aeb3fdd97de030e87a6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
(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-info
  [service]
  (map->Service
   {:id (.getServiceId service)
    :info (j/from-java (.getServiceInfo service))
    :base-url (.getBaseUrl service)
    ;; :kiosk-list (map #(kiosk/get-info % (.getServiceId service))
    ;;                  (.getAvailableKiosks (.getKioskList service)))
    }))

(defn get-services
  []
  (map #(get-info %) (NewPipe/getServices)))