viikonpäivät milloin haetaan

This commit is contained in:
Tontze
2026-06-19 09:06:58 +03:00
parent 0c06e012d3
commit 7356dffe6b
4 changed files with 79 additions and 17 deletions
Binary file not shown.
+36 -12
View File
@@ -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
}
}
+36 -1
View File
@@ -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) => `<tr><td>${k.jackett_haku}</td><td>${k.kohdekansio}</td><td class="text-end"><button onclick="poistaKohde(${i})" class="btn btn-link text-danger btn-sm p-0">Poista</button></td></tr>`).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) ? `<span class="badge bg-info text-dark">${paivaNimet[p]}</span>` : `<span class="badge bg-light text-muted">${paivaNimet[p]}</span>`
).join(' ');
return `<tr>
<td>${k.jackett_haku}</td>
<td>${k.kohdekansio}</td>
<td>${paivatTeksti}</td>
<td class="text-end">
<button onclick="muokkaaKohdetta(${i})" class="btn btn-link btn-sm p-0 me-2 text-warning">Muokkaa</button>
<button onclick="poistaKohde(${i})" class="btn btn-link text-danger btn-sm p-0">Poista</button>
</td>
</tr>`;
}).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);
});
}
</script>
</body>
</html>
+7 -4
View File
@@ -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))