viikonpäivä valinta
This commit is contained in:
Binary file not shown.
@@ -85,7 +85,9 @@ def lisaa_kohde():
|
||||
kaikki_data = torrent_vahti.lataa_kaikki_data()
|
||||
kaikki_data["hakukohteet"].append({
|
||||
"jackett_haku": data['jackett_haku'],
|
||||
"kohdekansio": data['kohdekansio']
|
||||
"regex_suodatin": data.get('regex_suodatin', '.*'),
|
||||
"kohdekansio": data['kohdekansio'],
|
||||
"paivat": data.get('paivat', [0, 1, 2, 3, 4, 5, 6])
|
||||
})
|
||||
torrent_vahti.tallenna_kaikki_data(kaikki_data)
|
||||
return jsonify({'status': 'ok'})
|
||||
|
||||
+2
-5
@@ -5,7 +5,8 @@
|
||||
"therarbg",
|
||||
"thepiratebay",
|
||||
"torrentdownload",
|
||||
"limetorrents"
|
||||
"limetorrents",
|
||||
"filemood"
|
||||
],
|
||||
"hakukohteet": [
|
||||
{
|
||||
@@ -27,10 +28,6 @@
|
||||
"jackett_haku": "Formula 1 2026 SkyF1HD 1080p",
|
||||
"regex_suodatin": "(?i)Formula.?1.*2026.*SkyF1HD.*1080p",
|
||||
"kohdekansio": "Formula1"
|
||||
},
|
||||
{
|
||||
"jackett_haku": "Rio hamasaki",
|
||||
"kohdekansio": "All"
|
||||
}
|
||||
],
|
||||
"asetukset": {
|
||||
|
||||
+16
-2
@@ -46,6 +46,18 @@
|
||||
<div class="col-md-6"><input type="text" id="haku-sana" class="form-control form-control-sm" placeholder="Haku" required></div>
|
||||
<input type="hidden" id="haku-regex" value=".*">
|
||||
<div class="col-md-5"><input type="text" id="haku-kansio" class="form-control form-control-sm" placeholder="Kansio" required></div>
|
||||
<div class="col-md-12">
|
||||
<label class="small text-muted">Aktiiviset päivät:</label><br>
|
||||
<div class="btn-group btn-group-sm" role="group">
|
||||
<input type="checkbox" class="btn-check" id="pv-0" checked><label class="btn btn-outline-secondary" for="pv-0">Ma</label>
|
||||
<input type="checkbox" class="btn-check" id="pv-1" checked><label class="btn btn-outline-secondary" for="pv-1">Ti</label>
|
||||
<input type="checkbox" class="btn-check" id="pv-2" checked><label class="btn btn-outline-secondary" for="pv-2">Ke</label>
|
||||
<input type="checkbox" class="btn-check" id="pv-3" checked><label class="btn btn-outline-secondary" for="pv-3">To</label>
|
||||
<input type="checkbox" class="btn-check" id="pv-4" checked><label class="btn btn-outline-secondary" for="pv-4">Pe</label>
|
||||
<input type="checkbox" class="btn-check" id="pv-5" checked><label class="btn btn-outline-secondary" for="pv-5">La</label>
|
||||
<input type="checkbox" class="btn-check" id="pv-6" checked><label class="btn btn-outline-secondary" for="pv-6">Su</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-1"><button type="submit" class="btn btn-success btn-sm w-100">Lisää</button></div>
|
||||
</form>
|
||||
</div>
|
||||
@@ -156,14 +168,16 @@
|
||||
function poistaKohde(i) { fetch(`/poista_kohde/${i}`, {method:'DELETE'}).then(() => paivitaNakyma()); }
|
||||
|
||||
document.getElementById('lisaa-form').addEventListener('submit', (e) => {
|
||||
e.preventDefault();
|
||||
e.preventDefault();
|
||||
const paivat = [0,1,2,3,4,5,6].filter(i => document.getElementById('pv-'+i).checked);
|
||||
fetch('/lisaa_kohde', {
|
||||
method:'POST',
|
||||
headers:{'Content-Type':'application/json'},
|
||||
body:JSON.stringify({
|
||||
jackett_haku: document.getElementById('haku-sana').value,
|
||||
regex_suodatin: document.getElementById('haku-regex').value,
|
||||
kohdekansio: document.getElementById('haku-kansio').value
|
||||
kohdekansio: document.getElementById('haku-kansio').value,
|
||||
paivat: paivat
|
||||
})
|
||||
}).then(() => { e.target.reset(); paivitaNakyma(); });
|
||||
});
|
||||
|
||||
@@ -3,6 +3,7 @@ import re
|
||||
import time
|
||||
import requests
|
||||
import json
|
||||
import datetime
|
||||
from bs4 import BeautifulSoup
|
||||
|
||||
SKRIPTIN_KANSIO = os.path.dirname(os.path.abspath(__file__))
|
||||
@@ -102,6 +103,7 @@ def tarkista_ja_lataa():
|
||||
print(f"--- ALOITETAAN ERITELTY JACKETT & QBITTORRENT API-HAKU ({time.strftime('%Y-%m-%d %H:%M:%S')}) ---")
|
||||
data = lataa_kaikki_data()
|
||||
ladatut = lataa_jo_ladatut()
|
||||
tanaan = datetime.datetime.now().weekday()
|
||||
|
||||
jackett_url = data["asetukset"].get("jackett_url", "")
|
||||
api_key = data["asetukset"].get("jackett_api_key", "")
|
||||
@@ -116,6 +118,10 @@ def tarkista_ja_lataa():
|
||||
return
|
||||
|
||||
for kohde in hakulista:
|
||||
sallitut_paivat = kohde.get("paivat", [0, 1, 2, 3, 4, 5, 6])
|
||||
if tanaan not in sallitut_paivat:
|
||||
continue
|
||||
|
||||
haku = kohde["jackett_haku"]
|
||||
hakusanat = haku.lower().split()
|
||||
kategoria = kohde["kohdekansio"].strip()
|
||||
|
||||
Reference in New Issue
Block a user