fix: add missing exclude keyword
All checks were successful
dl / lint (push) Successful in 1m59s
dl / docker (push) Successful in 3m25s

This commit is contained in:
Michel Roux 2024-12-24 16:48:05 +01:00
parent 1b12d64f53
commit a58e7ba4c1

View File

@ -13,6 +13,12 @@ parser = ArgumentParser()
parser.add_argument(
"--keyword", action="append", default=["mhdgz"], help="Prefered words to search on names"
)
parser.add_argument(
"--exclude",
action="append",
default=["3d", "dvd", "iso", "av1", "zza"],
help="Excluded words to search on names",
)
parser.add_argument("--cookie", required=True, help="Cookies to bypass CloudFlare")
parser.add_argument("--user-agent", required=True, help="User Agent to bypass CloudFlare")
parser.add_argument(
@ -52,8 +58,13 @@ def parse_size(size):
return int(float(number) * units[unit])
def is_valid(id: int, size: int, completed: int):
return size < parse_size("10Go") and completed > 100 and nb_files(id)
def is_valid(id: int, name: str, size: int, completed: int):
return (
size < parse_size("10Go")
and completed > 100
and not any(exclude.lower() in name.lower() for exclude in args.exclude)
and nb_files(id)
)
writer = DictWriter(stdout, fieldnames=["title", "season", "episode", "name", "link"])
@ -101,6 +112,7 @@ for feed in args.feed:
if any(keyword.lower() in columns[1].text.strip().lower() for keyword in args.keyword):
if is_valid(
int(columns[2].a["target"]),
columns[1].text.strip(),
parse_size(columns[5].text.strip()),
int(columns[6].text.strip()),
):
@ -117,6 +129,7 @@ for feed in args.feed:
if "multi" in columns[1].text.strip().lower():
if is_valid(
int(columns[2].a["target"]),
columns[1].text.strip(),
parse_size(columns[5].text.strip()),
int(columns[6].text.strip()),
):