fix: 🐛 fix mkv scanning
Some checks failed
dl / lint (push) Successful in 1m20s
dl / docker (push) Has been cancelled

This commit is contained in:
Michel Roux 2024-12-22 11:42:04 +01:00
parent e59d552a4b
commit 2537713f9f

View File

@ -31,15 +31,16 @@ def nb_files(id: int):
json = response.json()
soup = BeautifulSoup(json["html"], "html.parser")
rows = soup.find_all("tr")
length = 0
is_mkv = False
for row in rows:
columns = row.find_all("td")
if columns[1].text.strip()[-3:] == "mkv":
length += 1
is_mkv = True
break
return length
return is_mkv and len(rows) == 1
def parse_size(size):
@ -52,7 +53,7 @@ def parse_size(size):
def is_valid(id: int, size: int, completed: int):
return size < parse_size("10Go") and completed > 10 and nb_files(id) == 1
return size < parse_size("10Go") and completed > 10 and nb_files(id)
writer = DictWriter(stdout, fieldnames=["title", "season", "episode", "name", "link"])