Merge pull request #1705 from croneter/py3-fix-skipintro

Fix skip intro not working
This commit is contained in:
croneter 2021-11-13 14:09:06 +01:00 committed by GitHub
commit 578446d32a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 7 deletions

View file

@ -12,7 +12,6 @@ from .. import variables as v
from .. import backgroundthread from .. import backgroundthread
from .. import app from .. import app
from .. import timing from .. import timing
from .. import skip_plex_intro
# Disable annoying requests warnings # Disable annoying requests warnings
@ -408,12 +407,6 @@ class PlaystateMgr(backgroundthread.KillableThread):
else: else:
continue continue
signaled_playback_stop = False signaled_playback_stop = False
try:
# Check whether an intro is currently running
skip_plex_intro.check()
except IndexError:
# Playback might have already stopped
pass
# Send the playback progress info to the PMS # Send the playback progress info to the PMS
self.pms_timeline(players, message) self.pms_timeline(players, message)
# Send the info to all Companion devices via the PMS # Send the info to all Companion devices via the PMS

View file

@ -18,6 +18,7 @@ from . import variables as v
from . import app from . import app
from . import loghandler from . import loghandler
from . import backgroundthread from . import backgroundthread
from . import skip_plex_intro
from .windows import userselect from .windows import userselect
############################################################################### ###############################################################################
@ -554,6 +555,9 @@ class Service(object):
self.companion_listener.start() self.companion_listener.start()
self.alexa_ws.start() self.alexa_ws.start()
elif app.APP.is_playing:
skip_plex_intro.check()
xbmc.sleep(200) xbmc.sleep(200)
# EXITING PKC # EXITING PKC

View file

@ -15,6 +15,8 @@ def skip_intro(intros):
if start <= progress < end: if start <= progress < end:
in_intro = True in_intro = True
if in_intro and app.APP.skip_intro_dialog is None: if in_intro and app.APP.skip_intro_dialog is None:
# WARNING: This Dialog only seems to work if called from the main
# thread. Otherwise, onClick and onAction won't work
app.APP.skip_intro_dialog = SkipIntroDialog('script-plex-skip_intro.xml', app.APP.skip_intro_dialog = SkipIntroDialog('script-plex-skip_intro.xml',
v.ADDON_PATH, v.ADDON_PATH,
'default', 'default',
@ -32,6 +34,8 @@ def skip_intro(intros):
def check(): def check():
with app.APP.lock_playqueues: with app.APP.lock_playqueues:
if len(app.PLAYSTATE.active_players) != 1:
return
playerid = list(app.PLAYSTATE.active_players)[0] playerid = list(app.PLAYSTATE.active_players)[0]
intros = app.PLAYSTATE.player_states[playerid]['intro_markers'] intros = app.PLAYSTATE.player_states[playerid]['intro_markers']
if not intros: if not intros: