mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-08-14 02:26:58 -07:00
Change type to media_type
This commit is contained in:
parent
c70cc535e5
commit
77460f7617
5 changed files with 32 additions and 22 deletions
|
@ -418,25 +418,27 @@ class PmsConnect(object):
|
|||
|
||||
return request
|
||||
|
||||
def get_hub_recently_added(self, start='0', count='0', type='', output_format=''):
|
||||
def get_hub_recently_added(self, start='0', count='0', media_type='', other_video=False, output_format=''):
|
||||
"""
|
||||
Return Plex hub recently added.
|
||||
|
||||
Parameters required: start { item number to start from }
|
||||
count { number of results to return }
|
||||
type { str }
|
||||
media_type { str }
|
||||
Optional parameters: output_format { dict, json }
|
||||
|
||||
Output: array
|
||||
"""
|
||||
uri = '/hubs/home/recentlyAdded?X-Plex-Container-Start=%s&X-Plex-Container-Size=%s&type=%s' % (start, count, type)
|
||||
personal = '&personal=1' if other_video else ''
|
||||
uri = '/hubs/home/recentlyAdded?X-Plex-Container-Start=%s&X-Plex-Container-Size=%s&type=%s%s' \
|
||||
% (start, count, media_type, personal)
|
||||
request = self.request_handler.make_request(uri=uri,
|
||||
request_type='GET',
|
||||
output_format=output_format)
|
||||
|
||||
return request
|
||||
|
||||
def get_recently_added_details(self, start='0', count='0', type='', section_id=''):
|
||||
def get_recently_added_details(self, start='0', count='0', media_type='', section_id=''):
|
||||
"""
|
||||
Return processed and validated list of recently added items.
|
||||
|
||||
|
@ -444,14 +446,18 @@ class PmsConnect(object):
|
|||
|
||||
Output: array
|
||||
"""
|
||||
if type in ('movie', 'show', 'artist'):
|
||||
if type == 'movie':
|
||||
type = '1'
|
||||
elif type == 'show':
|
||||
type = '2'
|
||||
elif type == 'artist':
|
||||
type = '8'
|
||||
recent = self.get_hub_recently_added(start, count, type, output_format='xml')
|
||||
if media_type in ('movie', 'show', 'artist', 'other_video'):
|
||||
other_video = False
|
||||
if media_type == 'movie':
|
||||
media_type = '1'
|
||||
elif media_type == 'show':
|
||||
media_type = '2'
|
||||
elif media_type == 'artist':
|
||||
media_type = '8'
|
||||
elif media_type == 'other_video':
|
||||
media_type = '1'
|
||||
other_video = True
|
||||
recent = self.get_hub_recently_added(start, count, media_type, other_video, output_format='xml')
|
||||
elif section_id:
|
||||
recent = self.get_library_recently_added(section_id, start, count, output_format='xml')
|
||||
else:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue