Skip to content

Instantly share code, notes, and snippets.

@mountainpenguin
Last active October 16, 2016 11:04
Show Gist options
  • Select an option

  • Save mountainpenguin/8ce4673e295a0fb47b59566533dd6dec to your computer and use it in GitHub Desktop.

Select an option

Save mountainpenguin/8ce4673e295a0fb47b59566533dd6dec to your computer and use it in GitHub Desktop.
#!/usr/bin/env python2
from modules import rtorrent
from modules import config
import os
if __name__ == "__main__":
conf = config.Config()
socket_file = conf.get("rtorrent_socket")
RT = rtorrent.rtorrent(socket_file)
tlist = RT.getTorrentList()
# find first torrent with a single file
for tid in tlist:
tfiles = RT.getFiles(tid)
if len(tfiles) == 1:
break
# check ajaxPage method
print "default:", RT.conn.directory.default()
print "directory:", RT.conn.d.directory(tid)
rootDir = os.path.abspath(os.path.expanduser(os.path.expandvars(RT.getRootDir())))
print "rootDir:", rootDir
print "base_path:", tfiles[0].base_path
print "abs_path:", tfiles[0].abs_path
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment