add a resume question dialog box

for now this will work until we work out a better way
This commit is contained in:
shaun 2015-03-28 12:12:51 +11:00
parent 64bd1b3fed
commit 06052426e2

View file

@ -22,7 +22,6 @@ import xbmcvfs
addon = xbmcaddon.Addon(id='plugin.video.emby') addon = xbmcaddon.Addon(id='plugin.video.emby')
addondir = xbmc.translatePath(addon.getAddonInfo('profile')) addondir = xbmc.translatePath(addon.getAddonInfo('profile'))
language = addon.getLocalizedString
WINDOW = xbmcgui.Window( 10000 ) WINDOW = xbmcgui.Window( 10000 )
port = addon.getSetting('port') port = addon.getSetting('port')
@ -34,7 +33,7 @@ userid = downloadUtils.getUserId()
class PlaybackUtils(): class PlaybackUtils():
settings = None settings = None
language = None language = addon.getLocalizedString
logLevel = 0 logLevel = 0
@ -85,7 +84,7 @@ class PlaybackUtils():
# Can not play virtual items # Can not play virtual items
if (result.get("LocationType") == "Virtual"): if (result.get("LocationType") == "Virtual"):
xbmcgui.Dialog().ok(self.language(30128), language(30129)) xbmcgui.Dialog().ok(self.language(30128), self.language(30129))
watchedurl = 'http://' + server + '/mediabrowser/Users/'+ userid + '/PlayedItems/' + id watchedurl = 'http://' + server + '/mediabrowser/Users/'+ userid + '/PlayedItems/' + id
positionurl = 'http://' + server + '/mediabrowser/Users/'+ userid + '/PlayingItems/' + id positionurl = 'http://' + server + '/mediabrowser/Users/'+ userid + '/PlayingItems/' + id
@ -96,10 +95,19 @@ class PlaybackUtils():
WINDOW.setProperty(playurl+"positionurl", positionurl) WINDOW.setProperty(playurl+"positionurl", positionurl)
WINDOW.setProperty(playurl+"deleteurl", "") WINDOW.setProperty(playurl+"deleteurl", "")
WINDOW.setProperty(playurl+"deleteurl", deleteurl) WINDOW.setProperty(playurl+"deleteurl", deleteurl)
if seekTime != 0: if seekTime != 0:
displayTime = str(datetime.timedelta(seconds=seekTime))
display_list = [ self.language(30106) + ' ' + displayTime, self.language(30107)]
resumeScreen = xbmcgui.Dialog()
resume_result = resumeScreen.select(self.language(30105), display_list)
xbmc.log("RESUME_QUESTION : " + str(resume_result))
if resume_result == 0:
WINDOW.setProperty(playurl+"seektime", str(seekTime)) WINDOW.setProperty(playurl+"seektime", str(seekTime))
else: else:
WINDOW.clearProperty(playurl+"seektime") WINDOW.clearProperty(playurl+"seektime")
else:
WINDOW.clearProperty(playurl+"seektime")
if result.get("Type")=="Episode": if result.get("Type")=="Episode":
WINDOW.setProperty(playurl+"refresh_id", result.get("SeriesId")) WINDOW.setProperty(playurl+"refresh_id", result.get("SeriesId"))
@ -130,7 +138,7 @@ class PlaybackUtils():
xbmcplugin.setResolvedUrl(int(sys.argv[1]), True, listItem) xbmcplugin.setResolvedUrl(int(sys.argv[1]), True, listItem)
else: else:
xbmcplugin.setResolvedUrl(int(sys.argv[1]), True, listItem) xbmcplugin.setResolvedUrl(int(sys.argv[1]), True, listItem)
xbmc.Player().play(playurl,listItem) #xbmc.Player().play(playurl,listItem)
def setArt(self, list,name,path): def setArt(self, list,name,path):
if name=='thumb' or name=='fanart_image' or name=='small_poster' or name=='tiny_poster' or name == "medium_landscape" or name=='medium_poster' or name=='small_fanartimage' or name=='medium_fanartimage' or name=='fanart_noindicators': if name=='thumb' or name=='fanart_image' or name=='small_poster' or name=='tiny_poster' or name == "medium_landscape" or name=='medium_poster' or name=='small_fanartimage' or name=='medium_fanartimage' or name=='fanart_noindicators':
@ -178,9 +186,9 @@ class PlaybackUtils():
# play info # play info
playinformation = '' playinformation = ''
if PlayUtils().isDirectPlay(result) == True: if PlayUtils().isDirectPlay(result) == True:
playinformation = language(30165) playinformation = self.language(30165)
else: else:
playinformation = language(30166) playinformation = self.language(30166)
details = { details = {
'title' : result.get("Name", "Missing Name") + ' - ' + playinformation, 'title' : result.get("Name", "Missing Name") + ' - ' + playinformation,