fix: analyser api error.

eps complete logic.
This commit is contained in:
EstrellaXD
2023-10-30 20:29:00 +08:00
parent abd946b0f2
commit f296021d93
3 changed files with 22 additions and 13 deletions

View File

@@ -23,7 +23,6 @@ RUN set -ex && \
shadow \
tini \
openssl \
busybox-suid \
tzdata && \
python3 -m pip install --no-cache-dir --upgrade pip && \
sed -i '/bcrypt/d' requirements.txt && \

View File

@@ -144,7 +144,9 @@ class BangumiDatabase:
# Find eps_complete = False
# use `false()` to avoid E712 checking
# see: https://docs.astral.sh/ruff/rules/true-false-comparison/
condition = select(Bangumi).where(Bangumi.eps_collect == false())
condition = select(Bangumi).where(
and_(Bangumi.eps_collect == false(), Bangumi.deleted == false())
)
datas = self.session.exec(condition).all()
return datas

View File

@@ -82,14 +82,22 @@ class RSSAnalyser(TitleParser):
def link_to_data(self, rss: RSSItem) -> Bangumi | ResponseModel:
torrents = self.get_rss_torrents(rss.url, False)
for torrent in torrents:
data = self.torrent_to_data(torrent, rss)
if data:
return data
else:
return ResponseModel(
status=False,
status_code=406,
msg_en="Cannot parse this link.",
msg_zh="无法解析此链接。",
)
if not torrents:
for torrent in torrents:
data = self.torrent_to_data(torrent, rss)
if data:
return data
else:
return ResponseModel(
status=False,
status_code=406,
msg_en="Cannot parse this link.",
msg_zh="无法解析此链接。",
)
else:
return ResponseModel(
status=False,
status_code=406,
msg_en="Cannot find any torrent.",
msg_zh="无法找到种子。",
)