Add Radio Browser station importer
This commit is contained in:
12
src/radio/loadRadioStations.ts
Normal file
12
src/radio/loadRadioStations.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
import type { RadioStation } from './radioTypes.js';
|
||||
|
||||
export async function loadRadioStations(): Promise<RadioStation[]> {
|
||||
const response = await fetch('/data/radio-stations.json');
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error(`Failed to load radio stations: ${response.status}`);
|
||||
}
|
||||
|
||||
const stations = (await response.json()) as RadioStation[];
|
||||
return Array.isArray(stations) ? stations : [];
|
||||
}
|
||||
Reference in New Issue
Block a user