fix for directplay

This commit is contained in:
Marcel van der Veldt 2015-03-28 18:36:14 +01:00
parent eccfaf983f
commit 7493e57fcb
1 changed files with 32 additions and 20 deletions

View File

@ -891,10 +891,12 @@ class WriteKodiDB():
#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
print "set filepath for id " + str(id) + " - " + filenameAndPath filenameAndPath = utils.convertEncoding(filenameAndPath)
print "set filepath for id " + str(id)
if not filenameAndPath.startswith("http"):
#assume direct play
if "\\" in filenameAndPath: if "\\" in filenameAndPath:
filename = filenameAndPath.rsplit("\\",1)[-1] filename = filenameAndPath.rsplit("\\",1)[-1]
path = filenameAndPath.replace(filename,"") path = filenameAndPath.replace(filename,"")
@ -902,15 +904,19 @@ class WriteKodiDB():
filename = filenameAndPath.rsplit("/",1)[-1] filename = filenameAndPath.rsplit("/",1)[-1]
path = filenameAndPath.replace(filename,"") path = filenameAndPath.replace(filename,"")
else: else:
#assume play from stream ?
filename = filenameAndPath filename = filenameAndPath
path = None 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()
cursor = connection.cursor( ) cursor = connection.cursor( )
if path != None:
cursor.execute("SELECT idPath as pathid FROM path WHERE strPath = ?",(path,)) cursor.execute("SELECT idPath as pathid FROM path WHERE strPath = ?",(path,))
result = cursor.fetchone() result = cursor.fetchone()
if result != None: if result != None:
@ -922,6 +928,12 @@ class WriteKodiDB():
pathsql="insert into path(idPath, strPath) values(?, ?)" pathsql="insert into path(idPath, strPath) values(?, ?)"
cursor.execute(pathsql, (pathid,path)) cursor.execute(pathsql, (pathid,path))
cursor.execute("select coalesce(max(idPath),0) as pathid from path")
pathid = cursor.fetchone()[0]
pathid = pathid + 1
pathsql="insert into path(idPath, strPath) values(?, ?)"
cursor.execute(pathsql, (pathid,path))
if fileType == "episode": if fileType == "episode":
cursor.execute("SELECT idFile as fileidid FROM episode WHERE idEpisode = ?",(id,)) cursor.execute("SELECT idFile as fileidid FROM episode WHERE idEpisode = ?",(id,))
result = cursor.fetchone() result = cursor.fetchone()