diff --git a/data/interfaces/default/newsletters_table.html b/data/interfaces/default/newsletters_table.html index 5ceaf0a0..b2c4cb04 100644 --- a/data/interfaces/default/newsletters_table.html +++ b/data/interfaces/default/newsletters_table.html @@ -20,13 +20,28 @@ DOCUMENTATION :: END % else: ${newsletter['agent_label']}  (${newsletter['id']}) % endif - - + % if newsletter_handler.NEWSLETTER_SCHED.get_job('newsletter-{}'.format(newsletter['id'])): <% job = newsletter_handler.NEWSLETTER_SCHED.get_job('newsletter-{}'.format(newsletter['id'])) %> - + + + + % endif + % if newsletter['last_triggered']: + <% icon, icon_tooltip = ('fa-check', 'Success') if newsletter['last_success'] else ('fa-times', 'Failed') %> + + + + % else: + Last: never + % endif diff --git a/data/interfaces/default/notifiers_table.html b/data/interfaces/default/notifiers_table.html index d2bfa55e..1017f7f4 100644 --- a/data/interfaces/default/notifiers_table.html +++ b/data/interfaces/default/notifiers_table.html @@ -19,7 +19,20 @@ DOCUMENTATION :: END % else: ${notifier['agent_label']}  (${notifier['id']}) % endif - + + % if notifier['last_triggered']: + <% icon, icon_tooltip = ('fa-check', 'Success') if notifier['last_success'] else ('fa-times', 'Failed') %> + + + + % else: + never + + % endif % endfor diff --git a/data/interfaces/default/settings.html b/data/interfaces/default/settings.html index c5d8fe37..6710ff79 100644 --- a/data/interfaces/default/settings.html +++ b/data/interfaces/default/settings.html @@ -1278,7 +1278,7 @@

- Add a new notification agent, or configure an existing notification agent by clicking the settings icon on the right. + Add a new notification agent, or configure an existing notification agent by clicking on the item below.

Please see the Notification Agents Guide for instructions on setting up each notification agent. @@ -1298,7 +1298,7 @@

- Add a new newsletter agent, or configure an existing newsletter agent by clicking the settings icon on the right. + Add a new newsletter agent, or configure an existing newsletter agent by clicking on the item below.

Warning: The Image Hosting setting must be enabled for images to display on the newsletter. @@ -1630,7 +1630,7 @@

-

Register a new device using a QR code, or configure an existing device by clicking the settings icon on the right.

+

Register a new device using a QR code, or configure an existing device by clicking on the item below.

Warning: The API must be enabled under Web Interface to use the app.


diff --git a/plexpy/newsletters.py b/plexpy/newsletters.py index 661a2b42..5fe8448c 100644 --- a/plexpy/newsletters.py +++ b/plexpy/newsletters.py @@ -119,13 +119,22 @@ def get_newsletters(newsletter_id=None): if newsletter_id: where = "WHERE " if newsletter_id: - where_id += "id = ?" + where_id += "newsletters.id = ?" args.append(newsletter_id) where += " AND ".join([w for w in [where_id] if w]) db = database.MonitorDatabase() - result = db.select("SELECT id, agent_id, agent_name, agent_label, " - "friendly_name, cron, active FROM newsletters %s" % where, args=args) + result = db.select( + ( + "SELECT newsletters.id, newsletters.agent_id, newsletters.agent_name, newsletters.agent_label, " + "newsletters.friendly_name, newsletters.cron, newsletters.active, " + "MAX(newsletter_log.timestamp) AS last_triggered, newsletter_log.success AS last_success " + "FROM newsletters " + "LEFT OUTER JOIN newsletter_log ON newsletters.id = newsletter_log.newsletter_id " + "%s " + "GROUP BY newsletters.id" + ) % where, args=args + ) return result diff --git a/plexpy/notifiers.py b/plexpy/notifiers.py index ec8ad5b9..1e18644e 100644 --- a/plexpy/notifiers.py +++ b/plexpy/notifiers.py @@ -499,7 +499,7 @@ def get_notifiers(notifier_id=None, notify_action=None): if notifier_id or notify_action: where = 'WHERE ' if notifier_id: - where_id += 'id = ?' + where_id += 'notifiers.id = ?' args.append(notifier_id) if notify_action and notify_action in notify_actions: where_action = '%s = ?' % notify_action @@ -507,8 +507,16 @@ def get_notifiers(notifier_id=None, notify_action=None): where += ' AND '.join([w for w in [where_id, where_action] if w]) db = database.MonitorDatabase() - result = db.select("SELECT id, agent_id, agent_name, agent_label, friendly_name, %s FROM notifiers %s" - % (', '.join(notify_actions), where), args=args) + result = db.select( + ( + "SELECT notifiers.id, notifiers.agent_id, notifiers.agent_name, notifiers.agent_label, notifiers.friendly_name, %s, " + "MAX(notify_log.timestamp) AS last_triggered, notify_log.success AS last_success " + "FROM notifiers " + "LEFT OUTER JOIN notify_log ON notifiers.id = notify_log.notifier_id " + "%s " + "GROUP BY notifiers.id" + ) % (', '.join(notify_actions), where), args=args + ) for item in result: item['active'] = int(any([item.pop(k) for k in list(item.keys()) if k in notify_actions]))