Add grandparent_guids and parent_guids to get_metadata_details

This commit is contained in:
JonnyWong16 2022-05-31 10:57:01 -07:00
parent 695a00350b
commit ca3c2b09cf
No known key found for this signature in database
GPG key ID: B1F1F9807184697A
2 changed files with 61 additions and 20 deletions

View file

@ -787,6 +787,8 @@ class PmsConnect(object):
'labels': labels, 'labels': labels,
'collections': collections, 'collections': collections,
'guids': guids, 'guids': guids,
'parent_guids': [],
'grandparent_guids': [],
'full_title': helpers.get_xml_attr(metadata_main, 'title'), 'full_title': helpers.get_xml_attr(metadata_main, 'title'),
'children_count': helpers.cast_to_int(helpers.get_xml_attr(metadata_main, 'leafCount')), 'children_count': helpers.cast_to_int(helpers.get_xml_attr(metadata_main, 'leafCount')),
'live': int(helpers.get_xml_attr(metadata_main, 'live') == '1') 'live': int(helpers.get_xml_attr(metadata_main, 'live') == '1')
@ -841,6 +843,8 @@ class PmsConnect(object):
'labels': labels, 'labels': labels,
'collections': collections, 'collections': collections,
'guids': guids, 'guids': guids,
'parent_guids': [],
'grandparent_guids': [],
'full_title': helpers.get_xml_attr(metadata_main, 'title'), 'full_title': helpers.get_xml_attr(metadata_main, 'title'),
'children_count': helpers.cast_to_int(helpers.get_xml_attr(metadata_main, 'leafCount')), 'children_count': helpers.cast_to_int(helpers.get_xml_attr(metadata_main, 'leafCount')),
'live': int(helpers.get_xml_attr(metadata_main, 'live') == '1') 'live': int(helpers.get_xml_attr(metadata_main, 'live') == '1')
@ -897,7 +901,9 @@ class PmsConnect(object):
'genres': show_details.get('genres', []), 'genres': show_details.get('genres', []),
'labels': show_details.get('labels', []), 'labels': show_details.get('labels', []),
'collections': show_details.get('collections', []), 'collections': show_details.get('collections', []),
'guids': show_details.get('guids', []), 'guids': guids,
'parent_guids': show_details.get('guids', []),
'grandparent_guids': [],
'full_title': '{} - {}'.format(helpers.get_xml_attr(metadata_main, 'parentTitle'), 'full_title': '{} - {}'.format(helpers.get_xml_attr(metadata_main, 'parentTitle'),
helpers.get_xml_attr(metadata_main, 'title')), helpers.get_xml_attr(metadata_main, 'title')),
'children_count': helpers.cast_to_int(helpers.get_xml_attr(metadata_main, 'leafCount')), 'children_count': helpers.cast_to_int(helpers.get_xml_attr(metadata_main, 'leafCount')),
@ -916,6 +922,7 @@ class PmsConnect(object):
parent_rating_key = helpers.get_xml_attr(metadata_main, 'parentRatingKey') parent_rating_key = helpers.get_xml_attr(metadata_main, 'parentRatingKey')
parent_media_index = helpers.get_xml_attr(metadata_main, 'parentIndex') parent_media_index = helpers.get_xml_attr(metadata_main, 'parentIndex')
parent_thumb = helpers.get_xml_attr(metadata_main, 'parentThumb') parent_thumb = helpers.get_xml_attr(metadata_main, 'parentThumb')
season_details = self.get_metadata_details(parent_rating_key) if parent_rating_key else {}
if not plex_guid and not parent_rating_key: if not plex_guid and not parent_rating_key:
# Try getting the parent_rating_key from the parent_thumb # Try getting the parent_rating_key from the parent_thumb
@ -970,7 +977,9 @@ class PmsConnect(object):
'genres': show_details.get('genres', []), 'genres': show_details.get('genres', []),
'labels': show_details.get('labels', []), 'labels': show_details.get('labels', []),
'collections': show_details.get('collections', []), 'collections': show_details.get('collections', []),
'guids': show_details.get('guids', []), 'guids': guids,
'parent_guids': season_details.get('guids', []),
'grandparent_guids': show_details.get('guids', []),
'full_title': '{} - {}'.format(helpers.get_xml_attr(metadata_main, 'grandparentTitle'), 'full_title': '{} - {}'.format(helpers.get_xml_attr(metadata_main, 'grandparentTitle'),
helpers.get_xml_attr(metadata_main, 'title')), helpers.get_xml_attr(metadata_main, 'title')),
'children_count': helpers.cast_to_int(helpers.get_xml_attr(metadata_main, 'leafCount')), 'children_count': helpers.cast_to_int(helpers.get_xml_attr(metadata_main, 'leafCount')),
@ -1021,6 +1030,8 @@ class PmsConnect(object):
'labels': labels, 'labels': labels,
'collections': collections, 'collections': collections,
'guids': guids, 'guids': guids,
'parent_guids': [],
'grandparent_guids': [],
'full_title': helpers.get_xml_attr(metadata_main, 'title'), 'full_title': helpers.get_xml_attr(metadata_main, 'title'),
'children_count': helpers.cast_to_int(helpers.get_xml_attr(metadata_main, 'leafCount')), 'children_count': helpers.cast_to_int(helpers.get_xml_attr(metadata_main, 'leafCount')),
'live': int(helpers.get_xml_attr(metadata_main, 'live') == '1') 'live': int(helpers.get_xml_attr(metadata_main, 'live') == '1')
@ -1072,6 +1083,8 @@ class PmsConnect(object):
'labels': labels, 'labels': labels,
'collections': collections, 'collections': collections,
'guids': guids, 'guids': guids,
'parent_guids': artist_details.get('guids', []),
'grandparent_guids': [],
'full_title': '{} - {}'.format(helpers.get_xml_attr(metadata_main, 'parentTitle'), 'full_title': '{} - {}'.format(helpers.get_xml_attr(metadata_main, 'parentTitle'),
helpers.get_xml_attr(metadata_main, 'title')), helpers.get_xml_attr(metadata_main, 'title')),
'children_count': helpers.cast_to_int(helpers.get_xml_attr(metadata_main, 'leafCount')), 'children_count': helpers.cast_to_int(helpers.get_xml_attr(metadata_main, 'leafCount')),
@ -1125,7 +1138,9 @@ class PmsConnect(object):
'genres': album_details.get('genres', []), 'genres': album_details.get('genres', []),
'labels': album_details.get('labels', []), 'labels': album_details.get('labels', []),
'collections': album_details.get('collections', []), 'collections': album_details.get('collections', []),
'guids': album_details.get('guids', []), 'guids': guids,
'parent_guids': album_details.get('guids', []),
'grandparent_guids': album_details.get('parent_guids', []),
'full_title': '{} - {}'.format(helpers.get_xml_attr(metadata_main, 'title'), 'full_title': '{} - {}'.format(helpers.get_xml_attr(metadata_main, 'title'),
track_artist), track_artist),
'children_count': helpers.cast_to_int(helpers.get_xml_attr(metadata_main, 'leafCount')), 'children_count': helpers.cast_to_int(helpers.get_xml_attr(metadata_main, 'leafCount')),
@ -1176,6 +1191,8 @@ class PmsConnect(object):
'labels': labels, 'labels': labels,
'collections': collections, 'collections': collections,
'guids': guids, 'guids': guids,
'parent_guids': [],
'grandparent_guids': [],
'full_title': helpers.get_xml_attr(metadata_main, 'title'), 'full_title': helpers.get_xml_attr(metadata_main, 'title'),
'children_count': helpers.cast_to_int(helpers.get_xml_attr(metadata_main, 'leafCount')), 'children_count': helpers.cast_to_int(helpers.get_xml_attr(metadata_main, 'leafCount')),
'live': int(helpers.get_xml_attr(metadata_main, 'live') == '1') 'live': int(helpers.get_xml_attr(metadata_main, 'live') == '1')
@ -1226,7 +1243,9 @@ class PmsConnect(object):
'genres': photo_album_details.get('genres', []), 'genres': photo_album_details.get('genres', []),
'labels': photo_album_details.get('labels', []), 'labels': photo_album_details.get('labels', []),
'collections': photo_album_details.get('collections', []), 'collections': photo_album_details.get('collections', []),
'guids': photo_album_details.get('guids', []), 'guids': [],
'parent_guids': photo_album_details.get('guids', []),
'grandparent_guids': [],
'full_title': '{} - {}'.format(helpers.get_xml_attr(metadata_main, 'parentTitle') or library_name, 'full_title': '{} - {}'.format(helpers.get_xml_attr(metadata_main, 'parentTitle') or library_name,
helpers.get_xml_attr(metadata_main, 'title')), helpers.get_xml_attr(metadata_main, 'title')),
'children_count': helpers.cast_to_int(helpers.get_xml_attr(metadata_main, 'leafCount')), 'children_count': helpers.cast_to_int(helpers.get_xml_attr(metadata_main, 'leafCount')),
@ -1281,6 +1300,8 @@ class PmsConnect(object):
'labels': labels, 'labels': labels,
'collections': collections, 'collections': collections,
'guids': guids, 'guids': guids,
'parent_guids': [],
'grandparent_guids': [],
'full_title': helpers.get_xml_attr(metadata_main, 'title'), 'full_title': helpers.get_xml_attr(metadata_main, 'title'),
'children_count': helpers.cast_to_int(helpers.get_xml_attr(metadata_main, 'childCount')), 'children_count': helpers.cast_to_int(helpers.get_xml_attr(metadata_main, 'childCount')),
'live': int(helpers.get_xml_attr(metadata_main, 'live') == '1'), 'live': int(helpers.get_xml_attr(metadata_main, 'live') == '1'),
@ -1351,6 +1372,8 @@ class PmsConnect(object):
'labels': labels, 'labels': labels,
'collections': collections, 'collections': collections,
'guids': guids, 'guids': guids,
'parent_guids': [],
'grandparent_guids': [],
'full_title': helpers.get_xml_attr(metadata_main, 'title'), 'full_title': helpers.get_xml_attr(metadata_main, 'title'),
'extra_type': helpers.get_xml_attr(metadata_main, 'extraType'), 'extra_type': helpers.get_xml_attr(metadata_main, 'extraType'),
'sub_type': helpers.get_xml_attr(metadata_main, 'subtype'), 'sub_type': helpers.get_xml_attr(metadata_main, 'subtype'),

View file

@ -5283,16 +5283,21 @@ class WebInterface(object):
Returns: Returns:
json: json:
{"actors": [ {"actors": [
"Kit Harington",
"Emilia Clarke", "Emilia Clarke",
"Isaac Hempstead-Wright", "Lena Headey",
"Sophie Turner",
"Kit Harington",
"Peter Dinklage",
"Nikolaj Coster-Waldau",
"Maisie Williams", "Maisie Williams",
"Liam Cunningham", "Iain Glen",
"John Bradley",
"Alfie Allen"
], ],
"added_at": "1461572396", "added_at": "1461572396",
"art": "/library/metadata/1219/art/1462175063", "art": "/library/metadata/1219/art/1462175063",
"audience_rating": "8", "audience_rating": "7.4",
"audience_rating_image": "rottentomatoes://image.rating.upright", "audience_rating_image": "themoviedb://image.rating",
"banner": "/library/metadata/1219/banner/1462175063", "banner": "/library/metadata/1219/banner/1462175063",
"collections": [], "collections": [],
"content_rating": "TV-MA", "content_rating": "TV-MA",
@ -5302,16 +5307,26 @@ class WebInterface(object):
"duration": "2998290", "duration": "2998290",
"full_title": "Game of Thrones - The Red Woman", "full_title": "Game of Thrones - The Red Woman",
"genres": [ "genres": [
"Adventure", "Action/Adventure",
"Drama", "Drama",
"Fantasy" "Fantasy",
"Romance"
],
"grandparent_guid": "plex://show/5d9c086c46115600200aa2fe",
"grandparent_guids": [
"imdb://tt0944947",
"tmdb://1399",
"tvdb://121361"
], ],
"grandparent_guid": "com.plexapp.agents.thetvdb://121361?lang=en",
"grandparent_rating_key": "1219", "grandparent_rating_key": "1219",
"grandparent_thumb": "/library/metadata/1219/thumb/1462175063", "grandparent_thumb": "/library/metadata/1219/thumb/1462175063",
"grandparent_title": "Game of Thrones", "grandparent_title": "Game of Thrones",
"guid": "com.plexapp.agents.thetvdb://121361/6/1?lang=en", "guid": "plex://episode/5d9c1276e9d5a1001f4ff2fa",
"guids": [], "guids": [
"imdb://tt3658014",
"tmdb://1156503",
"tvdb://5469015"
],
"labels": [], "labels": [],
"last_viewed_at": "1462165717", "last_viewed_at": "1462165717",
"library_name": "TV Shows", "library_name": "TV Shows",
@ -5401,18 +5416,21 @@ class WebInterface(object):
"media_type": "episode", "media_type": "episode",
"original_title": "", "original_title": "",
"originally_available_at": "2016-04-24", "originally_available_at": "2016-04-24",
"parent_guid": "com.plexapp.agents.thetvdb://121361/6?lang=en", "parent_guid": "plex://season/602e67e61d3358002c4120f7",
"parent_guids": [
"tvdb://651357"
],
"parent_media_index": "6", "parent_media_index": "6",
"parent_rating_key": "153036", "parent_rating_key": "153036",
"parent_thumb": "/library/metadata/153036/thumb/1462175062", "parent_thumb": "/library/metadata/153036/thumb/1462175062",
"parent_title": "", "parent_title": "Season 6",
"rating": "7.8", "rating": "",
"rating_image": "rottentomatoes://image.rating.ripe", "rating_image": "",
"rating_key": "153037", "rating_key": "153037",
"section_id": "2", "section_id": "2",
"sort_title": "Red Woman", "sort_title": "Red Woman",
"studio": "HBO", "studio": "Revolution Sun Studios",
"summary": "Jon Snow is dead. Daenerys meets a strong man. Cersei sees her daughter again.", "summary": "The fate of Jon Snow is revealed. Daenerys meets a strong man. Cersei sees her daughter once again.",
"tagline": "", "tagline": "",
"thumb": "/library/metadata/153037/thumb/1462175060", "thumb": "/library/metadata/153037/thumb/1462175060",
"title": "The Red Woman", "title": "The Red Woman",