Skip to content

Instantly share code, notes, and snippets.

@kviktor
Last active August 29, 2015 14:06
Show Gist options
  • Save kviktor/074d6ec8dc060d2ef13a to your computer and use it in GitHub Desktop.
Save kviktor/074d6ec8dc060d2ef13a to your computer and use it in GitHub Desktop.
torrent \o/
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