Adjusted rtorrent connect method to work with httprpc URIs, adjusted option descriptions

This commit is contained in:
Dean Gardiner
2014-02-21 15:48:17 +13:00
parent ca2c4a0b3e
commit d448b8cd99
2 changed files with 12 additions and 6 deletions
@@ -31,8 +31,8 @@ config = [{
{
'name': 'host',
'default': 'localhost:80',
'description': 'Hostname with port or XML-RPC Endpoint URI. Usually <strong>scgi://localhost:5000</strong> '
'or <strong>localhost:80</strong>'
'description': 'RPC Communication URI. Usually <strong>scgi://localhost:5000</strong>, '
'<strong>httprpc://localhost/rutorrent</strong> or <strong>localhost:80</strong>'
},
{
'name': 'ssl',
@@ -46,7 +46,7 @@ config = [{
'type': 'string',
'default': 'RPC2',
'advanced': True,
'description': 'Change if you don\'t run rTorrent RPC at the default url.',
'description': 'Change if your RPC mount is at a different path.',
},
{
'name': 'username',
@@ -1,14 +1,15 @@
from base64 import b16encode, b32decode
from bencode import bencode, bdecode
from couchpotato.core.downloaders.base import Downloader, ReleaseDownloadList
from couchpotato.core.event import fireEvent, addEvent
from couchpotato.core.helpers.encoding import sp
from couchpotato.core.helpers.variable import cleanHost, splitString
from couchpotato.core.logger import CPLog
from base64 import b16encode, b32decode
from bencode import bencode, bdecode
from datetime import timedelta
from hashlib import sha1
from rtorrent import RTorrent
from rtorrent.err import MethodError
from urlparse import urlparse
import os
log = CPLog(__name__)
@@ -51,7 +52,12 @@ class rTorrent(Downloader):
if self.rt is not None:
return self.rt
url = cleanHost(self.conf('host'), protocol = True, ssl = self.conf('ssl')) + self.conf('rpc_url')
url = cleanHost(self.conf('host'), protocol = True, ssl = self.conf('ssl'))
parsed = urlparse(url)
# rpc_url is only used on http/https scgi pass-through
if parsed.scheme in ['http', 'https']:
url += self.conf('rpc_url')
if self.conf('username') and self.conf('password'):
self.rt = RTorrent(