This commit is contained in:
Marcel van der Veldt 2015-05-08 02:44:50 +02:00
commit 7fde54514e
2 changed files with 10 additions and 9 deletions

View file

@ -53,14 +53,17 @@ class PlayUtils():
playurl = self.transcoding(result, server, id) playurl = self.transcoding(result, server, id)
WINDOW.setProperty("transcoding%s" % id, "true") WINDOW.setProperty("transcoding%s" % id, "true")
self.logMsg("File is transcoding.", 1) self.logMsg("File is transcoding.", 1)
WINDOW.setProperty("%splaymethod" % playurl, "Transcode")
else: else:
self.logMsg("File is direct streaming.", 1) self.logMsg("File is direct streaming.", 1)
WINDOW.setProperty("%splaymethod" % playurl, "DirectStream")
else: else:
# 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("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'])
return False return False
else: else:
self.logMsg("File is direct playing.", 1) self.logMsg("File is direct playing.", 1)
WINDOW.setProperty("%splaymethod" % playurl, "DirectPlay")
except: except:
return False return False
@ -73,8 +76,10 @@ class PlayUtils():
playurl = self.transcoding(result, server, id) playurl = self.transcoding(result, server, id)
WINDOW.setProperty("transcoding%s" % id, "true") WINDOW.setProperty("transcoding%s" % id, "true")
self.logMsg("File is transcoding.", 1) self.logMsg("File is transcoding.", 1)
WINDOW.setProperty("%splaymethod" % playurl, "Transcode")
else: else:
self.logMsg("File is direct streaming.", 1) self.logMsg("File is direct streaming.", 1)
WINDOW.setProperty("%splaymethod" % playurl, "DirectStream")
except: except:
return False return False
@ -84,6 +89,7 @@ class PlayUtils():
playurl = self.transcoding(result, server, id) playurl = self.transcoding(result, server, id)
WINDOW.setProperty("transcoding%s" % id, "true") WINDOW.setProperty("transcoding%s" % id, "true")
self.logMsg("File is transcoding.", 1) self.logMsg("File is transcoding.", 1)
WINDOW.setProperty("%splaymethod" % playurl, "Transcode")
except: except:
return False return False
@ -93,9 +99,9 @@ class PlayUtils():
def isDirectPlay(self, result): def isDirectPlay(self, result):
# Requirements for Direct play: # Requirements for Direct play:
# FileSystem, Accessible path # FileSystem, Accessible path
addon = self.addon self.addon = xbmcaddon.Addon(id=self.addonId)
playhttp = addon.getSetting('playFromStream') playhttp = self.addon.getSetting('playFromStream')
# User forcing to play via HTTP instead of SMB # User forcing to play via HTTP instead of SMB
if playhttp == "true": if playhttp == "true":
return False return False
@ -111,6 +117,8 @@ class PlayUtils():
# Verify if path is accessible # Verify if path is accessible
if self.fileExists(result): if self.fileExists(result):
return True return True
else:
return False
def directPlay(self, result): def directPlay(self, result):

View file

@ -110,13 +110,6 @@ class PlaybackUtils():
WINDOW.setProperty(playurl+"type", result.get("Type")) WINDOW.setProperty(playurl+"type", result.get("Type"))
WINDOW.setProperty(playurl+"item_id", id) WINDOW.setProperty(playurl+"item_id", id)
if PlayUtils().isDirectPlay(result) == True:
playMethod = "DirectPlay"
else:
playMethod = "Transcode"
WINDOW.setProperty(playurl+"playmethod", playMethod)
mediaSources = result.get("MediaSources") mediaSources = result.get("MediaSources")
if(mediaSources != None): if(mediaSources != None):
if mediaSources[0].get('DefaultAudioStreamIndex') != None: if mediaSources[0].get('DefaultAudioStreamIndex') != None: