Example #1
0
 def __init__(self, target):
     """
     Initialise the RTorrent object.
     ``target`` is target dict as parsed by parse_config (pyrotorrent.py).
     """
     self.target = target
     self.s = RTorrentXMLRPC(target)
Example #2
0
 def __init__(self, target, _hash):
     """
     Initialise the Torrent object; pass a target dict (parsed by
     parse_config in pyrotorrentpy) and the torrent hash.
     """
     self.target = target
     self.s = RTorrentXMLRPC(target)
     self._hash = _hash
Example #3
0
    def __init__(self, target, *args):
        """
        """
        self.s = RTorrentXMLRPC(target)
        self.m = xmlrpclib.MultiCall(self.s)
        self.target = target['name']

        # Stack to put commands on
        self._groups = [[]]

        # We keep these purely for hash functionality
        self._groups_args = [[]]
        self._def_group_args = args
Example #4
0
    def __init__(self, target, *extra_args):
        """
        """
        self.s = RTorrentXMLRPC(target)
        self.target = target['name']
        self.extra_args = extra_args

        # Stack to put commands on
        self.commandstack = []

        # Same as commandstack, but stores the original names.
        # We need to for .all()
        self.commandistack = []

        # Contains possible arguments.
        self.commands = {}
Example #5
0
 def __init__(self, target):
     """
     Initialise the Peer object.
     """
     self.target = target
     self.s = RTorrentXMLRPC(target)
Example #6
0
class RTorrent(object):
    """
    RTorrent class. This wraps most of the RTorrent *main* functionality
    (read: global functionality) in a class. Think of, current upload and
    download, libTorrent version.

    Methods specific to a Torrent can be found in the :ref:`torrent-class`
    class.
    """

    # FIXME: If we leave URL at '' xmlrpclib will default to /RPC2 as well.
    def __init__(self, target):
        """
        Initialise the RTorrent object.
        ``target`` is target dict as parsed by parse_config (pyrotorrent.py).
        """
        self.target = target
        self.s = RTorrentXMLRPC(target)

    def __repr__(self):
        return 'RTorrent(%s)' % self.target['name']

    def get_download_list(self, _type=''):
        """
        Returns a list of torrents.
        _type defines what is returned. Valid:

            *   '' (Empty string), 'default'
            *   'complete'
            *   'incomplete'
            *   'started'
            *   'stopped'
            *   'active'
            *   'hashing'
            *   'seeding'

        Plus all customly defined views.
        """
        # FIXME: List is not complete(?) + exception should be raised.
        if _type not in ('complete', 'incomplete', 'started', 'stopped',
                'active', 'hashing', 'seeding', '', 'default'):
            return None

        res = self.s.download_list(_type)

        # FIXME: We now only have the hashes. Do we also want to fetch all the
        # data per torrent? Or perhaps only the basic info?

        return res

    def query(self):
        """
        Query returns a new RTorrentQuery object with the target
        from the current RTorrent object.

        Use this to execute several (different) calls on the RTorrent class in
        one request. This can increase performance and reduce latency and load.

        See :ref:`rtorrentquery-class` on how to use it.
        """
        from lib.rtorrentquery import RTorrentQuery
        return RTorrentQuery(self.target)
Example #7
0
    def __init__(self, target):

        self.target = target
        self.s = RTorrentXMLRPC(target)