diff --git a/API.md b/API.md index 7e9d5f10..4f8f3205 100644 --- a/API.md +++ b/API.md @@ -725,6 +725,45 @@ Returns: ``` +### get_exports_table +Get the data on the Tautulli export tables. + +``` +Required parameters: + section_id (str): The id of the Plex library section, OR + rating_key (str): The rating key of the exported item + +Optional parameters: + order_column (str): "added_at", "sort_title", "container", "bitrate", "video_codec", + "video_resolution", "video_framerate", "audio_codec", "audio_channels", + "file_size", "last_played", "play_count" + order_dir (str): "desc" or "asc" + start (int): Row to start from, 0 + length (int): Number of items to return, 25 + search (str): A string to search for, "Thrones" + +Returns: + json: + {"draw": 1, + "recordsTotal": 10, + "recordsFiltered": 3, + "data": + [{"row_id": 2, + "timestamp": 1596484600, + "section_id": 1, + "rating_key": 270716, + "media_type": "movie", + "media_type_title": "Movie", + "filename": "Movie - Frozen II [270716].20200803125640.json", + "complete": 1 + }, + {...}, + {...} + ] + } +``` + + ### get_geoip_lookup Get the geolocation info for an IP address. @@ -1026,45 +1065,6 @@ Returns: ``` -### get_library_export -Get the data on the Tautulli export tables. - -``` -Required parameters: - section_id (str): The id of the Plex library section, OR - rating_key (str): The rating key of the exported item - -Optional parameters: - order_column (str): "added_at", "sort_title", "container", "bitrate", "video_codec", - "video_resolution", "video_framerate", "audio_codec", "audio_channels", - "file_size", "last_played", "play_count" - order_dir (str): "desc" or "asc" - start (int): Row to start from, 0 - length (int): Number of items to return, 25 - search (str): A string to search for, "Thrones" - -Returns: - json: - {"draw": 1, - "recordsTotal": 10, - "recordsFiltered": 3, - "data": - [{"row_id": 2, - "timestamp": 1596484600, - "section_id": 1, - "rating_key": 270716, - "media_type": "movie", - "media_type_title": "Movie", - "filename": "Movie - Frozen II [270716].20200803125640.json", - "complete": 1 - }, - {...}, - {...} - ] - } -``` - - ### get_library_media_info Get the data on the Tautulli media info tables. diff --git a/data/interfaces/default/info.html b/data/interfaces/default/info.html index e003501c..c4d2755b 100644 --- a/data/interfaces/default/info.html +++ b/data/interfaces/default/info.html @@ -896,7 +896,7 @@ DOCUMENTATION :: END function loadExportTable() { // Build export table export_table_options.ajax = { - url: 'get_library_export', + url: 'get_export_list', type: 'POST', data: function ( d ) { return { diff --git a/data/interfaces/default/library.html b/data/interfaces/default/library.html index 7488fb22..a24d307c 100644 --- a/data/interfaces/default/library.html +++ b/data/interfaces/default/library.html @@ -517,7 +517,7 @@ DOCUMENTATION :: END function loadExportTable() { // Build export table export_table_options.ajax = { - url: 'get_library_export', + url: 'get_export_list', type: 'POST', data: function ( d ) { return { diff --git a/plexpy/webserve.py b/plexpy/webserve.py index c96a22bd..293ef1c1 100644 --- a/plexpy/webserve.py +++ b/plexpy/webserve.py @@ -872,66 +872,6 @@ class WebInterface(object): return {'success': result} - @cherrypy.expose - @cherrypy.tools.json_out() - @requireAuth(member_of("admin")) - @addtoapi() - def get_library_export(self, section_id=None, rating_key=None, **kwargs): - """ Get the data on the Tautulli export tables. - - ``` - Required parameters: - section_id (str): The id of the Plex library section, OR - rating_key (str): The rating key of the exported item - - Optional parameters: - order_column (str): "added_at", "sort_title", "container", "bitrate", "video_codec", - "video_resolution", "video_framerate", "audio_codec", "audio_channels", - "file_size", "last_played", "play_count" - order_dir (str): "desc" or "asc" - start (int): Row to start from, 0 - length (int): Number of items to return, 25 - search (str): A string to search for, "Thrones" - - Returns: - json: - {"draw": 1, - "recordsTotal": 10, - "recordsFiltered": 3, - "data": - [{"row_id": 2, - "timestamp": 1596484600, - "section_id": 1, - "rating_key": 270716, - "media_type": "movie", - "media_type_title": "Movie", - "filename": "Movie - Frozen II [270716].20200803125640.json", - "complete": 1 - }, - {...}, - {...} - ] - } - ``` - """ - # Check if datatables json_data was received. - # If not, then build the minimal amount of json data for a query - if not kwargs.get('json_data'): - # TODO: Find some one way to automatically get the columns - dt_columns = [("timestamp", True, False), - ("media_type_title", True, True), - ("rating_key", True, True), - ("file_format", True, True), - ("filename", True, True), - ("complete", True, False)] - kwargs['json_data'] = build_datatables_json(kwargs, dt_columns, "timestamp") - - result = exporter.get_export_datatable(section_id=section_id, - rating_key=rating_key, - kwargs=kwargs) - - return result - @cherrypy.expose @cherrypy.tools.json_out() @requireAuth(member_of("admin")) @@ -6480,6 +6420,66 @@ class WebInterface(object): return status + @cherrypy.expose + @cherrypy.tools.json_out() + @requireAuth(member_of("admin")) + @addtoapi("get_exports_table") + def get_export_list(self, section_id=None, rating_key=None, **kwargs): + """ Get the data on the Tautulli export tables. + + ``` + Required parameters: + section_id (str): The id of the Plex library section, OR + rating_key (str): The rating key of the exported item + + Optional parameters: + order_column (str): "added_at", "sort_title", "container", "bitrate", "video_codec", + "video_resolution", "video_framerate", "audio_codec", "audio_channels", + "file_size", "last_played", "play_count" + order_dir (str): "desc" or "asc" + start (int): Row to start from, 0 + length (int): Number of items to return, 25 + search (str): A string to search for, "Thrones" + + Returns: + json: + {"draw": 1, + "recordsTotal": 10, + "recordsFiltered": 3, + "data": + [{"row_id": 2, + "timestamp": 1596484600, + "section_id": 1, + "rating_key": 270716, + "media_type": "movie", + "media_type_title": "Movie", + "filename": "Movie - Frozen II [270716].20200803125640.json", + "complete": 1 + }, + {...}, + {...} + ] + } + ``` + """ + # Check if datatables json_data was received. + # If not, then build the minimal amount of json data for a query + if not kwargs.get('json_data'): + # TODO: Find some one way to automatically get the columns + dt_columns = [("timestamp", True, False), + ("media_type_title", True, True), + ("rating_key", True, True), + ("file_format", True, True), + ("filename", True, True), + ("complete", True, False)] + kwargs['json_data'] = build_datatables_json(kwargs, dt_columns, "timestamp") + + result = exporter.get_export_datatable(section_id=section_id, + rating_key=rating_key, + kwargs=kwargs) + + return result + @cherrypy.expose @requireAuth(member_of("admin")) def export_metadata_modal(self, section_id=None, rating_key=None, **kwargs):