Last active
August 29, 2015 14:06
-
-
Save kviktor/074d6ec8dc060d2ef13a to your computer and use it in GitHub Desktop.
torrent \o/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
from random import randrange | |
from subprocess import call | |
def get_random_name(): | |
return "%x.torrent" % randrange(pow(2, 30), pow(2, 40)) | |
for f in os.listdir(u"."): | |
if f.endswith(".torrent"): | |
name = get_random_name() | |
os.rename(f, name) | |
try: | |
call(["deluge-console", "add", name]) | |
except Exception as e: | |
print("Error during adding torrent, %s" % e) | |
else: | |
os.remove(name) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment