From f51b24f2b19d9dc8f041bda985a475f1906964dd Mon Sep 17 00:00:00 2001
From: zthxxx
Date: Sun, 11 Jun 2023 22:11:00 +0800
Subject: [PATCH 01/31] docs: adjust issue template for RFC
---
.github/ISSUE_TEMPLATE/rfc.yml | 47 ++++++++++++++++++++++++++++++----
1 file changed, 42 insertions(+), 5 deletions(-)
diff --git a/.github/ISSUE_TEMPLATE/rfc.yml b/.github/ISSUE_TEMPLATE/rfc.yml
index a6bb726a..9df703ac 100644
--- a/.github/ISSUE_TEMPLATE/rfc.yml
+++ b/.github/ISSUE_TEMPLATE/rfc.yml
@@ -1,3 +1,5 @@
+# https://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/syntax-for-issue-forms
+
name: 功能提案
description: Request for Comments
title: "[RFC]: "
@@ -6,12 +8,47 @@ body:
- type: markdown
attributes:
value: |
- 请说明你希望添加的功能。
+ 一份提案(RFC)定位为 **「在某功能/重构的具体开发前,用于开发者间 review 技术设计/方案的文档」**,
+ 目的是让协作的开发者间清晰的知道「要做什么」和「具体会怎么做」,
+ 以便评估和讨论产生的影响 (遗漏的考虑、向后兼容性、与现有功能的冲突),
+ 因此提案侧重在对解决问题的 **方案、设计、步骤** 的描述上。
+
+ 如果仅希望讨论是否添加或
+ 改进某功能本身,请使用 -> [Issue: 功能改进](https://github.com/EstrellaXD/Auto_Bangumi/issues/new?labels=feature+request&template=feature_request.yml&title=%5BFeature+Request%5D+)
+
- type: textarea
- id: feature-request
+ id: background
attributes:
- label: 功能改进
- description: 请详细描述需要改进或者添加的功能。
- placeholder: "功能改进"
+ label: 背景 or 问题
+ description: 简单描述遇到的什么问题或需要改动什么。可以引用其他 issue、讨论、文档等。
validations:
required: true
+
+ - type: textarea
+ id: goal
+ attributes:
+ label: "目标 & 方案简述"
+ description: 简单描述提案此提案实现后,**预期的目标效果**,以及简单大致描述会采取的方案/步骤,可能会/不会产生什么影响。
+ validations:
+ required: true
+
+ - type: textarea
+ id: design
+ attributes:
+ label: "方案设计 & 实现步骤"
+ description: |
+ 详细描述你设计的具体方案,可以考虑拆分列表或要点,一步步描述具体打算如何实现的步骤和相关细节。
+ 这部份不需要一次性写完整,即使在创建完此提案 issue 后,依旧可以再次编辑修改。
+ validations:
+ required: false
+
+
+ - type: textarea
+ id: alternative
+ attributes:
+ label: "替代方案 & 对比"
+ description: |
+ [可选] 为来实现目标效果,还考虑过什么其他方案,有什么对比?
+ validations:
+ required: false
+
From fcaf3f7210a8b2a280195cec5736dffc2c98e3d6 Mon Sep 17 00:00:00 2001
From: EstrellaXD
Date: Tue, 13 Jun 2023 22:26:12 +0800
Subject: [PATCH 02/31] fix: Database error that cannot get not added rules
---
docs/wiki | 2 +-
src/module/database/bangumi.py | 28 +++++++++++++++++++++++-----
2 files changed, 24 insertions(+), 6 deletions(-)
diff --git a/docs/wiki b/docs/wiki
index 519e381e..d0bb98f0 160000
--- a/docs/wiki
+++ b/docs/wiki
@@ -1 +1 @@
-Subproject commit 519e381e8a1add62e76a39181ee61bad02816035
+Subproject commit d0bb98f004fb292519dd56c42238ecb2f034eac9
diff --git a/src/module/database/bangumi.py b/src/module/database/bangumi.py
index 9aced49e..04fc1a5a 100644
--- a/src/module/database/bangumi.py
+++ b/src/module/database/bangumi.py
@@ -179,12 +179,13 @@ class BangumiDatabase(DataConnector):
return [self.__db_to_data(x) for x in dict_data]
def not_added(self) -> list[BangumiData]:
- condition = {"added": 0, "rule_name": None, "save_path": None}
- dict_data = self._search_datas(
- table_name=self.__table_name,
- condition=condition,
+ self._cursor.execute(
+ """
+ SELECT * FROM bangumi
+ WHERE added = 0 OR rule_name IS NULL OR save_path IS NULL
+ """
)
- return [self.__db_to_data(x) for x in dict_data]
+ return self.__fetch_data()
def gen_id(self) -> int:
self._cursor.execute(
@@ -215,7 +216,24 @@ class BangumiDatabase(DataConnector):
return True
return False
+
if __name__ == '__main__':
with BangumiDatabase() as db:
+ db.update_table()
+ data = BangumiData(
+ id=1,
+ title_raw="",
+ official_title="",
+ poster_link="",
+ rss_link=[],
+ eps_collect=0,
+ eps_total=0,
+ eps_update=0,
+ eps_complete=False,
+ added=False,
+ rule_name=None,
+ save_path=None,
+ )
+ db.insert(data)
print(db.not_added())
print(db.not_complete())
\ No newline at end of file
From 88f9b50e9abde064c394ab7a009a053abe1ad214 Mon Sep 17 00:00:00 2001
From: EstrellaXD
Date: Tue, 13 Jun 2023 22:34:00 +0800
Subject: [PATCH 03/31] feat: add try in api
---
src/module/api/bangumi.py | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/src/module/api/bangumi.py b/src/module/api/bangumi.py
index 8091890a..94c77c7f 100644
--- a/src/module/api/bangumi.py
+++ b/src/module/api/bangumi.py
@@ -1,3 +1,5 @@
+import logging
+
from fastapi import Depends, HTTPException, status
from fastapi.responses import JSONResponse
@@ -7,6 +9,7 @@ from module.models import BangumiData
from module.manager import TorrentManager
from module.security import get_current_user
+logger = logging.getLogger(__name__)
@router.get(
"/api/v1/bangumi/getAll", tags=["bangumi"], response_model=list[BangumiData]
@@ -39,7 +42,11 @@ async def update_rule(data: BangumiData, current_user=Depends(get_current_user))
status_code=status.HTTP_401_UNAUTHORIZED, detail="invalid token"
)
with TorrentManager() as torrent:
- return torrent.update_rule(data)
+ try:
+ return torrent.update_rule(data)
+ except Exception as e:
+ logger.error(f"Failed to update rule: {e}")
+ return JSONResponse(status_code=500, content={"message": "Failed"})
@router.delete("/api/v1/bangumi/deleteRule/{bangumi_id}", tags=["bangumi"])
From 47486856c37c4b2d49a61db1f00f59f2621bac25 Mon Sep 17 00:00:00 2001
From: EstrellaXD
Date: Wed, 14 Jun 2023 22:12:38 +0800
Subject: [PATCH 04/31] fix: Notification problem
---
src/module/database/bangumi.py | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/src/module/database/bangumi.py b/src/module/database/bangumi.py
index 04fc1a5a..f149bd52 100644
--- a/src/module/database/bangumi.py
+++ b/src/module/database/bangumi.py
@@ -129,13 +129,13 @@ class BangumiDatabase(DataConnector):
return self.__db_to_data(dict_data)
def match_poster(self, bangumi_name: str) -> str:
- condition = {"_custom_condition": "INSTR(:bangumi_name, official_title) > 0"}
- keys = ["official_title", "poster_link"]
- data = self._search_data(
- table_name=self.__table_name,
- keys=keys,
- condition=condition,
- )
+ data = self._cursor.execute(
+ """
+ SELECT official_title, poster_link FROM bangumi
+ WHERE INSTR(:title_raw, title_raw) > 0
+ """,
+ {"title_raw": bangumi_name},
+ ).fetchone()
if not data:
return ""
official_title, poster_link = data
From 4c94a51d57727be9967ef9a037dc4ae7067766ac Mon Sep 17 00:00:00 2001
From: EstrellaXD
Date: Thu, 15 Jun 2023 08:55:22 +0800
Subject: [PATCH 05/31] fix: lost poster problem
---
src/module/database/bangumi.py | 28 ++++++-------------------
src/module/notification/notification.py | 3 ++-
2 files changed, 8 insertions(+), 23 deletions(-)
diff --git a/src/module/database/bangumi.py b/src/module/database/bangumi.py
index f149bd52..1c49938b 100644
--- a/src/module/database/bangumi.py
+++ b/src/module/database/bangumi.py
@@ -131,14 +131,14 @@ class BangumiDatabase(DataConnector):
def match_poster(self, bangumi_name: str) -> str:
data = self._cursor.execute(
"""
- SELECT official_title, poster_link FROM bangumi
- WHERE INSTR(:title_raw, title_raw) > 0
+ SELECT poster_link FROM bangumi
+ WHERE INSTR(official_title, :official_title) > 0
""",
- {"title_raw": bangumi_name},
+ {"official_title": bangumi_name},
).fetchone()
if not data:
return ""
- official_title, poster_link = data
+ poster_link = data[0]
if not poster_link:
return ""
return poster_link
@@ -219,21 +219,5 @@ class BangumiDatabase(DataConnector):
if __name__ == '__main__':
with BangumiDatabase() as db:
- db.update_table()
- data = BangumiData(
- id=1,
- title_raw="",
- official_title="",
- poster_link="",
- rss_link=[],
- eps_collect=0,
- eps_total=0,
- eps_update=0,
- eps_complete=False,
- added=False,
- rule_name=None,
- save_path=None,
- )
- db.insert(data)
- print(db.not_added())
- print(db.not_complete())
\ No newline at end of file
+ name = "久保"
+ print(db.match_poster(name))
\ No newline at end of file
diff --git a/src/module/notification/notification.py b/src/module/notification/notification.py
index 1e13ff67..a59230b7 100644
--- a/src/module/notification/notification.py
+++ b/src/module/notification/notification.py
@@ -63,9 +63,10 @@ class PostNotification:
def __exit__(self, exc_type, exc_val, exc_tb):
self.notifier.__exit__(exc_type, exc_val, exc_tb)
+
if __name__ == "__main__":
info = Notification(
- official_title="魔法纪录 魔法少女小圆外传",
+ official_title="久保同学不放过我",
season=2,
episode=1,
)
From c1874fd9a532a94b8eb366d88523a965374b0ec4 Mon Sep 17 00:00:00 2001
From: EstrellaXD
Date: Tue, 20 Jun 2023 20:06:24 +0800
Subject: [PATCH 06/31] feat: add dev feature template
---
.github/ISSUE_TEMPLATE/dev-feature.yml | 17 +++++++++++++++++
docs/wiki | 2 +-
2 files changed, 18 insertions(+), 1 deletion(-)
create mode 100644 .github/ISSUE_TEMPLATE/dev-feature.yml
diff --git a/.github/ISSUE_TEMPLATE/dev-feature.yml b/.github/ISSUE_TEMPLATE/dev-feature.yml
new file mode 100644
index 00000000..d376c901
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/dev-feature.yml
@@ -0,0 +1,17 @@
+name: 功能提案
+description: Feature in Development
+title: "[Dev Feature]: "
+labels: ["dev feature"]
+body:
+ - type: markdown
+ attributes:
+ value: |
+ 请说明你希望添加的功能。
+ - type: textarea
+ id: feature-request
+ attributes:
+ label: 功能改进
+ description: 请详细描述需要改进或者添加的功能。
+ placeholder: "功能改进"
+ validations:
+ required: true
\ No newline at end of file
diff --git a/docs/wiki b/docs/wiki
index d0bb98f0..519e381e 160000
--- a/docs/wiki
+++ b/docs/wiki
@@ -1 +1 @@
-Subproject commit d0bb98f004fb292519dd56c42238ecb2f034eac9
+Subproject commit 519e381e8a1add62e76a39181ee61bad02816035
From f17b7c0c78f238dc74e1d6407b60a4d44c7128ba Mon Sep 17 00:00:00 2001
From: Estrella Pan <33726646+EstrellaXD@users.noreply.github.com>
Date: Tue, 20 Jun 2023 21:47:22 +0800
Subject: [PATCH 07/31] Update and rename dev-feature.yml to rfc.yml
feat: add rfc tag
---
.github/ISSUE_TEMPLATE/{dev-feature.yml => rfc.yml} | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
rename .github/ISSUE_TEMPLATE/{dev-feature.yml => rfc.yml} (75%)
diff --git a/.github/ISSUE_TEMPLATE/dev-feature.yml b/.github/ISSUE_TEMPLATE/rfc.yml
similarity index 75%
rename from .github/ISSUE_TEMPLATE/dev-feature.yml
rename to .github/ISSUE_TEMPLATE/rfc.yml
index d376c901..a6bb726a 100644
--- a/.github/ISSUE_TEMPLATE/dev-feature.yml
+++ b/.github/ISSUE_TEMPLATE/rfc.yml
@@ -1,7 +1,7 @@
name: 功能提案
-description: Feature in Development
-title: "[Dev Feature]: "
-labels: ["dev feature"]
+description: Request for Comments
+title: "[RFC]: "
+labels: ["RFC"]
body:
- type: markdown
attributes:
@@ -14,4 +14,4 @@ body:
description: 请详细描述需要改进或者添加的功能。
placeholder: "功能改进"
validations:
- required: true
\ No newline at end of file
+ required: true
From be9bcf1f522f2bf7243bb4826fedaa9b5f162518 Mon Sep 17 00:00:00 2001
From: zthxxx
Date: Fri, 23 Jun 2023 00:23:00 +0800
Subject: [PATCH 08/31] docs: add contributing docs
---
.github/ISSUE_TEMPLATE/rfc.yml | 7 +-
CONTRIBUTING.md | 180 +++++++++++++++++++++++++++++++++
2 files changed, 183 insertions(+), 4 deletions(-)
create mode 100644 CONTRIBUTING.md
diff --git a/.github/ISSUE_TEMPLATE/rfc.yml b/.github/ISSUE_TEMPLATE/rfc.yml
index 9df703ac..aad0d9d2 100644
--- a/.github/ISSUE_TEMPLATE/rfc.yml
+++ b/.github/ISSUE_TEMPLATE/rfc.yml
@@ -9,13 +9,12 @@ body:
attributes:
value: |
一份提案(RFC)定位为 **「在某功能/重构的具体开发前,用于开发者间 review 技术设计/方案的文档」**,
- 目的是让协作的开发者间清晰的知道「要做什么」和「具体会怎么做」,
+ 目的是让协作的开发者间清晰的知道「要做什么」和「具体会怎么做」,以及所有的开发者都能公开透明的参与讨论;
以便评估和讨论产生的影响 (遗漏的考虑、向后兼容性、与现有功能的冲突),
因此提案侧重在对解决问题的 **方案、设计、步骤** 的描述上。
- 如果仅希望讨论是否添加或
- 改进某功能本身,请使用 -> [Issue: 功能改进](https://github.com/EstrellaXD/Auto_Bangumi/issues/new?labels=feature+request&template=feature_request.yml&title=%5BFeature+Request%5D+)
-
+ 如果仅希望讨论是否添加或改进某功能本身,请使用 -> [Issue: 功能改进](https://github.com/EstrellaXD/Auto_Bangumi/issues/new?labels=feature+request&template=feature_request.yml&title=%5BFeature+Request%5D+)
+
- type: textarea
id: background
attributes:
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
new file mode 100644
index 00000000..3fa9266d
--- /dev/null
+++ b/CONTRIBUTING.md
@@ -0,0 +1,180 @@
+# 贡献指南 Contributing
+
+我们欢迎各位 Contributors 参与贡献帮助 AutoBangumi 更好的解决大家遇到的问题,
+
+这篇指南会指导你如何为 AutoBangumi 贡献功能修复代码,可以在你要提出 Pull Request 之前花几分钟来阅读一遍这篇指南。
+
+这篇文章包含什么?
+
+- [项目规划 Roadmap](#项目规划-roadmap)
+ - [提案寻求共识 Request for Comments](#提案寻求共识-request-for-comments)
+- [分支管理 Git Branch](#分支管理-git-branch)
+ - [版本号](#版本号)
+ - [分支开发,主干发布](#分支开发主干发布)
+ - [Branch 生命周期](#branch-生命周期)
+ - [Git Workflow 一览](#git-workflow-一览)
+- [Pull Request](#pull-request)
+- [版本发布介绍](#版本发布介绍)
+
+
+## 项目规划 Roadmap
+
+AutoBangumi 开发组使用 [GitHub Project](https://github.com/EstrellaXD/Auto_Bangumi/projects?query=is%3Aopen) 看板来管理预计开发的规划、在修复中的问题,以及它们处理的进度;
+
+这将帮助你更好的了解
+- 开发团队在做什么?
+- 有什么和你想贡献的方向一致的,可以直接参与实现与优化
+- 有什么已经在进行中的,避免自己重复不必要的工作
+
+在 [Project](https://github.com/EstrellaXD/Auto_Bangumi/projects?query=is%3Aopen) 中你可以看到除通常的 `[Feature Request]`, `[BUG]`, 一些小优化项以外,还有一类 **`[RFC]`**;
+
+### 提案寻求共识 Request for Comments
+
+> 在 issue 中通过 `RFC` label 能找到到现有的 [AutoBangumi RFCs](https://github.com/EstrellaXD/Auto_Bangumi/issues?q=is%3Aissue+label%3ARFC)
+
+对于一些小的优化项或者 bug 修复,你大可以直接帮忙调整代码然后提出 Pull Request,只需要简单阅读下 [分支管理](#分支管理-Git-Branch) 章节以基于正确的版本分支修复、以及通过 [Pull Request](#Pull-Request) 章节了解 PR 将如何被合并。
+
+
+
+而如果你打算做的是一项**较大的**功能重构,改动范围大而涉及的方面比较多,那么希望你能通过 [Issue: 功能提案](https://github.com/EstrellaXD/Auto_Bangumi/issues/new?assignees=&labels=RFC&projects=&template=rfc.yml&title=%5BRFC%5D%3A+) 先写一份 RFC 提案来简单阐述「你打算怎么做」的简短方案,来寻求开发者的讨论和共识。
+
+因为有些方案可能是开发团队原本讨论并且认为不要做的事,而上一步可以避免你浪费大量精力。
+
+> 如果仅希望讨论是否添加或改进某功能本身,而非「要如何实现」,请使用 -> [Issue: 功能改进](https://github.com/EstrellaXD/Auto_Bangumi/issues/new?labels=feature+request&template=feature_request.yml&title=%5BFeature+Request%5D+)
+
+
+
+
+一份 [提案(RFC)](https://github.com/EstrellaXD/Auto_Bangumi/issues?q=is%3Aissue+is%3Aopen+label%3ARFC) 定位为 **「在某功能/重构的具体开发前,用于开发者间 review 技术设计/方案的文档」**,
+
+目的是让协作的开发者间清晰的知道「要做什么」和「具体会怎么做」,以及所有的开发者都能公开透明的参与讨论;
+
+以便评估和讨论产生的影响 (遗漏的考虑、向后兼容性、与现有功能的冲突),
+
+因此提案侧重在对解决问题的 **方案、设计、步骤** 的描述上。
+
+
+## 分支管理 Git Branch
+
+### 版本号
+
+AutoBangumi 项目中的 Git 分支使用与发布版本规则密切相关,因此先介绍版本规范;
+
+AutoBangumi 发布的版本号遵循 [「语义化版本 SemVer」](https://semver.org/lang/zh-CN/) 的规范,
+
+使用 `..` 三位版本的格式,每一位版本上的数字更新含义如下:
+
+- **Major**: 大版本更新,很可能有不兼容的 配置/API 修改
+- **Minor**: 向下兼容的功能性新增
+- **Patch**: 向下兼容的 Bug 修复 / 小优化修正
+
+### 分支开发,主干发布
+
+AutoBangumi 项目使用「分支开发,主干发布」的模式,
+
+[**`main`**](https://github.com/EstrellaXD/Auto_Bangumi/commits/main) 分支是稳定版本的 **「主干分支」**,只用于发布版本,不用于直接开发新功能或修复。
+
+每一个 Minor 版本都有一个对应的 **「开发分支」** 用于开发新功能、与发布后维护修复问题,
+
+开发分支的名字为 `.-dev`,如 `3.1-dev`, `3.0-dev`, `2.6-dev`, 你可以在仓库的 [All Branches 中搜索到它们](https://github.com/EstrellaXD/Auto_Bangumi/branches/all?query=-dev)。
+
+
+### Branch 生命周期
+
+当一个 Minor 开发分支(以 `3.1-dev` 为例) 完成新功能开发,**首次**合入 main 分支后,
+- 发布 Minor 版本 (如 `3.1.0`)
+- 同时拉出**下一个** Minor 开发分支(`3.2-dev`),用于下一个版本新功能开发
+ - 而**上一个**版本开发分支(`3.0-dev`)进入归档不再维护
+- 且这个 Minor 分支(`3.1-dev`)进入维护阶段,不再增加新功能/重构,只维护 Bugs 修复
+ - Bug 修复到维护阶段的 Minor 分支(`3.1-dev`)后,会再往 main 分支合并,并发布 `Patch` 版本
+
+根据这个流程,对于各位 Contributors 在开发贡献时选择 Git Branch 来说,则是:
+- 若「修复 Bug」,则基于**当前发布版本**的 Minor 分支开发修复,并 PR 到这个分支
+- 若「添加新功能/重构」,则基于**还未发布的下一个版本** Minor 分支开发,并 PR 到这个分支
+
+> 「当前发布版本」为 [[Releases 页面]](https://github.com/EstrellaXD/Auto_Bangumi/releases) 最新版本,这也与 [[GitHub Container Registry]](https://github.com/EstrellaXD/Auto_Bangumi/pkgs/container/auto_bangumi) 中最新版本相同
+
+
+### Git Workflow 一览
+
+> 图中 commit timeline 从左到右 --->
+
+```mermaid
+%%{init: {'theme': 'base', 'gitGraph': {'showCommitLabel': true}}}%%
+
+gitGraph:
+ checkout main
+ commit id: "."
+ branch 3.0-dev
+ commit id: "feat 1"
+ commit id: "feat 2"
+ commit id: "feat 3"
+
+ checkout main
+ merge 3.0-dev tag: "3.0.9"
+ commit id: ".."
+
+ branch 3.1-dev
+ commit id: "feat 4"
+
+ checkout 3.0-dev
+ commit id: "PR merge (fix)"
+ checkout main
+ merge 3.0-dev tag: "3.0.10"
+
+ checkout 3.1-dev
+ commit id: "feat 5"
+ commit id: "feat 6"
+
+ checkout main
+ merge 3.1-dev tag: "3.1.0"
+ commit id: "..."
+
+ branch 3.2-dev
+ commit id: "feat 7"
+ commit id: "feat 8"
+
+ checkout 3.1-dev
+ commit id: "PR merge (fix) "
+ checkout main
+ merge 3.1-dev tag: "3.1.1"
+
+ checkout 3.2-dev
+ commit id: "PR merge (feat)"
+```
+
+
+## Pull Request
+
+请确保你根据上文的 Git 分支管理 章节选择了正确的 PR 目标分支,
+> - 若「修复 Bug」,则 PR 到**当前发布版本**的 Minor 维护分支
+> - 若「添加新功能/重构」,则 PR **下一个版本** Minor 开发分支
+
+
+
+- 一个 PR 应该只对应一件事,而不应引入不相关的更改;
+
+ 对于不同的事情可以拆分提多个 PR,这能帮助开发组每次 review 只专注一个问题。
+
+- 在提 PR 的标题与描述中,最好对修改内容做简短的说明,包括原因和意图,
+
+ 如果有相关的 issue 或 RFC,应该把它们链接到 PR 描述中,
+
+ 这将帮助开发组 code review 时能最快了解上下文。
+
+- 确保勾选了「允许维护者编辑」(`Allow edits from maintainers`) 选项。这使我们可以直接进行较小的编辑/重构并节省大量时间。
+
+- 请确保本地通过了「单元测试」和「代码风格 Lint」,这也会在 PR 的 GitHub CI 上检查
+ - 对于 bug fix 和新功能,通常开发组也会请求你添加对应改动的单元测试覆盖
+
+
+开发组会在有时间的最快阶段 Review 贡献者提的 PR 并讨论或批准合并(Approve Merge)。
+
+## 版本发布介绍
+
+版本发布目前由开发组通过手动合并「特定发版 PR」后自动触发打包与发布。
+
+通常 Bug 修复的 PR 合并后会很快发版,通常不到一周;
+
+而新功能的发版时间则会更长而且不定,你可以在我们的 [GitHub Project](https://github.com/EstrellaXD/Auto_Bangumi/projects?query=is%3Aopen) 看板中看到开发进度,一个版本规划的新功能都开发完备后就会发版。
+
From 58bff6cbdc84aefdeb255394fcf00c407905fab9 Mon Sep 17 00:00:00 2001
From: EstrellaXD
Date: Wed, 28 Jun 2023 16:15:17 +0800
Subject: [PATCH 09/31] refactor: refactor folder as 3.1
---
.dockerignore | 8 +-
.gitignore | 20 ++---
Dockerfile | 4 +-
backend/.pre-commit-config.yaml | 8 ++
backend/pyproject.toml | 63 +++++++++++++++
.../docker/etc/cont-init.d/010-old-compatible | 0
.../src}/docker/etc/cont-init.d/020-fixuser | 0
.../docker/etc/services.d/auto_bangumi/finish | 0
.../services.d/auto_bangumi/notification-fd | 0
.../docker/etc/services.d/auto_bangumi/run | 0
{src => backend/src}/icon | 0
{src => backend/src}/main.py | 0
{src => backend/src}/module/__init__.py | 0
.../src}/module/ab_decorator/__init__.py | 3 +-
{src => backend/src}/module/api/__init__.py | 0
{src => backend/src}/module/api/auth.py | 9 +--
{src => backend/src}/module/api/bangumi.py | 5 +-
{src => backend/src}/module/api/config.py | 0
{src => backend/src}/module/api/download.py | 0
{src => backend/src}/module/api/log.py | 0
{src => backend/src}/module/api/program.py | 0
{src => backend/src}/module/api/proxy.py | 0
{src => backend/src}/module/api/web.py | 0
.../src}/module/checker/__init__.py | 0
.../src}/module/checker/checker.py | 0
{src => backend/src}/module/conf/__init__.py | 0
{src => backend/src}/module/conf/config.py | 0
{src => backend/src}/module/conf/const.py | 0
{src => backend/src}/module/conf/log.py | 0
{src => backend/src}/module/conf/parse.py | 0
.../src}/module/conf/uvicorn_logging.py | 0
{src => backend/src}/module/core/__init__.py | 0
{src => backend/src}/module/core/program.py | 0
{src => backend/src}/module/core/rss_feed.py | 0
{src => backend/src}/module/core/status.py | 0
.../src}/module/core/sub_thread.py | 0
.../src}/module/database/__init__.py | 0
.../src}/module/database/bangumi.py | 12 ++-
.../src}/module/database/connector.py | 25 ++++--
.../src}/module/database/torrent.py | 0
{src => backend/src}/module/database/user.py | 0
.../src}/module/downloader/__init__.py | 0
.../src}/module/downloader/client/__init__.py | 0
.../downloader/client/aria2_downloader.py | 0
.../module/downloader/client/qb_downloader.py | 6 +-
.../module/downloader/client/tr_downloader.py | 0
.../src}/module/downloader/exceptions.py | 0
.../src}/module/downloader/path.py | 0
.../src}/module/manager/__init__.py | 0
.../src}/module/manager/collector.py | 10 ++-
.../src}/module/manager/renamer.py | 13 ++-
.../src}/module/manager/torrent.py | 80 ++++++++++++-------
.../src}/module/models/__init__.py | 0
{src => backend/src}/module/models/api.py | 0
{src => backend/src}/module/models/bangumi.py | 0
{src => backend/src}/module/models/config.py | 0
{src => backend/src}/module/models/torrent.py | 0
{src => backend/src}/module/models/user.py | 0
.../src}/module/network/__init__.py | 0
.../src}/module/network/request_contents.py | 6 +-
.../src}/module/network/request_url.py | 8 +-
backend/src/module/network/site/__init__.py | 1 +
.../src}/module/network/site/mikan.py | 2 +-
backend/src/module/notification/__init__.py | 1 +
.../src}/module/notification/notification.py | 3 +-
.../module/notification/plugin/__init__.py | 2 +-
.../src}/module/notification/plugin/bark.py | 0
.../module/notification/plugin/server_chan.py | 0
.../src}/module/notification/plugin/slack.py | 2 +-
.../module/notification/plugin/telegram.py | 0
.../src}/module/notification/plugin/wecom.py | 8 +-
.../src}/module/parser/__init__.py | 0
.../src}/module/parser/analyser/__init__.py | 0
.../src}/module/parser/analyser/bgm_parser.py | 0
.../module/parser/analyser/tmdb_parser.py | 38 ++++++---
.../module/parser/analyser/torrent_parser.py | 0
{src => backend/src}/module/parser/openai.py | 0
.../src}/module/parser/title_parser.py | 0
{src => backend/src}/module/rss/__init__.py | 0
{src => backend/src}/module/rss/analyser.py | 8 +-
{src => backend/src}/module/rss/filter.py | 0
{src => backend/src}/module/rss/searcher.py | 0
.../src}/module/searcher/__init__.py | 0
.../src}/module/searcher/plugin/__init__.py | 0
.../src}/module/searcher/plugin/mikan.py | 0
.../src}/module/searcher/searcher.py | 9 ++-
.../src}/module/security/__init__.py | 0
{src => backend/src}/module/security/api.py | 0
{src => backend/src}/module/security/jwt.py | 0
.../src}/module/update/__init__.py | 0
.../src}/module/update/data_migration.py | 0
{src => backend/src}/module/utils/__init__.py | 0
.../src}/module/utils/bangumi_data.py | 0
.../src}/module/utils/json_config.py | 0
{src => backend/src}/test/__init__.py | 0
{src => backend/src}/test/test_raw_parser.py | 1 -
.../src}/test/test_torrent_parser.py | 0
docs/wiki | 2 +-
pyrightconfig.json | 8 ++
src/module/network/site/__init__.py | 1 -
src/module/notification/__init__.py | 1 -
101 files changed, 252 insertions(+), 115 deletions(-)
create mode 100644 backend/.pre-commit-config.yaml
create mode 100644 backend/pyproject.toml
rename {src => backend/src}/docker/etc/cont-init.d/010-old-compatible (100%)
rename {src => backend/src}/docker/etc/cont-init.d/020-fixuser (100%)
rename {src => backend/src}/docker/etc/services.d/auto_bangumi/finish (100%)
rename {src => backend/src}/docker/etc/services.d/auto_bangumi/notification-fd (100%)
rename {src => backend/src}/docker/etc/services.d/auto_bangumi/run (100%)
rename {src => backend/src}/icon (100%)
rename {src => backend/src}/main.py (100%)
rename {src => backend/src}/module/__init__.py (100%)
rename {src => backend/src}/module/ab_decorator/__init__.py (97%)
rename {src => backend/src}/module/api/__init__.py (100%)
rename {src => backend/src}/module/api/auth.py (90%)
rename {src => backend/src}/module/api/bangumi.py (96%)
rename {src => backend/src}/module/api/config.py (100%)
rename {src => backend/src}/module/api/download.py (100%)
rename {src => backend/src}/module/api/log.py (100%)
rename {src => backend/src}/module/api/program.py (100%)
rename {src => backend/src}/module/api/proxy.py (100%)
rename {src => backend/src}/module/api/web.py (100%)
rename {src => backend/src}/module/checker/__init__.py (100%)
rename {src => backend/src}/module/checker/checker.py (100%)
rename {src => backend/src}/module/conf/__init__.py (100%)
rename {src => backend/src}/module/conf/config.py (100%)
rename {src => backend/src}/module/conf/const.py (100%)
rename {src => backend/src}/module/conf/log.py (100%)
rename {src => backend/src}/module/conf/parse.py (100%)
rename {src => backend/src}/module/conf/uvicorn_logging.py (100%)
rename {src => backend/src}/module/core/__init__.py (100%)
rename {src => backend/src}/module/core/program.py (100%)
rename {src => backend/src}/module/core/rss_feed.py (100%)
rename {src => backend/src}/module/core/status.py (100%)
rename {src => backend/src}/module/core/sub_thread.py (100%)
rename {src => backend/src}/module/database/__init__.py (100%)
rename {src => backend/src}/module/database/bangumi.py (95%)
rename {src => backend/src}/module/database/connector.py (89%)
rename {src => backend/src}/module/database/torrent.py (100%)
rename {src => backend/src}/module/database/user.py (100%)
rename {src => backend/src}/module/downloader/__init__.py (100%)
rename {src => backend/src}/module/downloader/client/__init__.py (100%)
rename {src => backend/src}/module/downloader/client/aria2_downloader.py (100%)
rename {src => backend/src}/module/downloader/client/qb_downloader.py (96%)
rename {src => backend/src}/module/downloader/client/tr_downloader.py (100%)
rename {src => backend/src}/module/downloader/exceptions.py (100%)
rename {src => backend/src}/module/downloader/path.py (100%)
rename {src => backend/src}/module/manager/__init__.py (100%)
rename {src => backend/src}/module/manager/collector.py (88%)
rename {src => backend/src}/module/manager/renamer.py (95%)
rename {src => backend/src}/module/manager/torrent.py (65%)
rename {src => backend/src}/module/models/__init__.py (100%)
rename {src => backend/src}/module/models/api.py (100%)
rename {src => backend/src}/module/models/bangumi.py (100%)
rename {src => backend/src}/module/models/config.py (100%)
rename {src => backend/src}/module/models/torrent.py (100%)
rename {src => backend/src}/module/models/user.py (100%)
rename {src => backend/src}/module/network/__init__.py (100%)
rename {src => backend/src}/module/network/request_contents.py (93%)
rename {src => backend/src}/module/network/request_url.py (92%)
create mode 100644 backend/src/module/network/site/__init__.py
rename {src => backend/src}/module/network/site/mikan.py (84%)
create mode 100644 backend/src/module/notification/__init__.py
rename {src => backend/src}/module/notification/notification.py (95%)
rename {src => backend/src}/module/notification/plugin/__init__.py (77%)
rename {src => backend/src}/module/notification/plugin/bark.py (100%)
rename {src => backend/src}/module/notification/plugin/server_chan.py (100%)
rename {src => backend/src}/module/notification/plugin/slack.py (95%)
rename {src => backend/src}/module/notification/plugin/telegram.py (100%)
rename {src => backend/src}/module/notification/plugin/wecom.py (87%)
rename {src => backend/src}/module/parser/__init__.py (100%)
rename {src => backend/src}/module/parser/analyser/__init__.py (100%)
rename {src => backend/src}/module/parser/analyser/bgm_parser.py (100%)
rename {src => backend/src}/module/parser/analyser/tmdb_parser.py (69%)
rename {src => backend/src}/module/parser/analyser/torrent_parser.py (100%)
rename {src => backend/src}/module/parser/openai.py (100%)
rename {src => backend/src}/module/parser/title_parser.py (100%)
rename {src => backend/src}/module/rss/__init__.py (100%)
rename {src => backend/src}/module/rss/analyser.py (93%)
rename {src => backend/src}/module/rss/filter.py (100%)
rename {src => backend/src}/module/rss/searcher.py (100%)
rename {src => backend/src}/module/searcher/__init__.py (100%)
rename {src => backend/src}/module/searcher/plugin/__init__.py (100%)
rename {src => backend/src}/module/searcher/plugin/mikan.py (100%)
rename {src => backend/src}/module/searcher/searcher.py (87%)
rename {src => backend/src}/module/security/__init__.py (100%)
rename {src => backend/src}/module/security/api.py (100%)
rename {src => backend/src}/module/security/jwt.py (100%)
rename {src => backend/src}/module/update/__init__.py (100%)
rename {src => backend/src}/module/update/data_migration.py (100%)
rename {src => backend/src}/module/utils/__init__.py (100%)
rename {src => backend/src}/module/utils/bangumi_data.py (100%)
rename {src => backend/src}/module/utils/json_config.py (100%)
rename {src => backend/src}/test/__init__.py (100%)
rename {src => backend/src}/test/test_raw_parser.py (99%)
rename {src => backend/src}/test/test_torrent_parser.py (100%)
create mode 100644 pyrightconfig.json
delete mode 100644 src/module/network/site/__init__.py
delete mode 100644 src/module/notification/__init__.py
diff --git a/.dockerignore b/.dockerignore
index 94a64c67..595cb0a5 100644
--- a/.dockerignore
+++ b/.dockerignore
@@ -19,8 +19,8 @@ coverage.xml
../.pytest_cache
.hypothesis
-src/module/tests
-src/module/conf/const_dev.py
+backend/src/module/tests
+backend/src/module/conf/const_dev.py
config/bangumi.json/config/bangumi.json
/docs
/.github
@@ -33,8 +33,8 @@ config/bangumi.json/config/bangumi.json
dist.zip
data
config
-/src/config
-/src/data
+/backend/src/config
+/backend/src/data
.pytest_cache
test
.env
diff --git a/.gitignore b/.gitignore
index f6222a65..2fba0a13 100644
--- a/.gitignore
+++ b/.gitignore
@@ -162,18 +162,18 @@ cython_debug/
#.idea/
# Custom
-/src/test.py
+/backend/src/test.py
-/src/module/run_debug.sh
-/src/module/debug_run.sh
-/src/module/__version__.py
-/src/data/
+/backend/src/module/run_debug.sh
+/backend/src/module/debug_run.sh
+/backend/src/module/__version__.py
+/backend/src/data/
-/src/module/conf/config_dev.ini
+/backend/src/module/conf/config_dev.ini
test.*
.run
-/src/templates/
-/src/config/
-/src/debuger.py
-/src/dist.zip
+/backend/src/templates/
+/backend/src/config/
+/backend/src/debuger.py
+/backend/src/dist.zip
diff --git a/Dockerfile b/Dockerfile
index 7f58121f..dd4d7534 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -45,8 +45,8 @@ RUN apk add --no-cache \
/root/.cache \
/tmp/*
-COPY --chmod=755 src/. .
-COPY --chmod=755 src/docker /
+COPY --chmod=755 backend/src/. .
+COPY --chmod=755 backend/src/docker /
ENTRYPOINT [ "/init" ]
diff --git a/backend/.pre-commit-config.yaml b/backend/.pre-commit-config.yaml
new file mode 100644
index 00000000..daecff1d
--- /dev/null
+++ b/backend/.pre-commit-config.yaml
@@ -0,0 +1,8 @@
+repos:
+- repo: https://github.com/psf/black
+ rev: 22.10.0
+ hooks:
+ - id: black
+ language: python
+
+# TODO: add ruff lint check before committing
\ No newline at end of file
diff --git a/backend/pyproject.toml b/backend/pyproject.toml
new file mode 100644
index 00000000..8342c4b9
--- /dev/null
+++ b/backend/pyproject.toml
@@ -0,0 +1,63 @@
+[tool.ruff]
+select = [
+ # pycodestyle(E): https://beta.ruff.rs/docs/rules/#pycodestyle-e-w
+ "E",
+ # Pyflakes(F): https://beta.ruff.rs/docs/rules/#pyflakes-f
+ "F",
+ # isort(I): https://beta.ruff.rs/docs/rules/#isort-i
+ "I"
+]
+ignore = [
+ # E501: https://beta.ruff.rs/docs/rules/line-too-long/
+ 'E501',
+ # F401: https://beta.ruff.rs/docs/rules/unused-import/
+ # avoid unused imports lint in `__init__.py`
+ 'F401',
+]
+
+# Allow autofix for all enabled rules (when `--fix`) is provided.
+fixable = ["A", "B", "C", "D", "E", "F", "G", "I", "N", "Q", "S", "T", "W", "ANN", "ARG", "BLE", "COM", "DJ", "DTZ", "EM", "ERA", "EXE", "FBT", "ICN", "INP", "ISC", "NPY", "PD", "PGH", "PIE", "PL", "PT", "PTH", "PYI", "RET", "RSE", "RUF", "SIM", "SLF", "TCH", "TID", "TRY", "UP", "YTT"]
+unfixable = []
+
+# Exclude a variety of commonly ignored directories.
+exclude = [
+ ".bzr",
+ ".direnv",
+ ".eggs",
+ ".git",
+ ".git-rewrite",
+ ".hg",
+ ".mypy_cache",
+ ".nox",
+ ".pants.d",
+ ".pytype",
+ ".ruff_cache",
+ ".svn",
+ ".tox",
+ ".venv",
+ "__pypackages__",
+ "_build",
+ "buck-out",
+ "build",
+ "dist",
+ "node_modules",
+ "venv",
+]
+per-file-ignores = {}
+
+# Same as Black.
+line-length = 88
+
+# Allow unused variables when underscore-prefixed.
+dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"
+
+# Assume Python 3.10.
+target-version = "py310"
+
+[tool.ruff.mccabe]
+# Unlike Flake8, default to a complexity level of 10.
+max-complexity = 10
+
+[tool.black]
+line-length = 88
+target-version = ['py310', 'py311']
diff --git a/src/docker/etc/cont-init.d/010-old-compatible b/backend/src/docker/etc/cont-init.d/010-old-compatible
similarity index 100%
rename from src/docker/etc/cont-init.d/010-old-compatible
rename to backend/src/docker/etc/cont-init.d/010-old-compatible
diff --git a/src/docker/etc/cont-init.d/020-fixuser b/backend/src/docker/etc/cont-init.d/020-fixuser
similarity index 100%
rename from src/docker/etc/cont-init.d/020-fixuser
rename to backend/src/docker/etc/cont-init.d/020-fixuser
diff --git a/src/docker/etc/services.d/auto_bangumi/finish b/backend/src/docker/etc/services.d/auto_bangumi/finish
similarity index 100%
rename from src/docker/etc/services.d/auto_bangumi/finish
rename to backend/src/docker/etc/services.d/auto_bangumi/finish
diff --git a/src/docker/etc/services.d/auto_bangumi/notification-fd b/backend/src/docker/etc/services.d/auto_bangumi/notification-fd
similarity index 100%
rename from src/docker/etc/services.d/auto_bangumi/notification-fd
rename to backend/src/docker/etc/services.d/auto_bangumi/notification-fd
diff --git a/src/docker/etc/services.d/auto_bangumi/run b/backend/src/docker/etc/services.d/auto_bangumi/run
similarity index 100%
rename from src/docker/etc/services.d/auto_bangumi/run
rename to backend/src/docker/etc/services.d/auto_bangumi/run
diff --git a/src/icon b/backend/src/icon
similarity index 100%
rename from src/icon
rename to backend/src/icon
diff --git a/src/main.py b/backend/src/main.py
similarity index 100%
rename from src/main.py
rename to backend/src/main.py
diff --git a/src/module/__init__.py b/backend/src/module/__init__.py
similarity index 100%
rename from src/module/__init__.py
rename to backend/src/module/__init__.py
diff --git a/src/module/ab_decorator/__init__.py b/backend/src/module/ab_decorator/__init__.py
similarity index 97%
rename from src/module/ab_decorator/__init__.py
rename to backend/src/module/ab_decorator/__init__.py
index f25a083b..3c29c227 100644
--- a/src/module/ab_decorator/__init__.py
+++ b/backend/src/module/ab_decorator/__init__.py
@@ -38,4 +38,5 @@ def locked(func):
def wrapper(*args, **kwargs):
with lock:
return func(*args, **kwargs)
- return wrapper
\ No newline at end of file
+
+ return wrapper
diff --git a/src/module/api/__init__.py b/backend/src/module/api/__init__.py
similarity index 100%
rename from src/module/api/__init__.py
rename to backend/src/module/api/__init__.py
diff --git a/src/module/api/auth.py b/backend/src/module/api/auth.py
similarity index 90%
rename from src/module/api/auth.py
rename to backend/src/module/api/auth.py
index bbea2090..de255dd3 100644
--- a/src/module/api/auth.py
+++ b/backend/src/module/api/auth.py
@@ -19,9 +19,7 @@ async def login(form_data: OAuth2PasswordRequestForm = Depends()):
username = form_data.username
password = form_data.password
auth_user(username, password)
- token = create_access_token(
- data={"sub": username}, expires_delta=timedelta(days=1)
- )
+ token = create_access_token(data={"sub": username}, expires_delta=timedelta(days=1))
return {"access_token": token, "token_type": "bearer", "expire": 86400}
@@ -32,10 +30,7 @@ async def refresh(current_user: User = Depends(get_current_user)):
raise HTTPException(
status_code=status.HTTP_401_UNAUTHORIZED, detail="invalid token"
)
- token = create_access_token(
- data = {"sub": current_user.username}
-
- )
+ token = create_access_token(data={"sub": current_user.username})
return {"access_token": token, "token_type": "bearer", "expire": 86400}
diff --git a/src/module/api/bangumi.py b/backend/src/module/api/bangumi.py
similarity index 96%
rename from src/module/api/bangumi.py
rename to backend/src/module/api/bangumi.py
index 94c77c7f..611e9c43 100644
--- a/src/module/api/bangumi.py
+++ b/backend/src/module/api/bangumi.py
@@ -11,6 +11,7 @@ from module.security import get_current_user
logger = logging.getLogger(__name__)
+
@router.get(
"/api/v1/bangumi/getAll", tags=["bangumi"], response_model=list[BangumiData]
)
@@ -50,7 +51,9 @@ async def update_rule(data: BangumiData, current_user=Depends(get_current_user))
@router.delete("/api/v1/bangumi/deleteRule/{bangumi_id}", tags=["bangumi"])
-async def delete_rule(bangumi_id: str, file: bool = False, current_user=Depends(get_current_user)):
+async def delete_rule(
+ bangumi_id: str, file: bool = False, current_user=Depends(get_current_user)
+):
if not current_user:
raise HTTPException(
status_code=status.HTTP_401_UNAUTHORIZED, detail="invalid token"
diff --git a/src/module/api/config.py b/backend/src/module/api/config.py
similarity index 100%
rename from src/module/api/config.py
rename to backend/src/module/api/config.py
diff --git a/src/module/api/download.py b/backend/src/module/api/download.py
similarity index 100%
rename from src/module/api/download.py
rename to backend/src/module/api/download.py
diff --git a/src/module/api/log.py b/backend/src/module/api/log.py
similarity index 100%
rename from src/module/api/log.py
rename to backend/src/module/api/log.py
diff --git a/src/module/api/program.py b/backend/src/module/api/program.py
similarity index 100%
rename from src/module/api/program.py
rename to backend/src/module/api/program.py
diff --git a/src/module/api/proxy.py b/backend/src/module/api/proxy.py
similarity index 100%
rename from src/module/api/proxy.py
rename to backend/src/module/api/proxy.py
diff --git a/src/module/api/web.py b/backend/src/module/api/web.py
similarity index 100%
rename from src/module/api/web.py
rename to backend/src/module/api/web.py
diff --git a/src/module/checker/__init__.py b/backend/src/module/checker/__init__.py
similarity index 100%
rename from src/module/checker/__init__.py
rename to backend/src/module/checker/__init__.py
diff --git a/src/module/checker/checker.py b/backend/src/module/checker/checker.py
similarity index 100%
rename from src/module/checker/checker.py
rename to backend/src/module/checker/checker.py
diff --git a/src/module/conf/__init__.py b/backend/src/module/conf/__init__.py
similarity index 100%
rename from src/module/conf/__init__.py
rename to backend/src/module/conf/__init__.py
diff --git a/src/module/conf/config.py b/backend/src/module/conf/config.py
similarity index 100%
rename from src/module/conf/config.py
rename to backend/src/module/conf/config.py
diff --git a/src/module/conf/const.py b/backend/src/module/conf/const.py
similarity index 100%
rename from src/module/conf/const.py
rename to backend/src/module/conf/const.py
diff --git a/src/module/conf/log.py b/backend/src/module/conf/log.py
similarity index 100%
rename from src/module/conf/log.py
rename to backend/src/module/conf/log.py
diff --git a/src/module/conf/parse.py b/backend/src/module/conf/parse.py
similarity index 100%
rename from src/module/conf/parse.py
rename to backend/src/module/conf/parse.py
diff --git a/src/module/conf/uvicorn_logging.py b/backend/src/module/conf/uvicorn_logging.py
similarity index 100%
rename from src/module/conf/uvicorn_logging.py
rename to backend/src/module/conf/uvicorn_logging.py
diff --git a/src/module/core/__init__.py b/backend/src/module/core/__init__.py
similarity index 100%
rename from src/module/core/__init__.py
rename to backend/src/module/core/__init__.py
diff --git a/src/module/core/program.py b/backend/src/module/core/program.py
similarity index 100%
rename from src/module/core/program.py
rename to backend/src/module/core/program.py
diff --git a/src/module/core/rss_feed.py b/backend/src/module/core/rss_feed.py
similarity index 100%
rename from src/module/core/rss_feed.py
rename to backend/src/module/core/rss_feed.py
diff --git a/src/module/core/status.py b/backend/src/module/core/status.py
similarity index 100%
rename from src/module/core/status.py
rename to backend/src/module/core/status.py
diff --git a/src/module/core/sub_thread.py b/backend/src/module/core/sub_thread.py
similarity index 100%
rename from src/module/core/sub_thread.py
rename to backend/src/module/core/sub_thread.py
diff --git a/src/module/database/__init__.py b/backend/src/module/database/__init__.py
similarity index 100%
rename from src/module/database/__init__.py
rename to backend/src/module/database/__init__.py
diff --git a/src/module/database/bangumi.py b/backend/src/module/database/bangumi.py
similarity index 95%
rename from src/module/database/bangumi.py
rename to backend/src/module/database/bangumi.py
index 1c49938b..0ba1ce92 100644
--- a/src/module/database/bangumi.py
+++ b/backend/src/module/database/bangumi.py
@@ -160,9 +160,13 @@ class BangumiDatabase(DataConnector):
if match_data.get("title_raw") in torrent.name:
if rss_link not in match_data.get("rss_link"):
match_data["rss_link"] += f",{rss_link}"
- self.update_rss(match_data.get("title_raw"), match_data.get("rss_link"))
+ self.update_rss(
+ match_data.get("title_raw"), match_data.get("rss_link")
+ )
if not match_data.get("poster_link"):
- self.update_poster(match_data.get("title_raw"), torrent.poster_link)
+ self.update_poster(
+ match_data.get("title_raw"), torrent.poster_link
+ )
torrent_list.pop(i)
break
else:
@@ -217,7 +221,7 @@ class BangumiDatabase(DataConnector):
return False
-if __name__ == '__main__':
+if __name__ == "__main__":
with BangumiDatabase() as db:
name = "久保"
- print(db.match_poster(name))
\ No newline at end of file
+ print(db.match_poster(name))
diff --git a/src/module/database/connector.py b/backend/src/module/database/connector.py
similarity index 89%
rename from src/module/database/connector.py
rename to backend/src/module/database/connector.py
index 751a6355..d4dbea56 100644
--- a/src/module/database/connector.py
+++ b/backend/src/module/database/connector.py
@@ -100,10 +100,14 @@ class DataConnector:
def _delete(self, table_name: str, condition: dict):
condition_sql = " AND ".join([f"{key} = :{key}" for key in condition.keys()])
- self._cursor.execute(f"DELETE FROM {table_name} WHERE {condition_sql}", condition)
+ self._cursor.execute(
+ f"DELETE FROM {table_name} WHERE {condition_sql}", condition
+ )
self._conn.commit()
- def _search(self, table_name: str, keys: list[str] | None = None, condition: dict = None):
+ def _search(
+ self, table_name: str, keys: list[str] | None = None, condition: dict = None
+ ):
if keys is None:
select_sql = "*"
else:
@@ -112,20 +116,25 @@ class DataConnector:
self._cursor.execute(f"SELECT {select_sql} FROM {table_name}")
else:
custom_condition = condition.pop("_custom_condition", None)
- condition_sql = " AND ".join([f"{key} = :{key}" for key in condition.keys()]) + (
- f" AND {custom_condition}" if custom_condition else ""
- )
+ condition_sql = " AND ".join(
+ [f"{key} = :{key}" for key in condition.keys()]
+ ) + (f" AND {custom_condition}" if custom_condition else "")
self._cursor.execute(
- f"SELECT {select_sql} FROM {table_name} WHERE {condition_sql}", condition
+ f"SELECT {select_sql} FROM {table_name} WHERE {condition_sql}",
+ condition,
)
- def _search_data(self, table_name: str, keys: list[str] | None = None, condition: dict = None) -> dict:
+ def _search_data(
+ self, table_name: str, keys: list[str] | None = None, condition: dict = None
+ ) -> dict:
if keys is None:
keys = self.__get_table_columns(table_name)
self._search(table_name, keys, condition)
return dict(zip(keys, self._cursor.fetchone()))
- def _search_datas(self, table_name: str, keys: list[str] | None = None, condition: dict = None) -> list[dict]:
+ def _search_datas(
+ self, table_name: str, keys: list[str] | None = None, condition: dict = None
+ ) -> list[dict]:
if keys is None:
keys = self.__get_table_columns(table_name)
self._search(table_name, keys, condition)
diff --git a/src/module/database/torrent.py b/backend/src/module/database/torrent.py
similarity index 100%
rename from src/module/database/torrent.py
rename to backend/src/module/database/torrent.py
diff --git a/src/module/database/user.py b/backend/src/module/database/user.py
similarity index 100%
rename from src/module/database/user.py
rename to backend/src/module/database/user.py
diff --git a/src/module/downloader/__init__.py b/backend/src/module/downloader/__init__.py
similarity index 100%
rename from src/module/downloader/__init__.py
rename to backend/src/module/downloader/__init__.py
diff --git a/src/module/downloader/client/__init__.py b/backend/src/module/downloader/client/__init__.py
similarity index 100%
rename from src/module/downloader/client/__init__.py
rename to backend/src/module/downloader/client/__init__.py
diff --git a/src/module/downloader/client/aria2_downloader.py b/backend/src/module/downloader/client/aria2_downloader.py
similarity index 100%
rename from src/module/downloader/client/aria2_downloader.py
rename to backend/src/module/downloader/client/aria2_downloader.py
diff --git a/src/module/downloader/client/qb_downloader.py b/backend/src/module/downloader/client/qb_downloader.py
similarity index 96%
rename from src/module/downloader/client/qb_downloader.py
rename to backend/src/module/downloader/client/qb_downloader.py
index fc5b622e..5ddedec2 100644
--- a/src/module/downloader/client/qb_downloader.py
+++ b/backend/src/module/downloader/client/qb_downloader.py
@@ -78,7 +78,9 @@ class QbDownloader:
@qb_connect_failed_wait
def torrents_info(self, status_filter, category, tag=None):
- return self._client.torrents_info(status_filter=status_filter, category=category, tag=tag)
+ return self._client.torrents_info(
+ status_filter=status_filter, category=category, tag=tag
+ )
def torrents_add(self, urls, save_path, category, torrent_files=None):
resp = self._client.torrents_add(
@@ -87,7 +89,7 @@ class QbDownloader:
torrent_files=torrent_files,
save_path=save_path,
category=category,
- use_auto_torrent_management=False
+ use_auto_torrent_management=False,
)
return resp == "Ok."
diff --git a/src/module/downloader/client/tr_downloader.py b/backend/src/module/downloader/client/tr_downloader.py
similarity index 100%
rename from src/module/downloader/client/tr_downloader.py
rename to backend/src/module/downloader/client/tr_downloader.py
diff --git a/src/module/downloader/exceptions.py b/backend/src/module/downloader/exceptions.py
similarity index 100%
rename from src/module/downloader/exceptions.py
rename to backend/src/module/downloader/exceptions.py
diff --git a/src/module/downloader/path.py b/backend/src/module/downloader/path.py
similarity index 100%
rename from src/module/downloader/path.py
rename to backend/src/module/downloader/path.py
diff --git a/src/module/manager/__init__.py b/backend/src/module/manager/__init__.py
similarity index 100%
rename from src/module/manager/__init__.py
rename to backend/src/module/manager/__init__.py
diff --git a/src/module/manager/collector.py b/backend/src/module/manager/collector.py
similarity index 88%
rename from src/module/manager/collector.py
rename to backend/src/module/manager/collector.py
index cff45d3f..86524221 100644
--- a/src/module/manager/collector.py
+++ b/backend/src/module/manager/collector.py
@@ -34,8 +34,12 @@ class SeasonCollector(DownloadClient):
torrents = st.get_torrents(link, _filter="|".join(data.filter))
torrent_files = None
if proxy:
- torrent_files = [st.get_content(torrent.torrent_link) for torrent in torrents]
- return self.add_season_torrents(data=data, torrents=torrents, torrent_files=torrent_files)
+ torrent_files = [
+ st.get_content(torrent.torrent_link) for torrent in torrents
+ ]
+ return self.add_season_torrents(
+ data=data, torrents=torrents, torrent_files=torrent_files
+ )
def subscribe_season(self, data: BangumiData):
with BangumiDatabase() as db:
@@ -57,5 +61,3 @@ def eps_complete():
sc.collect_season(data)
data.eps_collect = True
bd.update_list(datas)
-
-
diff --git a/src/module/manager/renamer.py b/backend/src/module/manager/renamer.py
similarity index 95%
rename from src/module/manager/renamer.py
rename to backend/src/module/manager/renamer.py
index 6cfc9b8b..9b04d145 100644
--- a/src/module/manager/renamer.py
+++ b/backend/src/module/manager/renamer.py
@@ -38,9 +38,7 @@ class Renamer(DownloadClient):
elif method == "advance":
return f"{bangumi_name} S{season}E{episode}{file_info.suffix}"
elif method == "normal":
- logger.warning(
- "[Renamer] Normal rename method is deprecated."
- )
+ logger.warning("[Renamer] Normal rename method is deprecated.")
return file_info.media_path
elif method == "subtitle_pn":
return f"{file_info.title} S{season}E{episode}.{file_info.language}{file_info.suffix}"
@@ -73,10 +71,10 @@ class Renamer(DownloadClient):
)
if renamed:
n = Notification(
- official_title=bangumi_name,
- season=ep.season,
- episode=ep.episode,
- )
+ official_title=bangumi_name,
+ season=ep.season,
+ episode=ep.episode,
+ )
return n
else:
logger.warning(f"[Renamer] {media_path} parse failed")
@@ -178,6 +176,7 @@ class Renamer(DownloadClient):
if __name__ == "__main__":
from module.conf import setup_logger
+
settings.log.debug_enable = True
setup_logger()
with Renamer() as renamer:
diff --git a/src/module/manager/torrent.py b/backend/src/module/manager/torrent.py
similarity index 65%
rename from src/module/manager/torrent.py
rename to backend/src/module/manager/torrent.py
index 6d43be6f..a11bb899 100644
--- a/src/module/manager/torrent.py
+++ b/backend/src/module/manager/torrent.py
@@ -14,7 +14,9 @@ class TorrentManager(BangumiDatabase):
def __match_torrents_list(data: BangumiData) -> list:
with DownloadClient() as client:
torrents = client.get_torrent_info(status_filter=None)
- return [torrent.hash for torrent in torrents if torrent.save_path == data.save_path]
+ return [
+ torrent.hash for torrent in torrents if torrent.save_path == data.save_path
+ ]
def delete_torrents(self, data: BangumiData, client: DownloadClient):
hash_list = self.__match_torrents_list(data)
@@ -34,17 +36,21 @@ class TorrentManager(BangumiDatabase):
self.delete_one(int(_id))
if file:
torrent_message = self.delete_torrents(data, client)
- return JSONResponse(status_code=200, content={
- "msg": f"Delete {data.official_title} rule. {torrent_message}"
- })
+ return JSONResponse(
+ status_code=200,
+ content={
+ "msg": f"Delete {data.official_title} rule. {torrent_message}"
+ },
+ )
logger.info(f"[Manager] Delete rule for {data.official_title}")
- return JSONResponse(status_code=200, content={
- "msg": f"Delete rule for {data.official_title}"
- })
+ return JSONResponse(
+ status_code=200,
+ content={"msg": f"Delete rule for {data.official_title}"},
+ )
else:
- return JSONResponse(status_code=406, content={
- "msg": f"Can't find id {_id}"
- })
+ return JSONResponse(
+ status_code=406, content={"msg": f"Can't find id {_id}"}
+ )
def disable_rule(self, _id: str | int, file: bool = False):
data = self.search_id(int(_id))
@@ -55,17 +61,23 @@ class TorrentManager(BangumiDatabase):
self.update_one(data)
if file:
torrent_message = self.delete_torrents(data, client)
- return JSONResponse(status_code=200, content={
- "msg": f"Disable {data.official_title} rule. {torrent_message}"
- })
+ return JSONResponse(
+ status_code=200,
+ content={
+ "msg": f"Disable {data.official_title} rule. {torrent_message}"
+ },
+ )
logger.info(f"[Manager] Disable rule for {data.official_title}")
- return JSONResponse(status_code=200, content={
- "msg": f"Disable {data.official_title} rule.",
- })
+ return JSONResponse(
+ status_code=200,
+ content={
+ "msg": f"Disable {data.official_title} rule.",
+ },
+ )
else:
- return JSONResponse(status_code=406, content={
- "msg": f"Can't find id {_id}"
- })
+ return JSONResponse(
+ status_code=406, content={"msg": f"Can't find id {_id}"}
+ )
def enable_rule(self, _id: str | int):
data = self.search_id(int(_id))
@@ -75,21 +87,24 @@ class TorrentManager(BangumiDatabase):
with DownloadClient() as client:
client.set_rule(data)
logger.info(f"[Manager] Enable rule for {data.official_title}")
- return JSONResponse(status_code=200, content={
- "msg": f"Enable {data.official_title} rule.",
- })
+ return JSONResponse(
+ status_code=200,
+ content={
+ "msg": f"Enable {data.official_title} rule.",
+ },
+ )
else:
- return JSONResponse(status_code=406, content={
- "msg": f"Can't find bangumi id {_id}"
- })
+ return JSONResponse(
+ status_code=406, content={"msg": f"Can't find bangumi id {_id}"}
+ )
def update_rule(self, data: BangumiData):
old_data = self.search_id(data.id)
if not old_data:
logger.error(f"[Manager] Can't find data with {data.id}")
- return JSONResponse(status_code=406, content={
- "msg": f"Can't find data with {data.id}"
- })
+ return JSONResponse(
+ status_code=406, content={"msg": f"Can't find data with {data.id}"}
+ )
else:
# Move torrent
match_list = self.__match_torrents_list(data)
@@ -101,9 +116,12 @@ class TorrentManager(BangumiDatabase):
client.remove_rule(data.rule_name)
client.set_rule(data)
self.update_one(data)
- return JSONResponse(status_code=200, content={
- "msg": f"Set new path for {data.official_title}",
- })
+ return JSONResponse(
+ status_code=200,
+ content={
+ "msg": f"Set new path for {data.official_title}",
+ },
+ )
def search_all_bangumi(self):
datas = self.search_all()
diff --git a/src/module/models/__init__.py b/backend/src/module/models/__init__.py
similarity index 100%
rename from src/module/models/__init__.py
rename to backend/src/module/models/__init__.py
diff --git a/src/module/models/api.py b/backend/src/module/models/api.py
similarity index 100%
rename from src/module/models/api.py
rename to backend/src/module/models/api.py
diff --git a/src/module/models/bangumi.py b/backend/src/module/models/bangumi.py
similarity index 100%
rename from src/module/models/bangumi.py
rename to backend/src/module/models/bangumi.py
diff --git a/src/module/models/config.py b/backend/src/module/models/config.py
similarity index 100%
rename from src/module/models/config.py
rename to backend/src/module/models/config.py
diff --git a/src/module/models/torrent.py b/backend/src/module/models/torrent.py
similarity index 100%
rename from src/module/models/torrent.py
rename to backend/src/module/models/torrent.py
diff --git a/src/module/models/user.py b/backend/src/module/models/user.py
similarity index 100%
rename from src/module/models/user.py
rename to backend/src/module/models/user.py
diff --git a/src/module/network/__init__.py b/backend/src/module/network/__init__.py
similarity index 100%
rename from src/module/network/__init__.py
rename to backend/src/module/network/__init__.py
diff --git a/src/module/network/request_contents.py b/backend/src/module/network/request_contents.py
similarity index 93%
rename from src/module/network/request_contents.py
rename to backend/src/module/network/request_contents.py
index 0c2096b6..77c074df 100644
--- a/src/module/network/request_contents.py
+++ b/backend/src/module/network/request_contents.py
@@ -51,7 +51,11 @@ class RequestContent(RequestURL):
torrent_titles, torrent_urls, torrent_homepage
):
if re.search(_filter, _title) is None:
- torrents.append(TorrentInfo(name=_title, torrent_link=torrent_url, homepage=homepage))
+ torrents.append(
+ TorrentInfo(
+ name=_title, torrent_link=torrent_url, homepage=homepage
+ )
+ )
return torrents
except ConnectionError:
return []
diff --git a/src/module/network/request_url.py b/backend/src/module/network/request_url.py
similarity index 92%
rename from src/module/network/request_url.py
rename to backend/src/module/network/request_url.py
index 16da3d4c..f4b65e7d 100644
--- a/src/module/network/request_url.py
+++ b/backend/src/module/network/request_url.py
@@ -23,7 +23,9 @@ class RequestURL:
req.raise_for_status()
return req
except requests.RequestException:
- logger.warning(f"[Network] Cannot connect to {url}. Wait for 5 seconds.")
+ logger.warning(
+ f"[Network] Cannot connect to {url}. Wait for 5 seconds."
+ )
try_time += 1
if try_time >= retry:
break
@@ -45,7 +47,9 @@ class RequestURL:
req.raise_for_status()
return req
except requests.RequestException:
- logger.warning(f"[Network] Cannot connect to {url}. Wait for 5 seconds.")
+ logger.warning(
+ f"[Network] Cannot connect to {url}. Wait for 5 seconds."
+ )
try_time += 1
if try_time >= retry:
break
diff --git a/backend/src/module/network/site/__init__.py b/backend/src/module/network/site/__init__.py
new file mode 100644
index 00000000..70f16f74
--- /dev/null
+++ b/backend/src/module/network/site/__init__.py
@@ -0,0 +1 @@
+from .mikan import mikan_parser
diff --git a/src/module/network/site/mikan.py b/backend/src/module/network/site/mikan.py
similarity index 84%
rename from src/module/network/site/mikan.py
rename to backend/src/module/network/site/mikan.py
index 5a326925..0ad4314b 100644
--- a/src/module/network/site/mikan.py
+++ b/backend/src/module/network/site/mikan.py
@@ -6,4 +6,4 @@ def mikan_parser(soup):
torrent_titles.append(item.find("title").text)
torrent_urls.append(item.find("enclosure").attrib["url"])
torrent_homepage.append(item.find("link").text)
- return torrent_titles, torrent_urls, torrent_homepage
\ No newline at end of file
+ return torrent_titles, torrent_urls, torrent_homepage
diff --git a/backend/src/module/notification/__init__.py b/backend/src/module/notification/__init__.py
new file mode 100644
index 00000000..e6a713ae
--- /dev/null
+++ b/backend/src/module/notification/__init__.py
@@ -0,0 +1 @@
+from .notification import PostNotification
diff --git a/src/module/notification/notification.py b/backend/src/module/notification/notification.py
similarity index 95%
rename from src/module/notification/notification.py
rename to backend/src/module/notification/notification.py
index a59230b7..a4bd7c72 100644
--- a/src/module/notification/notification.py
+++ b/backend/src/module/notification/notification.py
@@ -27,8 +27,7 @@ class PostNotification:
def __init__(self):
Notifier = getClient(settings.notification.type)
self.notifier = Notifier(
- token=settings.notification.token,
- chat_id=settings.notification.chat_id
+ token=settings.notification.token, chat_id=settings.notification.chat_id
)
@staticmethod
diff --git a/src/module/notification/plugin/__init__.py b/backend/src/module/notification/plugin/__init__.py
similarity index 77%
rename from src/module/notification/plugin/__init__.py
rename to backend/src/module/notification/plugin/__init__.py
index ece03d58..e9acda8f 100644
--- a/src/module/notification/plugin/__init__.py
+++ b/backend/src/module/notification/plugin/__init__.py
@@ -1,4 +1,4 @@
from .bark import BarkNotification
from .server_chan import ServerChanNotification
from .telegram import TelegramNotification
-from .wecom import WecomNotification
\ No newline at end of file
+from .wecom import WecomNotification
diff --git a/src/module/notification/plugin/bark.py b/backend/src/module/notification/plugin/bark.py
similarity index 100%
rename from src/module/notification/plugin/bark.py
rename to backend/src/module/notification/plugin/bark.py
diff --git a/src/module/notification/plugin/server_chan.py b/backend/src/module/notification/plugin/server_chan.py
similarity index 100%
rename from src/module/notification/plugin/server_chan.py
rename to backend/src/module/notification/plugin/server_chan.py
diff --git a/src/module/notification/plugin/slack.py b/backend/src/module/notification/plugin/slack.py
similarity index 95%
rename from src/module/notification/plugin/slack.py
rename to backend/src/module/notification/plugin/slack.py
index af4a0d83..f4da8a2d 100644
--- a/src/module/notification/plugin/slack.py
+++ b/backend/src/module/notification/plugin/slack.py
@@ -24,4 +24,4 @@ class SlackNotification(RequestContent):
data = {"title": notify.official_title, "body": text, "device_key": self.token}
resp = self.post_data(self.notification_url, data)
logger.debug(f"Bark notification: {resp.status_code}")
- return resp.status_code == 200
\ No newline at end of file
+ return resp.status_code == 200
diff --git a/src/module/notification/plugin/telegram.py b/backend/src/module/notification/plugin/telegram.py
similarity index 100%
rename from src/module/notification/plugin/telegram.py
rename to backend/src/module/notification/plugin/telegram.py
diff --git a/src/module/notification/plugin/wecom.py b/backend/src/module/notification/plugin/wecom.py
similarity index 87%
rename from src/module/notification/plugin/wecom.py
rename to backend/src/module/notification/plugin/wecom.py
index 11a63a75..dbd906c4 100644
--- a/src/module/notification/plugin/wecom.py
+++ b/backend/src/module/notification/plugin/wecom.py
@@ -11,7 +11,7 @@ class WecomNotification(RequestContent):
def __init__(self, token, chat_id, **kwargs):
super().__init__()
- #Chat_id is used as noti_url in this push tunnel
+ # Chat_id is used as noti_url in this push tunnel
self.notification_url = f"{chat_id}"
self.token = token
@@ -27,15 +27,15 @@ class WecomNotification(RequestContent):
title = "【番剧更新】" + notify.official_title
msg = self.gen_message(notify)
picurl = notify.poster_path
- #Default pic to avoid blank in message. Resolution:1068*455
+ # Default pic to avoid blank in message. Resolution:1068*455
if picurl == "https://mikanani.me":
picurl = "https://article.biliimg.com/bfs/article/d8bcd0408bf32594fd82f27de7d2c685829d1b2e.png"
data = {
- "key":self.token,
+ "key": self.token,
"type": "news",
"title": title,
"msg": msg,
- "picurl":picurl
+ "picurl": picurl,
}
resp = self.post_data(self.notification_url, data)
logger.debug(f"Wecom notification: {resp.status_code}")
diff --git a/src/module/parser/__init__.py b/backend/src/module/parser/__init__.py
similarity index 100%
rename from src/module/parser/__init__.py
rename to backend/src/module/parser/__init__.py
diff --git a/src/module/parser/analyser/__init__.py b/backend/src/module/parser/analyser/__init__.py
similarity index 100%
rename from src/module/parser/analyser/__init__.py
rename to backend/src/module/parser/analyser/__init__.py
diff --git a/src/module/parser/analyser/bgm_parser.py b/backend/src/module/parser/analyser/bgm_parser.py
similarity index 100%
rename from src/module/parser/analyser/bgm_parser.py
rename to backend/src/module/parser/analyser/bgm_parser.py
diff --git a/src/module/parser/analyser/tmdb_parser.py b/backend/src/module/parser/analyser/tmdb_parser.py
similarity index 69%
rename from src/module/parser/analyser/tmdb_parser.py
rename to backend/src/module/parser/analyser/tmdb_parser.py
index b3d206c3..7762c95a 100644
--- a/src/module/parser/analyser/tmdb_parser.py
+++ b/backend/src/module/parser/analyser/tmdb_parser.py
@@ -16,16 +16,14 @@ class TMDBInfo:
year: str
-LANGUAGE = {
- "zh": "zh-CN",
- "jp": "ja-JP",
- "en": "en-US"
-}
+LANGUAGE = {"zh": "zh-CN", "jp": "ja-JP", "en": "en-US"}
-search_url = lambda e: \
- f"https://api.themoviedb.org/3/search/tv?api_key={TMDB_API}&page=1&query={e}&include_adult=false"
-info_url = lambda e, key: \
- f"https://api.themoviedb.org/3/tv/{e}?api_key={TMDB_API}&language={LANGUAGE[key]}"
+search_url = (
+ lambda e: f"https://api.themoviedb.org/3/search/tv?api_key={TMDB_API}&page=1&query={e}&include_adult=false"
+)
+info_url = (
+ lambda e, key: f"https://api.themoviedb.org/3/tv/{e}?api_key={TMDB_API}&language={LANGUAGE[key]}"
+)
def is_animation(tv_id, language) -> bool:
@@ -43,7 +41,7 @@ def get_season(seasons: list) -> int:
for season in ss:
if re.search(r"第 \d 季", season.get("season")) is not None:
date = season.get("air_date").split("-")
- [year, _ , _] = date
+ [year, _, _] = date
now_year = time.localtime().tm_year
if int(year) <= now_year:
return int(re.findall(r"\d", season.get("season"))[0])
@@ -64,16 +62,30 @@ def tmdb_parser(title, language) -> TMDBInfo | None:
break
url_info = info_url(id, language)
info_content = req.get_json(url_info)
- season = [{"season": s.get("name"), "air_date": s.get("air_date"), "poster_path": s.get("poster_path")} for s in info_content.get("seasons")]
+ season = [
+ {
+ "season": s.get("name"),
+ "air_date": s.get("air_date"),
+ "poster_path": s.get("poster_path"),
+ }
+ for s in info_content.get("seasons")
+ ]
last_season = get_season(season)
original_title = info_content.get("original_name")
official_title = info_content.get("name")
year_number = info_content.get("first_air_date").split("-")[0]
- return TMDBInfo(id, official_title, original_title, season, last_season, str(year_number))
+ return TMDBInfo(
+ id,
+ official_title,
+ original_title,
+ season,
+ last_season,
+ str(year_number),
+ )
else:
return None
-if __name__ == '__main__':
+if __name__ == "__main__":
title = "海盗战记"
print(tmdb_parser(title, "zh").last_season)
diff --git a/src/module/parser/analyser/torrent_parser.py b/backend/src/module/parser/analyser/torrent_parser.py
similarity index 100%
rename from src/module/parser/analyser/torrent_parser.py
rename to backend/src/module/parser/analyser/torrent_parser.py
diff --git a/src/module/parser/openai.py b/backend/src/module/parser/openai.py
similarity index 100%
rename from src/module/parser/openai.py
rename to backend/src/module/parser/openai.py
diff --git a/src/module/parser/title_parser.py b/backend/src/module/parser/title_parser.py
similarity index 100%
rename from src/module/parser/title_parser.py
rename to backend/src/module/parser/title_parser.py
diff --git a/src/module/rss/__init__.py b/backend/src/module/rss/__init__.py
similarity index 100%
rename from src/module/rss/__init__.py
rename to backend/src/module/rss/__init__.py
diff --git a/src/module/rss/analyser.py b/backend/src/module/rss/analyser.py
similarity index 93%
rename from src/module/rss/analyser.py
rename to backend/src/module/rss/analyser.py
index 9ae35b37..7cc52083 100644
--- a/src/module/rss/analyser.py
+++ b/backend/src/module/rss/analyser.py
@@ -61,7 +61,9 @@ class RSSAnalyser:
logger.debug(f"[RSS] New title found: {data.official_title}")
return new_data
- def torrent_to_data(self, torrent: TorrentInfo, rss_link: str | None = None) -> BangumiData:
+ def torrent_to_data(
+ self, torrent: TorrentInfo, rss_link: str | None = None
+ ) -> BangumiData:
data = self._title_analyser.raw_parser(raw=torrent.name, rss_link=rss_link)
if data:
try:
@@ -75,7 +77,9 @@ class RSSAnalyser:
self.official_title_parser(data, mikan_title)
return data
- def rss_to_data(self, rss_link: str, database: BangumiDatabase, full_parse: bool = True) -> list[BangumiData]:
+ def rss_to_data(
+ self, rss_link: str, database: BangumiDatabase, full_parse: bool = True
+ ) -> list[BangumiData]:
rss_torrents = self.get_rss_torrents(rss_link, full_parse)
torrents_to_add = database.match_list(rss_torrents, rss_link)
if not torrents_to_add:
diff --git a/src/module/rss/filter.py b/backend/src/module/rss/filter.py
similarity index 100%
rename from src/module/rss/filter.py
rename to backend/src/module/rss/filter.py
diff --git a/src/module/rss/searcher.py b/backend/src/module/rss/searcher.py
similarity index 100%
rename from src/module/rss/searcher.py
rename to backend/src/module/rss/searcher.py
diff --git a/src/module/searcher/__init__.py b/backend/src/module/searcher/__init__.py
similarity index 100%
rename from src/module/searcher/__init__.py
rename to backend/src/module/searcher/__init__.py
diff --git a/src/module/searcher/plugin/__init__.py b/backend/src/module/searcher/plugin/__init__.py
similarity index 100%
rename from src/module/searcher/plugin/__init__.py
rename to backend/src/module/searcher/plugin/__init__.py
diff --git a/src/module/searcher/plugin/mikan.py b/backend/src/module/searcher/plugin/mikan.py
similarity index 100%
rename from src/module/searcher/plugin/mikan.py
rename to backend/src/module/searcher/plugin/mikan.py
diff --git a/src/module/searcher/searcher.py b/backend/src/module/searcher/searcher.py
similarity index 87%
rename from src/module/searcher/searcher.py
rename to backend/src/module/searcher/searcher.py
index 621022eb..ad46f664 100644
--- a/src/module/searcher/searcher.py
+++ b/backend/src/module/searcher/searcher.py
@@ -13,7 +13,9 @@ SEARCH_KEY = [
class SearchTorrent(RequestContent):
- def search_torrents(self, keywords: list[str], site: str = "mikan") -> list[TorrentBase]:
+ def search_torrents(
+ self, keywords: list[str], site: str = "mikan"
+ ) -> list[TorrentBase]:
url = search_url(site, keywords)
# TorrentInfo to TorrentBase
torrents = self.get_torrents(url)
@@ -25,6 +27,7 @@ class SearchTorrent(RequestContent):
"torrent_link": torrent.torrent_link,
"homepage": torrent.homepage,
}
+
return [TorrentBase(**d) for d in to_dict()]
def search_season(self, data: BangumiData):
@@ -33,7 +36,7 @@ class SearchTorrent(RequestContent):
return [torrent for torrent in torrents if data.title_raw in torrent.name]
-if __name__ == '__main__':
+if __name__ == "__main__":
with SearchTorrent() as st:
for t in st.search_torrents(["魔法科高校の劣等生"]):
- print(t)
\ No newline at end of file
+ print(t)
diff --git a/src/module/security/__init__.py b/backend/src/module/security/__init__.py
similarity index 100%
rename from src/module/security/__init__.py
rename to backend/src/module/security/__init__.py
diff --git a/src/module/security/api.py b/backend/src/module/security/api.py
similarity index 100%
rename from src/module/security/api.py
rename to backend/src/module/security/api.py
diff --git a/src/module/security/jwt.py b/backend/src/module/security/jwt.py
similarity index 100%
rename from src/module/security/jwt.py
rename to backend/src/module/security/jwt.py
diff --git a/src/module/update/__init__.py b/backend/src/module/update/__init__.py
similarity index 100%
rename from src/module/update/__init__.py
rename to backend/src/module/update/__init__.py
diff --git a/src/module/update/data_migration.py b/backend/src/module/update/data_migration.py
similarity index 100%
rename from src/module/update/data_migration.py
rename to backend/src/module/update/data_migration.py
diff --git a/src/module/utils/__init__.py b/backend/src/module/utils/__init__.py
similarity index 100%
rename from src/module/utils/__init__.py
rename to backend/src/module/utils/__init__.py
diff --git a/src/module/utils/bangumi_data.py b/backend/src/module/utils/bangumi_data.py
similarity index 100%
rename from src/module/utils/bangumi_data.py
rename to backend/src/module/utils/bangumi_data.py
diff --git a/src/module/utils/json_config.py b/backend/src/module/utils/json_config.py
similarity index 100%
rename from src/module/utils/json_config.py
rename to backend/src/module/utils/json_config.py
diff --git a/src/test/__init__.py b/backend/src/test/__init__.py
similarity index 100%
rename from src/test/__init__.py
rename to backend/src/test/__init__.py
diff --git a/src/test/test_raw_parser.py b/backend/src/test/test_raw_parser.py
similarity index 99%
rename from src/test/test_raw_parser.py
rename to backend/src/test/test_raw_parser.py
index f09f1aae..b4c3b446 100644
--- a/src/test/test_raw_parser.py
+++ b/backend/src/test/test_raw_parser.py
@@ -69,4 +69,3 @@ def test_raw_parser():
assert info.resolution == "720P"
assert info.episode == 5
assert info.season == 1
-
diff --git a/src/test/test_torrent_parser.py b/backend/src/test/test_torrent_parser.py
similarity index 100%
rename from src/test/test_torrent_parser.py
rename to backend/src/test/test_torrent_parser.py
diff --git a/docs/wiki b/docs/wiki
index d0bb98f0..519e381e 160000
--- a/docs/wiki
+++ b/docs/wiki
@@ -1 +1 @@
-Subproject commit d0bb98f004fb292519dd56c42238ecb2f034eac9
+Subproject commit 519e381e8a1add62e76a39181ee61bad02816035
diff --git a/pyrightconfig.json b/pyrightconfig.json
new file mode 100644
index 00000000..4521b494
--- /dev/null
+++ b/pyrightconfig.json
@@ -0,0 +1,8 @@
+{
+ "pythonPath": "/opt/homebrew/Caskroom/miniforge/base/envs/auto_bangumi/bin/python",
+ "root": "backend/src",
+ "venvPath": "/opt/homebrew/Caskroom/miniforge/base/envs",
+ "venv": "auto_bangumi",
+ "typeCheckingMode": "basic",
+ "reportMissingImports": true
+}
diff --git a/src/module/network/site/__init__.py b/src/module/network/site/__init__.py
deleted file mode 100644
index 04b8a615..00000000
--- a/src/module/network/site/__init__.py
+++ /dev/null
@@ -1 +0,0 @@
-from .mikan import mikan_parser
\ No newline at end of file
diff --git a/src/module/notification/__init__.py b/src/module/notification/__init__.py
deleted file mode 100644
index dbd1ac93..00000000
--- a/src/module/notification/__init__.py
+++ /dev/null
@@ -1 +0,0 @@
-from .notification import PostNotification
\ No newline at end of file
From ea698f4c5aa12b05fd1c4185d914c83b859b9f4b Mon Sep 17 00:00:00 2001
From: EstrellaXD
Date: Wed, 28 Jun 2023 16:17:51 +0800
Subject: [PATCH 10/31] refactor: mv file from src to backend/src
---
{src => backend/src}/module/downloader/download_client.py | 6 ++++--
{src => backend/src}/module/parser/analyser/raw_parser.py | 2 +-
2 files changed, 5 insertions(+), 3 deletions(-)
rename {src => backend/src}/module/downloader/download_client.py (97%)
rename {src => backend/src}/module/parser/analyser/raw_parser.py (99%)
diff --git a/src/module/downloader/download_client.py b/backend/src/module/downloader/download_client.py
similarity index 97%
rename from src/module/downloader/download_client.py
rename to backend/src/module/downloader/download_client.py
index c30c1cd3..ca7cfbd9 100644
--- a/src/module/downloader/download_client.py
+++ b/backend/src/module/downloader/download_client.py
@@ -99,7 +99,9 @@ class DownloadClient(TorrentPath):
logger.debug("[Downloader] Finished.")
def get_torrent_info(self, category="Bangumi", status_filter="completed", tag=None):
- return self.client.torrents_info(status_filter=status_filter, category=category, tag=tag)
+ return self.client.torrents_info(
+ status_filter=status_filter, category=category, tag=tag
+ )
def rename_torrent_file(self, _hash, old_path, new_path) -> bool:
logger.info(f"{old_path} >> {new_path}")
@@ -116,7 +118,7 @@ class DownloadClient(TorrentPath):
urls=torrent.get("urls"),
torrent_files=torrent.get("torrent_files"),
save_path=torrent.get("save_path"),
- category="Bangumi"
+ category="Bangumi",
):
logger.debug(f"[Downloader] Add torrent: {torrent.get('save_path')}")
return True
diff --git a/src/module/parser/analyser/raw_parser.py b/backend/src/module/parser/analyser/raw_parser.py
similarity index 99%
rename from src/module/parser/analyser/raw_parser.py
rename to backend/src/module/parser/analyser/raw_parser.py
index 22ab8a38..5de06089 100644
--- a/src/module/parser/analyser/raw_parser.py
+++ b/backend/src/module/parser/analyser/raw_parser.py
@@ -181,6 +181,6 @@ def raw_parser(raw: str) -> Episode | None:
)
-if __name__ == '__main__':
+if __name__ == "__main__":
title = "[动漫国字幕组&LoliHouse] THE MARGINAL SERVICE - 08 [WebRip 1080p HEVC-10bit AAC][简繁内封字幕]"
print(raw_parser(title))
From f28195eb609754b3076171b9148ac43f265127c8 Mon Sep 17 00:00:00 2001
From: EstrellaXD
Date: Wed, 28 Jun 2023 16:19:47 +0800
Subject: [PATCH 11/31] fix: ci
---
.github/workflows/docker.yml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml
index 110b0185..fdd527da 100644
--- a/.github/workflows/docker.yml
+++ b/.github/workflows/docker.yml
@@ -22,7 +22,7 @@ jobs:
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
pip install pytest
- name: Test
- working-directory: ./src
+ working-directory: ./backend/src
run: |
mkdir -p config
pytest
@@ -35,7 +35,7 @@ jobs:
- name: Checkout
uses: actions/checkout@v3
- name: Create Version info
- working-directory: ./src
+ working-directory: ./backend/src
run: |
echo "VERSION = '$GITHUB_REF_NAME'" > module/__version__.py
From 8ab42bf3c9423dce45b9c00c05e10dcd7c16796f Mon Sep 17 00:00:00 2001
From: EstrellaXD
Date: Thu, 29 Jun 2023 14:40:10 +0800
Subject: [PATCH 12/31] fix: fix #354
---
backend/src/module/parser/analyser/tmdb_parser.py | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/backend/src/module/parser/analyser/tmdb_parser.py b/backend/src/module/parser/analyser/tmdb_parser.py
index 7762c95a..879dae68 100644
--- a/backend/src/module/parser/analyser/tmdb_parser.py
+++ b/backend/src/module/parser/analyser/tmdb_parser.py
@@ -37,7 +37,8 @@ def is_animation(tv_id, language) -> bool:
def get_season(seasons: list) -> int:
- ss = sorted(seasons, key=lambda e: e.get("air_date"), reverse=True)
+ ss = [s for s in seasons if s["air_date"] is not None]
+ ss = sorted(ss, key=lambda e: e.get("air_date"), reverse=True)
for season in ss:
if re.search(r"第 \d 季", season.get("season")) is not None:
date = season.get("air_date").split("-")
@@ -84,8 +85,3 @@ def tmdb_parser(title, language) -> TMDBInfo | None:
)
else:
return None
-
-
-if __name__ == "__main__":
- title = "海盗战记"
- print(tmdb_parser(title, "zh").last_season)
From cf8cd87de7787034a37d37da161ed89192bbcaf6 Mon Sep 17 00:00:00 2001
From: EstrellaXD
Date: Thu, 29 Jun 2023 14:46:04 +0800
Subject: [PATCH 13/31] fix: fix #345
---
backend/src/module/security/api.py | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/backend/src/module/security/api.py b/backend/src/module/security/api.py
index 14282171..810ff15e 100644
--- a/backend/src/module/security/api.py
+++ b/backend/src/module/security/api.py
@@ -3,6 +3,7 @@ from fastapi.security import OAuth2PasswordBearer
from .jwt import verify_token
+
from module.database.user import AuthDB
from module.models.user import User
@@ -14,7 +15,12 @@ async def get_current_user(token: str = Depends(oauth2_scheme)):
raise HTTPException(
status_code=status.HTTP_401_UNAUTHORIZED, detail="invalid token"
)
- payload = verify_token(token)
+ try:
+ payload = verify_token(token)
+ except Exception:
+ raise HTTPException(
+ status_code=status.HTTP_401_UNAUTHORIZED, detail="invalid token"
+ )
if not payload:
raise HTTPException(
status_code=status.HTTP_401_UNAUTHORIZED, detail="invalid token"
From 32a2f8bf03eb7d1e8c0e6d9a4e878bdbb6080aae Mon Sep 17 00:00:00 2001
From: EstrellaXD
Date: Thu, 29 Jun 2023 17:38:03 +0800
Subject: [PATCH 14/31] change: update issue template
---
.github/ISSUE_TEMPLATE/bug_report.yml | 2 +-
.github/ISSUE_TEMPLATE/discussion.yml | 2 +-
.github/ISSUE_TEMPLATE/feature_request.yml | 2 +-
.github/ISSUE_TEMPLATE/rfc.yml | 2 +-
4 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml
index 14514ac3..3c4253bb 100644
--- a/.github/ISSUE_TEMPLATE/bug_report.yml
+++ b/.github/ISSUE_TEMPLATE/bug_report.yml
@@ -1,6 +1,6 @@
name: 问题反馈
description: File a bug report
-title: "[错误报告] 请在此处简单描述你的问题"
+title: "[错误报告]请在此处简单描述你的问题"
labels: ["bug"]
body:
- type: markdown
diff --git a/.github/ISSUE_TEMPLATE/discussion.yml b/.github/ISSUE_TEMPLATE/discussion.yml
index 26f18ef6..6c50712c 100644
--- a/.github/ISSUE_TEMPLATE/discussion.yml
+++ b/.github/ISSUE_TEMPLATE/discussion.yml
@@ -1,6 +1,6 @@
name: 项目讨论
description: discussion
-title: "[Discussion]: "
+title: "[Discussion] "
labels: ["discussion"]
body:
- type: markdown
diff --git a/.github/ISSUE_TEMPLATE/feature_request.yml b/.github/ISSUE_TEMPLATE/feature_request.yml
index bec710d0..c1572144 100644
--- a/.github/ISSUE_TEMPLATE/feature_request.yml
+++ b/.github/ISSUE_TEMPLATE/feature_request.yml
@@ -1,6 +1,6 @@
name: 功能改进
description: Feature Request
-title: "[Feature Request]: "
+title: "[Feature Request]"
labels: ["feature request"]
body:
- type: markdown
diff --git a/.github/ISSUE_TEMPLATE/rfc.yml b/.github/ISSUE_TEMPLATE/rfc.yml
index 9df703ac..78b4790c 100644
--- a/.github/ISSUE_TEMPLATE/rfc.yml
+++ b/.github/ISSUE_TEMPLATE/rfc.yml
@@ -2,7 +2,7 @@
name: 功能提案
description: Request for Comments
-title: "[RFC]: "
+title: "[RFC]"
labels: ["RFC"]
body:
- type: markdown
From 340198433adec40d879badc5dc63a9d1702f8bd2 Mon Sep 17 00:00:00 2001
From: EstrellaXD
Date: Thu, 29 Jun 2023 20:23:11 +0800
Subject: [PATCH 15/31] change: update pr workflow
---
.github/workflows/release.yml | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 7b6661ea..a4a2b4dd 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -12,7 +12,8 @@ jobs:
runs-on: ubuntu-latest
if: >
github.event.pull_request.merged == true &&
- github.event.pull_request.base.ref == 'main'
+ github.event.pull_request.base.ref == 'main' &&
+ github.event.pull_request.title =~ '^v(\d+\.\d+\.\d+)$'
steps:
- name: Checkout code
uses: actions/checkout@v2
From 8a990830b2b54debb2125e0719af0548f2ff255f Mon Sep 17 00:00:00 2001
From: Estrella Pan <33726646+EstrellaXD@users.noreply.github.com>
Date: Thu, 29 Jun 2023 20:29:01 +0800
Subject: [PATCH 16/31] Merge pull request #363 from zthxxx/main
docs: add contributing docs
(cherry picked from commit def02fb53e9096845bf3615e8c00c9a48e295f6c)
---
.github/ISSUE_TEMPLATE/rfc.yml | 7 +-
CONTRIBUTING.md | 180 +++++++++++++++++++++++++++++++++
2 files changed, 183 insertions(+), 4 deletions(-)
create mode 100644 CONTRIBUTING.md
diff --git a/.github/ISSUE_TEMPLATE/rfc.yml b/.github/ISSUE_TEMPLATE/rfc.yml
index 78b4790c..6b3b8aad 100644
--- a/.github/ISSUE_TEMPLATE/rfc.yml
+++ b/.github/ISSUE_TEMPLATE/rfc.yml
@@ -9,13 +9,12 @@ body:
attributes:
value: |
一份提案(RFC)定位为 **「在某功能/重构的具体开发前,用于开发者间 review 技术设计/方案的文档」**,
- 目的是让协作的开发者间清晰的知道「要做什么」和「具体会怎么做」,
+ 目的是让协作的开发者间清晰的知道「要做什么」和「具体会怎么做」,以及所有的开发者都能公开透明的参与讨论;
以便评估和讨论产生的影响 (遗漏的考虑、向后兼容性、与现有功能的冲突),
因此提案侧重在对解决问题的 **方案、设计、步骤** 的描述上。
- 如果仅希望讨论是否添加或
- 改进某功能本身,请使用 -> [Issue: 功能改进](https://github.com/EstrellaXD/Auto_Bangumi/issues/new?labels=feature+request&template=feature_request.yml&title=%5BFeature+Request%5D+)
-
+ 如果仅希望讨论是否添加或改进某功能本身,请使用 -> [Issue: 功能改进](https://github.com/EstrellaXD/Auto_Bangumi/issues/new?labels=feature+request&template=feature_request.yml&title=%5BFeature+Request%5D+)
+
- type: textarea
id: background
attributes:
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
new file mode 100644
index 00000000..3fa9266d
--- /dev/null
+++ b/CONTRIBUTING.md
@@ -0,0 +1,180 @@
+# 贡献指南 Contributing
+
+我们欢迎各位 Contributors 参与贡献帮助 AutoBangumi 更好的解决大家遇到的问题,
+
+这篇指南会指导你如何为 AutoBangumi 贡献功能修复代码,可以在你要提出 Pull Request 之前花几分钟来阅读一遍这篇指南。
+
+这篇文章包含什么?
+
+- [项目规划 Roadmap](#项目规划-roadmap)
+ - [提案寻求共识 Request for Comments](#提案寻求共识-request-for-comments)
+- [分支管理 Git Branch](#分支管理-git-branch)
+ - [版本号](#版本号)
+ - [分支开发,主干发布](#分支开发主干发布)
+ - [Branch 生命周期](#branch-生命周期)
+ - [Git Workflow 一览](#git-workflow-一览)
+- [Pull Request](#pull-request)
+- [版本发布介绍](#版本发布介绍)
+
+
+## 项目规划 Roadmap
+
+AutoBangumi 开发组使用 [GitHub Project](https://github.com/EstrellaXD/Auto_Bangumi/projects?query=is%3Aopen) 看板来管理预计开发的规划、在修复中的问题,以及它们处理的进度;
+
+这将帮助你更好的了解
+- 开发团队在做什么?
+- 有什么和你想贡献的方向一致的,可以直接参与实现与优化
+- 有什么已经在进行中的,避免自己重复不必要的工作
+
+在 [Project](https://github.com/EstrellaXD/Auto_Bangumi/projects?query=is%3Aopen) 中你可以看到除通常的 `[Feature Request]`, `[BUG]`, 一些小优化项以外,还有一类 **`[RFC]`**;
+
+### 提案寻求共识 Request for Comments
+
+> 在 issue 中通过 `RFC` label 能找到到现有的 [AutoBangumi RFCs](https://github.com/EstrellaXD/Auto_Bangumi/issues?q=is%3Aissue+label%3ARFC)
+
+对于一些小的优化项或者 bug 修复,你大可以直接帮忙调整代码然后提出 Pull Request,只需要简单阅读下 [分支管理](#分支管理-Git-Branch) 章节以基于正确的版本分支修复、以及通过 [Pull Request](#Pull-Request) 章节了解 PR 将如何被合并。
+
+
+
+而如果你打算做的是一项**较大的**功能重构,改动范围大而涉及的方面比较多,那么希望你能通过 [Issue: 功能提案](https://github.com/EstrellaXD/Auto_Bangumi/issues/new?assignees=&labels=RFC&projects=&template=rfc.yml&title=%5BRFC%5D%3A+) 先写一份 RFC 提案来简单阐述「你打算怎么做」的简短方案,来寻求开发者的讨论和共识。
+
+因为有些方案可能是开发团队原本讨论并且认为不要做的事,而上一步可以避免你浪费大量精力。
+
+> 如果仅希望讨论是否添加或改进某功能本身,而非「要如何实现」,请使用 -> [Issue: 功能改进](https://github.com/EstrellaXD/Auto_Bangumi/issues/new?labels=feature+request&template=feature_request.yml&title=%5BFeature+Request%5D+)
+
+
+
+
+一份 [提案(RFC)](https://github.com/EstrellaXD/Auto_Bangumi/issues?q=is%3Aissue+is%3Aopen+label%3ARFC) 定位为 **「在某功能/重构的具体开发前,用于开发者间 review 技术设计/方案的文档」**,
+
+目的是让协作的开发者间清晰的知道「要做什么」和「具体会怎么做」,以及所有的开发者都能公开透明的参与讨论;
+
+以便评估和讨论产生的影响 (遗漏的考虑、向后兼容性、与现有功能的冲突),
+
+因此提案侧重在对解决问题的 **方案、设计、步骤** 的描述上。
+
+
+## 分支管理 Git Branch
+
+### 版本号
+
+AutoBangumi 项目中的 Git 分支使用与发布版本规则密切相关,因此先介绍版本规范;
+
+AutoBangumi 发布的版本号遵循 [「语义化版本 SemVer」](https://semver.org/lang/zh-CN/) 的规范,
+
+使用 `..` 三位版本的格式,每一位版本上的数字更新含义如下:
+
+- **Major**: 大版本更新,很可能有不兼容的 配置/API 修改
+- **Minor**: 向下兼容的功能性新增
+- **Patch**: 向下兼容的 Bug 修复 / 小优化修正
+
+### 分支开发,主干发布
+
+AutoBangumi 项目使用「分支开发,主干发布」的模式,
+
+[**`main`**](https://github.com/EstrellaXD/Auto_Bangumi/commits/main) 分支是稳定版本的 **「主干分支」**,只用于发布版本,不用于直接开发新功能或修复。
+
+每一个 Minor 版本都有一个对应的 **「开发分支」** 用于开发新功能、与发布后维护修复问题,
+
+开发分支的名字为 `.-dev`,如 `3.1-dev`, `3.0-dev`, `2.6-dev`, 你可以在仓库的 [All Branches 中搜索到它们](https://github.com/EstrellaXD/Auto_Bangumi/branches/all?query=-dev)。
+
+
+### Branch 生命周期
+
+当一个 Minor 开发分支(以 `3.1-dev` 为例) 完成新功能开发,**首次**合入 main 分支后,
+- 发布 Minor 版本 (如 `3.1.0`)
+- 同时拉出**下一个** Minor 开发分支(`3.2-dev`),用于下一个版本新功能开发
+ - 而**上一个**版本开发分支(`3.0-dev`)进入归档不再维护
+- 且这个 Minor 分支(`3.1-dev`)进入维护阶段,不再增加新功能/重构,只维护 Bugs 修复
+ - Bug 修复到维护阶段的 Minor 分支(`3.1-dev`)后,会再往 main 分支合并,并发布 `Patch` 版本
+
+根据这个流程,对于各位 Contributors 在开发贡献时选择 Git Branch 来说,则是:
+- 若「修复 Bug」,则基于**当前发布版本**的 Minor 分支开发修复,并 PR 到这个分支
+- 若「添加新功能/重构」,则基于**还未发布的下一个版本** Minor 分支开发,并 PR 到这个分支
+
+> 「当前发布版本」为 [[Releases 页面]](https://github.com/EstrellaXD/Auto_Bangumi/releases) 最新版本,这也与 [[GitHub Container Registry]](https://github.com/EstrellaXD/Auto_Bangumi/pkgs/container/auto_bangumi) 中最新版本相同
+
+
+### Git Workflow 一览
+
+> 图中 commit timeline 从左到右 --->
+
+```mermaid
+%%{init: {'theme': 'base', 'gitGraph': {'showCommitLabel': true}}}%%
+
+gitGraph:
+ checkout main
+ commit id: "."
+ branch 3.0-dev
+ commit id: "feat 1"
+ commit id: "feat 2"
+ commit id: "feat 3"
+
+ checkout main
+ merge 3.0-dev tag: "3.0.9"
+ commit id: ".."
+
+ branch 3.1-dev
+ commit id: "feat 4"
+
+ checkout 3.0-dev
+ commit id: "PR merge (fix)"
+ checkout main
+ merge 3.0-dev tag: "3.0.10"
+
+ checkout 3.1-dev
+ commit id: "feat 5"
+ commit id: "feat 6"
+
+ checkout main
+ merge 3.1-dev tag: "3.1.0"
+ commit id: "..."
+
+ branch 3.2-dev
+ commit id: "feat 7"
+ commit id: "feat 8"
+
+ checkout 3.1-dev
+ commit id: "PR merge (fix) "
+ checkout main
+ merge 3.1-dev tag: "3.1.1"
+
+ checkout 3.2-dev
+ commit id: "PR merge (feat)"
+```
+
+
+## Pull Request
+
+请确保你根据上文的 Git 分支管理 章节选择了正确的 PR 目标分支,
+> - 若「修复 Bug」,则 PR 到**当前发布版本**的 Minor 维护分支
+> - 若「添加新功能/重构」,则 PR **下一个版本** Minor 开发分支
+
+
+
+- 一个 PR 应该只对应一件事,而不应引入不相关的更改;
+
+ 对于不同的事情可以拆分提多个 PR,这能帮助开发组每次 review 只专注一个问题。
+
+- 在提 PR 的标题与描述中,最好对修改内容做简短的说明,包括原因和意图,
+
+ 如果有相关的 issue 或 RFC,应该把它们链接到 PR 描述中,
+
+ 这将帮助开发组 code review 时能最快了解上下文。
+
+- 确保勾选了「允许维护者编辑」(`Allow edits from maintainers`) 选项。这使我们可以直接进行较小的编辑/重构并节省大量时间。
+
+- 请确保本地通过了「单元测试」和「代码风格 Lint」,这也会在 PR 的 GitHub CI 上检查
+ - 对于 bug fix 和新功能,通常开发组也会请求你添加对应改动的单元测试覆盖
+
+
+开发组会在有时间的最快阶段 Review 贡献者提的 PR 并讨论或批准合并(Approve Merge)。
+
+## 版本发布介绍
+
+版本发布目前由开发组通过手动合并「特定发版 PR」后自动触发打包与发布。
+
+通常 Bug 修复的 PR 合并后会很快发版,通常不到一周;
+
+而新功能的发版时间则会更长而且不定,你可以在我们的 [GitHub Project](https://github.com/EstrellaXD/Auto_Bangumi/projects?query=is%3Aopen) 看板中看到开发进度,一个版本规划的新功能都开发完备后就会发版。
+
From a8581fb610d4573cb6787b89eef71154a7126a1f Mon Sep 17 00:00:00 2001
From: EstrellaXD
Date: Fri, 30 Jun 2023 12:31:49 +0800
Subject: [PATCH 17/31] change: update pr workflow
---
.github/workflows/release.yml | 24 ++++++++++++++++++++----
1 file changed, 20 insertions(+), 4 deletions(-)
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index a4a2b4dd..cc2acdc5 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -8,12 +8,28 @@ on:
- main
jobs:
- generate_release_draft:
- runs-on: ubuntu-latest
+ check_pr_title:
if: >
github.event.pull_request.merged == true &&
- github.event.pull_request.base.ref == 'main' &&
- github.event.pull_request.title =~ '^v(\d+\.\d+\.\d+)$'
+ github.event.pull_request.base.ref == 'main'
+ runs-on: ubuntu-latest
+ outputs:
+ version_pr: ${{ steps.check.outputs.version_pr }}
+ steps:
+ - name: Check if PR title is version
+ id: check
+ run: |
+ if [[ "${{ github.event.pull_request.title }}" =~ ^([0-9]+\.[0-9]+\.[0-9]+)$ ]]; then
+ echo "::set-output name=version_pr::true"
+ else
+ echo "::set-output name=version_pr::false"
+ fi
+
+ generate_release_draft:
+ needs: check_pr_title
+ if:
+ needs.check_pr_title.outputs.version_pr == 'true'
+ runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
From a287b58770c4cf0961463f3341d1497f422f9699 Mon Sep 17 00:00:00 2001
From: EstrellaXD
Date: Fri, 30 Jun 2023 12:48:20 +0800
Subject: [PATCH 18/31] fix: poster match problem
---
backend/src/module/database/bangumi.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/backend/src/module/database/bangumi.py b/backend/src/module/database/bangumi.py
index 0ba1ce92..9d2a530c 100644
--- a/backend/src/module/database/bangumi.py
+++ b/backend/src/module/database/bangumi.py
@@ -132,7 +132,7 @@ class BangumiDatabase(DataConnector):
data = self._cursor.execute(
"""
SELECT poster_link FROM bangumi
- WHERE INSTR(official_title, :official_title) > 0
+ WHERE INSTR(:official_title, official_title) > 0
""",
{"official_title": bangumi_name},
).fetchone()
@@ -223,5 +223,5 @@ class BangumiDatabase(DataConnector):
if __name__ == "__main__":
with BangumiDatabase() as db:
- name = "久保"
+ name = "久保同学不放过我(2023)"
print(db.match_poster(name))
From f9b32d7ac15a989f61ecbe970ff465d3783abd80 Mon Sep 17 00:00:00 2001
From: EstrellaXD
Date: Wed, 5 Jul 2023 14:11:24 +0800
Subject: [PATCH 19/31] fix: close #375
---
backend/src/module/parser/analyser/raw_parser.py | 4 +++-
backend/src/test/test_raw_parser.py | 9 +++++++++
2 files changed, 12 insertions(+), 1 deletion(-)
diff --git a/backend/src/module/parser/analyser/raw_parser.py b/backend/src/module/parser/analyser/raw_parser.py
index 5de06089..37458d85 100644
--- a/backend/src/module/parser/analyser/raw_parser.py
+++ b/backend/src/module/parser/analyser/raw_parser.py
@@ -106,6 +106,8 @@ def name_process(name: str):
name_zh = item.strip()
elif re.search(r"[a-zA-Z]{3,}", item) and not name_en:
name_en = item.strip()
+ if name_en not in name:
+ name_en = None
return name_en, name_zh, name_jp
@@ -182,5 +184,5 @@ def raw_parser(raw: str) -> Episode | None:
if __name__ == "__main__":
- title = "[动漫国字幕组&LoliHouse] THE MARGINAL SERVICE - 08 [WebRip 1080p HEVC-10bit AAC][简繁内封字幕]"
+ title = "【极影字幕·毁片党】LoveLive! SunShine!! 幻日的夜羽 -SUNSHINE in the MIRROR- 第01集 TV版 HEVC_opus 1080p "
print(raw_parser(title))
diff --git a/backend/src/test/test_raw_parser.py b/backend/src/test/test_raw_parser.py
index b4c3b446..60297c8e 100644
--- a/backend/src/test/test_raw_parser.py
+++ b/backend/src/test/test_raw_parser.py
@@ -69,3 +69,12 @@ def test_raw_parser():
assert info.resolution == "720P"
assert info.episode == 5
assert info.season == 1
+
+ content = "【极影字幕·毁片党】LoveLive! SunShine!! 幻日的夜羽 -SUNSHINE in the MIRROR- 第01集 TV版 HEVC_opus 1080p "
+ info = raw_parser(content)
+ assert info.group == "极影字幕·毁片党"
+ assert info.title_zh == "幻日的夜羽"
+ assert info.title_en == "LoveLive! SunShine!!"
+ assert info.resolution == "1080p"
+ assert info.episode == 1
+ assert info.season == 1
From 87224cd8ad4cac52f91ed5b47da32cbd00852b12 Mon Sep 17 00:00:00 2001
From: EstrellaXD
Date: Mon, 10 Jul 2023 22:36:55 +0800
Subject: [PATCH 20/31] fix: parser error #385 #375
---
.../src/module/parser/analyser/raw_parser.py | 22 ++++++++++++++-----
backend/src/test/test_raw_parser.py | 10 +++++++++
2 files changed, 27 insertions(+), 5 deletions(-)
diff --git a/backend/src/module/parser/analyser/raw_parser.py b/backend/src/module/parser/analyser/raw_parser.py
index 37458d85..1f3c3469 100644
--- a/backend/src/module/parser/analyser/raw_parser.py
+++ b/backend/src/module/parser/analyser/raw_parser.py
@@ -94,11 +94,23 @@ def name_process(name: str):
split = re.split("-", name)
if len(split) == 1:
split_space = split[0].split(" ")
- for idx, item in enumerate(split_space):
+ language_pattern = []
+ for item in split_space:
if re.search(r"^[\u4e00-\u9fa5]{2,}", item) is not None:
- split_space.remove(item)
- split = [item.strip(), " ".join(split_space).strip()]
- break
+ language_pattern.append(1)
+ elif re.search(r"[a-zA-Z]{2,}", item) is not None:
+ language_pattern.append(0)
+ elif re.search(r"[\u0800-\u4e00]{2,}", item) is not None:
+ language_pattern.append(2)
+ split = [split_space[0]]
+ for i in range(1, len(split_space)):
+ # 如果当前字符串的语言与上一个字符串的语言相同
+ if language_pattern[i] == language_pattern[i - 1]:
+ # 合并这两个字符串
+ split[-1] += ' ' + split_space[i]
+ else:
+ # 否则,将当前字符串添加到结果列表中
+ split.append(split_space[i])
for item in split:
if re.search(r"[\u0800-\u4e00]{2,}", item) and not name_jp:
name_jp = item.strip()
@@ -184,5 +196,5 @@ def raw_parser(raw: str) -> Episode | None:
if __name__ == "__main__":
- title = "【极影字幕·毁片党】LoveLive! SunShine!! 幻日的夜羽 -SUNSHINE in the MIRROR- 第01集 TV版 HEVC_opus 1080p "
+ title = "【极影字幕·毁片党】LoveLive! SunShine!! 幻日的夜羽 -SUNSHINE in the MIRROR- 第01集 TV版 HEVC_opus 1080p"
print(raw_parser(title))
diff --git a/backend/src/test/test_raw_parser.py b/backend/src/test/test_raw_parser.py
index 60297c8e..39f1944c 100644
--- a/backend/src/test/test_raw_parser.py
+++ b/backend/src/test/test_raw_parser.py
@@ -78,3 +78,13 @@ def test_raw_parser():
assert info.resolution == "1080p"
assert info.episode == 1
assert info.season == 1
+
+ content = "[ANi] BLEACH 死神 千年血战篇-诀别谭- - 14 [1080P][Baha][WEB-DL][AAC AVC][CHT][MP4]"
+ info = raw_parser(content)
+ assert info.group == "ANi"
+ assert info.title_en == "BLEACH"
+ assert info.title_zh == "死神 千年血战篇-诀别谭-"
+ assert info.resolution == "1080P"
+ assert info.episode == 14
+ assert info.season == 1
+
From 3a8d9a71b42ec6635cfaeacbf8377698faae9531 Mon Sep 17 00:00:00 2001
From: EstrellaXD
Date: Mon, 10 Jul 2023 22:40:41 +0800
Subject: [PATCH 21/31] fix: requirement issue
---
requirements.txt | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/requirements.txt b/requirements.txt
index 2781feb3..2c84d529 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -6,7 +6,7 @@ click
fastapi
h11
idna
-pydantic
+pydantic == 1.10
PySocks
qbittorrent-api
requests
From c28f8ce93a07504b9d328d1e0c25a697fd8534aa Mon Sep 17 00:00:00 2001
From: EstrellaXD
Date: Tue, 11 Jul 2023 10:03:40 +0800
Subject: [PATCH 22/31] fix: fix problem when init problem ab would change rss
refresh time to 30min. #387
---
backend/src/module/downloader/download_client.py | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/backend/src/module/downloader/download_client.py b/backend/src/module/downloader/download_client.py
index ca7cfbd9..203b4705 100644
--- a/backend/src/module/downloader/download_client.py
+++ b/backend/src/module/downloader/download_client.py
@@ -55,9 +55,8 @@ class DownloadClient(TorrentPath):
def init_downloader(self):
prefs = {
"rss_auto_downloading_enabled": True,
- "rss_max_articles_per_feed": 500,
+ "rss_max_articles_per_feed": 5000,
"rss_processing_enabled": True,
- "rss_refresh_interval": 30,
}
self.client.prefs_init(prefs=prefs)
try:
From 67f0b81458f801569d5282ee8f23b0846e0bc1f4 Mon Sep 17 00:00:00 2001
From: EstrellaXD
Date: Sat, 15 Jul 2023 15:57:29 +0800
Subject: [PATCH 23/31] fix: parser problem
---
backend/src/module/parser/analyser/raw_parser.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/backend/src/module/parser/analyser/raw_parser.py b/backend/src/module/parser/analyser/raw_parser.py
index 1f3c3469..5520af97 100644
--- a/backend/src/module/parser/analyser/raw_parser.py
+++ b/backend/src/module/parser/analyser/raw_parser.py
@@ -96,7 +96,7 @@ def name_process(name: str):
split_space = split[0].split(" ")
language_pattern = []
for item in split_space:
- if re.search(r"^[\u4e00-\u9fa5]{2,}", item) is not None:
+ if re.search(r"[\u4e00-\u9fa5]{2,}", item) is not None:
language_pattern.append(1)
elif re.search(r"[a-zA-Z]{2,}", item) is not None:
language_pattern.append(0)
@@ -107,7 +107,7 @@ def name_process(name: str):
# 如果当前字符串的语言与上一个字符串的语言相同
if language_pattern[i] == language_pattern[i - 1]:
# 合并这两个字符串
- split[-1] += ' ' + split_space[i]
+ split[-1] += " " + split_space[i]
else:
# 否则,将当前字符串添加到结果列表中
split.append(split_space[i])
From 0e6e1f7a67445f617a34c075b56027469f5941da Mon Sep 17 00:00:00 2001
From: EstrellaXD
Date: Sat, 15 Jul 2023 16:07:29 +0800
Subject: [PATCH 24/31] docs: update README.md
---
README.md | 28 +++++++++++-----------------
1 file changed, 11 insertions(+), 17 deletions(-)
diff --git a/README.md b/README.md
index cc968cd3..493ad072 100644
--- a/README.md
+++ b/README.md
@@ -17,10 +17,6 @@
本项目是基于 [Mikan Project](https://mikanani.me)、[qBittorrent](https://qbittorrent.org) 的全自动追番整理下载工具。只需要在 [Mikan Project](https://mikanani.me) 上订阅番剧,就可以全自动追番。并且整理完成的名称和目录可以直接被 [Plex]()、[Jellyfin]() 等媒体库软件识别,无需二次刮削。
-[主项目地址](https://www.github.com/EstrellaXD/Auto_Bangumi)
-/ [WebUI 仓库](https://github.com/Rewrite0/Auto_Bangumi_WebUI)
-/ [Wiki 说明](https://www.github.com/EstrellaXD/Auto_Bangumi/wiki)
-
## AutoBangumi 功能说明
- 简易单次配置就能持续使用
@@ -59,12 +55,10 @@
- 内置 TDMB 解析器,可以直接生成完整的 TMDB 格式的文件以及番剧信息。
- 对于 Mikan RSS 的反代支持。
-## 如何开始
+## [快速开始](https://www.autobangumi.org/deploy/quick-start.html)
-- **[部署说明 (Official)](https://github.com/EstrellaXD/Auto_Bangumi/wiki)**
-- **[2.6版本更新说明](https://github.com/EstrellaXD/Auto_Bangumi/wiki/2.6更新说明)**
-- **[3.0版本更新说明](https://github.com/EstrellaXD/Auto_Bangumi/wiki/3.0更新说明)**
-- **[部署说明 (手把手)](https://www.himiku.com/archives/auto-bangumi.html)**
+- **[项目官网](https://autobangumi.org)**
+- **[3.0 更新说明](https://www.autobangumi.org/changelog/3.0.html)**
## 相关群组
@@ -82,19 +76,19 @@
- 对其他站点种子的解析归类。
- 本地化番剧订阅方式。
-- Transmission & Aria2 的支持。
-
-# 声明
-
-## 致谢
-
-感谢 [Sean](https://github.com/findix) 提供的大量帮助
-感谢 [Rewrite0](https://github.com/Rewrite0) 开发的 WebUI
+- Transmission 的支持。
## Star History
[](https://star-history.com/#EstrellaXD/Auto_Bangumi)
+## 贡献
+
+欢迎提供 ISSUE 或者 PR
+
+
+
+
## Licence
[MIT licence](https://github.com/EstrellaXD/Auto_Bangumi/blob/main/LICENSE)
From 94cc22a88950f01cbb955aca855319c12b855e57 Mon Sep 17 00:00:00 2001
From: EstrellaXD
Date: Sat, 15 Jul 2023 16:08:41 +0800
Subject: [PATCH 25/31] docs: update CONTRIBUTING.md to main page
---
README.md | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/README.md b/README.md
index 493ad072..6fd6cf2b 100644
--- a/README.md
+++ b/README.md
@@ -84,7 +84,9 @@
## 贡献
-欢迎提供 ISSUE 或者 PR
+欢迎提供 ISSUE 或者 PR, 贡献代码前建议阅读 [CONTRIBUTING.md](CONTRIBUTING.md)。
+
+贡献者名单请见:
From 766bcb13a2ec1991f04e06a79539ba12925de8f4 Mon Sep 17 00:00:00 2001
From: EstrellaXD
Date: Sat, 15 Jul 2023 16:15:27 +0800
Subject: [PATCH 26/31] fix: cannot match title when title parser item has
regex item.
---
backend/src/module/downloader/download_client.py | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/backend/src/module/downloader/download_client.py b/backend/src/module/downloader/download_client.py
index 203b4705..6b003e1e 100644
--- a/backend/src/module/downloader/download_client.py
+++ b/backend/src/module/downloader/download_client.py
@@ -1,4 +1,5 @@
import logging
+import re
from .path import TorrentPath
@@ -70,9 +71,10 @@ class DownloadClient(TorrentPath):
def set_rule(self, data: BangumiData):
data.rule_name = self._rule_name(data)
data.save_path = self._gen_save_path(data)
+ raw_title = re.escape(data.title_raw)
rule = {
"enable": True,
- "mustContain": data.title_raw,
+ "mustContain": raw_title,
"mustNotContain": "|".join(data.filter),
"useRegex": True,
"episodeFilter": "",
From 8c3c31edf2515e7813b06f6f3aeed217fb26c95e Mon Sep 17 00:00:00 2001
From: EstrellaXD
Date: Sun, 23 Jul 2023 18:18:37 +0800
Subject: [PATCH 27/31] change: remove wiki address in issue template.
---
.github/ISSUE_TEMPLATE/bug_report.yml | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml
index 3c4253bb..cf8b7c3b 100644
--- a/.github/ISSUE_TEMPLATE/bug_report.yml
+++ b/.github/ISSUE_TEMPLATE/bug_report.yml
@@ -6,7 +6,7 @@ body:
- type: markdown
attributes:
value: |
- 描述问题前,请先更新到最新版本。2.5 之前的版本升级请参考 [升级指南](https://github.com/EstrellaXD/Auto_Bangumi/wiki/2.6更新说明#如何从老版本更新的注意事项)
+ 描述问题前,请先更新到最新版本。2.5 之前的版本升级请参考 [升级指南](https://www.autobangumi.org/changelog/2.6.html#如何从老版本更新的注意事项)
请确认以下信息,如果你的问题可以直接在文档中找到,那么你的 issue 将会被直接关闭。
解析器问题请转到[专用模板](https://github.com/EstrellaXD/Auto_Bangumi/issues/new?assignees=&labels=bug&template=parser_bug.yml&title=%5B解析器错误%5D),
重命名问题请到[专用模板](https://github.com/EstrellaXD/Auto_Bangumi/issues/new?assignees=&labels=bug&template=rename_bug.yml&title=%5B重命名错误%5D)
@@ -18,9 +18,9 @@ body:
options:
- label: 我的版本是最新版本,我的版本号与 [version](https://github.com/EstrellaXD/Auto_Bangumi/releases/latest) 相同。
required: true
- - label: 我已经查阅了[排错流程](https://github.com/EstrellaXD/Auto_Bangumi/wiki/排错流程),确保提出的问题不在其中。
+ - label: 我已经查阅了[排错流程](https://autobangumi.org/faq/排错流程),确保提出的问题不在其中。
required: true
- - label: 我已经查阅了[已知问题](https://github.com/EstrellaXD/Auto_Bangumi/wiki/常见问题),并确认我的问题不在其中。
+ - label: 我已经查阅了[已知问题](https://autobangumi.org/faq/常见问题),并确认我的问题不在其中。
required: true
- label: 我已经 [issue](https://github.com/EstrellaXD/Auto_Bangumi/issues) 中搜索过,确认我的问题没有被提出过。
required: true
From 41f373170e2218ed54d570d88fc520925b3d23d2 Mon Sep 17 00:00:00 2001
From: EstrellaXD
Date: Sun, 23 Jul 2023 18:21:13 +0800
Subject: [PATCH 28/31] fix: link problem.
---
.github/ISSUE_TEMPLATE/bug_report.yml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml
index cf8b7c3b..74367ca5 100644
--- a/.github/ISSUE_TEMPLATE/bug_report.yml
+++ b/.github/ISSUE_TEMPLATE/bug_report.yml
@@ -18,9 +18,9 @@ body:
options:
- label: 我的版本是最新版本,我的版本号与 [version](https://github.com/EstrellaXD/Auto_Bangumi/releases/latest) 相同。
required: true
- - label: 我已经查阅了[排错流程](https://autobangumi.org/faq/排错流程),确保提出的问题不在其中。
+ - label: 我已经查阅了[排错流程](https://autobangumi.org/faq/排错流程.html),确保提出的问题不在其中。
required: true
- - label: 我已经查阅了[已知问题](https://autobangumi.org/faq/常见问题),并确认我的问题不在其中。
+ - label: 我已经查阅了[已知问题](https://autobangumi.org/faq/常见问题.html),并确认我的问题不在其中。
required: true
- label: 我已经 [issue](https://github.com/EstrellaXD/Auto_Bangumi/issues) 中搜索过,确认我的问题没有被提出过。
required: true
From ca034a3d7b27b137d93db5119f3c30ffee514632 Mon Sep 17 00:00:00 2001
From: EstrellaXD
Date: Sun, 23 Jul 2023 18:27:11 +0800
Subject: [PATCH 29/31] docs: update README.md
---
README.md | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/README.md b/README.md
index 6fd6cf2b..02b845f5 100644
--- a/README.md
+++ b/README.md
@@ -9,6 +9,10 @@
+
+ 官方网站 | 快速开始 | 更新日志 | TG 群组
+
+
# 项目说明
@@ -55,17 +59,12 @@
- 内置 TDMB 解析器,可以直接生成完整的 TMDB 格式的文件以及番剧信息。
- 对于 Mikan RSS 的反代支持。
-## [快速开始](https://www.autobangumi.org/deploy/quick-start.html)
-
-- **[项目官网](https://autobangumi.org)**
-- **[3.0 更新说明](https://www.autobangumi.org/changelog/3.0.html)**
-
## 相关群组
- 更新推送:[Telegram Channel](https://t.me/autobangumi_update)
- Bug 反馈群:[Telegram](https://t.me/+yNisOnDGaX5jMTM9)
-## Roadmap
+## [Roadmap](https://github.com/users/EstrellaXD/projects/2)
***开发中的功能:***
From c1c4a628c359aaae6e81cacf561560004344374e Mon Sep 17 00:00:00 2001
From: EstrellaXD
Date: Sun, 23 Jul 2023 18:29:08 +0800
Subject: [PATCH 30/31] fix: link problem
---
README.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/README.md b/README.md
index 02b845f5..a83b9c99 100644
--- a/README.md
+++ b/README.md
@@ -10,7 +10,7 @@
- 官方网站 | 快速开始 | 更新日志 | TG 群组
+ 官方网站 | 快速开始 | 更新日志 | TG 群组
# 项目说明
From 58cd4796e51a7d60e45ef553f138974f95071575 Mon Sep 17 00:00:00 2001
From: EstrellaXD
Date: Mon, 28 Aug 2023 22:14:18 +0800
Subject: [PATCH 31/31] feat: add ipv6 support.
---
backend/src/main.py | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/backend/src/main.py b/backend/src/main.py
index c0229948..3ccd2649 100644
--- a/backend/src/main.py
+++ b/backend/src/main.py
@@ -1,3 +1,5 @@
+import os
+
import logging
import uvicorn
@@ -21,9 +23,10 @@ uvicorn_logging_config = {
}
if __name__ == "__main__":
+ host = "::" if os.getenv("IPV6") else "0.0.0.0"
uvicorn.run(
router,
- host="0.0.0.0",
+ host=host,
port=settings.program.webui_port,
log_config=uvicorn_logging_config,
)