mirror of
https://github.com/dmunozv04/iSponsorBlockTV.git
synced 2025-12-10 14:06:44 +03:00
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
This commit is contained in:
@@ -101,12 +101,18 @@ class DeviceListener:
|
|||||||
next_segment = None
|
next_segment = None
|
||||||
for segment in segments:
|
for segment in segments:
|
||||||
segment_start = segment["start"]
|
segment_start = segment["start"]
|
||||||
is_within_start_range = position < 1 and segment_start <= position < segment["end"] and segment["end"] > 1
|
is_within_start_range = (
|
||||||
|
position < 1
|
||||||
|
and segment_start <= position < segment["end"]
|
||||||
|
and segment["end"] > 1
|
||||||
|
)
|
||||||
is_beyond_current_position = segment_start > position
|
is_beyond_current_position = segment_start > position
|
||||||
|
|
||||||
if is_within_start_range or is_beyond_current_position:
|
if is_within_start_range or is_beyond_current_position:
|
||||||
next_segment = segment
|
next_segment = segment
|
||||||
start_next_segment = position if is_within_start_range else segment_start
|
start_next_segment = (
|
||||||
|
position if is_within_start_range else segment_start
|
||||||
|
)
|
||||||
break
|
break
|
||||||
if start_next_segment:
|
if start_next_segment:
|
||||||
time_to_next = (
|
time_to_next = (
|
||||||
|
|||||||
@@ -155,7 +155,7 @@ class YtLoungeApi(pyytlounge.YtLoungeApi):
|
|||||||
self.shorts_disconnected = True
|
self.shorts_disconnected = True
|
||||||
elif event_type == "onAutoplayModeChanged":
|
elif event_type == "onAutoplayModeChanged":
|
||||||
create_task(self.set_auto_play_mode(self.auto_play))
|
create_task(self.set_auto_play_mode(self.auto_play))
|
||||||
|
|
||||||
elif event_type == "onPlaybackSpeedChanged":
|
elif event_type == "onPlaybackSpeedChanged":
|
||||||
data = args[0]
|
data = args[0]
|
||||||
self.playback_speed = float(data.get("playbackSpeed", "1"))
|
self.playback_speed = float(data.get("playbackSpeed", "1"))
|
||||||
@@ -191,7 +191,7 @@ class YtLoungeApi(pyytlounge.YtLoungeApi):
|
|||||||
|
|
||||||
async def play_video(self, video_id: str) -> bool:
|
async def play_video(self, video_id: str) -> bool:
|
||||||
return await self._command("setPlaylist", {"videoId": video_id})
|
return await self._command("setPlaylist", {"videoId": video_id})
|
||||||
|
|
||||||
async def get_now_playing(self):
|
async def get_now_playing(self):
|
||||||
return await super()._command("getNowPlaying")
|
return await super()._command("getNowPlaying")
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user