Skip to content

Commit

Permalink
Add Monitor; re init the plugin when the configuration changes
Browse files Browse the repository at this point in the history
  • Loading branch information
maximeh committed Oct 9, 2013
1 parent 5fcc53e commit 6c39c7b
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions default.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,15 @@

from resources.lib.myepisodes import MyEpisodes

class MyMonitor(xbmc.Monitor):
def __init__( self, *args, **kwargs ):
xbmc.Monitor.__init__( self )
self.action = kwargs['action']

def onSettingsChanged( self ):
log('#DEBUG# onSettingsChanged')
self.action()

class Player(xbmc.Player):

def __init__ (self):
Expand All @@ -32,6 +41,13 @@ def __init__ (self):
self._min_percent = int(__addon__.getSetting('watched-percent'))
self._tracker = None
self._playbackLock = threading.Event()
self.Monitor = MyMonitor(action = self._reset)

def _reset(self):
self._tearDown()
if self.mye:
del self.mye
self.__init__()

def _trackPosition(self):
while self._playbackLock.isSet() and not xbmc.abortRequested:
Expand Down

0 comments on commit 6c39c7b

Please sign in to comment.