Skip to content

Commit

Permalink
fix: analyser api error.
Browse files Browse the repository at this point in the history
eps complete logic.
  • Loading branch information
EstrellaXD committed Oct 30, 2023
1 parent abd946b commit f296021
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 13 deletions.
1 change: 0 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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 && \
Expand Down
4 changes: 3 additions & 1 deletion backend/src/module/database/bangumi.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,9 @@ def not_complete(self) -> list[Bangumi]:
# 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

Expand Down
30 changes: 19 additions & 11 deletions backend/src/module/rss/analyser.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,14 +82,22 @@ def rss_to_data(

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="无法找到种子。",
)

0 comments on commit f296021

Please sign in to comment.