mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-06 05:01:14 -07:00
Allow deleting mobile device using the registered device_id
This commit is contained in:
parent
bee3361ace
commit
d97b87d9cc
3 changed files with 13 additions and 6 deletions
3
API.md
3
API.md
|
@ -240,7 +240,8 @@ Remove a mobile device from the database.
|
||||||
|
|
||||||
```
|
```
|
||||||
Required parameters:
|
Required parameters:
|
||||||
mobile_device_id (int): The device id to delete
|
mobile_device_id (int): The mobile device database id to delete, OR
|
||||||
|
device_id (str): The unique device identifier for the mobile device
|
||||||
|
|
||||||
Optional parameters:
|
Optional parameters:
|
||||||
None
|
None
|
||||||
|
|
|
@ -149,13 +149,17 @@ def set_mobile_device_config(mobile_device_id=None, **kwargs):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
def delete_mobile_device(mobile_device_id=None):
|
def delete_mobile_device(mobile_device_id=None, device_id=None):
|
||||||
db = database.MonitorDatabase()
|
db = database.MonitorDatabase()
|
||||||
|
|
||||||
if mobile_device_id:
|
if mobile_device_id:
|
||||||
logger.debug("Tautulli MobileApp :: Deleting device_id %s from the database." % mobile_device_id)
|
logger.debug("Tautulli MobileApp :: Deleting mobile_device_id %s from the database." % mobile_device_id)
|
||||||
result = db.action('DELETE FROM mobile_devices WHERE id = ?', args=[mobile_device_id])
|
result = db.action('DELETE FROM mobile_devices WHERE id = ?', args=[mobile_device_id])
|
||||||
return True
|
return True
|
||||||
|
elif device_id:
|
||||||
|
logger.debug("Tautulli MobileApp :: Deleting device_id %s from the database." % device_id)
|
||||||
|
result = db.action('DELETE FROM mobile_devices WHERE device_id = ?', args=[device_id])
|
||||||
|
return True
|
||||||
else:
|
else:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
|
@ -3823,12 +3823,13 @@ class WebInterface(object):
|
||||||
@cherrypy.tools.json_out()
|
@cherrypy.tools.json_out()
|
||||||
@requireAuth(member_of("admin"))
|
@requireAuth(member_of("admin"))
|
||||||
@addtoapi()
|
@addtoapi()
|
||||||
def delete_mobile_device(self, mobile_device_id=None, **kwargs):
|
def delete_mobile_device(self, mobile_device_id=None, device_id=None, **kwargs):
|
||||||
""" Remove a mobile device from the database.
|
""" Remove a mobile device from the database.
|
||||||
|
|
||||||
```
|
```
|
||||||
Required parameters:
|
Required parameters:
|
||||||
mobile_device_id (int): The device id to delete
|
mobile_device_id (int): The mobile device database id to delete, OR
|
||||||
|
device_id (str): The unique device identifier for the mobile device
|
||||||
|
|
||||||
Optional parameters:
|
Optional parameters:
|
||||||
None
|
None
|
||||||
|
@ -3837,7 +3838,8 @@ class WebInterface(object):
|
||||||
None
|
None
|
||||||
```
|
```
|
||||||
"""
|
"""
|
||||||
result = mobile_app.delete_mobile_device(mobile_device_id=mobile_device_id)
|
result = mobile_app.delete_mobile_device(mobile_device_id=mobile_device_id,
|
||||||
|
device_id=device_id)
|
||||||
if result:
|
if result:
|
||||||
return {'result': 'success', 'message': 'Deleted mobile device.'}
|
return {'result': 'success', 'message': 'Deleted mobile device.'}
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue