use custom resume dialog
This commit is contained in:
@@ -57,6 +57,7 @@ from clientinfo import ClientInformation
|
||||
from datamanager import DataManager
|
||||
from views import DefaultViews, loadSkinDefaults
|
||||
from server_detect import checkServer
|
||||
from resume_dialog import ResumeDialog
|
||||
|
||||
|
||||
__settings__ = xbmcaddon.Addon(id='plugin.video.embycon')
|
||||
@@ -630,9 +631,15 @@ def PLAY( url, handle ):
|
||||
reasonableTicks = int(userData.get("PlaybackPositionTicks")) / 1000
|
||||
seekTime = reasonableTicks / 10000
|
||||
displayTime = str(timedelta(seconds=seekTime))
|
||||
display_list = [ "Resume from " + displayTime, "Start from beginning"]
|
||||
resumeScreen = xbmcgui.Dialog()
|
||||
resume_result = resumeScreen.select('Resume', display_list)
|
||||
|
||||
resumeDialog = ResumeDialog("ResumeDialog.xml", __cwd__, "default", "720p")
|
||||
resumeDialog.setResumeTime("Resume from " + displayTime)
|
||||
resumeDialog.doModal()
|
||||
resume_result = resumeDialog.getResumeAction()
|
||||
del resumeDialog
|
||||
|
||||
log.info("Resume Dialog Result: " + str(resume_result))
|
||||
|
||||
if resume_result == -1:
|
||||
return
|
||||
|
||||
|
||||
50
resources/lib/resume_dialog.py
Normal file
50
resources/lib/resume_dialog.py
Normal file
@@ -0,0 +1,50 @@
|
||||
|
||||
import os
|
||||
import sys
|
||||
import xbmc
|
||||
import xbmcgui
|
||||
import xbmcaddon
|
||||
import logging
|
||||
|
||||
log = logging.getLogger("EmbyCon." + __name__)
|
||||
|
||||
class ResumeDialog(xbmcgui.WindowXMLDialog):
|
||||
|
||||
resumePlay = -1
|
||||
resumeTimeStamp = ""
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
xbmcgui.WindowXMLDialog.__init__(self, *args, **kwargs)
|
||||
log.info("ResumeDialog INITIALISED")
|
||||
|
||||
def onInit(self):
|
||||
self.action_exitkeys_id = [10, 13]
|
||||
|
||||
self.getControl(3010).setLabel(self.resumeTimeStamp)
|
||||
|
||||
def onFocus(self, controlId):
|
||||
pass
|
||||
|
||||
def doAction(self, actionID):
|
||||
pass
|
||||
|
||||
def onClick(self, controlID):
|
||||
|
||||
if(controlID == 3010):
|
||||
self.resumePlay = 0
|
||||
self.close()
|
||||
if(controlID == 3011):
|
||||
self.resumePlay = 1
|
||||
self.close()
|
||||
|
||||
pass
|
||||
|
||||
def setResumeTime(self, timeStamp):
|
||||
self.resumeTimeStamp = timeStamp
|
||||
|
||||
def getResumeAction(self):
|
||||
return self.resumePlay
|
||||
|
||||
|
||||
|
||||
|
||||
48
resources/skins/default/720p/ResumeDialog.xml
Normal file
48
resources/skins/default/720p/ResumeDialog.xml
Normal file
@@ -0,0 +1,48 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<window id="3301" type="dialog">
|
||||
<defaultcontrol always="true">3010</defaultcontrol>
|
||||
<zorder>2</zorder>
|
||||
<coordinates>
|
||||
<system>1</system>
|
||||
<left>450</left>
|
||||
<top>250</top>
|
||||
</coordinates>
|
||||
<include>dialogeffect</include>
|
||||
<controls>
|
||||
|
||||
<control type="image">
|
||||
<left>0</left>
|
||||
<top>0</top>
|
||||
<width>340</width>
|
||||
<height>160</height>
|
||||
<texture border="40">bg.png</texture>
|
||||
</control>
|
||||
|
||||
<control type="button" id="3010">
|
||||
<texturenofocus border="1" colordiffuse="ff161616">white.png</texturenofocus>
|
||||
<texturefocus border="1" colordiffuse="ff525252">white.png</texturefocus>
|
||||
<left>20</left>
|
||||
<top>30</top>
|
||||
<width>300</width>
|
||||
<height>40</height>
|
||||
<label>-</label>
|
||||
<onup>-</onup>
|
||||
<ondown>3011</ondown>
|
||||
<font>font14</font>
|
||||
</control>
|
||||
|
||||
<control type="button" id="3011">
|
||||
<texturenofocus border="1" colordiffuse="ff161616">white.png</texturenofocus>
|
||||
<texturefocus border="1" colordiffuse="ff525252">white.png</texturefocus>
|
||||
<left>20</left>
|
||||
<top>90</top>
|
||||
<width>300</width>
|
||||
<height>40</height>
|
||||
<label>Start from beginning</label>
|
||||
<onup>3010</onup>
|
||||
<ondown>3012</ondown>
|
||||
<font>font14</font>
|
||||
</control>
|
||||
|
||||
</controls>
|
||||
</window>
|
||||
Reference in New Issue
Block a user