diff --git a/backend/src/module/manager/collector.py b/backend/src/module/manager/collector.py index 3299cf4d..40fd2b5d 100644 --- a/backend/src/module/manager/collector.py +++ b/backend/src/module/manager/collector.py @@ -38,7 +38,8 @@ class SeasonCollector(DownloadClient): msg_zh=f"收集 {bangumi.official_title} 第 {bangumi.season} 季失败。", ) - def subscribe_season(self, data: Bangumi): + @staticmethod + def subscribe_season(data: Bangumi): with RSSEngine() as engine: data.added = True data.eps_collect = True @@ -46,13 +47,8 @@ class SeasonCollector(DownloadClient): rss_link=data.rss_link, name=data.official_title, aggregate=False ) engine.bangumi.add(data) - engine.refresh_rss(self) - return ResponseModel( - status=True, - status_code=200, - msg_en=f"Subscribe {data.official_title} successfully.", - msg_zh=f"订阅 {data.official_title} 成功。", - ) + return engine.download_bangumi(data) + def eps_complete(): diff --git a/backend/src/module/rss/engine.py b/backend/src/module/rss/engine.py index e6932453..60f9e397 100644 --- a/backend/src/module/rss/engine.py +++ b/backend/src/module/rss/engine.py @@ -15,6 +15,7 @@ logger = logging.getLogger(__name__) class RSSEngine(Database): def __init__(self, _engine=engine): super().__init__(_engine) + self._to_refresh = False @staticmethod def _get_torrents(rss: RSSItem) -> list[Torrent]: @@ -123,3 +124,24 @@ class RSSEngine(Database): torrent.downloaded = True # Add all torrents to database self.torrent.add_all(new_torrents) + + def download_bangumi(self, bangumi: Bangumi): + with RequestContent() as req: + torrents = req.get_torrents(bangumi.rss_link, bangumi.filter.replace(",", "|")) + if torrents: + with DownloadClient() as client: + client.add_torrent(torrents, bangumi) + self.torrent.add_all(torrents) + return ResponseModel( + status=True, + status_code=200, + msg_en=f"[Engine] Download {bangumi.official_title} successfully.", + msg_zh=f"下载 {bangumi.official_title} 成功。", + ) + else: + return ResponseModel( + status=False, + status_code=406, + msg_en=f"[Engine] Download {bangumi.official_title} failed.", + msg_zh=f"[Engine] 下载 {bangumi.official_title} 失败。", + ) diff --git a/webui/src/components/ab-search-bar.vue b/webui/src/components/ab-search-bar.vue index 01f884f7..32076331 100644 --- a/webui/src/components/ab-search-bar.vue +++ b/webui/src/components/ab-search-bar.vue @@ -67,7 +67,7 @@ function onSelect(site: string) { v-on-click-outside="clearSearch" abs top-84px left-192px z-8 > - + - - + - \ No newline at end of file diff --git a/webui/src/components/layout/ab-topbar.vue b/webui/src/components/layout/ab-topbar.vue index 7b6146c6..1ed9c44b 100644 --- a/webui/src/components/layout/ab-topbar.vue +++ b/webui/src/components/layout/ab-topbar.vue @@ -95,7 +95,6 @@ onUnmounted(() => { -
{{ showAddRSS }}
@@ -104,11 +103,9 @@ onUnmounted(() => { :running="running" @click-add="() => (showAddRSS = true)" @change-lang="() => changeLocale()" - > + />
- - diff --git a/webui/src/pages/index/bangumi.vue b/webui/src/pages/index/bangumi.vue index dff22418..1c608bbb 100644 --- a/webui/src/pages/index/bangumi.vue +++ b/webui/src/pages/index/bangumi.vue @@ -15,7 +15,7 @@ definePage({