mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-11 07:46:07 -07:00
Add paging for recently added to the API
This commit is contained in:
parent
8033b47596
commit
bdb43c0e9e
3 changed files with 21 additions and 19 deletions
21
API.md
21
API.md
|
@ -1061,6 +1061,7 @@ Required parameters:
|
||||||
count (str): Number of items to return
|
count (str): Number of items to return
|
||||||
|
|
||||||
Optional parameters:
|
Optional parameters:
|
||||||
|
start (str): The item number to start at
|
||||||
section_id (str): The id of the Plex library section
|
section_id (str): The id of the Plex library section
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
|
@ -1357,7 +1358,7 @@ Returns:
|
||||||
|
|
||||||
|
|
||||||
### get_user_logins
|
### get_user_logins
|
||||||
Get the data on PlexPy user login table.
|
Get the data on PlexPy user login table.
|
||||||
|
|
||||||
```
|
```
|
||||||
Required parameters:
|
Required parameters:
|
||||||
|
@ -1376,15 +1377,15 @@ Returns:
|
||||||
"recordsTotal": 2344,
|
"recordsTotal": 2344,
|
||||||
"recordsFiltered": 10,
|
"recordsFiltered": 10,
|
||||||
"data":
|
"data":
|
||||||
[{"browser": "Safari 7.0.3",
|
[{"browser": "Safari 7.0.3",
|
||||||
"friendly_name": "Jon Snow",
|
"friendly_name": "Jon Snow",
|
||||||
"host": "http://plexpy.castleblack.com",
|
"host": "http://plexpy.castleblack.com",
|
||||||
"ip_address": "xxx.xxx.xxx.xxx",
|
"ip_address": "xxx.xxx.xxx.xxx",
|
||||||
"os": "Mac OS X",
|
"os": "Mac OS X",
|
||||||
"timestamp": 1462591869,
|
"timestamp": 1462591869,
|
||||||
"user": "LordCommanderSnow",
|
"user": "LordCommanderSnow",
|
||||||
"user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_3) AppleWebKit/537.75.14 (KHTML, like Gecko) Version/7.0.3 Safari/7046A194A",
|
"user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_3) AppleWebKit/537.75.14 (KHTML, like Gecko) Version/7.0.3 Safari/7046A194A",
|
||||||
"user_group": "guest",
|
"user_group": "guest",
|
||||||
"user_id": 133788
|
"user_id": 133788
|
||||||
},
|
},
|
||||||
{...},
|
{...},
|
||||||
|
|
|
@ -179,7 +179,7 @@ class PmsConnect(object):
|
||||||
|
|
||||||
return request
|
return request
|
||||||
|
|
||||||
def get_recently_added(self, count='0', output_format=''):
|
def get_recently_added(self, start='0', count='0', output_format=''):
|
||||||
"""
|
"""
|
||||||
Return list of recently added items.
|
Return list of recently added items.
|
||||||
|
|
||||||
|
@ -188,7 +188,7 @@ class PmsConnect(object):
|
||||||
|
|
||||||
Output: array
|
Output: array
|
||||||
"""
|
"""
|
||||||
uri = '/library/recentlyAdded?X-Plex-Container-Start=0&X-Plex-Container-Size=' + count
|
uri = '/library/recentlyAdded?X-Plex-Container-Start=%s&X-Plex-Container-Size=%s' % (start, count)
|
||||||
request = self.request_handler.make_request(uri=uri,
|
request = self.request_handler.make_request(uri=uri,
|
||||||
proto=self.protocol,
|
proto=self.protocol,
|
||||||
request_type='GET',
|
request_type='GET',
|
||||||
|
@ -196,7 +196,7 @@ class PmsConnect(object):
|
||||||
|
|
||||||
return request
|
return request
|
||||||
|
|
||||||
def get_library_recently_added(self, section_id='', count='0', output_format=''):
|
def get_library_recently_added(self, section_id='', start='0', count='0', output_format=''):
|
||||||
"""
|
"""
|
||||||
Return list of recently added items.
|
Return list of recently added items.
|
||||||
|
|
||||||
|
@ -205,7 +205,7 @@ class PmsConnect(object):
|
||||||
|
|
||||||
Output: array
|
Output: array
|
||||||
"""
|
"""
|
||||||
uri = '/library/sections/' + section_id + '/recentlyAdded?X-Plex-Container-Start=0&X-Plex-Container-Size=' + count
|
uri = '/library/sections/%s/recentlyAdded?X-Plex-Container-Start=%s&X-Plex-Container-Size=%s' % (section_id, start, count)
|
||||||
request = self.request_handler.make_request(uri=uri,
|
request = self.request_handler.make_request(uri=uri,
|
||||||
proto=self.protocol,
|
proto=self.protocol,
|
||||||
request_type='GET',
|
request_type='GET',
|
||||||
|
@ -458,7 +458,7 @@ class PmsConnect(object):
|
||||||
|
|
||||||
return request
|
return request
|
||||||
|
|
||||||
def get_recently_added_details(self, section_id='', count='0'):
|
def get_recently_added_details(self, section_id='', start='0', count='0'):
|
||||||
"""
|
"""
|
||||||
Return processed and validated list of recently added items.
|
Return processed and validated list of recently added items.
|
||||||
|
|
||||||
|
@ -467,9 +467,9 @@ class PmsConnect(object):
|
||||||
Output: array
|
Output: array
|
||||||
"""
|
"""
|
||||||
if section_id:
|
if section_id:
|
||||||
recent = self.get_library_recently_added(section_id, count, output_format='xml')
|
recent = self.get_library_recently_added(section_id, start, count, output_format='xml')
|
||||||
else:
|
else:
|
||||||
recent = self.get_recently_added(count, output_format='xml')
|
recent = self.get_recently_added(start, count, output_format='xml')
|
||||||
|
|
||||||
try:
|
try:
|
||||||
xml_head = recent.getElementsByTagName('MediaContainer')
|
xml_head = recent.getElementsByTagName('MediaContainer')
|
||||||
|
|
|
@ -3329,7 +3329,7 @@ class WebInterface(object):
|
||||||
@cherrypy.tools.json_out()
|
@cherrypy.tools.json_out()
|
||||||
@requireAuth(member_of("admin"))
|
@requireAuth(member_of("admin"))
|
||||||
@addtoapi("get_recently_added")
|
@addtoapi("get_recently_added")
|
||||||
def get_recently_added_details(self, count='0', section_id='', **kwargs):
|
def get_recently_added_details(self, start='0', count='0', section_id='', **kwargs):
|
||||||
""" Get all items that where recelty added to plex.
|
""" Get all items that where recelty added to plex.
|
||||||
|
|
||||||
```
|
```
|
||||||
|
@ -3337,6 +3337,7 @@ class WebInterface(object):
|
||||||
count (str): Number of items to return
|
count (str): Number of items to return
|
||||||
|
|
||||||
Optional parameters:
|
Optional parameters:
|
||||||
|
start (str): The item number to start at
|
||||||
section_id (str): The id of the Plex library section
|
section_id (str): The id of the Plex library section
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
|
@ -3366,7 +3367,7 @@ class WebInterface(object):
|
||||||
```
|
```
|
||||||
"""
|
"""
|
||||||
pms_connect = pmsconnect.PmsConnect()
|
pms_connect = pmsconnect.PmsConnect()
|
||||||
result = pms_connect.get_recently_added_details(count=count, section_id=section_id)
|
result = pms_connect.get_recently_added_details(start=start, count=count, section_id=section_id)
|
||||||
|
|
||||||
if result:
|
if result:
|
||||||
return result
|
return result
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue