[pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci
This commit is contained in:
pre-commit-ci[bot]
2025-05-28 21:48:24 +00:00
parent fd6f0d7283
commit 98c1211b09

View File

@@ -265,7 +265,7 @@ class YtLoungeApi(pyytlounge.YtLoungeApi):
"TYPE": "xmlhttp", "TYPE": "xmlhttp",
"theme": "cl", "theme": "cl",
"sessionSource": "MDX_SESSION_SOURCE_UNKNOWN", "sessionSource": "MDX_SESSION_SOURCE_UNKNOWN",
"connectParams": "{\"setStatesParams\": \"{\"playbackSpeed\":0}\"}", "connectParams": '{"setStatesParams": "{"playbackSpeed":0}"}',
"sessionNonce": str(uuid4()), "sessionNonce": str(uuid4()),
"RID": "1", "RID": "1",
"CVER": "1", "CVER": "1",
@@ -278,9 +278,7 @@ class YtLoungeApi(pyytlounge.YtLoungeApi):
"device": "REMOTE_CONTROL", "device": "REMOTE_CONTROL",
"name": self.device_name, "name": self.device_name,
} }
connect_url = ( connect_url = f"{api_base}/bc/bind"
f"{api_base}/bc/bind"
)
async with self.session.post(url=connect_url, data=connect_body) as resp: async with self.session.post(url=connect_url, data=connect_body) as resp:
try: try:
text = await resp.text() text = await resp.text()
@@ -290,13 +288,11 @@ class YtLoungeApi(pyytlounge.YtLoungeApi):
"Connection denied, attempting to circumvent the issue" "Connection denied, attempting to circumvent the issue"
) )
await self.connect_as_screen() await self.connect_as_screen()
#self._lounge_token_expired() # self._lounge_token_expired()
return False return False
if resp.status != 200: if resp.status != 200:
self._logger.warning( self._logger.warning("Unknown reply to connect %i %s", resp.status, resp.reason)
"Unknown reply to connect %i %s", resp.status, resp.reason
)
return False return False
lines = text.splitlines() lines = text.splitlines()
async for events in self._parse_event_chunks(as_aiter(lines)): async for events in self._parse_event_chunks(as_aiter(lines)):
@@ -322,7 +318,7 @@ class YtLoungeApi(pyytlounge.YtLoungeApi):
"TYPE": "xmlhttp", "TYPE": "xmlhttp",
"theme": "cl", "theme": "cl",
"sessionSource": "MDX_SESSION_SOURCE_UNKNOWN", "sessionSource": "MDX_SESSION_SOURCE_UNKNOWN",
"connectParams": "{\"setStatesParams\": \"{\"playbackSpeed\":0}\"}", "connectParams": '{"setStatesParams": "{"playbackSpeed":0}"}',
"sessionNonce": str(uuid4()), "sessionNonce": str(uuid4()),
"RID": "1", "RID": "1",
"CVER": "1", "CVER": "1",
@@ -335,13 +331,13 @@ class YtLoungeApi(pyytlounge.YtLoungeApi):
"device": "LOUNGE_SCREEN", "device": "LOUNGE_SCREEN",
"name": self.device_name, "name": self.device_name,
} }
connect_url = ( connect_url = f"{api_base}/bc/bind"
f"{api_base}/bc/bind"
)
async with self.session.post(url=connect_url, data=connect_body) as resp: async with self.session.post(url=connect_url, data=connect_body) as resp:
try: try:
await resp.text() await resp.text()
self.logger.error("Connected as screen: please force close the app on the device for iSponsorBlockTV to work properly") self.logger.error(
"Connected as screen: please force close the app on the device for iSponsorBlockTV to work properly"
)
self.logger.warn("Exiting in 5 seconds") self.logger.warn("Exiting in 5 seconds")
await asyncio.sleep(5) await asyncio.sleep(5)
sys.exit(0) sys.exit(0)