/
/
1"""Constants for Radio Paradise provider."""
2
3from typing import TypedDict
4
5import aiohttp
6from music_assistant_models.enums import ContentType
7
8# Base URL for station icons
9STATION_ICONS_BASE_URL = (
10 "https://raw.githubusercontent.com/music-assistant/music-assistant.io/main/public/assets/icons"
11)
12
13# API base URLs
14API_BASE_URL = "https://api.radioparadise.com/api"
15PLAY_API_URL = f"{API_BASE_URL}/play?bitrate=4&info=true&chan="
16NOWPLAYING_API_URL = f"{API_BASE_URL}/now_playing?chan="
17COVER_BASE_URL = "https://img.radioparadise.com"
18
19# How often the player queue calls back into _update_stream_metadata while a stream is active.
20STREAM_METADATA_UPDATE_INTERVAL = 10
21
22# Per-request timeout for Radio Paradise API calls.
23API_TIMEOUT = aiohttp.ClientTimeout(total=10)
24
25
26class RadioParadiseChannel(TypedDict):
27 """Type definition for a Radio Paradise channel."""
28
29 name: str
30 description: str
31 stream_url: str
32 content_type: ContentType
33 station_icon: str
34
35
36# Channels 0-4 stream FLAC; channel 5 (Serenity) is AAC because Radio Paradise
37# doesn't publish a FLAC variant for it.
38RADIO_PARADISE_CHANNELS: dict[str, RadioParadiseChannel] = {
39 "0": {
40 "name": "Radio Paradise - Main Mix",
41 "description": "Eclectic mix of music - hand-picked by real humans",
42 "stream_url": "https://stream.radioparadise.com/flac",
43 "content_type": ContentType.FLAC,
44 "station_icon": "radioparadise-logo-main.png",
45 },
46 "1": {
47 "name": "Radio Paradise - Mellow Mix",
48 "description": "A mellower selection from the RP music library",
49 "stream_url": "https://stream.radioparadise.com/mellow-flac",
50 "content_type": ContentType.FLAC,
51 "station_icon": "radioparadise-logo-mellow.png",
52 },
53 "2": {
54 "name": "Radio Paradise - Rock Mix",
55 "description": "Heavier selections from the RP music library",
56 "stream_url": "https://stream.radioparadise.com/rock-flac",
57 "content_type": ContentType.FLAC,
58 "station_icon": "radioparadise-logo-rock.png",
59 },
60 "3": {
61 "name": "Radio Paradise - Global",
62 "description": "Global music and experimental selections",
63 "stream_url": "https://stream.radioparadise.com/global-flac",
64 "content_type": ContentType.FLAC,
65 "station_icon": "radioparadise-logo-global.png",
66 },
67 "4": {
68 "name": "Radio Paradise - Beyond",
69 "description": "Exploring the frontiers of improvisational music",
70 "stream_url": "https://stream.radioparadise.com/beyond-flac",
71 "content_type": ContentType.FLAC,
72 "station_icon": "radioparadise-logo-beyond.png",
73 },
74 "5": {
75 "name": "Radio Paradise - Serenity",
76 "description": "Don't panic, and don't forget your towel",
77 "stream_url": "https://stream.radioparadise.com/serenity",
78 "content_type": ContentType.AAC,
79 "station_icon": "radioparadise-logo-serenity.png",
80 },
81}
82