fix: adult content filter

This commit is contained in:
Goldy
2024-11-19 23:36:11 +01:00
parent 9495f1e2bf
commit f5afeff6af
2 changed files with 7 additions and 2 deletions
+2 -1
View File
@@ -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
+5 -1
View File
@@ -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
):