1
0
Fork 0
mirror of https://github.com/heyarne/airsonic-ui.git synced 2026-05-06 18:33:38 +02:00

Merge incomplete podcast support

commit 4ac35d6530f7770e7b80307321c72541a55e2c8e
Author: Arne Schlüter <arne@schlueter.is>
Date:   Mon Oct 8 21:09:04 2018 +0200

    Stub out podcast detail view

commit 60742a22e93bfe6f432e06d56d3e4da671184559
Author: Arne Schlüter <arne@schlueter.is>
Date:   Tue Sep 18 23:02:39 2018 +0200

    Simplify api helpers; closes #16

commit 8bbc79ebf4dbbe3dbfa08cb4c7c1edd341d507eb
Author: Arne Schlüter <arne@schlueter.is>
Date:   Tue Sep 18 19:39:17 2018 +0200

    Adjust `stream-url` to work with podcast episodes

commit 991ba5b65230a7429c160ca1b7968ecbb8595e0b
Author: Arne Schlüter <arne@schlueter.is>
Date:   Tue Sep 18 19:14:08 2018 +0200

    Fix breadcrumbs for podcasts

commit 37c3a894eded2fe37f9af031d3132c7175702266
Author: Arne Schlüter <arne@schlueter.is>
Date:   Tue Sep 18 15:11:54 2018 +0200

    Stub out overview for podcasts
This commit is contained in:
Arne Schlüter 2018-10-08 21:15:29 +02:00
commit fa485bbf42
19 changed files with 350 additions and 133 deletions

View file

@ -10,12 +10,12 @@
(api/url server endpoint {}))
(def fixtures
{:default-url (url "http://localhost:8080" "ping")})
{:default-url (url {:server "http://localhost:8080"} "ping")})
(deftest general-url-construction
(testing "Handles missing slashes"
(is (true? (str/starts-with? (fixtures :default-url) "http://localhost:8080/rest/ping")))
(is (true? (str/starts-with? (url "http://localhost:8080/" "ping") "http://localhost:8080/rest/ping"))))
(is (true? (str/starts-with? (url {:server "http://localhost:8080"} "ping") "http://localhost:8080/rest/ping")))
(is (true? (str/starts-with? (url {:server "http://localhost:8080/"} "ping") "http://localhost:8080/rest/ping"))))
(testing "Should set correct default parameters"
(is (string? (re-find #"f=json" (fixtures :default-url))))
(is (string? (re-find #"v=1\.15\.0" (fixtures :default-url))))))
@ -24,19 +24,22 @@
(testing "Should escape url parameters"
(let [query "äöüß"
encoded-str (js/encodeURIComponent query)]
(is (str/includes? (api/url "http://localhost" "search3" {:query query}) encoded-str)))))
(is (str/includes? (api/url {:server "http://localhost"} "search3" {:query query}) encoded-str)))))
(deftest song-urls
(deftest stream-urls
(testing "Should construct the url based on a song's id"
(let [song {:id 1234}]
(is (true? (str/includes? (api/song-url "http://localhost" {} song) (str "id=" (:id song))))))))
(let [stream-url (api/stream-url {:server "http://localhost"} fixtures/song)]
(is (str/includes? stream-url (str "id=" (:id fixtures/song))))))
(testing "Should also work for podcasts"
(let [stream-url (api/stream-url {:server "http://localhost"} fixtures/podcast-episode)]
(is (str/includes? stream-url (str "id=" (:streamId fixtures/podcast-episode)))))))
(deftest cover-urls
(let [album {:coverArt "cover-99999"}]
(testing "Should construct the url based on an item's cover-id"
(is (true? (str/includes? (api/cover-url "http://server.tld" {} album -1) (str "id=" (:coverArt album))))))
(is (true? (str/includes? (api/cover-url {:server "http://server.tld"} album -1) (str "id=" (:coverArt album))))))
(testing "Should scale an image to a given size"
(is (true? (str/includes? (api/cover-url "http://server.tld" {} album 48) "size=48"))))))
(is (true? (str/includes? (api/cover-url {:server "http://server.tld"} album 48) "size=48"))))))
(deftest response-handling
(testing "Should unwrap responses"

View file

@ -86,3 +86,30 @@
:paused? false
:current-src "https://londe.arnes.space/rest/stream?f=json&c=airsonic-ui-cljs&v=1.15.0&id=9574&u=arne&p=27h-%25bO%5B8-.ys%40SQ%7Bg%24-%5B5NZkX%7Dw%24NNwY%263DPATi%2CgaFoH%40e"
:current-time 3.477029})
(def podcast-episode
{:genre "Vocal",
:description
"Themen der Sendung: Druck auf Maaßen nach Äußerungen zu Chemnitz wächst, Köthen: 22-Jähriger stirbt nach Streit an Herzversagen, Parlamentswahl in Schweden, Russland und Syrien setzen Luftangriffe auf syrische Provinz Idlib fort, Tote und Verletzte bei Ausschreitungen im irakischem Basra, Nordkorea feiert 70. Jubiläum seiner Staatsgründung, Zahl der Toten nach Erdbeben in Japan steigt auf 39, Pläne von CDU und CSU: Fluggesellschaften sollen Auskunft über Verspätungen geben, Menschenkette in Dangast als Zeichen gegen Flüchtlingssterben im Mittelmeer, Das Wetter",
:suffix "mp3",
:isDir false,
:bitRate 64,
:parent "10409",
:channelId "4",
:type "podcast",
:created "2018-09-09T19:41:13.000Z",
:duration 965,
:artist "Tagesschau (Audio-Podcast)",
:isVideo false,
:publishDate "2018-09-09T18:00:00.000Z",
:size 7812758,
:title "09.09.2018 - tagesschau 20:00 Uhr",
:playCount 0,
:year 2018,
:streamId "11181",
:status "completed",
:id "507",
:coverArt "10409",
:contentType "audio/mpeg",
:album "tagesschau",
:track 1})

View file

@ -31,11 +31,8 @@
:u "test-user"
:p "some-random-password"}]
(testing "Should give the correct path once the credentials are set"
(is (= (api/cover-url (:server credentials)
(select-keys credentials [:u :p])
fixtures/song
48)
(subs/cover-url [credentials] [:subs/cover-image fixtures/song 48]))))))
(is (= (api/cover-url credentials fixtures/song 48)
(subs/cover-url credentials [:subs/cover-image fixtures/song 48]))))))
(def successful-auth-db
"For the details see event_test.cljs"