Rewire autoplay flag
This commit is contained in:
parent
12befecc4a
commit
439857a9ce
3 changed files with 10 additions and 7 deletions
|
@ -57,6 +57,8 @@ class PlayState(object):
|
|||
# from the beginning?
|
||||
# Do set to None if NO resume dialog is displayed! True/False otherwise
|
||||
self.resume_playback = None
|
||||
# Don't ask user whether to resume but immediatly resume
|
||||
self.autoplay = False
|
||||
# Was the playback initiated by the user using the Kodi context menu?
|
||||
self.context_menu_play = False
|
||||
# Set by context menu - shall we force-transcode the next playing item?
|
||||
|
|
|
@ -32,6 +32,7 @@ class KodiMonitor(xbmc.Monitor):
|
|||
def __init__(self):
|
||||
self._already_slept = False
|
||||
self.hack_replay = None
|
||||
self.playlistid = None
|
||||
xbmc.Monitor.__init__(self)
|
||||
for playerid in app.PLAYSTATE.player_states:
|
||||
app.PLAYSTATE.player_states[playerid] = copy.deepcopy(app.PLAYSTATE.template)
|
||||
|
@ -202,14 +203,16 @@ class KodiMonitor(xbmc.Monitor):
|
|||
"""
|
||||
pass
|
||||
|
||||
@staticmethod
|
||||
def _playlist_onclear(data):
|
||||
def _playlist_onclear(self, data):
|
||||
"""
|
||||
Called if a Kodi playlist is cleared. Example data dict:
|
||||
{
|
||||
u'playlistid': 1,
|
||||
}
|
||||
"""
|
||||
if self.playlistid == data['playlistid']:
|
||||
LOG.debug('Resetting autoplay')
|
||||
app.PLAYSTATE.autoplay = False
|
||||
playqueue = PQ.PLAYQUEUES[data['playlistid']]
|
||||
if not playqueue.is_pkc_clear():
|
||||
playqueue.pkc_edit = True
|
||||
|
|
|
@ -208,19 +208,17 @@ class PlayStrm(object):
|
|||
'''
|
||||
seektime = app.PLAYSTATE.resume_playback
|
||||
app.PLAYSTATE.resume_playback = None
|
||||
auto_play = utils.window('plex.autoplay.bool')
|
||||
if auto_play:
|
||||
if app.PLAYSTATE.autoplay:
|
||||
seektime = False
|
||||
LOG.info('Skip resume for autoplay')
|
||||
elif seektime is None:
|
||||
resume = self.api.resume_point()
|
||||
if resume:
|
||||
seektime = resume_dialog(resume)
|
||||
LOG.info('Resume: %s', seektime)
|
||||
LOG.info('User chose resume: %s', seektime)
|
||||
if seektime is None:
|
||||
raise PlayStrmException('User backed out of resume dialog.')
|
||||
# Todo: Probably need to have a look here
|
||||
utils.window('plex.autoplay.bool', value='true')
|
||||
app.PLAYSTATE.autoplay = True
|
||||
return seektime
|
||||
|
||||
def _set_intros(self, xml):
|
||||
|
|
Loading…
Reference in a new issue