diff --git a/data/interfaces/default/index.html b/data/interfaces/default/index.html index 74ab3705..5c930fb8 100644 --- a/data/interfaces/default/index.html +++ b/data/interfaces/default/index.html @@ -91,18 +91,21 @@
-
- + items
@@ -542,75 +545,24 @@ % endif % if 'recently_added' in config['home_sections']: + + + + % if _session['user_group'] == 'admin': + + % endif + + +
+

+ ${item['title']} +

+

+ ${item['child_count']} Seasons +

+

 

% elif item['media_type'] == 'season':
-
+
+
+
+
+ % if _session['user_group'] == 'admin': + + % endif +
+
+
+

+ ${item['grandparent_title']} +

+

+ ${item['title']} +

+

+ S${item['parent_media_index']} + · + E${item['media_index']} +

% elif item['media_type'] == 'album': @@ -109,6 +167,7 @@ DOCUMENTATION :: END

${item['title']}

+

 

% endif diff --git a/data/interfaces/default/user_recently_watched.html b/data/interfaces/default/user_recently_watched.html index 6878e1da..755d1ad9 100644 --- a/data/interfaces/default/user_recently_watched.html +++ b/data/interfaces/default/user_recently_watched.html @@ -59,7 +59,7 @@ DOCUMENTATION :: END

${item['grandparent_title']}

-

+

${item['title']}

@@ -71,6 +71,7 @@ DOCUMENTATION :: END ${item['title']}

${item['year']}

+

 

% endif % else: @@ -110,7 +111,7 @@ DOCUMENTATION :: END

${item['grandparent_title']}

-

+

${item['title']}

diff --git a/plexpy/pmsconnect.py b/plexpy/pmsconnect.py index 736785ef..669a0e69 100644 --- a/plexpy/pmsconnect.py +++ b/plexpy/pmsconnect.py @@ -484,7 +484,26 @@ class PmsConnect(object): return request - def get_recently_added_details(self, section_id='', start='0', count='0'): + def get_hub_recently_added(self, start='0', count='0', type='', output_format=''): + """ + Return Plex hub recently added. + + Parameters required: start { item number to start from } + count { number of results to return } + 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) + request = self.request_handler.make_request(uri=uri, + proto=self.protocol, + request_type='GET', + output_format=output_format) + + return request + + def get_recently_added_details(self, start='0', count='0', type='', section_id=''): """ Return processed and validated list of recently added items. @@ -492,7 +511,15 @@ class PmsConnect(object): Output: array """ - if section_id: + 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') + 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') @@ -529,7 +556,8 @@ class PmsConnect(object): 'thumb': helpers.get_xml_attr(item, 'thumb'), 'parent_thumb': helpers.get_xml_attr(item, 'parentThumb'), 'grandparent_thumb': helpers.get_xml_attr(item, 'grandparentThumb'), - 'added_at': helpers.get_xml_attr(item, 'addedAt') + 'added_at': helpers.get_xml_attr(item, 'addedAt'), + 'child_count': helpers.get_xml_attr(item, 'childCount') } recents_list.append(recent_items) @@ -551,7 +579,8 @@ class PmsConnect(object): 'thumb': helpers.get_xml_attr(item, 'thumb'), 'parent_thumb': helpers.get_xml_attr(item, 'parentThumb'), 'grandparent_thumb': helpers.get_xml_attr(item, 'grandparentThumb'), - 'added_at': helpers.get_xml_attr(item, 'addedAt') + 'added_at': helpers.get_xml_attr(item, 'addedAt'), + 'child_count': helpers.get_xml_attr(item, 'childCount') } recents_list.append(recent_items) diff --git a/plexpy/webserve.py b/plexpy/webserve.py index 5b52d9bc..aaa0b532 100644 --- a/plexpy/webserve.py +++ b/plexpy/webserve.py @@ -350,11 +350,11 @@ class WebInterface(object): @cherrypy.expose @requireAuth() - def get_recently_added(self, count='0', **kwargs): + def get_recently_added(self, count='0', type='', **kwargs): try: pms_connect = pmsconnect.PmsConnect() - result = pms_connect.get_recently_added_details(count=count) + result = pms_connect.get_recently_added_details(count=count, type=type) except IOError as e: return serve_template(templatename="recently_added.html", data=None) @@ -4072,7 +4072,7 @@ class WebInterface(object): @cherrypy.tools.json_out() @requireAuth(member_of("admin")) @addtoapi("get_recently_added") - def get_recently_added_details(self, start='0', count='0', section_id='', **kwargs): + def get_recently_added_details(self, start='0', count='0', type='', section_id='', **kwargs): """ Get all items that where recelty added to plex. ``` @@ -4081,6 +4081,7 @@ class WebInterface(object): Optional parameters: start (str): The item number to start at + type (str): The media type: movie, show, artist section_id (str): The id of the Plex library section Returns: @@ -4110,7 +4111,7 @@ class WebInterface(object): ``` """ pms_connect = pmsconnect.PmsConnect() - result = pms_connect.get_recently_added_details(start=start, count=count, section_id=section_id) + result = pms_connect.get_recently_added_details(start=start, count=count, type=type, section_id=section_id) if result: return result