use the plugin method for playback when transcoding, use native kodi playback for direct access

This commit is contained in:
Marcel van der Veldt 2015-03-28 19:04:32 +01:00
parent 7493e57fcb
commit 03d99ed0d8
4 changed files with 23 additions and 26 deletions

View file

@ -63,6 +63,10 @@ class CreateFiles():
host = addon.getSetting('ipaddress') host = addon.getSetting('ipaddress')
server = host + ":" + port server = host + ":" + port
playurl = PlayUtils().getPlayUrl(server, item["Id"], item) playurl = PlayUtils().getPlayUrl(server, item["Id"], item)
#do not use direct path for transcoding
if playurl.startswith("http"):
playurl = "plugin://plugin.video.emby/?id=" + item["Id"] + '&mode=play'
text_file.writelines(playurl) text_file.writelines(playurl)
text_file.close() text_file.close()

View file

@ -76,10 +76,11 @@ class PlayUtils():
# Works out if we are direct playing or not # Works out if we are direct playing or not
def isDirectPlay(self, result): def isDirectPlay(self, result):
if (self.fileExists(result) or (result.get("LocationType") == "FileSystem" and self.isNetworkQualitySufficient(result) == True and self.isLocalPath(result) == False)): # if (self.fileExists(result) or (result.get("LocationType") == "FileSystem" and self.isNetworkQualitySufficient(result) == True and self.isLocalPath(result) == False)):
return True # return True
else: # else:
return False # return False
return False
# Works out if the network quality can play directly or if transcoding is needed # Works out if the network quality can play directly or if transcoding is needed

View file

@ -99,6 +99,8 @@ class WriteKodiDB():
#set Filename #set Filename
playurl = PlayUtils().getPlayUrl(server, MBitem["Id"], MBitem) playurl = PlayUtils().getPlayUrl(server, MBitem["Id"], MBitem)
if playurl.startswith("http"):
playurl = "plugin://plugin.video.emby/?id=" + MBitem["Id"] + '&mode=play'
if playurl != KodiItem["file"]: if playurl != KodiItem["file"]:
self.setKodiFilename(KodiItem["movieid"], playurl, "movie") self.setKodiFilename(KodiItem["movieid"], playurl, "movie")
@ -432,6 +434,8 @@ class WriteKodiDB():
#set Filename #set Filename
playurl = PlayUtils().getPlayUrl(server, MBitem["Id"], MBitem) playurl = PlayUtils().getPlayUrl(server, MBitem["Id"], MBitem)
if playurl.startswith("http"):
playurl = "plugin://plugin.video.emby/?id=" + MBitem["Id"] + '&mode=play'
if playurl != KodiItem["file"]: if playurl != KodiItem["file"]:
self.setKodiFilename(KodiItem["episodeid"], playurl, "episode") self.setKodiFilename(KodiItem["episodeid"], playurl, "episode")
@ -890,28 +894,16 @@ class WriteKodiDB():
def setKodiFilename(self, id, filenameAndPath, fileType): def setKodiFilename(self, id, filenameAndPath, fileType):
#use sqlite to set the filename in DB -- needed to avoid problems with resumepoints etc #use sqlite to set the filename in DB -- needed to avoid problems with resumepoints etc
#todo --> submit PR to kodi team to get this added to the jsonrpc api #todo --> submit PR to kodi team to get this added to the jsonrpc api
#todo --> extend support for musicvideos
filenameAndPath = utils.convertEncoding(filenameAndPath) filenameAndPath = utils.convertEncoding(filenameAndPath)
print "set filepath for id " + str(id) if "\\" in filenameAndPath:
filename = filenameAndPath.rsplit("\\",1)[-1]
if not filenameAndPath.startswith("http"): path = filenameAndPath.replace(filename,"")
#assume direct play elif "/" in filenameAndPath:
if "\\" in filenameAndPath: filename = filenameAndPath.rsplit("/",1)[-1]
filename = filenameAndPath.rsplit("\\",1)[-1] path = filenameAndPath.replace(filename,"")
path = filenameAndPath.replace(filename,"")
elif "/" in filenameAndPath:
filename = filenameAndPath.rsplit("/",1)[-1]
path = filenameAndPath.replace(filename,"")
else:
#assume play from stream ?
filename = filenameAndPath
path = "plugin://plugin.video.emby/"
else:
#assume play from stream
filename = filenameAndPath
path = "plugin://plugin.video.emby/"
utils.logMsg("MB3 Sync","setting filename in kodi db..." + fileType + ": " + str(id)) utils.logMsg("MB3 Sync","setting filename in kodi db..." + fileType + ": " + str(id))
xbmc.sleep(sleepVal) xbmc.sleep(sleepVal)
connection = utils.KodiSQL() connection = utils.KodiSQL()

View file

@ -29,7 +29,7 @@
</category> </category>
<category label="Playback"> <!-- Extra Sync options --> <category label="Playback"> <!-- Extra Sync options -->
<setting id="addExtraPlaybackArt" type="bool" label="Add extra playback art" default="true" visible="true" enable="true" /> <setting id="addExtraPlaybackArt" type="bool" label="Add extra playback art" default="true" visible="false" enable="true" />
<setting id="smbusername" type="text" label="30007" default="" visible="true" enable="true" /> <setting id="smbusername" type="text" label="30007" default="" visible="true" enable="true" />
<setting id="smbpassword" type="text" label="30008" default="" option="hidden" visible="true" enable="true" /> <setting id="smbpassword" type="text" label="30008" default="" option="hidden" visible="true" enable="true" />
</category> </category>