From 2eac7bbcb485822f396344050a570aa395f817da Mon Sep 17 00:00:00 2001 From: Marcel van der Veldt Date: Sat, 2 May 2015 04:01:52 +0200 Subject: [PATCH] fixed updates from websocket --- resources/lib/DownloadUtils.py | 4 ++-- resources/lib/WebSocketClient.py | 13 ++++++++----- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/resources/lib/DownloadUtils.py b/resources/lib/DownloadUtils.py index 92410b2c..479da4d6 100644 --- a/resources/lib/DownloadUtils.py +++ b/resources/lib/DownloadUtils.py @@ -11,8 +11,8 @@ from ClientInformation import ClientInformation from requests.packages.urllib3.exceptions import InsecureRequestWarning # Disable requests logging -requests.packages.urllib3.disable_warnings(InsecureRequestWarning) -logging.getLogger("requests").setLevel(logging.WARNING) +# requests.packages.urllib3.disable_warnings(InsecureRequestWarning) +# logging.getLogger("requests").setLevel(logging.WARNING) class DownloadUtils(): diff --git a/resources/lib/WebSocketClient.py b/resources/lib/WebSocketClient.py index e09e105a..148d1658 100644 --- a/resources/lib/WebSocketClient.py +++ b/resources/lib/WebSocketClient.py @@ -180,12 +180,15 @@ class WebSocketThread(threading.Thread): def remove_items(self, itemsRemoved): for item in itemsRemoved: + connection = utils.KodiSQL() + cursor = connection.cursor() self.logMsg("Message : Doing LibraryChanged : Items Removed : Calling deleteEpisodeFromKodiLibraryByMbId: " + item, 0) - WriteKodiDB().deleteEpisodeFromKodiLibraryByMbId(item) + WriteKodiDB().deleteEpisodeFromKodiLibrary(item, connection, cursor) self.logMsg("Message : Doing LibraryChanged : Items Removed : Calling deleteMovieFromKodiLibrary: " + item, 0) - WriteKodiDB().deleteMovieFromKodiLibrary(item) + WriteKodiDB().deleteMovieFromKodiLibrary(item, connection, cursor) self.logMsg("Message : Doing LibraryChanged : Items Removed : Calling deleteMusicVideoFromKodiLibrary: " + item, 0) - WriteKodiDB().deleteMusicVideoFromKodiLibrary(item) + WriteKodiDB().deleteMusicVideoFromKodiLibrary(item, connection, cursor) + cursor.close() def update_items(self, itemsToUpdate): # doing adds and updates @@ -193,8 +196,8 @@ class WebSocketThread(threading.Thread): self.logMsg("Message : Doing LibraryChanged : Processing Added and Updated : " + str(itemsToUpdate), 0) connection = utils.KodiSQL() cursor = connection.cursor() - LibrarySync().MoviesSync(connection, cursor, fullsync = False, installFirstRun = False, itemList = itemsToUpdate) - LibrarySync().TvShowsSync(connection, cursor, fullsync = False, installFirstRun = False, itemList = itemsToUpdate) + LibrarySync().MoviesSync(connection, cursor, False, itemsToUpdate) + LibrarySync().TvShowsSync(connection, cursor, False, itemsToUpdate) cursor.close() def user_data_update(self, userDataList):