z230
This commit is contained in:
48
Seedbox/52 UložBalíkAudioknih.py
Normal file
48
Seedbox/52 UložBalíkAudioknih.py
Normal file
@@ -0,0 +1,48 @@
|
||||
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()
|
||||
Reference in New Issue
Block a user