Delegate + SponsorBlock parallel — best of both worlds

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).
This commit is contained in:
Kayos 2026-05-23 11:59:26 -07:00
parent 9ed0aae2d0
commit 365badd502

View file

@ -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