diff --git a/__pycache__/torrent_vahti.cpython-311.pyc b/__pycache__/torrent_vahti.cpython-311.pyc index 91f690b..9252a14 100644 Binary files a/__pycache__/torrent_vahti.cpython-311.pyc and b/__pycache__/torrent_vahti.cpython-311.pyc differ diff --git a/hakulista.json b/hakulista.json index c29cbb4..7709a2f 100644 --- a/hakulista.json +++ b/hakulista.json @@ -52,6 +52,14 @@ 5, 6 ] + }, + { + "jackett_haku": "äänikirja", + "regex_suodatin": ".*", + "kohdekansio": "All", + "paivat": [ + 6 + ] } ], "asetukset": { diff --git a/torrent_vahti.py b/torrent_vahti.py index 787dea2..05bd72c 100644 --- a/torrent_vahti.py +++ b/torrent_vahti.py @@ -138,23 +138,14 @@ def tarkista_ja_lataa(): for nimi, linkki in list(set(kaikki_tulokset)): if linkki in ladatut: continue - nimi_lower = nimi.lower() - loytyy_kaikki = True + # Luodaan regex: sana1.*?sana2.*?sana3 + pattern_str = ".*?".join([re.escape(sana) for sana in hakusanat]) - viimeisin_indeksi = 0 - for sana in hakusanat: - pattern = r'\b' + re.escape(sana) + r'\b' - match = re.search(pattern, nimi_lower[viimeisin_indeksi:]) - - if not match: - loytyy_kaikki = False - break - - viimeisin_indeksi += match.end() - - if loytyy_kaikki: + # Etsitään regexillä osumaa (re.IGNORECASE huomioi kirjainkoon) + if re.search(pattern_str, nimi, re.IGNORECASE): uudet_kohteet.append((nimi, linkki)) + for nimi, linkki in uudet_kohteet: status = qbit_lisaa_torrent_api_keylla(qbit_url, qbit_api_key, linkki, kategoria) if status == 200 or status == 409: