From 025fd31da838d7c0a96811473fa744509c488d5d Mon Sep 17 00:00:00 2001 From: Marcel van der Veldt Date: Tue, 12 May 2015 18:16:30 +0200 Subject: [PATCH] a little more error handling added --- resources/lib/WriteKodiVideoDB.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/resources/lib/WriteKodiVideoDB.py b/resources/lib/WriteKodiVideoDB.py index 146c972a..33d1c76d 100644 --- a/resources/lib/WriteKodiVideoDB.py +++ b/resources/lib/WriteKodiVideoDB.py @@ -58,6 +58,10 @@ class WriteKodiVideoDB(): MBitem = ReadEmbyDB().getFullItem(embyId) + if not MBitem: + utils.logMsg("ADD movie to Kodi library FAILED", "Item %s not found on server!" %embyId) + return + # If the item already exist in the local Kodi DB we'll perform a full item update # If the item doesn't exist, we'll add it to the database @@ -225,6 +229,10 @@ class WriteKodiVideoDB(): downloadUtils = DownloadUtils() MBitem = ReadEmbyDB().getFullItem(embyId) + + if not MBitem: + utils.logMsg("ADD musicvideo to Kodi library FAILED", "Item %s not found on server!" %embyId) + return # If the item already exist in the local Kodi DB we'll perform a full item update # If the item doesn't exist, we'll add it to the database @@ -358,6 +366,10 @@ class WriteKodiVideoDB(): MBitem = ReadEmbyDB().getFullItem(embyId) + if not MBitem: + utils.logMsg("ADD tvshow to Kodi library FAILED", "Item %s not found on server!" %embyId) + return + timeInfo = API().getTimeInfo(MBitem) userData=API().getUserData(MBitem) @@ -489,6 +501,10 @@ class WriteKodiVideoDB(): # If the item doesn't exist, we'll add it to the database MBitem = ReadEmbyDB().getFullItem(embyId) + if not MBitem: + utils.logMsg("ADD episode to Kodi library FAILED", "Item %s not found on server!" %embyId) + return + cursor.execute("SELECT kodi_id FROM emby WHERE emby_id = ?",(MBitem["Id"],)) result = cursor.fetchone() if result != None: