Skip to content

Commit

Permalink
feat: zilean only mode
Browse files Browse the repository at this point in the history
  • Loading branch information
g0ldyy committed Jul 7, 2024
1 parent 33699ab commit 123378f
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 21 deletions.
40 changes: 23 additions & 17 deletions comet/api/stream.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,26 +158,32 @@ async def stream(request: Request, b64config: str, type: str, id: str):
f"Start of {indexer_manager_type} search for {logName} with indexers {config['indexers']}"
)

search_terms = [name]
if type == "series":
search_terms.append(f"{name} S0{season}E0{episode}")
tasks = [
get_indexer_manager(session, indexer_manager_type, config["indexers"], term)
for term in search_terms
]
search_response = await asyncio.gather(*tasks)

torrents = []
for results in search_response:
if results is None:
continue
if len(config["indexers"]) != 0:
search_terms = [name]
if type == "series":
search_terms.append(f"{name} S0{season}E0{episode}")
tasks = [
get_indexer_manager(session, indexer_manager_type, config["indexers"], term)
for term in search_terms
]
search_response = await asyncio.gather(*tasks)

for result in results:
torrents.append(result)

for results in search_response:
if results is None:
continue

logger.info(
f"{len(torrents)} torrents found for {logName} with {indexer_manager_type}"
)
for result in results:
torrents.append(result)

logger.info(
f"{len(torrents)} torrents found for {logName} with {indexer_manager_type}"
)
else:
logger.info(
f"No indexer selected by user for {logName}"
)

zilean_hashes_count = 0
if settings.ZILEAN_URL:
Expand Down
8 changes: 4 additions & 4 deletions comet/utils/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,10 @@ def check_indexers(cls, v, values):
valid_indexers = [
indexer for indexer in v if indexer in settings.INDEXER_MANAGER_INDEXERS
]
if not valid_indexers:
raise ValueError(
f"At least one indexer must be from {settings.INDEXER_MANAGER_INDEXERS}"
)
# if not valid_indexers: # For only Zilean mode
# raise ValueError(
# f"At least one indexer must be from {settings.INDEXER_MANAGER_INDEXERS}"
# )
return valid_indexers

@field_validator("maxResults")
Expand Down

0 comments on commit 123378f

Please sign in to comment.