From 365badd502f6ce12eb4145e2c4b2217e3931f1e8 Mon Sep 17 00:00:00 2001 From: Kayos Date: Sat, 23 May 2026 11:59:26 -0700 Subject: [PATCH] =?UTF-8?q?Delegate=20+=20SponsorBlock=20parallel=20?= =?UTF-8?q?=E2=80=94=20best=20of=20both=20worlds?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Wire _attach_sponsorblock to also fire when delegating to pv.youtube. xbmc.Player() is a global accessor so our monitor's getTime() / seekTime() / isPlaying() work regardless of which addon initiated the playback. Result: HD via pv.youtube's MPD + our SponsorBlock skips. Verified: played LTT 2T8x5antlnc via delegation, seeked to 1:45, our monitor detected the 1:48-2:08 sponsor segment, called seekTime(128.4), log line '[torttube] sponsorblock skip: sponsor 108.3-128.4 (20s)'. Position landed at 2:17 (post-skip natural playback). --- addon/plugin.video.torttube/main.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/addon/plugin.video.torttube/main.py b/addon/plugin.video.torttube/main.py index 67165a4..1895648 100644 --- a/addon/plugin.video.torttube/main.py +++ b/addon/plugin.video.torttube/main.py @@ -396,16 +396,18 @@ def _play(yt_id: str) -> None: """ _log(f"play id={yt_id}") - # Tier 0: delegate to plugin.video.youtube if installed. Don't run our - # SponsorBlock monitor in this path — pv.youtube has its own and would - # double-skip if both fire. + # Tier 0: delegate to plugin.video.youtube if installed. Our SponsorBlock + # monitor still attaches because xbmc.Player() works regardless of which + # addon initiated playback. If pv.youtube ALSO has SB enabled the user + # might see double skips; rare in practice (pv.youtube's SB is off by + # default and theirs is more conservative). use_pv_youtube = True try: use_pv_youtube = ADDON.getSettingBool("prefer_pv_youtube") except Exception: - # Setting not yet in Kodi's cache (settings.xml just changed) — default on. pass if use_pv_youtube and _delegate_to_pv_youtube(yt_id): + _attach_sponsorblock(yt_id) return mpd_bytes: bytes | None = None