Return a sync_media_type for synced collections/playlists

This commit is contained in:
JonnyWong16 2021-02-20 13:42:39 -08:00
parent ea199178b2
commit 947892c93f
No known key found for this signature in database
GPG key ID: B1F1F9807184697A
2 changed files with 7 additions and 1 deletions

View file

@ -558,16 +558,20 @@ class PlexTV(object):
sync_item = synced.getElementsByTagName('SyncItem') sync_item = synced.getElementsByTagName('SyncItem')
for item in sync_item: for item in sync_item:
sync_media_type = None
rating_key = None rating_key = None
for location in item.getElementsByTagName('Location'): for location in item.getElementsByTagName('Location'):
location_uri = unquote(helpers.get_xml_attr(location, 'uri')) location_uri = unquote(helpers.get_xml_attr(location, 'uri'))
if location_uri.startswith('library://'): if location_uri.startswith('library://'):
if 'collection' in location_uri:
sync_media_type = 'collection'
clean_uri = location_uri.split('/') clean_uri = location_uri.split('/')
rating_key = next((j for i, j in zip(clean_uri[:-1], clean_uri[1:]) rating_key = next((j for i, j in zip(clean_uri[:-1], clean_uri[1:])
if i in ('metadata', 'collections')), None) if i in ('metadata', 'collections')), None)
elif location_uri.startswith('playlist://'): elif location_uri.startswith('playlist://'):
sync_media_type = 'playlist'
tokens = users.Users().get_tokens(user_id=device_user_id) tokens = users.Users().get_tokens(user_id=device_user_id)
if tokens['server_token']: if tokens['server_token']:
plex = Plex(token=tokens['server_token']) plex = Plex(token=tokens['server_token'])
@ -635,7 +639,8 @@ class PlexTV(object):
"total_size": status_total_size, "total_size": status_total_size,
"failure": status_failure, "failure": status_failure,
"client_id": client_id, "client_id": client_id,
"sync_id": sync_id "sync_id": sync_id,
"sync_media_type": sync_media_type
} }
synced_items.append(sync_details) synced_items.append(sync_details)

View file

@ -5977,6 +5977,7 @@ class WebInterface(object):
"root_title": "Movies", "root_title": "Movies",
"state": "complete", "state": "complete",
"sync_id": "11617019", "sync_id": "11617019",
"sync_media_type": null,
"sync_title": "Deadpool", "sync_title": "Deadpool",
"total_size": "560718134", "total_size": "560718134",
"user": "DrukenDwarfMan", "user": "DrukenDwarfMan",