Fix NoneType error in set_notify_state

This commit is contained in:
JonnyWong16 2016-02-21 16:33:42 -08:00
parent d5f4a1a48a
commit 48b0f7dc27
3 changed files with 56 additions and 56 deletions

View file

@ -64,13 +64,6 @@ from plexpy import helpers
</label> </label>
<p class="help-block">Trigger notification when a media item is added to the Plex Media Server.</p> <p class="help-block">Trigger notification when a media item is added to the Plex Media Server.</p>
</div> </div>
<div class="checkbox">
<label>
<input type="checkbox" data-size="small" data-id="${data['id']}" data-config-name="${data['config_prefix']}_on_extdown" ${helpers.checked(data['on_extdown'])} class="toggle-switches">
Notify on Plex remote access down
</label>
<p class="help-block">Trigger notification when the Plex Media Server cannot be reached externally.</p>
</div>
<div class="checkbox"> <div class="checkbox">
<label> <label>
<input type="checkbox" data-size="small" data-id="${data['id']}" data-config-name="${data['config_prefix']}_on_intdown" ${helpers.checked(data['on_intdown'])} class="toggle-switches"> <input type="checkbox" data-size="small" data-id="${data['id']}" data-config-name="${data['config_prefix']}_on_intdown" ${helpers.checked(data['on_intdown'])} class="toggle-switches">
@ -78,13 +71,6 @@ from plexpy import helpers
</label> </label>
<p class="help-block">Trigger notification when the Plex Media Server cannot be reached internally.</p> <p class="help-block">Trigger notification when the Plex Media Server cannot be reached internally.</p>
</div> </div>
<div class="checkbox">
<label>
<input type="checkbox" data-size="small" data-id="${data['id']}" data-config-name="${data['config_prefix']}_on_extup" ${helpers.checked(data['on_extup'])} class="toggle-switches">
Notify on Plex remote access back up
</label>
<p class="help-block">Trigger notification when the Plex Media Server can be reached externally after being down.</p>
</div>
<div class="checkbox"> <div class="checkbox">
<label> <label>
<input type="checkbox" data-size="small" data-id="${data['id']}" data-config-name="${data['config_prefix']}_on_intup" ${helpers.checked(data['on_intup'])} class="toggle-switches"> <input type="checkbox" data-size="small" data-id="${data['id']}" data-config-name="${data['config_prefix']}_on_intup" ${helpers.checked(data['on_intup'])} class="toggle-switches">
@ -92,6 +78,20 @@ from plexpy import helpers
</label> </label>
<p class="help-block">Trigger notification when the Plex Media Server can be reached internally after being down.</p> <p class="help-block">Trigger notification when the Plex Media Server can be reached internally after being down.</p>
</div> </div>
<div class="checkbox">
<label>
<input type="checkbox" data-size="small" data-id="${data['id']}" data-config-name="${data['config_prefix']}_on_extdown" ${helpers.checked(data['on_extdown'])} class="toggle-switches">
Notify on Plex remote access down
</label>
<p class="help-block">Trigger notification when the Plex Media Server cannot be reached externally.</p>
</div>
<div class="checkbox">
<label>
<input type="checkbox" data-size="small" data-id="${data['id']}" data-config-name="${data['config_prefix']}_on_extup" ${helpers.checked(data['on_extup'])} class="toggle-switches">
Notify on Plex remote access back up
</label>
<p class="help-block">Trigger notification when the Plex Media Server can be reached externally after being down.</p>
</div>
</div> </div>
</div> </div>
</div> </div>

View file

@ -890,23 +890,6 @@ available_notification_agents = sorted(notifiers.available_notification_agents()
</li> </li>
</ul> </ul>
</li> </li>
<li>
<div class="link"><i class="fa fa-server fa-fw"></i>&nbsp;Plex Remote Access Down<i class="fa fa-chevron-down"></i></div>
<ul class="submenu">
<li>
<div class="form-group">
<label for="notify_on_extdown_subject_text">Subject Line</label>
<input class="form-control" type="text" id="notify_on_extdown_subject_text" name="notify_on_extdown_subject_text" value="${config['notify_on_extdown_subject_text']}" data-parsley-trigger="change" required>
<p class="help-block">Set a custom subject line.</p>
</div>
<div class="form-group">
<label for="notify_on_extdown_body_text">Message Body</label>
<textarea class="form-control" id="notify_on_extdown_body_text" name="notify_on_extdown_body_text" data-parsley-trigger="change" data-autoresize required>${config['notify_on_extdown_body_text']}</textarea>
<p class="help-block">Set a custom body.</p>
</div>
</li>
</ul>
</li>
<li> <li>
<div class="link"><i class="fa fa-server fa-fw"></i>&nbsp;Plex Server Down<i class="fa fa-chevron-down"></i></div> <div class="link"><i class="fa fa-server fa-fw"></i>&nbsp;Plex Server Down<i class="fa fa-chevron-down"></i></div>
<ul class="submenu"> <ul class="submenu">
@ -924,23 +907,6 @@ available_notification_agents = sorted(notifiers.available_notification_agents()
</li> </li>
</ul> </ul>
</li> </li>
<li>
<div class="link"><i class="fa fa-server fa-fw"></i>&nbsp;Plex Remote Access Back Up<i class="fa fa-chevron-down"></i></div>
<ul class="submenu">
<li>
<div class="form-group">
<label for="notify_on_extup_subject_text">Subject Line</label>
<input class="form-control" type="text" id="notify_on_extup_subject_text" name="notify_on_extup_subject_text" value="${config['notify_on_extup_subject_text']}" data-parsley-trigger="change" required>
<p class="help-block">Set a custom subject line.</p>
</div>
<div class="form-group">
<label for="notify_on_extup_body_text">Message Body</label>
<textarea class="form-control" id="notify_on_extup_body_text" name="notify_on_extup_body_text" data-parsley-trigger="change" data-autoresize required>${config['notify_on_extup_body_text']}</textarea>
<p class="help-block">Set a custom body.</p>
</div>
</li>
</ul>
</li>
<li> <li>
<div class="link"><i class="fa fa-server fa-fw"></i>&nbsp;Plex Server Back Up<i class="fa fa-chevron-down"></i></div> <div class="link"><i class="fa fa-server fa-fw"></i>&nbsp;Plex Server Back Up<i class="fa fa-chevron-down"></i></div>
<ul class="submenu"> <ul class="submenu">
@ -958,6 +924,40 @@ available_notification_agents = sorted(notifiers.available_notification_agents()
</li> </li>
</ul> </ul>
</li> </li>
<li>
<div class="link"><i class="fa fa-server fa-fw"></i>&nbsp;Plex Remote Access Down<i class="fa fa-chevron-down"></i></div>
<ul class="submenu">
<li>
<div class="form-group">
<label for="notify_on_extdown_subject_text">Subject Line</label>
<input class="form-control" type="text" id="notify_on_extdown_subject_text" name="notify_on_extdown_subject_text" value="${config['notify_on_extdown_subject_text']}" data-parsley-trigger="change" required>
<p class="help-block">Set a custom subject line.</p>
</div>
<div class="form-group">
<label for="notify_on_extdown_body_text">Message Body</label>
<textarea class="form-control" id="notify_on_extdown_body_text" name="notify_on_extdown_body_text" data-parsley-trigger="change" data-autoresize required>${config['notify_on_extdown_body_text']}</textarea>
<p class="help-block">Set a custom body.</p>
</div>
</li>
</ul>
</li>
<li>
<div class="link"><i class="fa fa-server fa-fw"></i>&nbsp;Plex Remote Access Back Up<i class="fa fa-chevron-down"></i></div>
<ul class="submenu">
<li>
<div class="form-group">
<label for="notify_on_extup_subject_text">Subject Line</label>
<input class="form-control" type="text" id="notify_on_extup_subject_text" name="notify_on_extup_subject_text" value="${config['notify_on_extup_subject_text']}" data-parsley-trigger="change" required>
<p class="help-block">Set a custom subject line.</p>
</div>
<div class="form-group">
<label for="notify_on_extup_body_text">Message Body</label>
<textarea class="form-control" id="notify_on_extup_body_text" name="notify_on_extup_body_text" data-parsley-trigger="change" data-autoresize required>${config['notify_on_extup_body_text']}</textarea>
<p class="help-block">Set a custom body.</p>
</div>
</li>
</ul>
</li>
</ul> </ul>
<ul id="accordion-scripts" class="accordion list-unstyled"> <ul id="accordion-scripts" class="accordion list-unstyled">
<li> <li>

View file

@ -287,11 +287,11 @@ 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=None, set_notify_state(session={},
notify_action=notify_action, notify_action=notify_action,
agent_info=agent, agent_info=agent,
notify_strings=notify_strings, notify_strings=notify_strings,
metadata=None) 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
@ -303,11 +303,11 @@ 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=None, set_notify_state(session={},
notify_action=notify_action, notify_action=notify_action,
agent_info=agent, agent_info=agent,
notify_strings=notify_strings, notify_strings=notify_strings,
metadata=None) 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
@ -319,11 +319,11 @@ 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=None, set_notify_state(session={},
notify_action=notify_action, notify_action=notify_action,
agent_info=agent, agent_info=agent,
notify_strings=notify_strings, notify_strings=notify_strings,
metadata=None) 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
@ -335,11 +335,11 @@ 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=None, set_notify_state(session={},
notify_action=notify_action, notify_action=notify_action,
agent_info=agent, agent_info=agent,
notify_strings=notify_strings, notify_strings=notify_strings,
metadata=None) 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.")