Refactor Plex intro detection

This commit is contained in:
croneter 2021-10-29 20:01:25 +02:00
parent eec4e14513
commit edf0cd9a54
3 changed files with 7 additions and 6 deletions

View file

@ -12,6 +12,7 @@ from .. import backgroundthread
from .. import app from .. import app
from .. import timing from .. import timing
from .. import playqueue as PQ from .. import playqueue as PQ
from .. import skip_plex_intro
# Disable annoying requests warnings # Disable annoying requests warnings
@ -383,6 +384,12 @@ 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

@ -19,7 +19,6 @@ 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
############################################################################### ###############################################################################
@ -558,9 +557,6 @@ class Service(object):
self.playqueue.start() self.playqueue.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

@ -32,8 +32,6 @@ 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: