From a426a578246dc97978ba5a870a4b06ab6c09cf73 Mon Sep 17 00:00:00 2001 From: projectdx Date: Sun, 23 Oct 2022 23:36:05 +0900 Subject: [PATCH] anilife update 2022.10.23(01.) --- logic_anilife.py | 19 +++ templates/anime_downloader_anilife_list.html | 144 +++++++++++++++++++ 2 files changed, 163 insertions(+) create mode 100644 templates/anime_downloader_anilife_list.html diff --git a/logic_anilife.py b/logic_anilife.py index f8a3bd3..00ef460 100644 --- a/logic_anilife.py +++ b/logic_anilife.py @@ -835,6 +835,8 @@ class LogicAniLife(LogicModuleBase): thread.daemon = True thread.start() return jsonify("") + elif sub == "web_list": + return jsonify(ModelAniLifeItem.web_list(request)) except Exception as e: P.logger.error("Exception:%s", e) @@ -1330,6 +1332,23 @@ class ModelAniLifeItem(db.Model): db.session.add(self) db.session.commit() + @classmethod + def web_list(cls, req): + ret = {} + page = int(req.form["page"]) if "page" in req.form else 1 + page_size = 30 + job_id = "" + search = req.form["search_word"] if "search_word" in req.form else "" + option = req.form["option"] if "option" in req.form else "all" + order = req.form["order"] if "order" in req.form else "desc" + query = cls.make_query(search=search, order=order, option=option) + count = query.count() + query = query.limit(page_size).offset((page - 1) * page_size) + lists = query.all() + ret["list"] = [item.as_dict() for item in lists] + ret["paging"] = Util.get_paging_info(count, page, page_size) + return ret + @classmethod def make_query(cls, search="", order="desc", option="all"): query = db.session.query(cls) diff --git a/templates/anime_downloader_anilife_list.html b/templates/anime_downloader_anilife_list.html new file mode 100644 index 0000000..797a6c1 --- /dev/null +++ b/templates/anime_downloader_anilife_list.html @@ -0,0 +1,144 @@ +{% extends "base.html" %} +{% block content %} + +
+ +
+ {{ macros.m_hr_head_top() }} + {{ macros.m_row_start('0') }} + {{ macros.m_col(2, macros.m_strong('Poster')) }} + {{ macros.m_col(10, macros.m_strong('Info')) }} + {{ macros.m_row_end() }} + {{ macros.m_hr_head_bottom() }} +
+
+
+ + +{% endblock %} \ No newline at end of file