Apply media type toggles to recently added

This commit is contained in:
Jonathan Wong 2015-11-21 10:28:26 -08:00
parent e6aef01508
commit 17bb57d5f5

View file

@ -169,15 +169,22 @@ def notify(stream_data=None, notify_action=None):
def notify_timeline(timeline_data=None, notify_action=None): def notify_timeline(timeline_data=None, notify_action=None):
if timeline_data and notify_action: if timeline_data and notify_action:
for agent in notifiers.available_notification_agents(): if (timeline_data['media_type'] == 'movie' and plexpy.CONFIG.MOVIE_NOTIFY_ENABLE) \
if agent['on_created'] and notify_action == 'created': or ((timeline_data['media_type'] == 'show' or timeline_data['media_type'] == 'episode') \
# Build and send notification and plexpy.CONFIG.TV_NOTIFY_ENABLE) \
notify_strings = build_notify_text(timeline=timeline_data, state=notify_action) or ((timeline_data['media_type'] == 'artist' or timeline_data['media_type'] == 'track') \
notifiers.send_notification(config_id=agent['id'], and plexpy.CONFIG.MUSIC_NOTIFY_ENABLE):
subject=notify_strings[0],
body=notify_strings[1]) for agent in notifiers.available_notification_agents():
# Set the notification state in the db if agent['on_created'] and notify_action == 'created':
set_notify_state(session=timeline_data, state=notify_action, agent_info=agent) # Build and send notification
notify_strings = build_notify_text(timeline=timeline_data, state=notify_action)
notifiers.send_notification(config_id=agent['id'],
subject=notify_strings[0],
body=notify_strings[1])
# Set the notification state in the db
set_notify_state(session=timeline_data, state=notify_action, agent_info=agent)
elif not timeline_data and notify_action: elif not timeline_data and notify_action:
for agent in notifiers.available_notification_agents(): for agent in notifiers.available_notification_agents():
if agent['on_extdown'] and notify_action == 'extdown': if agent['on_extdown'] and notify_action == 'extdown':