use existing file only if the path was the same as well
This commit is contained in:
parent
4b6f192b4b
commit
6f11368575
1 changed files with 22 additions and 13 deletions
|
@ -680,18 +680,23 @@ class WriteKodiDB():
|
||||||
path = playurl.replace(filename,"")
|
path = playurl.replace(filename,"")
|
||||||
|
|
||||||
#create the path
|
#create the path
|
||||||
cursor.execute("select coalesce(max(idPath),0) as pathid from path")
|
cursor.execute("SELECT idPath as pathid FROM path WHERE strPath = ?",(path,))
|
||||||
pathid = cursor.fetchone()[0]
|
result = cursor.fetchone()
|
||||||
pathid = pathid + 1
|
if result != None:
|
||||||
pathsql="insert into path(idPath, strPath, strContent, strScraper, noUpdate) values(?, ?, ?, ?, ?)"
|
pathid = result[0]
|
||||||
cursor.execute(pathsql, (pathid,path,"movies","metadata.local",1))
|
else:
|
||||||
|
cursor.execute("select coalesce(max(idPath),0) as pathid from path")
|
||||||
|
pathid = cursor.fetchone()[0]
|
||||||
|
pathid = pathid + 1
|
||||||
|
pathsql = "insert into path(idPath, strPath, strContent, strScraper, noUpdate) values(?, ?, ?, ?, ?)"
|
||||||
|
cursor.execute(pathsql, (pathid,path,"movies","metadata.local",1))
|
||||||
|
|
||||||
playcount = None
|
playcount = None
|
||||||
if userData.get("PlayCount") == "1":
|
if userData.get("PlayCount") == "1":
|
||||||
playcount = 1
|
playcount = 1
|
||||||
|
|
||||||
#create the file if not exists
|
#create the file if not exists
|
||||||
cursor.execute("SELECT idFile as fileid FROM files WHERE strFilename = ?",(filename,))
|
cursor.execute("SELECT idFile as fileid FROM files WHERE strFilename = ? and idPath = ?",(filename,pathid,))
|
||||||
result = cursor.fetchone()
|
result = cursor.fetchone()
|
||||||
if result != None:
|
if result != None:
|
||||||
fileid = result[0]
|
fileid = result[0]
|
||||||
|
@ -785,11 +790,16 @@ class WriteKodiDB():
|
||||||
path = playurl.replace(filename,"")
|
path = playurl.replace(filename,"")
|
||||||
|
|
||||||
#create the path
|
#create the path
|
||||||
cursor.execute("select coalesce(max(idPath),0) as pathid from path")
|
cursor.execute("SELECT idPath as pathid FROM path WHERE strPath = ?",(path,))
|
||||||
pathid = cursor.fetchone()[0]
|
result = cursor.fetchone()
|
||||||
pathid = pathid + 1
|
if result != None:
|
||||||
pathsql="insert into path(idPath, strPath, strContent, strScraper, noUpdate) values(?, ?, ?, ?, ?)"
|
pathid = result[0]
|
||||||
cursor.execute(pathsql, (pathid,path,"musicvideos","metadata.local",1))
|
else:
|
||||||
|
cursor.execute("select coalesce(max(idPath),0) as pathid from path")
|
||||||
|
pathid = cursor.fetchone()[0]
|
||||||
|
pathid = pathid + 1
|
||||||
|
pathsql = "insert into path(idPath, strPath, strContent, strScraper, noUpdate) values(?, ?, ?, ?, ?)"
|
||||||
|
cursor.execute(pathsql, (pathid,path,"movies","metadata.local",1))
|
||||||
|
|
||||||
playcount = None
|
playcount = None
|
||||||
if userData.get("PlayCount") == "1":
|
if userData.get("PlayCount") == "1":
|
||||||
|
@ -886,13 +896,12 @@ class WriteKodiDB():
|
||||||
pathsql="insert into path(idPath, strPath, strContent, strScraper, noUpdate) values(?, ?, ?, ?, ?)"
|
pathsql="insert into path(idPath, strPath, strContent, strScraper, noUpdate) values(?, ?, ?, ?, ?)"
|
||||||
cursor.execute(pathsql, (pathid,path,None,None,1))
|
cursor.execute(pathsql, (pathid,path,None,None,1))
|
||||||
|
|
||||||
|
|
||||||
playcount = None
|
playcount = None
|
||||||
if userData.get("PlayCount") == "1":
|
if userData.get("PlayCount") == "1":
|
||||||
playcount = 1
|
playcount = 1
|
||||||
|
|
||||||
#create the file if not exists
|
#create the file if not exists
|
||||||
cursor.execute("SELECT idFile as fileid FROM files WHERE strFilename = ?",(filename,))
|
cursor.execute("SELECT idFile as fileid FROM files WHERE strFilename = ? and idPath = ?",(filename,pathid,))
|
||||||
result = cursor.fetchone()
|
result = cursor.fetchone()
|
||||||
if result != None:
|
if result != None:
|
||||||
fileid = result[0]
|
fileid = result[0]
|
||||||
|
|
Loading…
Reference in a new issue