mirror of
https://github.com/jellyfin/jellyfin-kodi.git
synced 2024-11-10 04:06:11 +00:00
dont add episodes that dont have a season entry yet
This commit is contained in:
parent
19e38bec8e
commit
c72027f6a2
1 changed files with 20 additions and 6 deletions
|
@ -868,7 +868,7 @@ class WriteKodiDB():
|
|||
cursor.execute("SELECT idEpisode FROM episode WHERE c20 = ?",(MBitem["Id"],))
|
||||
result = cursor.fetchone()
|
||||
if result != None:
|
||||
utils.logMsg("Emby", "TV Show already exists in DB : " + MBitem["Id"] + " - " + MBitem["Name"], 2)
|
||||
utils.logMsg("Emby", "Episode already exists in DB : " + MBitem["Id"] + " - " + MBitem["Name"], 2)
|
||||
return
|
||||
|
||||
addon = xbmcaddon.Addon(id='plugin.video.emby')
|
||||
|
@ -931,16 +931,30 @@ class WriteKodiDB():
|
|||
|
||||
#get the showid
|
||||
cursor.execute("SELECT idShow as showid FROM tvshow WHERE c12 = ?",(MBitem["SeriesId"],))
|
||||
try:
|
||||
showid = cursor.fetchone()[0]
|
||||
except:
|
||||
result = cursor.fetchone()
|
||||
showid = -1
|
||||
if(result == None):
|
||||
utils.logMsg("Emby","Error adding episode to Kodi Library, couldn't find show - ID: " + MBitem["Id"] + " - " + MBitem["Name"])
|
||||
actionPerformed = False
|
||||
return
|
||||
actionPerformed = False
|
||||
return False
|
||||
else:
|
||||
showid = result[0]
|
||||
|
||||
# check season
|
||||
season = 0
|
||||
if MBitem.get("ParentIndexNumber") != None:
|
||||
season = int(MBitem.get("ParentIndexNumber"))
|
||||
utils.logMsg("Emby","Error adding episode to Kodi Library, no ParentIndexNumber - ID: " + MBitem["Id"] + " - " + MBitem["Name"])
|
||||
return False
|
||||
|
||||
cursor.execute("SELECT idSeason FROM seasons WHERE idShow = ? and season = ?",(showid, season))
|
||||
result = cursor.fetchone()
|
||||
if(result == None):
|
||||
utils.logMsg("Emby","Error adding episode to Kodi Library, season does not exist - ID: " + MBitem["Id"] + " - " + MBitem["Name"])
|
||||
actionPerformed = False
|
||||
return False
|
||||
|
||||
# build info
|
||||
episode = 0
|
||||
if MBitem.get("IndexNumber") != None:
|
||||
episode = int(MBitem.get("IndexNumber"))
|
||||
|
|
Loading…
Reference in a new issue