From 9cadfa949a19b6c16f5b59a56c3a5941e69a6d02 Mon Sep 17 00:00:00 2001 From: Yurii <34578544+Laxilef@users.noreply.github.com> Date: Wed, 8 Jan 2025 06:44:34 +0300 Subject: [PATCH] Codestyle --- custom_components/yandex_station/core/utils.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/custom_components/yandex_station/core/utils.py b/custom_components/yandex_station/core/utils.py index 72983aa..305f714 100644 --- a/custom_components/yandex_station/core/utils.py +++ b/custom_components/yandex_station/core/utils.py @@ -464,10 +464,12 @@ async def head(self, request: web.Request, sid: str, uid: str, ext: str): async with self.session.head(url, headers=headers) as r: response = web.Response(status=r.status) response.headers.update(r.headers) + # important for DLNA players response.headers.update({ "Content-Type": MIME_TYPES[ext], }) + if not rng: response.headers.update({ "Accept-Ranges": "bytes", @@ -486,13 +488,17 @@ async def get(self, request: web.Request, sid: str, uid: str, ext: str): async with self.session.get(url, headers=headers) as r: response = web.StreamResponse(status=r.status) response.headers.update(r.headers) + + # important for DLNA players response.headers.update({ "Content-Type": MIME_TYPES[ext], }) + if not rng: response.headers.update({ "Accept-Ranges": "bytes", }) + await response.prepare(request) # same chunks as default web.FileResponse