From 52efd45429462b4a5d0c6a4f026c5ff7002e9e5a Mon Sep 17 00:00:00 2001 From: EstrellaXD Date: Tue, 5 Jul 2022 00:25:19 +0800 Subject: [PATCH] =?UTF-8?q?2.5.5=20=E4=BF=AE=E5=A4=8D=E9=A6=96=E6=AC=A1?= =?UTF-8?q?=E5=90=AF=E5=8A=A8=E5=8F=AF=E8=83=BD=E6=97=A0=E6=B3=95=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0RSS=E7=9A=84=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- auto_bangumi/api.py | 11 ++++++++ auto_bangumi/conf/const.py | 2 +- auto_bangumi/core/renamer.py | 2 +- auto_bangumi/core/rss_analyser.py | 32 +++++++----------------- auto_bangumi/downloader/qb_downloader.py | 2 +- 5 files changed, 23 insertions(+), 26 deletions(-) diff --git a/auto_bangumi/api.py b/auto_bangumi/api.py index 1ea87e6c..4aebd77f 100644 --- a/auto_bangumi/api.py +++ b/auto_bangumi/api.py @@ -87,6 +87,17 @@ async def search(input: Search): return "Nothing Happened" +class AddRule(BaseModel): + title: str + season: int + + +@app.post("/api/v1/addrule") +async def add_rule(info: AddRule): + + return "success" + + def run(): args = parse() if args.debug: diff --git a/auto_bangumi/conf/const.py b/auto_bangumi/conf/const.py index b00ef940..3deec962 100644 --- a/auto_bangumi/conf/const.py +++ b/auto_bangumi/conf/const.py @@ -1,7 +1,7 @@ # -*- encoding: utf-8 -*- DEFAULT_SETTINGS = { - "version": "2.5.1", + "version": "2.5.5", "data_version": 4.0, "host_ip": "localhost:8080", "sleep_time": 7200, diff --git a/auto_bangumi/core/renamer.py b/auto_bangumi/core/renamer.py index fbaa690b..e64bc3e1 100644 --- a/auto_bangumi/core/renamer.py +++ b/auto_bangumi/core/renamer.py @@ -83,5 +83,5 @@ if __name__ == "__main__": settings.init(DEV_SETTINGS) client = DownloadClient() rename = Renamer(client) - print(rename.split_path("/downloads/Bangumi/勇者辞职.mp4")) + rename.run() # rename.set_folder() diff --git a/auto_bangumi/core/rss_analyser.py b/auto_bangumi/core/rss_analyser.py index 0fb1a92c..a86caed6 100644 --- a/auto_bangumi/core/rss_analyser.py +++ b/auto_bangumi/core/rss_analyser.py @@ -22,15 +22,17 @@ class RSSAnalyser: for raw_title in rss_titles: logger.debug(raw_title) extra_add = True - for d in bangumi_info: - if re.search(d["title_raw"], raw_title) is not None: - logger.debug(f"Had added {d['title_raw']} before") - extra_add = False - break + if bangumi_info is not []: + for d in bangumi_info: + if re.search(d["title_raw"], raw_title) is not None: + logger.debug(f"Had added {d['title_raw']} before") + extra_add = False + break if extra_add: data = self._title_analyser.return_dict(raw_title) - if data["official_title"] not in bangumi_info: + if data is not None and data["official_title"] not in bangumi_info: bangumi_info.append(data) + return bangumi_info def rss_to_data(self, url): rss_title = self._request.get_title(url) @@ -55,23 +57,7 @@ if __name__ == "__main__": print(settings.host_ip) client = DownloadClient() ra = RSSAnalyser() - data = [{'official_title': '勇者辞职不干了', 'title_raw': 'Yuusha, Yamemasu', 'season': 1, 'season_raw': '', 'group': 'Lilith-Raws', 'dpi': '1080p', 'source': 'Baha', 'subtitle': 'CHT', 'added': False, 'eps_collect': False}, - {'official_title': '朋友游戏', 'title_raw': 'Tomodachi Game', 'season': 1, 'season_raw': '', 'group': '离谱Sub', 'dpi': '1080p', 'source': None, 'subtitle': '简体内嵌', 'added': True, 'eps_collect': False}, - {'official_title': '街角魔族', 'title_raw': 'Machikado Mazoku: 2-choume', 'season': 2, 'season_raw': '', 'group': '桜都字幕组', 'dpi': '1080P', 'source': None, 'subtitle': '简繁内封', 'added': True, 'eps_collect': False}, - {'official_title': '杜鹃的婚约', 'title_raw': 'Kakkou no Iinazuke', 'season': 1, 'season_raw': '', 'group': 'Lilith-Raws', 'dpi': '1080p', 'source': 'Baha', 'subtitle': 'CHT', 'added': True, 'eps_collect': False}, - {'official_title': '间谍过家家', 'title_raw': 'SPYxFAMILY', 'season': 1, 'season_raw': '', 'group': 'Lilith-Raws', 'dpi': '1080p', 'source': 'Baha', 'subtitle': 'CHT', 'added': True, 'eps_collect': False}, - {'official_title': 'Love Live!虹咲学园 学园偶像同好会', 'title_raw': 'Love Live!虹咲学园 学园偶像同好会', 'season': 2, 'season_raw': 'S02', 'group': 'Lilith-Raws', 'dpi': '1080p', 'source': 'Baha', 'subtitle': 'CHT', 'added': True, 'eps_collect': False}, - {'official_title': '指名!', 'title_raw': 'CUE!', 'season': 1, 'season_raw': '', 'group': '喵萌Production', 'dpi': '1080p', 'source': None, 'subtitle': '简日双语', 'added': True, 'eps_collect': False}, - {'official_title': '辉夜大小姐想让我告白', 'title_raw': 'Kaguya-sama wa Kokurasetai', 'season': None, 'season_raw': 'S03', 'group': 'Lilith-Raws', 'dpi': '1080p', 'source': 'Baha', 'subtitle': 'CHT', 'added': True, 'eps_collect': False}, - {'official_title': '处刑少女的生存之道', 'title_raw': 'Shokei Shoujo no Virgin Road', 'season': 1, 'season_raw': '', 'group': 'Lilith-Raws', 'dpi': '1080p', 'source': 'Baha', 'subtitle': 'CHT', 'added': True, 'eps_collect': False}, - {'official_title': 'Kakkou no Iikagen', 'title_raw': 'Kakkou no Iikagen', 'season': 1, 'season_raw': '', 'group': 'Lilith-Raws', 'dpi': '1080p', 'source': 'Baha', 'subtitle': 'CHT', 'added': True, 'eps_collect': False}, - {'official_title': '古见同学有交流障碍症。', 'title_raw': 'Komi-san wa, Komyushou Desu.', 'season': 2, 'season_raw': '', 'group': '幻樱字幕组', 'dpi': '1920X1080', 'source': None, 'subtitle': 'GB', 'added': True, 'eps_collect': False}, - {'official_title': '夏日重现', 'title_raw': 'Summer Time Rendering', 'season': 1, 'season_raw': '', 'group': '喵萌奶茶屋', 'dpi': '1080p', 'source': None, 'subtitle': '简日双语', 'added': True, 'eps_collect': False}, - {'official_title': '魔法使黎明期', 'title_raw': 'Mahoutsukai Reimeiki', 'season': 1, 'season_raw': '', 'group': 'Lilith-Raws', 'dpi': '1080p', 'source': 'Baha', 'subtitle': 'CHT', 'added': True, 'eps_collect': False}, - {'official_title': '派对浪客诸葛孔明', 'title_raw': 'Paripi Koumei', 'season': 1, 'season_raw': '', 'group': 'Lilith-Raws', 'dpi': '1080p', 'source': None, 'subtitle': 'CHT', 'added': True, 'eps_collect': False}, - {'official_title': '相合之物', 'title_raw': 'Deaimon', 'season': 1, 'season_raw': '', 'group': 'Lilith-Raws', 'dpi': '1080p', 'source': 'Baha', 'subtitle': 'CHT', 'added': True, 'eps_collect': False}, - {'official_title': '盾之勇者成名录', 'title_raw': 'Tate no Yuusha no Nariagari', 'season': 2, 'season_raw': 'S02', 'group': 'Lilith-Raws', 'dpi': '1080p', 'source': 'Baha', 'subtitle': 'CHT', 'added': True, 'eps_collect': False}, - {'official_title': '史上最强大魔王转生为村民A', 'title_raw': 'Shijou Saikyou no Daimaou', 'season': 1, 'season_raw': '', 'group': 'Lilith-Raws', 'dpi': '1080p', 'source': 'Baha', 'subtitle': 'CHT', 'added': True, 'eps_collect': False}] + data = [] ra.run(data, client) for d in data: print(d) \ No newline at end of file diff --git a/auto_bangumi/downloader/qb_downloader.py b/auto_bangumi/downloader/qb_downloader.py index c87b2037..b0962532 100644 --- a/auto_bangumi/downloader/qb_downloader.py +++ b/auto_bangumi/downloader/qb_downloader.py @@ -65,7 +65,7 @@ class QbDownloader: try: self._client.rss_remove_item(item_path) except Conflict409Error as e: - logger.exception(e) + # logger.exception(e) logger.info("Add new RSS") raise ConflictError()