mirror of
https://github.com/g0ldyy/comet.git
synced 2026-01-12 01:16:12 +01:00
fix: adult content filter
This commit is contained in:
+2
-1
@@ -356,9 +356,10 @@ async def stream(request: Request, b64config: str, type: str, id: str):
|
||||
for i in range(0, len(indexed_torrents), chunk_size)
|
||||
]
|
||||
|
||||
remove_adult_content = settings.REMOVE_ADULT_CONTENT and config["removeTrash"]
|
||||
tasks = []
|
||||
for chunk in chunks:
|
||||
tasks.append(filter(chunk, name, year, year_end, aliases))
|
||||
tasks.append(filter(chunk, name, year, year_end, aliases, remove_adult_content))
|
||||
|
||||
filtered_torrents = await asyncio.gather(*tasks)
|
||||
index_less = 0
|
||||
|
||||
@@ -467,7 +467,7 @@ async def get_mediafusion(log_name: str, type: str, full_id: str):
|
||||
return results
|
||||
|
||||
|
||||
async def filter(torrents: list, name: str, year: int, year_end: int, aliases: dict):
|
||||
async def filter(torrents: list, name: str, year: int, year_end: int, aliases: dict, remove_adult_content: bool):
|
||||
results = []
|
||||
for torrent in torrents:
|
||||
index = torrent[0]
|
||||
@@ -478,6 +478,10 @@ async def filter(torrents: list, name: str, year: int, year_end: int, aliases: d
|
||||
|
||||
parsed = parse(title)
|
||||
|
||||
if remove_adult_content and parsed.adult:
|
||||
results.append((index, False))
|
||||
continue
|
||||
|
||||
if parsed.parsed_title and not title_match(
|
||||
name, parsed.parsed_title, aliases=aliases
|
||||
):
|
||||
|
||||
Reference in New Issue
Block a user