diff options
author | Miguel Ángel Moreno <mail@migalmoreno.com> | 2022-12-20 00:35:56 +0100 |
---|---|---|
committer | Miguel Ángel Moreno <mail@migalmoreno.com> | 2022-12-20 00:54:58 +0100 |
commit | e71fdc8dbac5c77d6c2fd252f31fc12cd6375e30 (patch) | |
tree | 890953876b06a647e6790715f2580aa94aebe4a7 /src/backend/tau/api/search.clj | |
parent | e4714f94ff6d01847fa61c33c678b6d856c3b30a (diff) |
fix: Fix related streams on API endpoints
Diffstat (limited to 'src/backend/tau/api/search.clj')
-rw-r--r-- | src/backend/tau/api/search.clj | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/backend/tau/api/search.clj b/src/backend/tau/api/search.clj index 4969f10..106999d 100644 --- a/src/backend/tau/api/search.clj +++ b/src/backend/tau/api/search.clj @@ -17,15 +17,15 @@ (defrecord SearchResultPage [items next-page]) -(defn get-search-results +(defn get-results [items] (map #(case (.name (.getInfoType %)) - "STREAM" (stream/get-stream-result %) - "CHANNEL" (channel/get-channel-result %) - "PLAYLIST" (playlist/get-playlist-result %)) + "STREAM" (stream/get-result %) + "CHANNEL" (channel/get-result %) + "PLAYLIST" (playlist/get-result %)) items)) -(defn get-search-info +(defn get-info ([service-id query content-filters sort-filter] (let [service (NewPipe/getService service-id) query-handler (.. service @@ -33,7 +33,7 @@ (fromQuery query (or content-filters '()) (or sort-filter ""))) info (SearchInfo/getInfo service query-handler)] (map->SearchResult - {:items (get-search-results (.getRelatedItems info)) + {:items (get-results (.getRelatedItems info)) :next-page (j/from-java (.getNextPage info)) :search-suggestion (.getSearchSuggestion info) :corrected-search? (.isCorrectedSearch info)}))) @@ -45,5 +45,5 @@ (fromQuery query (or content-filters '()) (or sort-filter ""))) info (SearchInfo/getMoreItems service query-handler (Page. url))] (map->SearchResultPage - {:items (get-search-results (.getItems info)) + {:items (get-results (.getItems info)) :next-page (j/from-java (.getNextPage info))})))) |