mirror of
https://github.com/EstrellaXD/Auto_Bangumi.git
synced 2026-04-24 02:20:38 +08:00
fix: collector season limit. Fix #470
This commit is contained in:
@@ -9,7 +9,7 @@ logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
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}..."
|
||||
)
|
||||
|
||||
@@ -30,8 +30,9 @@ class RequestContent(RequestURL):
|
||||
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}")
|
||||
|
||||
@@ -44,7 +44,7 @@ class SearchTorrent(RequestContent, RSSAnalyser):
|
||||
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]
|
||||
Reference in New Issue
Block a user