diff --git a/web/action.py b/web/action.py index 946b2cfe..e17485b6 100644 --- a/web/action.py +++ b/web/action.py @@ -240,6 +240,7 @@ def __init__(self): "get_category_config": self.get_category_config, "get_system_processes": self.get_system_processes, "run_plugin_method": self.run_plugin_method, + "get_library_resume": self.__get_resume, } # 远程命令响应 self._commands = { @@ -2610,6 +2611,15 @@ def __restory_backup(data): return {"code": 1, "msg": "文件不存在"} + @staticmethod + def __get_resume(data): + """ + 获得继续观看 + """ + num = data.get("num") or 12 + # 实测,plex 似乎无法按照数目返回,此处手动切片 + return { "code": 0, "list": MediaServer().get_resume(num)[0:num] } + @staticmethod def __start_mediasync(data): """ diff --git a/web/apiv1.py b/web/apiv1.py index 758f4689..3941d04d 100644 --- a/web/apiv1.py +++ b/web/apiv1.py @@ -912,6 +912,17 @@ def post(): """ return WebAction().api_action(cmd='get_library_playhistory') +@library.route('/mediaserver/resume') +class LibraryResume(ClientResource): + parser = reqparse.RequestParser() + parser.add_argument('num', type=int, help='返回记录数', location='form', required=True) + + @library.doc(parser=parser) + def post(self): + """ + 查询媒体库继续观看列表 + """ + return WebAction().api_action(cmd='get_library_resume', data=self.parser.parse_args()) @library.route('/mediaserver/statistics') class LibraryStatistics(ClientResource):