Add managed catalog sync and player UX improvements

This commit is contained in:
2026-04-29 13:49:16 +02:00
parent b866845b6a
commit c8f8c76e8a
21 changed files with 71429 additions and 148 deletions

View File

@@ -13,6 +13,7 @@ const API_ENDPOINT = 'https://de1.api.radio-browser.info/json/stations/search';
const scriptDir = path.dirname(fileURLToPath(import.meta.url));
const repoRoot = path.resolve(scriptDir, '..');
const outputPath = path.join(repoRoot, 'public', 'data', 'radio-stations.json');
const syncOutputPath = path.join(repoRoot, 'public', 'data', 'radio-stations-sync.json');
const collectedStations: RadioStation[] = [];
const seenStationIds = new Set<string>();
@@ -52,11 +53,16 @@ collectedStations.sort((left, right) => {
});
await mkdir(path.dirname(outputPath), { recursive: true });
await writeFile(outputPath, `${JSON.stringify(collectedStations, null, 2)}\n`, 'utf8');
const serializedStations = `${JSON.stringify(collectedStations, null, 2)}\n`;
await Promise.all([
writeFile(outputPath, serializedStations, 'utf8'),
writeFile(syncOutputPath, serializedStations, 'utf8'),
]);
console.log(`[radio-import] Imported ${collectedStations.length} stations from ${successfulCountries}/${radioCountries.length} countries.`);
console.log(`[radio-import] Failed countries: ${failedCountries.length > 0 ? failedCountries.join(', ') : 'None'}`);
console.log('[radio-import] Output: public/data/radio-stations.json');
console.log('[radio-import] Sync output: public/data/radio-stations-sync.json');
async function fetchCountryStations(countryCode: string): Promise<RadioBrowserStation[]> {
const url = new URL(API_ENDPOINT);