Combine recently added manually due to change in Plex recently added API

This commit is contained in:
JonnyWong16 2019-03-02 18:42:43 -08:00
parent 2a707fc512
commit 5dd7806c0e

View file

@ -446,7 +446,10 @@ class PmsConnect(object):
Output: array
"""
if media_type in ('movie', 'show', 'artist', 'other_video'):
media_types = ('movie', 'show', 'artist', 'other_video')
recents_list = []
if media_type in media_types:
other_video = False
if media_type == 'movie':
media_type = '1'
@ -461,7 +464,12 @@ class PmsConnect(object):
elif section_id:
recent = self.get_library_recently_added(section_id, start, count, output_format='xml')
else:
recent = self.get_recently_added(start, count, output_format='xml')
for media_type in media_types:
recents = self.get_recently_added_details(start, count, media_type)
recents_list += recents['recently_added']
output = {'recently_added': sorted(recents_list, key=lambda k: k['added_at'], reverse=True)[:int(count)]}
return output
try:
xml_head = recent.getElementsByTagName('MediaContainer')
@ -469,8 +477,6 @@ class PmsConnect(object):
logger.warn(u"Tautulli Pmsconnect :: Unable to parse XML for get_recently_added: %s." % e)
return []
recents_list = []
for a in xml_head:
if a.getAttribute('size'):
if a.getAttribute('size') == '0':