mirror of
https://github.com/EstrellaXD/Auto_Bangumi.git
synced 2026-06-15 06:27:53 +08:00
feat: add animation. Speed up subscribe.
This commit is contained in:
@@ -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():
|
||||
|
||||
@@ -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} 失败。",
|
||||
)
|
||||
|
||||
@@ -67,7 +67,7 @@ function onSelect(site: string) {
|
||||
v-on-click-outside="clearSearch"
|
||||
abs top-84px left-192px z-8
|
||||
>
|
||||
<TransitionGroup name="result" tag="ab-bangumi-card" space-y-12px>
|
||||
<transition-group name="result" tag="div" space-y-12px>
|
||||
<!-- TODO: Transition Effect to fix. -->
|
||||
<ab-bangumi-card
|
||||
v-for="bangumi in bangumiList"
|
||||
@@ -76,13 +76,20 @@ function onSelect(site: string) {
|
||||
type="search"
|
||||
@click="() => $emit('add-bangumi', bangumi)"
|
||||
/>
|
||||
</TransitionGroup>
|
||||
|
||||
</transition-group>
|
||||
</div>
|
||||
|
||||
</template>
|
||||
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.result-enter-active,
|
||||
.result-leave-active {
|
||||
transition: all 0.5s ease;
|
||||
}
|
||||
|
||||
.result-enter-from,
|
||||
.result-leave-to {
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
</style>
|
||||
@@ -95,7 +95,6 @@ onUnmounted(() => {
|
||||
</div>
|
||||
|
||||
<ab-search-bar @add-bangumi="addSearchResult"/>
|
||||
<div text-h2>{{ showAddRSS }}</div>
|
||||
</div>
|
||||
|
||||
<div ml-auto>
|
||||
@@ -104,11 +103,9 @@ onUnmounted(() => {
|
||||
:running="running"
|
||||
@click-add="() => (showAddRSS = true)"
|
||||
@change-lang="() => changeLocale()"
|
||||
></ab-status-bar>
|
||||
/>
|
||||
</div>
|
||||
|
||||
<ab-change-account v-model:show="showAccount"></ab-change-account>
|
||||
|
||||
<ab-add-rss v-model:show="showAddRSS" v-model:rule="searchRule"></ab-add-rss>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -15,7 +15,7 @@ definePage({
|
||||
<template>
|
||||
<div overflow-auto mt-12px flex-grow>
|
||||
<div>
|
||||
<TransitionGroup
|
||||
<transition-group
|
||||
name="bangumi" tag="div"
|
||||
flex="~ wrap" gap-y-12px gap-x-32px>
|
||||
<!-- TODO: Transition Effect to fix. -->
|
||||
@@ -27,7 +27,7 @@ definePage({
|
||||
type="primary"
|
||||
@click="() => openEditPopup(i)"
|
||||
></ab-bangumi-card>
|
||||
</TransitionGroup>
|
||||
</transition-group>
|
||||
|
||||
<ab-edit-rule
|
||||
v-model:show="editRule.show"
|
||||
@@ -43,7 +43,12 @@ definePage({
|
||||
</template>
|
||||
|
||||
<style>
|
||||
.bangumi-enter-active, .bangumi-leave-active {
|
||||
transition: opacity .3s;
|
||||
.bangumi-enter-active,
|
||||
.bangumi-leave-active {
|
||||
transition: all 0.5s ease;
|
||||
}
|
||||
.bangumi-enter-from,
|
||||
.bangumi-leave-to {
|
||||
opacity: 0;
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user