one more fix for tvshow paths
This commit is contained in:
parent
4ad3ef00fc
commit
8ec2d7d33b
1 changed files with 8 additions and 10 deletions
|
@ -894,6 +894,7 @@ class WriteKodiDB():
|
||||||
utils.logMsg("MB3 Sync","old filename -->" + oldFileName)
|
utils.logMsg("MB3 Sync","old filename -->" + oldFileName)
|
||||||
utils.logMsg("MB3 Sync","new filename -->" + newFileName)
|
utils.logMsg("MB3 Sync","new filename -->" + newFileName)
|
||||||
|
|
||||||
|
######### PROCESS TV SHOW ############
|
||||||
if fileType == "tvshow" and not newFileName.startswith("http"):
|
if fileType == "tvshow" and not newFileName.startswith("http"):
|
||||||
#for tvshows we only store the path in DB
|
#for tvshows we only store the path in DB
|
||||||
cursor.execute("SELECT idPath as pathid FROM tvshowlinkpath WHERE idShow = ?",(id,))
|
cursor.execute("SELECT idPath as pathid FROM tvshowlinkpath WHERE idShow = ?",(id,))
|
||||||
|
@ -918,7 +919,12 @@ class WriteKodiDB():
|
||||||
######### PROCESS EPISODE ############
|
######### PROCESS EPISODE ############
|
||||||
if fileType == "episode":
|
if fileType == "episode":
|
||||||
|
|
||||||
#create the path - return id if already exists
|
#get the file and the current path id
|
||||||
|
cursor.execute("SELECT idFile as fileid FROM episode WHERE idEpisode = ?",(id,))
|
||||||
|
result = cursor.fetchone()
|
||||||
|
fileid = result[0]
|
||||||
|
|
||||||
|
#create the new path - return id if already exists
|
||||||
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:
|
||||||
|
@ -930,14 +936,6 @@ 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))
|
||||||
|
|
||||||
#get the file and the current path id
|
|
||||||
cursor.execute("SELECT idFile as fileid FROM episode WHERE idEpisode = ?",(id,))
|
|
||||||
result = cursor.fetchone()
|
|
||||||
fileid = result[0]
|
|
||||||
cursor.execute("SELECT idPath as curpathid FROM files WHERE idFile = ?",(fileid,))
|
|
||||||
result = cursor.fetchone()
|
|
||||||
curpathid = result[0]
|
|
||||||
|
|
||||||
#set the new path and filename to the episode
|
#set the new path and filename to the episode
|
||||||
cursor.execute("UPDATE files SET idPath = ?, strFilename = ? WHERE idFile = ?", (pathid,filename,fileid))
|
cursor.execute("UPDATE files SET idPath = ?, strFilename = ? WHERE idFile = ?", (pathid,filename,fileid))
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue