Ability to play radio stations from subsonic api (#199)

This commit is contained in:
Simon J
2024-02-26 05:51:30 +11:00
committed by GitHub
parent eb3124b705
commit e7f5f5871e
11 changed files with 382 additions and 41 deletions

View File

@@ -205,6 +205,15 @@ type GetTopSongsResponse = {
topSongs: { song: song[] };
};
type GetInternetRadioStationsResponse = {
internetRadioStations: { internetRadioStation: {
id: string,
name: string,
streamUrl: string,
homePageUrl?: string }[]
}
}
type GetSongResponse = {
song: song;
};
@@ -1011,6 +1020,24 @@ export class Subsonic implements MusicService {
)
)
),
radioStations: async () => subsonic
.getJSON<GetInternetRadioStationsResponse>(
credentials,
"/rest/getInternetRadioStations"
)
.then((it) => it.internetRadioStations.internetRadioStation || [])
.then((stations) => stations.map((it) => ({
id: it.id,
name: it.name,
url: it.streamUrl,
homePage: it.homePageUrl
}))),
radioStation: async (id: string) => genericSubsonic
.radioStations()
.then(it =>
it.find(station => station.id === id)!
),
};
if (credentials.type == "navidrome") {