From 830410b1ac983d863da5bfdd23873c0eddfdeebf Mon Sep 17 00:00:00 2001 From: Tontze Date: Sun, 28 Jun 2026 13:45:43 +0300 Subject: [PATCH] aktiiviset haut muokkauksen parannus --- __pycache__/torrent_vahti.cpython-311.pyc | Bin 9486 -> 9486 bytes app.py | 18 +++- hakulista.json | 9 +- templates/index.html | 104 +++++++++++++++------- torrent_vahti.py | 2 +- 5 files changed, 100 insertions(+), 33 deletions(-) diff --git a/__pycache__/torrent_vahti.cpython-311.pyc b/__pycache__/torrent_vahti.cpython-311.pyc index 9252a14b38556aff615088dadcd3fc3beb481569..274762ac2d5f52718f4b0bef5d0d7bf9465d538c 100644 GIT binary patch delta 26 gcmeD4>ht1S&dbZi00b4$8@W0K809uk5vURY09s-Ou>b%7 delta 26 gcmeD4>ht1S&dbZi00c|yHga_eF!FDnB2Xm)09xnb%7 diff --git a/app.py b/app.py index d92efdf..67e3589 100644 --- a/app.py +++ b/app.py @@ -101,6 +101,23 @@ def poista_kohde(index): torrent_vahti.tallenna_kaikki_data(kaikki_data) return jsonify({'status': 'ok'}) +@app.route('/paivita_kohde/', methods=['POST']) +def paivita_kohde(index): + data = request.json + kaikki_data = torrent_vahti.lataa_kaikki_data() + + if 0 <= index < len(kaikki_data.get("hakukohteet", [])): + kaikki_data["hakukohteet"][index] = { + "jackett_haku": data['jackett_haku'], + "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'}) + + return jsonify({'status': 'error', 'message': 'Virheellinen indeksi'}), 400 + @app.route('/poista_historiarivi', methods=['POST']) def poista_historiarivi(): data = request.json @@ -128,7 +145,6 @@ def tyhjenna_loki(): return jsonify({'status': 'ok'}) if __name__ == '__main__': - # Käytetään dynaamista ajastinta asetuksista def automaattinen_ajastin(): while True: kaikki_data = torrent_vahti.lataa_kaikki_data() diff --git a/hakulista.json b/hakulista.json index 7709a2f..5642f91 100644 --- a/hakulista.json +++ b/hakulista.json @@ -4,7 +4,6 @@ "torrentgalaxyclone", "therarbg", "thepiratebay", - "torrentdownload", "limetorrents", "filemood" ], @@ -60,6 +59,14 @@ "paivat": [ 6 ] + }, + { + "jackett_haku": "audiobook suomeksi", + "regex_suodatin": ".*", + "kohdekansio": "All", + "paivat": [ + 6 + ] } ], "asetukset": { diff --git a/templates/index.html b/templates/index.html index 0957c6e..a0a1ae4 100644 --- a/templates/index.html +++ b/templates/index.html @@ -118,6 +118,8 @@ diff --git a/torrent_vahti.py b/torrent_vahti.py index 05bd72c..8b1e807 100644 --- a/torrent_vahti.py +++ b/torrent_vahti.py @@ -55,7 +55,7 @@ def hae_jackettista(jackett_url, api_key, indeksori, hakusana): url = f"{jackett_url}/api/v2.0/indexers/{indeksori}/results/torznab/api" params = {"apikey": api_key, "t": "search", "q": hakusana} try: - res = requests.get(url, params=params, timeout=15) + res = requests.get(url, params=params, timeout=30) res.raise_for_status() soup = BeautifulSoup(res.text, 'xml')