From 2537713f9f0c91115f7ff8c6a8f9289b3e6d351f Mon Sep 17 00:00:00 2001 From: Michel Roux Date: Sun, 22 Dec 2024 11:42:04 +0100 Subject: [PATCH] fix: :bug: fix mkv scanning --- commands/2hdp.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/commands/2hdp.py b/commands/2hdp.py index d2a2a18..086d9ed 100755 --- a/commands/2hdp.py +++ b/commands/2hdp.py @@ -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"])