Make sure build_notify_text returns two values
This commit is contained in:
@@ -325,11 +325,9 @@ def notify_timeline(timeline_data=None, notify_action=None):
|
|||||||
notify_action=notify_action)
|
notify_action=notify_action)
|
||||||
|
|
||||||
# Set the notification state in the db
|
# Set the notification state in the db
|
||||||
set_notify_state(session={},
|
set_notify_state(notify_action=notify_action,
|
||||||
notify_action=notify_action,
|
|
||||||
agent_info=agent,
|
agent_info=agent,
|
||||||
notify_strings=notify_strings,
|
notify_strings=notify_strings)
|
||||||
metadata={})
|
|
||||||
|
|
||||||
if agent['on_intdown'] and notify_action == 'intdown':
|
if agent['on_intdown'] and notify_action == 'intdown':
|
||||||
# Build and send notification
|
# Build and send notification
|
||||||
@@ -343,11 +341,9 @@ def notify_timeline(timeline_data=None, notify_action=None):
|
|||||||
notify_action=notify_action)
|
notify_action=notify_action)
|
||||||
|
|
||||||
# Set the notification state in the db
|
# Set the notification state in the db
|
||||||
set_notify_state(session={},
|
set_notify_state(notify_action=notify_action,
|
||||||
notify_action=notify_action,
|
|
||||||
agent_info=agent,
|
agent_info=agent,
|
||||||
notify_strings=notify_strings,
|
notify_strings=notify_strings)
|
||||||
metadata={})
|
|
||||||
|
|
||||||
if agent['on_extup'] and notify_action == 'extup':
|
if agent['on_extup'] and notify_action == 'extup':
|
||||||
# Build and send notification
|
# Build and send notification
|
||||||
@@ -361,11 +357,9 @@ def notify_timeline(timeline_data=None, notify_action=None):
|
|||||||
notify_action=notify_action)
|
notify_action=notify_action)
|
||||||
|
|
||||||
# Set the notification state in the db
|
# Set the notification state in the db
|
||||||
set_notify_state(session={},
|
set_notify_state(notify_action=notify_action,
|
||||||
notify_action=notify_action,
|
|
||||||
agent_info=agent,
|
agent_info=agent,
|
||||||
notify_strings=notify_strings,
|
notify_strings=notify_strings)
|
||||||
metadata={})
|
|
||||||
|
|
||||||
if agent['on_intup'] and notify_action == 'intup':
|
if agent['on_intup'] and notify_action == 'intup':
|
||||||
# Build and send notification
|
# Build and send notification
|
||||||
@@ -379,11 +373,9 @@ def notify_timeline(timeline_data=None, notify_action=None):
|
|||||||
notify_action=notify_action)
|
notify_action=notify_action)
|
||||||
|
|
||||||
# Set the notification state in the db
|
# Set the notification state in the db
|
||||||
set_notify_state(session={},
|
set_notify_state(notify_action=notify_action,
|
||||||
notify_action=notify_action,
|
|
||||||
agent_info=agent,
|
agent_info=agent,
|
||||||
notify_strings=notify_strings,
|
notify_strings=notify_strings)
|
||||||
metadata={})
|
|
||||||
|
|
||||||
if agent['on_pmsupdate'] and notify_action == 'pmsupdate':
|
if agent['on_pmsupdate'] and notify_action == 'pmsupdate':
|
||||||
# Build and send notification
|
# Build and send notification
|
||||||
@@ -397,11 +389,9 @@ def notify_timeline(timeline_data=None, notify_action=None):
|
|||||||
notify_action=notify_action)
|
notify_action=notify_action)
|
||||||
|
|
||||||
# Set the notification state in the db
|
# Set the notification state in the db
|
||||||
set_notify_state(session={},
|
set_notify_state(notify_action=notify_action,
|
||||||
notify_action=notify_action,
|
|
||||||
agent_info=agent,
|
agent_info=agent,
|
||||||
notify_strings=notify_strings,
|
notify_strings=notify_strings)
|
||||||
metadata={})
|
|
||||||
|
|
||||||
else:
|
else:
|
||||||
logger.debug(u"PlexPy NotificationHandler :: Notify timeline called but incomplete data received.")
|
logger.debug(u"PlexPy NotificationHandler :: Notify timeline called but incomplete data received.")
|
||||||
@@ -426,11 +416,14 @@ def get_notify_state(session):
|
|||||||
return notify_states
|
return notify_states
|
||||||
|
|
||||||
|
|
||||||
def set_notify_state(session, notify_action, agent_info, notify_strings, metadata):
|
def set_notify_state(notify_action, agent_info, notify_strings, session=None, metadata=None):
|
||||||
|
|
||||||
if notify_action and agent_info:
|
if notify_action and agent_info:
|
||||||
monitor_db = database.MonitorDatabase()
|
monitor_db = database.MonitorDatabase()
|
||||||
|
|
||||||
|
session = session or {}
|
||||||
|
metadata = metadata or {}
|
||||||
|
|
||||||
if notify_strings[2]:
|
if notify_strings[2]:
|
||||||
script_args = '[' + ', '.join(notify_strings[2]) + ']'
|
script_args = '[' + ', '.join(notify_strings[2]) + ']'
|
||||||
else:
|
else:
|
||||||
@@ -496,7 +489,7 @@ def build_notify_text(session=None, timeline=None, notify_action=None, agent_id=
|
|||||||
metadata = metadata_list['metadata']
|
metadata = metadata_list['metadata']
|
||||||
else:
|
else:
|
||||||
logger.error(u"PlexPy NotificationHandler :: Unable to retrieve metadata for rating_key %s" % str(rating_key))
|
logger.error(u"PlexPy NotificationHandler :: Unable to retrieve metadata for rating_key %s" % str(rating_key))
|
||||||
return []
|
return [None, None, None], None
|
||||||
|
|
||||||
# Check for exclusion tags
|
# Check for exclusion tags
|
||||||
if metadata['media_type'] == 'movie':
|
if metadata['media_type'] == 'movie':
|
||||||
@@ -918,7 +911,7 @@ def build_notify_text(session=None, timeline=None, notify_action=None, agent_id=
|
|||||||
else:
|
else:
|
||||||
return [subject_text, body_text, script_args], metadata
|
return [subject_text, body_text, script_args], metadata
|
||||||
else:
|
else:
|
||||||
return None
|
return [None, None, None], None
|
||||||
|
|
||||||
|
|
||||||
def build_server_notify_text(notify_action=None, agent_id=None):
|
def build_server_notify_text(notify_action=None, agent_id=None):
|
||||||
|
Reference in New Issue
Block a user