From 495f02db31b1ef427918f1bc71e55012428daa69 Mon Sep 17 00:00:00 2001 From: mattohm <31443434+mattohm@users.noreply.github.com> Date: Mon, 11 Dec 2017 14:28:25 -0500 Subject: [PATCH] Ignore blank email Guest or managed users have no email listed causing the script to error --- scripts/plexEmail.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/scripts/plexEmail.py b/scripts/plexEmail.py index 610fa53..d5dfa1e 100644 --- a/scripts/plexEmail.py +++ b/scripts/plexEmail.py @@ -347,8 +347,9 @@ def getSharedUserEmails(): for elem in parsed: for name, value in sorted(elem.attrib.items()): if (name == 'email'): - logging.info('getSharedUserEmails: adding email - ' + value.lower()) - emails.append(value.lower()) + if value: + logging.info('getSharedUserEmails: adding email - ' + value.lower()) + emails.append(value.lower()) logging.info('getSharedUserEmails: Returning shared emails') logging.debug('getSharedUserEmails: email list - ' + ' '.join(emails)) @@ -1742,4 +1743,4 @@ def exceptionHandler(type, value, tb): print 'Emails were not sent because there were no new additions in the timeframe specified.' con.close() -os.remove(DATABASE_FILE + '_plexemail') \ No newline at end of file +os.remove(DATABASE_FILE + '_plexemail')