mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-15 01:32:57 -07:00
Add ability to delete synced items
This commit is contained in:
parent
718049b9f3
commit
a2eeda64df
10 changed files with 227 additions and 48 deletions
|
@ -296,7 +296,7 @@ class PlexTV(object):
|
|||
return request
|
||||
|
||||
def get_plextv_sync_lists(self, machine_id='', output_format=''):
|
||||
uri = '/servers/' + machine_id + '/sync_lists'
|
||||
uri = '/servers/%s/sync_lists' % machine_id
|
||||
request = self.request_handler.make_request(uri=uri,
|
||||
proto=self.protocol,
|
||||
request_type='GET',
|
||||
|
@ -337,6 +337,24 @@ class PlexTV(object):
|
|||
|
||||
return request
|
||||
|
||||
def delete_plextv_device_sync_lists(self, client_id='', output_format=''):
|
||||
uri = '/devices/%s/sync_items' % client_id
|
||||
request = self.request_handler.make_request(uri=uri,
|
||||
proto=self.protocol,
|
||||
request_type='GET',
|
||||
output_format=output_format)
|
||||
|
||||
return request
|
||||
|
||||
def delete_plextv_sync(self, client_id='', sync_id='', output_format=''):
|
||||
uri = '/devices/%s/sync_items/%s' % (client_id, sync_id)
|
||||
request = self.request_handler.make_request(uri=uri,
|
||||
proto=self.protocol,
|
||||
request_type='DELETE',
|
||||
output_format=output_format)
|
||||
|
||||
return request
|
||||
|
||||
def get_full_users_list(self):
|
||||
friends_list = self.get_plextv_friends()
|
||||
own_account = self.get_plextv_user_details()
|
||||
|
@ -425,7 +443,8 @@ class PlexTV(object):
|
|||
logger.warn(u"PlexPy PlexTV :: Unable to parse XML for get_synced_items.")
|
||||
else:
|
||||
for a in xml_head:
|
||||
client_id = helpers.get_xml_attr(a, 'id')
|
||||
sync_id = helpers.get_xml_attr(a, 'id')
|
||||
client_id = helpers.get_xml_attr(a, 'clientIdentifier')
|
||||
sync_device = a.getElementsByTagName('Device')
|
||||
for device in sync_device:
|
||||
device_user_id = helpers.get_xml_attr(device, 'userID')
|
||||
|
@ -505,6 +524,7 @@ class PlexTV(object):
|
|||
"video_quality": settings_video_quality,
|
||||
"total_size": status_total_size,
|
||||
"failure": status_failure,
|
||||
"client_id": client_id,
|
||||
"sync_id": sync_id
|
||||
}
|
||||
|
||||
|
@ -512,6 +532,10 @@ class PlexTV(object):
|
|||
|
||||
return session.filter_session_info(synced_items, filter_key='user_id')
|
||||
|
||||
def delete_sync(self, client_id, sync_id):
|
||||
logger.info(u"PlexPy PlexTV :: Deleting sync item '%s'." % sync_id)
|
||||
self.delete_plextv_sync(client_id=client_id, sync_id=sync_id)
|
||||
|
||||
def get_server_urls(self, include_https=True):
|
||||
|
||||
if plexpy.CONFIG.PMS_IDENTIFIER:
|
||||
|
|
|
@ -2271,6 +2271,17 @@ class WebInterface(object):
|
|||
|
||||
return output
|
||||
|
||||
@cherrypy.expose
|
||||
@cherrypy.tools.json_out()
|
||||
@requireAuth(member_of("admin"))
|
||||
def delete_sync_rows(self, client_id, sync_id, **kwargs):
|
||||
if client_id and sync_id:
|
||||
plex_tv = plextv.PlexTV()
|
||||
delete_row = plex_tv.delete_sync(client_id=client_id, sync_id=sync_id)
|
||||
return {'message': 'Sync deleted'}
|
||||
else:
|
||||
return {'message': 'no data received'}
|
||||
|
||||
|
||||
##### Logs #####
|
||||
@cherrypy.expose
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue