/
/
/
1"""Constants for the ABC Radio provider."""
2
3from typing import TypedDict
4
5import aiohttp
6
7# Now-playing API, also used by ABC's own web players.
8API_BASE_URL = "https://music.abcradio.net.au/api/v1"
9NOW_PLAYING_URL = API_BASE_URL + "/plays/{station_id}/now.json"
10
11# Live HLS streams as served by ABC's streaming CDN.
12STREAM_BASE_URL = "https://streaming.abc-cdn.net.au/audio/hls"
13
14# Station logos hosted on ABC's content CDN.
15STATION_LOGO_BASE_URL = "https://live-production.wcms.abc-cdn.net.au"
16
17# How often the player queue calls back into _update_stream_metadata while a stream is active.
18STREAM_METADATA_UPDATE_INTERVAL = 30
19
20# Per-request timeout for ABC Radio API calls.
21API_TIMEOUT = aiohttp.ClientTimeout(total=10)
22
23
24class ABCRadioStation(TypedDict):
25 """Type definition for an ABC Radio station."""
26
27 name: str
28 description: str
29 stream_url: str
30 logo_url: str
31
32
33# Station ids double as the service ids used by the ABC Radio now-playing API.
34ABC_RADIO_STATIONS: dict[str, ABCRadioStation] = {
35 "triplej": {
36 "name": "triple j",
37 "description": "New music and the best new and emerging artists",
38 "stream_url": f"{STREAM_BASE_URL}/triplejnsw.m3u8",
39 "logo_url": f"{STATION_LOGO_BASE_URL}/c170c3d8b69f13bf43865be27b027687",
40 },
41 "doublej": {
42 "name": "Double J",
43 "description": "Music news, interviews and new releases for grown-up music lovers",
44 "stream_url": f"{STREAM_BASE_URL}/doublejnsw.m3u8",
45 "logo_url": f"{STATION_LOGO_BASE_URL}/fe840de7a554fe27949bd9f6ee74c67d",
46 },
47 "unearthed": {
48 "name": "triple j Unearthed",
49 "description": "The best new and undiscovered Australian artists",
50 "stream_url": f"{STREAM_BASE_URL}/triplejunearthed.m3u8",
51 "logo_url": f"{STATION_LOGO_BASE_URL}/457cfcb2f56f45a89fe67c5e075ca91b",
52 },
53 "classic": {
54 "name": "ABC Classic",
55 "description": "Classical music to help you relax, focus and escape",
56 "stream_url": f"{STREAM_BASE_URL}/classicnsw.m3u8",
57 "logo_url": f"{STATION_LOGO_BASE_URL}/1613925515143520dff362b9f5bdf0cf",
58 },
59 "classic2": {
60 "name": "ABC Classic 2",
61 "description": "A deeper dive into the world of classical music",
62 "stream_url": f"{STREAM_BASE_URL}/classic2.m3u8",
63 "logo_url": f"{STATION_LOGO_BASE_URL}/1cf56a5051e18e63dbd3b43da5b9fb3e",
64 },
65 "jazz": {
66 "name": "ABC Jazz",
67 "description": "Jazz from Australia and around the world, 24/7",
68 "stream_url": f"{STREAM_BASE_URL}/abcjazz.m3u8",
69 "logo_url": f"{STATION_LOGO_BASE_URL}/1d3fcd8ee593c191730231c7981e23e2",
70 },
71 "country": {
72 "name": "ABC Country",
73 "description": "Country music from the classics to brand new releases",
74 "stream_url": f"{STREAM_BASE_URL}/abccountry.m3u8",
75 "logo_url": f"{STATION_LOGO_BASE_URL}/498b1d68a7fef49f03e8c8d476ea6583",
76 },
77 "kidslisten": {
78 "name": "ABC Kids listen",
79 "description": "Music and stories made for young children",
80 "stream_url": f"{STREAM_BASE_URL}/abckids.m3u8",
81 "logo_url": f"{STATION_LOGO_BASE_URL}/fca9b9528d2502f6ed38568557274e21",
82 },
83}
84