Correction to the http dialog
However still unsure there's a bug. The only way the dialog will show up is if xbmcvfs.exists() returned false. Still waiting for someone to post a debug log.
This commit is contained in:
parent
097d48c2c4
commit
4a6c5c10ac
2 changed files with 18 additions and 8 deletions
|
@ -22,6 +22,7 @@ class PlayUtils():
|
||||||
|
|
||||||
addonName = clientInfo.getAddonName()
|
addonName = clientInfo.getAddonName()
|
||||||
addon = xbmcaddon.Addon()
|
addon = xbmcaddon.Addon()
|
||||||
|
WINDOW = xbmcgui.Window(10000)
|
||||||
|
|
||||||
audioPref = addon.getSetting('Audiopref')
|
audioPref = addon.getSetting('Audiopref')
|
||||||
subsPref = addon.getSetting('Subspref')
|
subsPref = addon.getSetting('Subspref')
|
||||||
|
@ -36,7 +37,7 @@ class PlayUtils():
|
||||||
|
|
||||||
def getPlayUrl(self, server, id, result):
|
def getPlayUrl(self, server, id, result):
|
||||||
|
|
||||||
WINDOW = xbmcgui.Window(10000)
|
WINDOW = self.WINDOW
|
||||||
username = WINDOW.getProperty('currUser')
|
username = WINDOW.getProperty('currUser')
|
||||||
server = WINDOW.getProperty('server%s' % username)
|
server = WINDOW.getProperty('server%s' % username)
|
||||||
|
|
||||||
|
@ -54,11 +55,15 @@ class PlayUtils():
|
||||||
self.logMsg("File is direct streaming.", 1)
|
self.logMsg("File is direct streaming.", 1)
|
||||||
WINDOW.setProperty("%splaymethod" % playurl, "DirectStream")
|
WINDOW.setProperty("%splaymethod" % playurl, "DirectStream")
|
||||||
|
|
||||||
else:# Try transcoding
|
elif self.isTranscoding(result):
|
||||||
|
# Try transcoding
|
||||||
playurl = self.transcoding(result, server, id)
|
playurl = self.transcoding(result, server, id)
|
||||||
if playurl:
|
if playurl:
|
||||||
self.logMsg("File is transcoding.", 1)
|
self.logMsg("File is transcoding.", 1)
|
||||||
WINDOW.setProperty("%splaymethod" % playurl, "Transcode")
|
WINDOW.setProperty("%splaymethod" % playurl, "Transcode")
|
||||||
|
else:
|
||||||
|
# Error
|
||||||
|
return False
|
||||||
|
|
||||||
return playurl.encode('utf-8')
|
return playurl.encode('utf-8')
|
||||||
|
|
||||||
|
@ -86,16 +91,19 @@ class PlayUtils():
|
||||||
if self.fileExists(result):
|
if self.fileExists(result):
|
||||||
return True
|
return True
|
||||||
else:
|
else:
|
||||||
self.logMsg("Can't direct play: Unable to locate the content.", 1)
|
self.logMsg("Unable to direct play. Verify the following path is accessible by the device: %s. You might also need to add SMB credentials in the addon settings." % result[u'MediaSources'][0][u'Path'])
|
||||||
if dialog:
|
if dialog:
|
||||||
# Let user know that direct play failed
|
# Let user know that direct play failed
|
||||||
resp = xbmcgui.Dialog().select('Warning: Unable to direct play.', ['Play from HTTP', 'Play from HTTP and remember next time.'])
|
dialog = xbmcgui.Dialog()
|
||||||
|
resp = dialog.select('Warning: Unable to direct play.', ['Play from HTTP', 'Play from HTTP and remember next time.'])
|
||||||
if resp == 1:
|
if resp == 1:
|
||||||
# Remember next time
|
# Remember next time
|
||||||
self.addon.setSetting('playFromStream', "true")
|
self.addon.setSetting('playFromStream', "true")
|
||||||
else:
|
elif resp < 0:
|
||||||
# User decided not to proceed.
|
# User decided not to proceed.
|
||||||
self.logMsg("Unable to direct play. Verify the following path is accessible by the device: %s. You might also need to add SMB credentials in the addon settings." % result[u'MediaSources'][0][u'Path'])
|
self.logMsg("User cancelled HTTP selection dialog.", 1)
|
||||||
|
self.WINDOW.setProperty("playurlFalse", "true")
|
||||||
|
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -32,6 +32,8 @@ class PlaybackUtils():
|
||||||
logLevel = 0
|
logLevel = 0
|
||||||
downloadUtils = DownloadUtils()
|
downloadUtils = DownloadUtils()
|
||||||
|
|
||||||
|
WINDOW.clearProperty('playurlFalse')
|
||||||
|
|
||||||
def __init__(self, *args):
|
def __init__(self, *args):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
@ -90,8 +92,8 @@ class PlaybackUtils():
|
||||||
return self.AddToPlaylist(itemsToPlay)
|
return self.AddToPlaylist(itemsToPlay)
|
||||||
|
|
||||||
playurl = PlayUtils().getPlayUrl(server, id, result)
|
playurl = PlayUtils().getPlayUrl(server, id, result)
|
||||||
if playurl == False:
|
if playurl == False or WINDOW.getProperty('playurlFalse') == "true":
|
||||||
#xbmcgui.Dialog().ok('Warning', 'Failed to launch playback.')
|
WINDOW.clearProperty('playurlFalse')
|
||||||
xbmc.log("Failed to retrieve the playback path/url.")
|
xbmc.log("Failed to retrieve the playback path/url.")
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue