resume_playback: use kodi api for context menu for consistency with the skin in use (#422)
This commit is contained in:
@@ -1619,48 +1619,16 @@ def play_torrent(item, xlistitem, mediaurl):
|
|||||||
xbmc.executebuiltin("PlayMedia(" + torrent_options[selection][1] % mediaurl + ")")
|
xbmc.executebuiltin("PlayMedia(" + torrent_options[selection][1] % mediaurl + ")")
|
||||||
|
|
||||||
def resume_playback(played_time):
|
def resume_playback(played_time):
|
||||||
class ResumePlayback(xbmcgui.WindowXMLDialog):
|
|
||||||
Close = False
|
|
||||||
Resume = False
|
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
|
||||||
self.action_exitkeys_id = [92, 10]
|
|
||||||
self.progress_control = None
|
|
||||||
played_time = kwargs.get('played_time')
|
|
||||||
m, s = divmod(played_time, 60)
|
|
||||||
h, m = divmod(m, 60)
|
|
||||||
self.setProperty("time", '%02d:%02d:%02d' % (h, m, s))
|
|
||||||
|
|
||||||
def set_values(self, value):
|
|
||||||
self.Resume = value
|
|
||||||
self.Close = True
|
|
||||||
|
|
||||||
def is_close(self):
|
|
||||||
return self.Close
|
|
||||||
|
|
||||||
def onClick(self, controlId):
|
|
||||||
if controlId == 3012: # Resume
|
|
||||||
self.set_values(True)
|
|
||||||
self.close()
|
|
||||||
elif controlId == 3013: # Cancel
|
|
||||||
self.set_values(False)
|
|
||||||
self.close()
|
|
||||||
|
|
||||||
def onAction(self, action):
|
|
||||||
if action in self.action_exitkeys_id:
|
|
||||||
self.set_values(False)
|
|
||||||
self.close()
|
|
||||||
|
|
||||||
if played_time and played_time > 30:
|
if played_time and played_time > 30:
|
||||||
Dialog = ResumePlayback('ResumePlayback.xml', config.get_runtime_path(), played_time=played_time)
|
m, s = divmod(played_time, 60)
|
||||||
Dialog.show()
|
h, m = divmod(m, 60)
|
||||||
t = 0
|
idx = xbmcgui.Dialog().contextmenu(
|
||||||
while not Dialog.is_close() and t < 100:
|
[
|
||||||
t += 1
|
xbmc.getLocalizedString(12022).format('%02d:%02d:%02d' % (h, m, s)),
|
||||||
xbmc.sleep(100)
|
xbmc.getLocalizedString(12021)
|
||||||
if not Dialog.Resume: played_time = 0
|
])
|
||||||
|
if idx: played_time = 0
|
||||||
else: played_time = 0
|
else: played_time = 0
|
||||||
xbmc.sleep(300)
|
|
||||||
return played_time
|
return played_time
|
||||||
|
|
||||||
##### INPUTSTREM #####
|
##### INPUTSTREM #####
|
||||||
@@ -2031,4 +1999,4 @@ def serverWindow(item, itemlist, runDirectly=True):
|
|||||||
from platformcode.launcher import run
|
from platformcode.launcher import run
|
||||||
run(selection)
|
run(selection)
|
||||||
else:
|
else:
|
||||||
return selection
|
return selection
|
||||||
|
|||||||
Reference in New Issue
Block a user