mirror of
https://github.com/Laborratte5/linux-iso-seeder.git
synced 2025-12-30 17:08:17 +01:00
Cleaner downloads
This commit is contained in:
parent
0cfeb056a6
commit
bd3c4b1702
1 changed files with 8 additions and 1 deletions
|
|
@ -21,7 +21,14 @@ logging.basicConfig(
|
||||||
watch_dir = "/watch"
|
watch_dir = "/watch"
|
||||||
|
|
||||||
def download_torrent(name, url):
|
def download_torrent(name, url):
|
||||||
dest = os.path.join(watch_dir, f"{name}.torrent")
|
dest = os.path.join(watch_dir, f"{name}.torrent")
|
||||||
|
added = os.path.join(watch_dir, f"{name}.torrent.added")
|
||||||
|
|
||||||
|
# Skip if already processed or queued
|
||||||
|
if dest.exists() or added.exists():
|
||||||
|
logging.info("Skip %s – torrent already present.", dest.name)
|
||||||
|
return False
|
||||||
|
|
||||||
try:
|
try:
|
||||||
logging.info(f"Fetching {url} ...")
|
logging.info(f"Fetching {url} ...")
|
||||||
r = requests.get(url, timeout=30)
|
r = requests.get(url, timeout=30)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue