mirror of
https://github.com/jellyfin/jellyfin-kodi.git
synced 2024-12-25 10:16: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"],))
|
cursor.execute("SELECT idEpisode FROM episode WHERE c20 = ?",(MBitem["Id"],))
|
||||||
result = cursor.fetchone()
|
result = cursor.fetchone()
|
||||||
if result != None:
|
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
|
return
|
||||||
|
|
||||||
addon = xbmcaddon.Addon(id='plugin.video.emby')
|
addon = xbmcaddon.Addon(id='plugin.video.emby')
|
||||||
|
@ -931,16 +931,30 @@ class WriteKodiDB():
|
||||||
|
|
||||||
#get the showid
|
#get the showid
|
||||||
cursor.execute("SELECT idShow as showid FROM tvshow WHERE c12 = ?",(MBitem["SeriesId"],))
|
cursor.execute("SELECT idShow as showid FROM tvshow WHERE c12 = ?",(MBitem["SeriesId"],))
|
||||||
try:
|
result = cursor.fetchone()
|
||||||
showid = cursor.fetchone()[0]
|
showid = -1
|
||||||
except:
|
if(result == None):
|
||||||
utils.logMsg("Emby","Error adding episode to Kodi Library, couldn't find show - ID: " + MBitem["Id"] + " - " + MBitem["Name"])
|
utils.logMsg("Emby","Error adding episode to Kodi Library, couldn't find show - ID: " + MBitem["Id"] + " - " + MBitem["Name"])
|
||||||
actionPerformed = False
|
actionPerformed = False
|
||||||
return
|
return False
|
||||||
|
else:
|
||||||
|
showid = result[0]
|
||||||
|
|
||||||
|
# check season
|
||||||
season = 0
|
season = 0
|
||||||
if MBitem.get("ParentIndexNumber") != None:
|
if MBitem.get("ParentIndexNumber") != None:
|
||||||
season = int(MBitem.get("ParentIndexNumber"))
|
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
|
episode = 0
|
||||||
if MBitem.get("IndexNumber") != None:
|
if MBitem.get("IndexNumber") != None:
|
||||||
episode = int(MBitem.get("IndexNumber"))
|
episode = int(MBitem.get("IndexNumber"))
|
||||||
|
|
Loading…
Reference in a new issue