parent
5a87c90058
commit
097d48c2c4
1 changed files with 6 additions and 13 deletions
|
@ -22,7 +22,6 @@ 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')
|
||||||
|
@ -37,7 +36,7 @@ class PlayUtils():
|
||||||
|
|
||||||
def getPlayUrl(self, server, id, result):
|
def getPlayUrl(self, server, id, result):
|
||||||
|
|
||||||
WINDOW = self.WINDOW
|
WINDOW = xbmcgui.Window(10000)
|
||||||
username = WINDOW.getProperty('currUser')
|
username = WINDOW.getProperty('currUser')
|
||||||
server = WINDOW.getProperty('server%s' % username)
|
server = WINDOW.getProperty('server%s' % username)
|
||||||
|
|
||||||
|
@ -48,22 +47,18 @@ class PlayUtils():
|
||||||
self.logMsg("File is direct playing.", 1)
|
self.logMsg("File is direct playing.", 1)
|
||||||
WINDOW.setProperty("%splaymethod" % playurl.encode('utf-8'), "DirectPlay")
|
WINDOW.setProperty("%splaymethod" % playurl.encode('utf-8'), "DirectPlay")
|
||||||
|
|
||||||
elif self.isDirectStream(result) and WINDOW.getProperty('playurlFalse') != "true":
|
elif self.isDirectStream(result):
|
||||||
# Try direct stream
|
# Try direct stream
|
||||||
playurl = self.directStream(result, server, id)
|
playurl = self.directStream(result, server, id)
|
||||||
if playurl:
|
if playurl:
|
||||||
self.logMsg("File is direct streaming.", 1)
|
self.logMsg("File is direct streaming.", 1)
|
||||||
WINDOW.setProperty("%splaymethod" % playurl, "DirectStream")
|
WINDOW.setProperty("%splaymethod" % playurl, "DirectStream")
|
||||||
|
|
||||||
elif self.isTranscoding(result) and WINDOW.getProperty('playurlFalse') != "true":
|
else:# Try transcoding
|
||||||
# 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 or User cancelled HTTP dialog.
|
|
||||||
return False
|
|
||||||
|
|
||||||
return playurl.encode('utf-8')
|
return playurl.encode('utf-8')
|
||||||
|
|
||||||
|
@ -91,18 +86,16 @@ class PlayUtils():
|
||||||
if self.fileExists(result):
|
if self.fileExists(result):
|
||||||
return True
|
return True
|
||||||
else:
|
else:
|
||||||
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("Can't direct play: Unable to locate the content.", 1)
|
||||||
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.'])
|
resp = xbmcgui.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")
|
||||||
elif resp < 0:
|
else:
|
||||||
# User decided not to proceed.
|
# User decided not to proceed.
|
||||||
self.logMsg("User cancelled HTTP selection dialog.", 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'])
|
||||||
self.WINDOW.setProperty("playurlFalse", "true")
|
|
||||||
|
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue