Skip to content

Commit

Permalink
fix: collector season limit. Fix #470
Browse files Browse the repository at this point in the history
  • Loading branch information
EstrellaXD committed Sep 25, 2023
1 parent a5f9f85 commit ba1674c
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion backend/src/module/manager/collector.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@


class SeasonCollector(DownloadClient):
def collect_season(self, bangumi: Bangumi, link: str = None, limit: int = 50):
def collect_season(self, bangumi: Bangumi, link: str = None, limit: int = None):
logger.info(
f"Start collecting {bangumi.official_title} Season {bangumi.season}..."
)
Expand Down
5 changes: 3 additions & 2 deletions backend/src/module/network/request_contents.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,9 @@ def get_torrents(
torrents.append(
Torrent(name=_title, url=torrent_url, homepage=homepage)
)
if len(torrents) >= limit:
break
if isinstance(limit, int):
if len(torrents) >= limit:
break
return torrents
else:
logger.warning(f"[Network] Failed to get torrents: {_url}")
Expand Down
2 changes: 1 addition & 1 deletion backend/src/module/searcher/searcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def special_url(data: Bangumi, site: str) -> RSSItem:
url = search_url(site, keywords)
return url

def search_season(self, data: Bangumi, site: str = "mikan", limit: int = 5) -> list[Torrent]:
def search_season(self, data: Bangumi, site: str = "mikan", limit: int = None) -> list[Torrent]:
rss_item = self.special_url(data, site)
torrents = self.search_torrents(rss_item, limit=limit)
return [torrent for torrent in torrents if data.title_raw in torrent.name]

0 comments on commit ba1674c

Please sign in to comment.