From e71fdc8dbac5c77d6c2fd252f31fc12cd6375e30 Mon Sep 17 00:00:00 2001 From: Miguel Ángel Moreno Date: Tue, 20 Dec 2022 00:35:56 +0100 Subject: fix: Fix related streams on API endpoints --- src/backend/tau/api/search.clj | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src/backend/tau/api/search.clj') 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))})))) -- cgit v1.2.3