# Path: lib/xmlrpc.py
# class RTorrentXMLRPC(object):
# 
#     def __init__(self, target):
#         self.info = target
# 
#         if self.info['type'] == CONNECTION_HTTP:
#             self.c = xmlrpc.client.ServerProxy('http://%s:%i%s' % \
#                 (self.info['host'], self.info['port'], \
#                 self.info['url']))
#         else:
#             self.c = xmlrpc2scgi.RTorrentXMLRPCClient(self.info['fd'])
# 
# 
#     def __getattr__(self, attr, **args):
#         return getattr(self.c, attr)


from lib.xmlrpc import RTorrentXMLRPC
        from lib.rtorrentquery import RTorrentQuery
import types
    # Simple test.
    old = x.get_upload_throttle()
    print 'Throttle:', old
    print 'Return:', x.set_upload_throttle(20000)
    print 'Throttle:', x.get_upload_throttle()
    print 'Return:', x.set_upload_throttle(old)
    print 'Throttle:', x.get_upload_throttle()

    print 'Download list', x.get_download_list()

"""


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

# Path: lib/xmlrpc.py
# class RTorrentXMLRPC(object):
# 
#     def __init__(self, target):
#         self.info = target
# 
#         if self.info['type'] == CONNECTION_HTTP:
#             self.c = xmlrpc.client.ServerProxy('http://%s:%i%s' % \
#                 (self.info['host'], self.info['port'], \
#                 self.info['url']))
#         else:
#             self.c = xmlrpc2scgi.RTorrentXMLRPCClient(self.info['fd'])
# 
# 
#     def __getattr__(self, attr, **args):
#         return getattr(self.c, attr)


# Path: model/rtorrent.py
from lib.xmlrpc import RTorrentXMLRPC
        from lib.rtorrentquery import RTorrentQuery
import types

    # Simple test.
    old = x.get_upload_throttle()
    print 'Throttle:', old
    print 'Return:', x.set_upload_throttle(20000)
    print 'Throttle:', x.get_upload_throttle()
    print 'Return:', x.set_upload_throttle(old)
    print 'Throttle:', x.get_upload_throttle()

    print 'Download list', x.get_download_list()

"""


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)