Exemple #1
0
 def __init__(self, port):
     if type(port) == int:
         self.port = port
         #test connection
         self.conn = xmlrpc.RTorrentXMLRPCClient("scgi://localhost:%i" %
                                                 self.port)
     else:
         #path defined
         self.conn = xmlrpc.RTorrentXMLRPCClient(port)
     self.conn.system.listMethods()
Exemple #2
0
    def __init__(self, target):
        self.info = target

        if self.info['type'] == CONNECTION_HTTP:
            self.c = xmlrpclib.ServerProxy('http://%s:%i%s' % \
                (self.info['host'], self.info['port'], \
                self.info['url']))
        else:
            self.c = xmlrpc2scgi.RTorrentXMLRPCClient(self.info['fd'])
Exemple #3
0
def get_rtc():
    rtc = xmlrpc2scgi.RTorrentXMLRPCClient(rtc_uri)
    if (len(rtc_uri) < 4) or (rtc == None):
        showMessage('Ошибка подключения', 'Проверьте rTorrent URI', 5000)
        return None
    try:
        rtc_version = rtc.system.client_version()
        print 'Версия rTorrent [%s]' % rtc_version
    except:
        showMessage('rTorrent не подключен!', rtc_uri, 5000)
        return None
    return rtc
Exemple #4
0
__cwd__ = __addon__.getAddonInfo('path')

# Set plugin fanart
# TODO: Check to see if this actually works or not, haven't managed to see it yet!
xbmcplugin.setPluginFanart(int(sys.argv[1]),
                           os.path.join(__cwd__, 'fanart.jpg'))

# Connection constants
# Check to see if addon is set to socket or port mode
if int(__setting__('use_socket')) == 1:
    __connection__ = 'scgi://' + __setting__('domain_socket')
else:
    __connection__ = 'scgi://' + str(__setting__('scgi_server')) + ':' + str(
        __setting__('scgi_port'))

rtc_test = xmlrpc2scgi.RTorrentXMLRPCClient(__connection__)


# Check to see if we can connect to rTorrent. If not ask to open Settings page.
def connection_ok():
    # establishing connection
    # TODO: Add checking to make sure it establishes correctly
    try:
        rtc_test.system.client_version()
    except:
        dialog = xbmcgui.Dialog()
        ret = dialog.yesno(__lang__(30155), __lang__(30156), __lang__(30157))
        if ret is True:
            __addon__.openSettings()
            connection_ok()
        else: