From a8236222fb3d2f4fb67715eabe7ee5960c28f733 Mon Sep 17 00:00:00 2001 From: Tim van der Westhuizen Date: Fri, 27 Nov 2015 10:45:25 +0200 Subject: [PATCH 1/2] Catch null ratingKeys in plexWatch db importer. Make sure we have a string when parsing the latinToAscii function. --- plexpy/helpers.py | 16 +++++++++------- plexpy/plexwatch_import.py | 7 ++++++- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/plexpy/helpers.py b/plexpy/helpers.py index fbefaaa1..e5f5cc42 100644 --- a/plexpy/helpers.py +++ b/plexpy/helpers.py @@ -92,13 +92,15 @@ def latinToAscii(unicrap): } r = '' - for i in unicrap: - if ord(i) in xlate: - r += xlate[ord(i)] - elif ord(i) >= 0x80: - pass - else: - r += str(i) + if unicrap: + for i in unicrap: + if ord(i) in xlate: + r += xlate[ord(i)] + elif ord(i) >= 0x80: + pass + else: + r += str(i) + return r diff --git a/plexpy/plexwatch_import.py b/plexpy/plexwatch_import.py index e50c3ca4..b92be702 100644 --- a/plexpy/plexwatch_import.py +++ b/plexpy/plexwatch_import.py @@ -292,10 +292,15 @@ def import_from_plexwatch(database=None, table_name=None, import_ignore_interval # If we get back None from our xml extractor skip over the record and log error. if not extracted_xml: - logger.error(u"PlexPy Importer :: Skipping line with ratingKey %s due to malformed xml." + logger.error(u"PlexPy Importer :: Skipping record with ratingKey %s due to malformed xml." % str(row['rating_key'])) continue + # Skip line if we don't have a ratingKey to work with + if not row['rating_key']: + logger.error(u"PlexPy Importer :: Skipping record due to null ratingRey.") + continue + # If the user_id no longer exists in the friends list, pull it from the xml. if user_data.get_user_id(user=row['user']): user_id = user_data.get_user_id(user=row['user']) From fae3f38a88f4610787df5cabb76ff42853d27d0a Mon Sep 17 00:00:00 2001 From: Tim van der Westhuizen Date: Fri, 27 Nov 2015 10:52:29 +0200 Subject: [PATCH 2/2] v1.2.6 --- CHANGELOG.md | 6 ++++++ plexpy/version.py | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1a0de924..80214da5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## v1.2.6 (2015-11-27) + +* Fixes for IP logging in PMS < 0.9.14.x. +* Fix issue in plexWatch importer when trying to import item with no ratingKey. + + ## v1.2.5 (2015-11-25) * Add video_decision and audio_decision to notification options diff --git a/plexpy/version.py b/plexpy/version.py index 5060fcf0..d6213d00 100644 --- a/plexpy/version.py +++ b/plexpy/version.py @@ -1,2 +1,2 @@ PLEXPY_VERSION = "master" -PLEXPY_RELEASE_VERSION = "1.2.5" +PLEXPY_RELEASE_VERSION = "1.2.6"