Files
torrents/Seedbox/52 UložBalíkAudioknih.py
2026-03-03 14:27:37 +01:00

49 lines
869 B
Python

import pymysql
# =========================
# CONFIG
# =========================
DB_CONFIG = {
"host": "192.168.1.50",
"user": "root",
"password": "Vlado9674+",
"database": "torrents",
"charset": "utf8mb4"
}
SEARCH_NAME = "Balík audioknih"
# =========================
# MAIN
# =========================
conn = pymysql.connect(**DB_CONFIG)
with conn.cursor() as cursor:
cursor.execute("""
SELECT id, title_visible, torrent_content
FROM torrents
WHERE title_visible LIKE %s
LIMIT 1
""", ("%" + SEARCH_NAME + "%",))
row = cursor.fetchone()
if not row:
print("Torrent not found")
exit()
torrent_id, title, blob = row
filename = f"{title}.torrent".replace("/", "_")
with open(filename, "wb") as f:
f.write(blob)
print("Saved:", filename)
conn.close()