feat(bassdrive): add the drum & bass relay and a shared wordmark font
This commit is contained in:
1 parent
84ec3b08f6
commit
50a9a735f7
14 files changed
+1166
-79
No files matched your search
@@ -0,0 +1,56 @@
|
||||
"""Bundled station, so a cold offline start still makes sense.
|
||||
|
||||
Bassdrive is one station with three mounts and a handful of mirror hosts; the
|
||||
streams below are the ones its own ``.m3u`` files list. The live status-json
|
||||
always wins when it is reachable.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Any
|
||||
|
||||
# (url, format, quality, bitrate)
|
||||
_MOUNTS: tuple[tuple[str, str, str, str], ...] = (
|
||||
("https://ice.bassdrive.net:443/stream", "mp3", "highest", "128"),
|
||||
("https://ice.bassdrive.net:443/stream56", "aacp", "high", "56"),
|
||||
("https://ice.bassdrive.net:443/stream32", "aacp", "low", "32"),
|
||||
)
|
||||
|
||||
#: Alternative servers from bassdrive.m3u, tried when the primary is down.
|
||||
_MIRRORS: tuple[str, ...] = (
|
||||
"http://chi.bassdrive.co:80",
|
||||
"http://bassdrive.radioca.st:8702",
|
||||
"http://stream.bassdrive.uk:8200",
|
||||
"http://au.bassdrive.co:8000",
|
||||
)
|
||||
|
||||
_SERVER_TYPE = {"mp3": "audio/mpeg", "aacp": "audio/aacp"}
|
||||
|
||||
|
||||
def fallback_status() -> dict[str, Any]:
|
||||
"""A ``status-json.xsl``-shaped payload, so the normal parser can eat it."""
|
||||
return {
|
||||
"icestats": {
|
||||
"source": [
|
||||
{
|
||||
"listenurl": url,
|
||||
"bitrate": int(bitrate),
|
||||
"server_type": _SERVER_TYPE.get(fmt, "audio/mpeg"),
|
||||
"listeners": 0,
|
||||
"display-title": "",
|
||||
}
|
||||
for url, fmt, _quality, bitrate in _MOUNTS
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
def fallback_stations() -> list[Any]:
|
||||
from .api import station_from_status
|
||||
|
||||
station = station_from_status(fallback_status())
|
||||
return [station] if station is not None else []
|
||||
|
||||
|
||||
def known_stream_urls() -> list[str]:
|
||||
return [url for url, _format, _quality, _bitrate in _MOUNTS] + list(_MIRRORS)
|
||||
Reference in new issue
Block a user