From 2642d2d3fb098e4ba93046bee01887fd4c20c025 Mon Sep 17 00:00:00 2001 From: Matthew Stratford Date: Sun, 21 Mar 2021 13:19:29 +0000 Subject: [PATCH] Use bapsicle for direct track search --- src/api.ts | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/src/api.ts b/src/api.ts index f66a941..56372f0 100644 --- a/src/api.ts +++ b/src/api.ts @@ -47,6 +47,20 @@ export async function myradioApiRequest( } } +export async function bapsicleApiRequest( + endpoint: string, + method: "GET" | "POST" | "PUT", + params: any +): Promise { + const res = await apiRequest( + "http://webstudio-dev.ury.org.uk:13500" + endpoint, + method, + params + ); + const json = await res.json(); + return json; +} + export async function broadcastApiRequest( endpoint: string, method: "GET" | "POST" | "PUT", @@ -180,12 +194,17 @@ export function searchForTracks( artist: string, title: string ): Promise> { + return bapsicleApiRequest("/library/search/track", "GET", { + artist, + title, + }); + /* return myradioApiRequest("/track/search", "GET", { artist, title, limit: 100, digitised: true, - }); + }); */ } export interface NipswebPlaylist {