From 3a4349e64722eb0346568848af83855567aef95a Mon Sep 17 00:00:00 2001 From: tomkat83 Date: Wed, 23 Mar 2016 16:57:49 +0100 Subject: [PATCH] Disable SSL warning in Log, clean Futurewarnings --- resources/lib/PlexAPI.py | 12 ++++++++---- resources/lib/artwork.py | 4 ++++ resources/lib/image_cache_thread.py | 4 ++++ resources/lib/librarysync.py | 11 ++++++----- 4 files changed, 22 insertions(+), 9 deletions(-) diff --git a/resources/lib/PlexAPI.py b/resources/lib/PlexAPI.py index 0f85d543..f46ea86d 100644 --- a/resources/lib/PlexAPI.py +++ b/resources/lib/PlexAPI.py @@ -51,6 +51,7 @@ from threading import Thread import Queue import traceback import requests +import xml.etree.ElementTree as etree import re import json @@ -58,7 +59,10 @@ from urllib import urlencode, quote_plus, unquote from PlexFunctions import PlexToKodiTimefactor, PMSHttpsEnabled -import xml.etree.ElementTree as etree + +# Disable requests logging +from requests.packages.urllib3.exceptions import InsecureRequestWarning +requests.packages.urllib3.disable_warnings(InsecureRequestWarning) @utils.logging @@ -191,12 +195,12 @@ class PlexAPI(): # Wait for approx 30 seconds (since the PIN is not visible anymore :-)) while count < 30: xml = self.CheckPlexTvSignin(identifier) - if xml: + if xml is not False: break # Wait for 1 seconds xbmc.sleep(1000) count += 1 - if not xml: + if xml is False: # Could not sign in to plex.tv Try again later dialog.ok(self.addonName, string(39305)) return False @@ -260,7 +264,7 @@ class PlexAPI(): identifier = None # Download xml = self.TalkToPlexServer(url, talkType="POST") - if not xml: + if xml is False: return code, identifier try: code = xml.find('code').text diff --git a/resources/lib/artwork.py b/resources/lib/artwork.py index 9d9da4ec..3b2c21f3 100644 --- a/resources/lib/artwork.py +++ b/resources/lib/artwork.py @@ -15,6 +15,10 @@ import xbmcvfs import utils import image_cache_thread +# Disable requests logging +from requests.packages.urllib3.exceptions import InsecureRequestWarning +requests.packages.urllib3.disable_warnings(InsecureRequestWarning) + ############################################################################### diff --git a/resources/lib/image_cache_thread.py b/resources/lib/image_cache_thread.py index 69003b69..d40164e7 100644 --- a/resources/lib/image_cache_thread.py +++ b/resources/lib/image_cache_thread.py @@ -3,6 +3,10 @@ import utils import xbmc import requests +# Disable requests logging +from requests.packages.urllib3.exceptions import InsecureRequestWarning +requests.packages.urllib3.disable_warnings(InsecureRequestWarning) + @utils.logging class image_cache_thread(threading.Thread): diff --git a/resources/lib/librarysync.py b/resources/lib/librarysync.py index 9d13b1db..f097d1df 100644 --- a/resources/lib/librarysync.py +++ b/resources/lib/librarysync.py @@ -326,7 +326,7 @@ class LibrarySync(Thread): # Get the Plex item's metadata xml = PlexFunctions.GetPlexMetadata(plexId) - if not xml: + if xml is None: self.logMsg("Could not download metadata, aborting time sync", -1) return libraryId = xml[0].attrib['librarySectionID'] @@ -1215,7 +1215,7 @@ class LibrarySync(Thread): viewName = view['name'] allPlexTvShows = PlexFunctions.GetPlexSectionResults( viewId, containerSize=self.limitindex) - if not allPlexTvShows: + if allPlexTvShows is None: self.logMsg( "Error downloading show view xml for view %s" % viewId, -1) continue @@ -1242,7 +1242,7 @@ class LibrarySync(Thread): # Grab all seasons to tvshow from PMS seasons = PlexFunctions.GetAllPlexChildren( tvShowId, containerSize=self.limitindex) - if not seasons: + if seasons is None: self.logMsg( "Error downloading season xml for show %s" % tvShowId, -1) continue @@ -1267,7 +1267,7 @@ class LibrarySync(Thread): # Grab all episodes to tvshow from PMS episodes = PlexFunctions.GetAllPlexLeaves( view['id'], containerSize=self.limitindex) - if not episodes: + if episodes is None: self.logMsg( "Error downloading episod xml for view %s" % view.get('name'), -1) @@ -1365,7 +1365,7 @@ class LibrarySync(Thread): viewName = view['name'] itemsXML = PlexFunctions.GetPlexSectionResults( viewId, args=urlArgs, containerSize=self.limitindex) - if not itemsXML: + if itemsXML is None: self.logMsg("Error downloading xml for view %s" % viewId, -1) continue @@ -1407,6 +1407,7 @@ class LibrarySync(Thread): except Exception as e: utils.window('emby_dbScan', clear=True) self.logMsg('LibrarySync thread crashed', -1) + self.logMsg('Error message: %s' % e, -1) # Library sync thread has crashed xbmcgui.Dialog().ok( heading=self.addonName,