mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-08-19 12:59:42 -07:00
Check device is registered before sending notification
This commit is contained in:
parent
0a493b9349
commit
4bdf520bce
2 changed files with 10 additions and 3 deletions
|
@ -15,9 +15,9 @@ DOCUMENTATION :: END
|
||||||
<li class="registered-device" data-id="${device['device_id']}" data-name="${device['device_name']}">
|
<li class="registered-device" data-id="${device['device_id']}" data-name="${device['device_name']}">
|
||||||
<span>
|
<span>
|
||||||
<span class="toggle-left mobile-device-tooltip edit-mobile-device" data-toggle="tooltip" data-placement="top" title="Rename Device"><i class="fa fa-lg fa-pencil"></i></span>
|
<span class="toggle-left mobile-device-tooltip edit-mobile-device" data-toggle="tooltip" data-placement="top" title="Rename Device"><i class="fa fa-lg fa-pencil"></i></span>
|
||||||
<span class="mobile-device-name">${device['device_name']}</span>
|
<span class="mobile-device-name">${device['friendly_name'] or device['device_name']}</span>
|
||||||
<input type="text" class="edit-mobile-device-name hidden" value="${device['device_name']}" />
|
<input type="text" class="edit-mobile-device-name hidden" value="${device['device_name']}" />
|
||||||
<span class="toggle-right delete-mobile-device"><i class="fa fa-lg fa-times"></i></span>
|
<span class="toggle-right delete-mobile-device" data-toggle="tooltip" data-placement="top" title="Remove Device"><i class="fa fa-lg fa-times"></i></span>
|
||||||
</span>
|
</span>
|
||||||
</li>
|
</li>
|
||||||
% endfor
|
% endfor
|
||||||
|
@ -25,6 +25,7 @@ DOCUMENTATION :: END
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
$('.mobile-device-tooltip').tooltip();
|
$('.mobile-device-tooltip').tooltip();
|
||||||
|
$('.delete-mobile-device').tooltip();
|
||||||
|
|
||||||
$('.delete-mobile-device').click(function () {
|
$('.delete-mobile-device').click(function () {
|
||||||
var device_id = $(this).closest('li').data('id');
|
var device_id = $(this).closest('li').data('id');
|
||||||
|
|
|
@ -44,6 +44,7 @@ import plexpy
|
||||||
import database
|
import database
|
||||||
import helpers
|
import helpers
|
||||||
import logger
|
import logger
|
||||||
|
import mobile_app
|
||||||
import request
|
import request
|
||||||
from plexpy.config import _BLACKLIST_KEYS, _WHITELIST_KEYS
|
from plexpy.config import _BLACKLIST_KEYS, _WHITELIST_KEYS
|
||||||
from plexpy.helpers import checked
|
from plexpy.helpers import checked
|
||||||
|
@ -690,6 +691,11 @@ class ANDROIDAPP(Notifier):
|
||||||
if not subject or not body:
|
if not subject or not body:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
# Check mobile device is still registered
|
||||||
|
if self.config['device_id'] and not mobile_app.get_mobile_devices(device_id=self.config['device_id']):
|
||||||
|
logger.warn(u"PlexPy Notifiers :: Unable to send Android app notification: device not registered.")
|
||||||
|
return
|
||||||
|
|
||||||
data = {'app_id': self.ONESIGNAL_APP_ID,
|
data = {'app_id': self.ONESIGNAL_APP_ID,
|
||||||
'include_player_ids': [self.config['device_id']],
|
'include_player_ids': [self.config['device_id']],
|
||||||
'headings': {'en': subject.encode("utf-8")},
|
'headings': {'en': subject.encode("utf-8")},
|
||||||
|
@ -740,7 +746,7 @@ class ANDROIDAPP(Notifier):
|
||||||
devices_config = {'label': 'Device',
|
devices_config = {'label': 'Device',
|
||||||
'description': 'No devices registered. ' \
|
'description': 'No devices registered. ' \
|
||||||
'<a data-tab-destination="tabs-android_app" data-toggle="tab" data-dismiss="modal" ' \
|
'<a data-tab-destination="tabs-android_app" data-toggle="tab" data-dismiss="modal" ' \
|
||||||
'style="cursor: pointer;">Click here</a> to get the Android App.',
|
'style="cursor: pointer;">Get the Android App</a> and register a device.',
|
||||||
'input_type': 'help'
|
'input_type': 'help'
|
||||||
}
|
}
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue