mirror of
https://github.com/moparisthebest/SickRage
synced 2024-12-12 11:02:21 -05:00
Fixes issue with trailing slash being appened to end of url when adding custom RSS torrent provider.
This commit is contained in:
parent
736cb7c738
commit
d37a992508
@ -20,9 +20,10 @@ import cherrypy
|
|||||||
import os.path
|
import os.path
|
||||||
import datetime
|
import datetime
|
||||||
import re
|
import re
|
||||||
import time
|
import urlparse
|
||||||
import sickbeard
|
import sickbeard
|
||||||
|
|
||||||
|
from sickbeard import encodingKludge as ek
|
||||||
from sickbeard import helpers
|
from sickbeard import helpers
|
||||||
from sickbeard import logger
|
from sickbeard import logger
|
||||||
from sickbeard import naming
|
from sickbeard import naming
|
||||||
@ -274,22 +275,30 @@ def clean_hosts(hosts, default_port=None):
|
|||||||
|
|
||||||
def clean_url(url):
|
def clean_url(url):
|
||||||
"""
|
"""
|
||||||
Returns an url starting with http:// or https:// and ending with /
|
Returns an cleaned url starting with a scheme and folder with trailing /
|
||||||
or an empty string
|
or an empty string
|
||||||
"""
|
"""
|
||||||
|
|
||||||
if url:
|
if url and url.strip():
|
||||||
|
|
||||||
if not re.match(r'(https?|scgi)://.*', url):
|
url = url.strip()
|
||||||
url = 'http://' + url
|
|
||||||
|
|
||||||
if not url.endswith('/'):
|
if '://' not in url:
|
||||||
url = url + '/'
|
url = '//' + url
|
||||||
|
|
||||||
|
scheme, netloc, path, query, fragment = urlparse.urlsplit(url, 'http')
|
||||||
|
|
||||||
|
if not path.endswith('/'):
|
||||||
|
basename, ext = ek.ek(os.path.splitext, ek.ek(os.path.basename, path)) # @UnusedVariable
|
||||||
|
if not ext:
|
||||||
|
path = path + '/'
|
||||||
|
|
||||||
|
cleaned_url = urlparse.urlunsplit((scheme, netloc, path, query, fragment))
|
||||||
|
|
||||||
else:
|
else:
|
||||||
url = ''
|
cleaned_url = ''
|
||||||
|
|
||||||
return url
|
return cleaned_url
|
||||||
|
|
||||||
|
|
||||||
def to_int(val, default=0):
|
def to_int(val, default=0):
|
||||||
@ -376,7 +385,7 @@ def check_setting_str(config, cfg_name, item_name, def_val, log=True):
|
|||||||
config[cfg_name][item_name] = helpers.encrypt(my_val, encryption_version)
|
config[cfg_name][item_name] = helpers.encrypt(my_val, encryption_version)
|
||||||
|
|
||||||
if log:
|
if log:
|
||||||
logger.log(item_name + " -> " + my_val, logger.DEBUG)
|
logger.log(item_name + " -> " + str(my_val), logger.DEBUG)
|
||||||
else:
|
else:
|
||||||
logger.log(item_name + " -> ******", logger.DEBUG)
|
logger.log(item_name + " -> ******", logger.DEBUG)
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@ class TorrentRssProvider(generic.TorrentProvider):
|
|||||||
def __init__(self, name, url, search_mode='eponly', search_fallback=False, backlog_only=False):
|
def __init__(self, name, url, search_mode='eponly', search_fallback=False, backlog_only=False):
|
||||||
generic.TorrentProvider.__init__(self, name)
|
generic.TorrentProvider.__init__(self, name)
|
||||||
self.cache = TorrentRssCache(self)
|
self.cache = TorrentRssCache(self)
|
||||||
#self.url = re.sub('\/$', '', url)
|
self.url = re.sub('\/$', '', url)
|
||||||
self.url = url
|
self.url = url
|
||||||
self.enabled = True
|
self.enabled = True
|
||||||
self.supportsBacklog = False
|
self.supportsBacklog = False
|
||||||
|
Loading…
Reference in New Issue
Block a user