Compare commits

...

10 Commits

Author SHA1 Message Date
dmunozv04
7dd144357d update textual and aiohttp 2024-09-25 20:58:10 +02:00
dmunozv04
8c9ce641f0 remove argparse
fixes #195
2024-09-23 13:32:27 +02:00
dmunozv04
7b1a59e01f update requirements 2024-09-21 13:38:47 +02:00
dmunozv04
d9ab2cd070 bump version 2024-09-18 17:20:27 +02:00
dmunozv04
ea2004ba94 fix release ci 2024-09-18 17:20:22 +02:00
David
63f5a3bc41 Bump version 2024-09-18 15:17:29 +02:00
David
e999a93503 Merge pull request #191 from dmunozv04/add-mutex-command
Implements mutex when sending commands to YouTube
2024-09-18 15:17:07 +02:00
pre-commit-ci[bot]
8cc3f8aa05 [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2024-09-15 13:20:36 +00:00
dmunozv04
5fadc81a69 Fix occasional IndexError
in loungeScreenDisconnected event
2024-09-15 14:49:39 +02:00
dmunozv04
39aef5babf Test wrap command function in a mutex
to avoid race conditions with the _command_offset
2024-09-14 23:44:32 +02:00
4 changed files with 21 additions and 10 deletions

View File

@@ -179,6 +179,8 @@ jobs:
publish-to-release:
permissions:
contents: write
needs:
- build-sdist-and-wheel
- build-binaries

View File

@@ -1,6 +1,6 @@
[project]
name = "iSponsorBlockTV"
version = "2.1.0"
version = "2.2.1"
authors = [
{"name" = "dmunozv04"}
]

View File

@@ -1,11 +1,10 @@
aiohttp==3.9.5
aiohttp==3.10.6
appdirs==1.4.4
argparse==1.4.0
async-cache==1.1.1
pyytlounge==2.0.0
rich==13.7.1
pyytlounge==2.1.1
rich==13.8.1
ssdp==1.3.0
textual==0.58.0
textual-slider==0.1.1
textual==0.81.0
textual-slider==0.1.2
xmltodict==0.13.0
rich_click==1.8.3

View File

@@ -35,6 +35,7 @@ class YtLoungeApi(pyytlounge.YtLoungeApi):
self.mute_ads = config.mute_ads
self.skip_ads = config.skip_ads
self.auto_play = config.auto_play
self._command_mutex = asyncio.Lock()
# Ensures that we still are subscribed to the lounge
async def _watchdog(self):
@@ -145,9 +146,12 @@ class YtLoungeApi(pyytlounge.YtLoungeApi):
self.shorts_disconnected = False
create_task(self.play_video(video_id_saved))
elif event_type == "loungeScreenDisconnected":
data = args[0]
if data["reason"] == "disconnectedByUserScreenInitiated": # Short playing?
self.shorts_disconnected = True
if args: # Sometimes it's empty
data = args[0]
if (
data["reason"] == "disconnectedByUserScreenInitiated"
): # Short playing?
self.shorts_disconnected = True
elif event_type == "onAutoplayModeChanged":
create_task(self.set_auto_play_mode(self.auto_play))
@@ -181,3 +185,9 @@ class YtLoungeApi(pyytlounge.YtLoungeApi):
async def play_video(self, video_id: str) -> bool:
return await self._command("setPlaylist", {"videoId": video_id})
# Test to wrap the command function in a mutex to avoid race conditions with
# the _command_offset (TODO: move to upstream if it works)
async def _command(self, command: str, command_parameters: dict = None) -> bool:
async with self._command_mutex:
return await super()._command(command, command_parameters)