timeout = ClientTimeout(total=0, connect=10, sock_read=5)
try:
async with mass.http_session.get(
- url, headers=HTTP_HEADERS_ICY, allow_redirects=True, timeout=timeout
+ url, headers=HTTP_HEADERS_ICY, allow_redirects=True, timeout=timeout, encoded="%" in url
) as resp:
resolved_url = str(resp.real_url)
headers = resp.headers
"""Get (radio) audio stream from HTTP, including ICY metadata retrieval."""
timeout = ClientTimeout(total=0, connect=30, sock_read=5 * 60)
LOGGER.debug("Start streaming radio with ICY metadata from url %s", url)
- async with mass.http_session.get(url, headers=HTTP_HEADERS_ICY, timeout=timeout) as resp:
+ async with mass.http_session.get(
+ url, headers=HTTP_HEADERS_ICY, timeout=timeout, encoded="%" in url
+ ) as resp:
headers = resp.headers
meta_int = int(headers["icy-metaint"])
while True:
while True:
logger.log(VERBOSE_LOG_LEVEL, "start streaming chunks from substream %s", substream_url)
async with mass.http_session.get(
- substream_url, headers=HTTP_HEADERS, timeout=timeout
+ substream_url, headers=HTTP_HEADERS, timeout=timeout, encoded="%" in substream_url
) as resp:
resp.raise_for_status()
charset = resp.charset or "utf-8"
timeout = ClientTimeout(total=0, connect=30, sock_read=5 * 60)
# fetch master playlist and select (best) child playlist
# https://datatracker.ietf.org/doc/html/draft-pantos-http-live-streaming-19#section-10
- async with mass.http_session.get(url, headers=HTTP_HEADERS, timeout=timeout) as resp:
+ async with mass.http_session.get(
+ url, headers=HTTP_HEADERS, timeout=timeout, encoded="%" in url
+ ) as resp:
resp.raise_for_status()
charset = resp.charset or "utf-8"
master_m3u_data = await resp.text(charset)
# try to get filesize with a head request
seek_supported = streamdetails.can_seek
if seek_position or not streamdetails.size:
- async with mass.http_session.head(url, headers=HTTP_HEADERS) as resp:
+ async with mass.http_session.head(url, headers=HTTP_HEADERS, encoded="%" in url) as resp:
resp.raise_for_status()
if size := resp.headers.get("Content-Length"):
streamdetails.size = int(size)
# start the streaming from http
bytes_received = 0
- async with mass.http_session.get(url, headers=headers, timeout=timeout) as resp:
+ async with mass.http_session.get(
+ url, headers=headers, timeout=timeout, encoded="%" in url
+ ) as resp:
is_partial = resp.status == 206
if seek_position and not is_partial:
raise InvalidDataError("HTTP source does not support seeking!")