-
-
Save vanquishregret/9654230 to your computer and use it in GitHub Desktop.
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
#!/usr/bin/env python | |
SESSION_DIR = '/path/to/.sessions' | |
# ^ should match session_path from .rtorrent.rc | |
MV_DIR = '/downloads/complete/tracker1.com' | |
# ^ Change this to path these files should have been moved to | |
import os | |
import sys | |
import glob | |
try: | |
from bencode import bdecode,bencode | |
except: | |
print "Please rune # easy_install BitTorrent_bencode" | |
sys.exit() | |
sys.path.append('/usr/lib/python2.6/site-packages/BTL') | |
for torrent in glob.glob(SESSION_DIR): | |
data = bdecode(open(str(torrent),'rb').read()) | |
path = data['rtorrent']['directory'] | |
dir = os.path.basename(path) | |
target = os.path.join(MV_DIR,dir) | |
os.system("mv '%s' '%s'" % (path,target)) | |
data['rtorrent']['directory'] = target | |
data = bencode(data) | |
f = open(str(torrent),'w') | |
f.write(data) | |
f.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment