/
/
/
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. The "-flacm" mounts carry the same FLAC
38# audio WITH ICY stream titles; the plain "-flac" mounts are a single continuous
39# Ogg stream whose metadata never updates after connect.
40RADIO_PARADISE_CHANNELS: dict[str, RadioParadiseChannel] = {
41 "0": {
42 "name": "Radio Paradise - Main Mix",
43 "description": "Eclectic mix of music - hand-picked by real humans",
44 "stream_url": "https://stream.radioparadise.com/flacm",
45 "content_type": ContentType.FLAC,
46 "station_icon": "radioparadise-logo-main.png",
47 },
48 "1": {
49 "name": "Radio Paradise - Mellow Mix",
50 "description": "A mellower selection from the RP music library",
51 "stream_url": "https://stream.radioparadise.com/mellow-flacm",
52 "content_type": ContentType.FLAC,
53 "station_icon": "radioparadise-logo-mellow.png",
54 },
55 "2": {
56 "name": "Radio Paradise - Rock Mix",
57 "description": "Heavier selections from the RP music library",
58 "stream_url": "https://stream.radioparadise.com/rock-flacm",
59 "content_type": ContentType.FLAC,
60 "station_icon": "radioparadise-logo-rock.png",
61 },
62 "3": {
63 "name": "Radio Paradise - Global",
64 "description": "Global music and experimental selections",
65 "stream_url": "https://stream.radioparadise.com/global-flacm",
66 "content_type": ContentType.FLAC,
67 "station_icon": "radioparadise-logo-global.png",
68 },
69 "4": {
70 "name": "Radio Paradise - Beyond",
71 "description": "Exploring the frontiers of improvisational music",
72 "stream_url": "https://stream.radioparadise.com/beyond-flacm",
73 "content_type": ContentType.FLAC,
74 "station_icon": "radioparadise-logo-beyond.png",
75 },
76 "5": {
77 "name": "Radio Paradise - Serenity",
78 "description": "Don't panic, and don't forget your towel",
79 "stream_url": "https://stream.radioparadise.com/serenity",
80 "content_type": ContentType.AAC,
81 "station_icon": "radioparadise-logo-serenity.png",
82 },
83}
84