From 7356dffe6b45679ff97597a5fdb010a20174d27c Mon Sep 17 00:00:00 2001 From: Tontze Date: Fri, 19 Jun 2026 09:06:58 +0300 Subject: [PATCH] =?UTF-8?q?viikonp=C3=A4iv=C3=A4t=20milloin=20haetaan?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- __pycache__/torrent_vahti.cpython-311.pyc | Bin 9349 -> 9507 bytes hakulista.json | 48 ++++++++++++++++------ templates/index.html | 37 ++++++++++++++++- torrent_vahti.py | 11 +++-- 4 files changed, 79 insertions(+), 17 deletions(-) diff --git a/__pycache__/torrent_vahti.cpython-311.pyc b/__pycache__/torrent_vahti.cpython-311.pyc index d6a9893a0a21510fb6806ee77a87aad18c8ca893..91f690bf8d20a2daa8973720fb7397786417267c 100644 GIT binary patch delta 661 zcmZqmTT^iW;JmcCiXS8oHd*aI3^1+3U7{) zY++=aGWnsDdwp1~c#2qwB1kU;WC_ApHR8({85mXrF$7crsT45~Su25}LkOyXp+=%c zq(&@-p_NGzCd9Ce31|ioLqM%$jbt%Pig>LkBSW4UO8XB3}&STB$aqM;v)`@+(U!E90{hGqbZZZwZ!VX6B}57H8(gXXd4( zW*2APVku6{OT5KikXTZZT9kK-H8-&&IpY>vaYqaiWIK7;$!`VOCnw4abIk%8 zoDRgrx|{3dc^KI=S&cq2XilD>@RUu6)AR#_(Bx`G<$4)~4&Mg~iWhifZ%8P9VBp|2 z1QQcjZb->5Ra&CC!eycU68(!(h8tWjN?A@|zbhd%hjW4Y3abld?ib8Ffar?0=S2yx zD-vE4SRaVXd|+S_l)9m!Il=dah~xy<2Lg%JL&!36*MNOc9s00zdAVL;IR8QWdl*c%0vZAsIwv1XI7~n+RXQkvzoXJ6MJnfXAS29j>&?I!kc3x zTNoKrCqI;OXIHNkuMt@w01~!ks1dIbO%baC>RQIcz_1#KA)r>GMj}Nd8_X|aNfECV zV`Ru zxgf$0NN7q;UMF{Ca-+Pk7H>{|Wl3dae0E}Hc6R11mg2;`#9Qo{c`2#c#hJI*ic1np zN{fr7fSM+6mpA5`4rHVQaWUKGFY-K$Y-+4V9~smpvnf7h9Xku=G6 zg6$0z%?Z9YL?kD;-cZq=+^n=+^cGW5Y7r=0i+n+ZEQqL?9H5-XIDPVdWfjIno1Z8% TG4fk6YJFgU6BU!cs^|d#W*>yk diff --git a/hakulista.json b/hakulista.json index 3955505..c29cbb4 100644 --- a/hakulista.json +++ b/hakulista.json @@ -9,25 +9,49 @@ "filemood" ], "hakukohteet": [ - { - "jackett_haku": "motogp 2026 720p jff", - "regex_suodatin": "motogp.*?2026.*?720p.*?jff.*?", - "kohdekansio": "MotoGP" - }, { "jackett_haku": "motogp 2026 tntsportshd 1080p", - "regex_suodatin": "motogp.*?2026.*?tntsportshd.*?1080p.*?", - "kohdekansio": "MotoGP" + "regex_suodatin": ".*", + "kohdekansio": "MotoGP", + "paivat": [ + 3, + 4, + 5, + 6 + ] }, { "jackett_haku": "Formula 1 2026 1080p SS", - "regex_suodatin": "\tFormula.*?1.*?2026.*?1080p.*?SS.*?", - "kohdekansio": "Formula1" + "regex_suodatin": ".*", + "kohdekansio": "Formula1", + "paivat": [ + 3, + 4, + 5, + 6 + ] }, { "jackett_haku": "Formula 1 2026 SkyF1HD 1080p", - "regex_suodatin": "(?i)Formula.?1.*2026.*SkyF1HD.*1080p", - "kohdekansio": "Formula1" + "regex_suodatin": ".*", + "kohdekansio": "Formula1", + "paivat": [ + 3, + 4, + 5, + 6 + ] + }, + { + "jackett_haku": "motogp 2026 720p jff", + "regex_suodatin": ".*", + "kohdekansio": "MotoGP", + "paivat": [ + 3, + 4, + 5, + 6 + ] } ], "asetukset": { @@ -36,6 +60,6 @@ "qbit_url": "http://192.168.1.40:8080/", "qbit_user": "admin", "qbit_pass": "qbt_uFxc7gqD7sJsBk9FJdH38bLIyapr", - "haku_vali": 10 + "haku_vali": 900 } } \ No newline at end of file diff --git a/templates/index.html b/templates/index.html index c38e733..0957c6e 100644 --- a/templates/index.html +++ b/templates/index.html @@ -132,7 +132,22 @@ document.getElementById('tila-badge').className = "badge bg-success"; const lista = document.getElementById('hakukohteet-lista'); - lista.innerHTML = data.hakukohteet.map((k, i) => `${k.jackett_haku}${k.kohdekansio}`).join(''); + lista.innerHTML = data.hakukohteet.map((k, i) => { + const paivaNimet = ['Ma', 'Ti', 'Ke', 'To', 'Pe', 'La', 'Su']; + const paivatTeksti = [0, 1, 2, 3, 4, 5, 6].map(p => + k.paivat.includes(p) ? `${paivaNimet[p]}` : `${paivaNimet[p]}` + ).join(' '); + + return ` + ${k.jackett_haku} + ${k.kohdekansio} + ${paivatTeksti} + + + + + `; + }).join(''); const hakuTermi = document.getElementById('historia-haku').value.toLowerCase(); const lokiDiv = document.getElementById('loki-sisalto'); @@ -199,6 +214,26 @@ document.getElementById('tyhjenna-loki-btn').addEventListener('click', () => fetch('/tyhjenna_loki', {method:'POST'}).then(() => paivitaNakyma())); paivitaNakyma(); setInterval(paivitaNakyma, 5000); + function muokkaaKohdetta(i) { + fetch('/status') + .then(res => res.json()) + .then(data => { + const kohde = data.hakukohteet[i]; + // Täytetään lomake hakukohteen tiedoilla + document.getElementById('haku-sana').value = kohde.jackett_haku; + document.getElementById('haku-kansio').value = kohde.kohdekansio; + + // Päivitetään checkboxit + [0, 1, 2, 3, 4, 5, 6].forEach(p => { + const cb = document.getElementById('pv-' + p); + if (cb) cb.checked = kohde.paivat.includes(p); + }); + + // Vieritetään sivu takaisin ylös lomakkeeseen + window.scrollTo(0, 0); + }); +} + diff --git a/torrent_vahti.py b/torrent_vahti.py index c94855e..787dea2 100644 --- a/torrent_vahti.py +++ b/torrent_vahti.py @@ -139,15 +139,18 @@ def tarkista_ja_lataa(): if linkki in ladatut: continue nimi_lower = nimi.lower() - viimeisin_indeksi = -1 loytyy_kaikki = True + viimeisin_indeksi = 0 for sana in hakusanat: - indeksi = nimi_lower.find(sana, viimeisin_indeksi + 1) - if indeksi == -1: + 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 = indeksi + + viimeisin_indeksi += match.end() if loytyy_kaikki: uudet_kohteet.append((nimi, linkki))