Aberrant/rtorrent.py

23 lines
568 B
Python
Raw Normal View History

2019-01-16 12:49:42 -05:00
#!/usr/bin/env python3
"""
This module handles the interface with rTorrent via XMLRPC.
"""
import xmlrpc.client
_s = xmlrpc.client.ServerProxy("http://localhost:8000/RPC2")
def get_all():
"""Returns all torrents in the 'main' view."""
return _s.download_list("", "main")
def get_active():
"""Returns all torrents in the 'active' view."""
return _s.download_list("", "active")
def get_info(torrent):
"""Retrieves relevant info about a particular torrent."""
data = {}
data['name'] = _s.d.name(torrent)
data['complete'] = _s.d.complete(torrent)
return data