diff --git a/__pycache__/torrent_vahti.cpython-311.pyc b/__pycache__/torrent_vahti.cpython-311.pyc index 9252a14..274762a 100644 Binary files a/__pycache__/torrent_vahti.cpython-311.pyc and b/__pycache__/torrent_vahti.cpython-311.pyc differ 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')