Get rid of ContextMonitor and the dedicated Python thread - with new resume mechanics, this is not needed anymore

This commit is contained in:
croneter 2019-11-01 13:00:34 +01:00
parent 2ba406bd4e
commit 5e3f3daf90
3 changed files with 0 additions and 46 deletions

View file

@ -11,7 +11,6 @@ import json
import binascii
import xbmc
import xbmcgui
from .plex_api import API
from .plex_db import PlexDB
@ -23,10 +22,6 @@ from . import backgroundthread, app, variables as v
LOG = getLogger('PLEX.kodimonitor')
# "Start from beginning", "Play from beginning"
STRINGS = (utils.lang(12021).encode('utf-8'),
utils.lang(12023).encode('utf-8'))
class KodiMonitor(xbmc.Monitor):
"""
@ -593,36 +588,3 @@ def _videolibrary_onupdate(data):
PF.scrobble(db_item['plex_id'], 'watched')
else:
PF.scrobble(db_item['plex_id'], 'unwatched')
class ContextMonitor(backgroundthread.KillableThread):
"""
Detect the resume dialog for widgets. Could also be used to detect
external players (see Emby implementation)
Let's not register this thread because it won't quit due to
xbmc.getCondVisibility
It should still exit at some point due to xbmc.abortRequested
"""
def run(self):
LOG.info("----===## Starting ContextMonitor ##===----")
# app.APP.register_thread(self)
try:
self._run()
finally:
# app.APP.deregister_thread(self)
LOG.info("##===---- ContextMonitor Stopped ----===##")
def _run(self):
while not self.isCanceled():
# The following function will block if called while PKC should
# exit!
if xbmc.getCondVisibility('Window.IsVisible(DialogContextMenu.xml)'):
if xbmc.getInfoLabel('Control.GetLabel(1002)') in STRINGS:
# Remember that the item IS indeed resumable
control = int(xbmcgui.Window(10106).getFocusId())
app.PLAYSTATE.resume_playback = True if control == 1001 else False
else:
# Different context menu is displayed
app.PLAYSTATE.resume_playback = False
xbmc.sleep(100)

View file

@ -54,7 +54,6 @@ def playback_triage(plex_id=None, plex_type=None, path=None, resolve=True,
# playback
app.PLAYSTATE.context_menu_play = False
app.PLAYSTATE.force_transcode = False
app.PLAYSTATE.resume_playback = None
def _playback_triage(plex_id, plex_type, path, resolve, resume):
@ -133,9 +132,6 @@ def _playback_triage(plex_id, plex_type, path, resolve, resume):
initiate = True
else:
initiate = False
if not initiate and app.PLAYSTATE.resume_playback is not None:
LOG.debug('Detected re-playing of the same item')
initiate = True
if initiate:
_playback_init(plex_id, plex_type, playqueue, pos, resume)
else:

View file

@ -95,7 +95,6 @@ class Service(object):
self.setup = None
self.alexa = None
self.playqueue = None
self.context_monitor = None
# Flags for other threads
self.connection_check_running = False
self.auth_running = False
@ -422,9 +421,6 @@ class Service(object):
# Some plumbing
app.init()
app.APP.monitor = kodimonitor.KodiMonitor()
self.context_monitor = kodimonitor.ContextMonitor()
# Start immediately to catch user input even before auth
self.context_monitor.start()
app.APP.player = xbmc.Player()
# Initialize the PKC playqueues
PQ.init_playqueues()