mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-15 01:32:57 -07:00
Update get_metadata_childern to include all artist album types
* Fixes #1559
This commit is contained in:
parent
cd85269fe5
commit
93cb067454
2 changed files with 31 additions and 8 deletions
|
@ -544,6 +544,8 @@ class Libraries(object):
|
||||||
|
|
||||||
if rating_key:
|
if rating_key:
|
||||||
library_children = pms_connect.get_library_children_details(rating_key=rating_key,
|
library_children = pms_connect.get_library_children_details(rating_key=rating_key,
|
||||||
|
section_id=section_id,
|
||||||
|
section_type=section_type,
|
||||||
get_media_info=True)
|
get_media_info=True)
|
||||||
elif section_id:
|
elif section_id:
|
||||||
library_children = pms_connect.get_library_children_details(section_id=section_id,
|
library_children = pms_connect.get_library_children_details(section_id=section_id,
|
||||||
|
|
|
@ -144,7 +144,7 @@ class PmsConnect(object):
|
||||||
|
|
||||||
return request
|
return request
|
||||||
|
|
||||||
def get_metadata_children(self, rating_key='', collection=False, output_format=''):
|
def get_metadata_children(self, rating_key='', section_id='', artist=False, collection=False, output_format=''):
|
||||||
"""
|
"""
|
||||||
Return metadata for children of the request item.
|
Return metadata for children of the request item.
|
||||||
|
|
||||||
|
@ -153,6 +153,11 @@ class PmsConnect(object):
|
||||||
|
|
||||||
Output: array
|
Output: array
|
||||||
"""
|
"""
|
||||||
|
if artist:
|
||||||
|
uri = '/library/sections/{}/all?artist.id={}&type=9'.format(
|
||||||
|
section_id, rating_key
|
||||||
|
)
|
||||||
|
else:
|
||||||
uri = '/library/{}/{}/children'.format(
|
uri = '/library/{}/{}/children'.format(
|
||||||
'collections' if collection else 'metadata', rating_key
|
'collections' if collection else 'metadata', rating_key
|
||||||
)
|
)
|
||||||
|
@ -2307,6 +2312,10 @@ class PmsConnect(object):
|
||||||
children_data = self.get_metadata_children(rating_key, collection=True, output_format='xml')
|
children_data = self.get_metadata_children(rating_key, collection=True, output_format='xml')
|
||||||
elif get_grandchildren:
|
elif get_grandchildren:
|
||||||
children_data = self.get_metadata_grandchildren(rating_key, output_format='xml')
|
children_data = self.get_metadata_grandchildren(rating_key, output_format='xml')
|
||||||
|
elif media_type == 'artist':
|
||||||
|
artist_metadata = self.get_metadata_details(rating_key)
|
||||||
|
section_id = artist_metadata['section_id']
|
||||||
|
children_data = self.get_metadata_children(rating_key, section_id, artist=True, output_format='xml')
|
||||||
else:
|
else:
|
||||||
children_data = self.get_metadata_children(rating_key, output_format='xml')
|
children_data = self.get_metadata_children(rating_key, output_format='xml')
|
||||||
|
|
||||||
|
@ -2636,10 +2645,11 @@ class PmsConnect(object):
|
||||||
else:
|
else:
|
||||||
sort_type = ''
|
sort_type = ''
|
||||||
|
|
||||||
if str(section_id).isdigit():
|
if str(rating_key).isdigit():
|
||||||
|
_artist = section_type == 'album'
|
||||||
|
library_data = self.get_metadata_children(str(rating_key), str(section_id), artist=_artist, output_format='xml')
|
||||||
|
elif str(section_id).isdigit():
|
||||||
library_data = self.get_library_list(str(section_id), list_type, count, sort_type, label_key, output_format='xml')
|
library_data = self.get_library_list(str(section_id), list_type, count, sort_type, label_key, output_format='xml')
|
||||||
elif str(rating_key).isdigit():
|
|
||||||
library_data = self.get_metadata_children(str(rating_key), output_format='xml')
|
|
||||||
else:
|
else:
|
||||||
logger.warn("Tautulli Pmsconnect :: get_library_children called by invalid section_id or rating_key provided.")
|
logger.warn("Tautulli Pmsconnect :: get_library_children called by invalid section_id or rating_key provided.")
|
||||||
return []
|
return []
|
||||||
|
@ -2988,8 +2998,19 @@ class PmsConnect(object):
|
||||||
logger.warn("Tautulli Pmsconnect :: Unable to get grandparent_rating_key for get_rating_keys_list: %s." % e)
|
logger.warn("Tautulli Pmsconnect :: Unable to get grandparent_rating_key for get_rating_keys_list: %s." % e)
|
||||||
return {}
|
return {}
|
||||||
|
|
||||||
|
elif media_type == 'artist':
|
||||||
|
try:
|
||||||
|
metadata = self.get_metadata_details(rating_key=rating_key)
|
||||||
|
section_id = metadata['section_id']
|
||||||
|
library_name = metadata['library_name']
|
||||||
|
except Exception as e:
|
||||||
|
logger.warn("Tautulli Pmsconnect :: Unable to get grandparent_rating_key for get_rating_keys_list: %s." % e)
|
||||||
|
return {}
|
||||||
|
|
||||||
|
|
||||||
# get parent_rating_keys
|
# get parent_rating_keys
|
||||||
metadata = self.get_metadata_children(str(rating_key), output_format='xml')
|
_artist = media_type in ('artist', 'album', 'track')
|
||||||
|
metadata = self.get_metadata_children(str(rating_key), str(section_id), artist=_artist, output_format='xml')
|
||||||
|
|
||||||
try:
|
try:
|
||||||
xml_head = metadata.getElementsByTagName('MediaContainer')
|
xml_head = metadata.getElementsByTagName('MediaContainer')
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue