mirror of
https://github.com/moparisthebest/SickRage
synced 2024-12-12 11:02:21 -05:00
Fixes issues with processTV failed downloads and HDBits auth info
This commit is contained in:
parent
d616ca2298
commit
f0bd8e5e4a
@ -299,6 +299,15 @@ var show_nzb_providers = #if $sickbeard.USE_NZBS then "true" else "false"#;
|
||||
</div>
|
||||
#end if
|
||||
|
||||
#if $hasattr($curTorrentProvider, 'passkey'):
|
||||
<div class="field-pair">
|
||||
<label class="clearfix">
|
||||
<span class="component-title">Passkey:</span>
|
||||
<input class="component-desc" type="text" name="${curTorrentProvider.getID()}_passkey" id="${curTorrentProvider.getID()}_passkey" value="$curTorrentProvider.passkey" size="40" />
|
||||
</label>
|
||||
</div>
|
||||
#end if
|
||||
|
||||
#if $hasattr($curTorrentProvider, 'ratio'):
|
||||
<div class="field-pair">
|
||||
<label class="clearfix">
|
||||
|
@ -608,7 +608,8 @@ def initialize(consoleLogging=True):
|
||||
|
||||
USENET_RETENTION = check_setting_int(CFG, 'General', 'usenet_retention', 500)
|
||||
|
||||
DAILYSEARCH_FREQUENCY = check_setting_int(CFG, 'General', 'dailysearch_frequency', DEFAULT_DAILYSEARCH_FREQUENCY)
|
||||
DAILYSEARCH_FREQUENCY = check_setting_int(CFG, 'General', 'dailysearch_frequency',
|
||||
DEFAULT_DAILYSEARCH_FREQUENCY)
|
||||
if DAILYSEARCH_FREQUENCY < MIN_DAILYSEARCH_FREQUENCY:
|
||||
DAILYSEARCH_FREQUENCY = MIN_DAILYSEARCH_FREQUENCY
|
||||
|
||||
@ -1002,6 +1003,9 @@ def initialize(consoleLogging=True):
|
||||
if hasattr(curTorrentProvider, 'password'):
|
||||
curTorrentProvider.password = check_setting_str(CFG, curTorrentProvider.getID().upper(),
|
||||
curTorrentProvider.getID() + '_password', '')
|
||||
if hasattr(curTorrentProvider, 'passkey'):
|
||||
curTorrentProvider.passkey = check_setting_str(CFG, curTorrentProvider.getID().upper(),
|
||||
curTorrentProvider.getID() + '_passkey', '')
|
||||
if hasattr(curTorrentProvider, 'proxy'):
|
||||
curTorrentProvider.proxy.enabled = bool(check_setting_int(CFG, curTorrentProvider.getID().upper(),
|
||||
curTorrentProvider.getID() + '_proxy', 0))
|
||||
@ -1395,6 +1399,9 @@ def save_config():
|
||||
if hasattr(curTorrentProvider, 'password'):
|
||||
new_config[curTorrentProvider.getID().upper()][curTorrentProvider.getID() + '_password'] = helpers.encrypt(
|
||||
curTorrentProvider.password, ENCRYPTION_VERSION)
|
||||
if hasattr(curTorrentProvider, 'passkey'):
|
||||
new_config[curTorrentProvider.getID().upper()][
|
||||
curTorrentProvider.getID() + '_passkey'] = curTorrentProvider.passkey
|
||||
if hasattr(curTorrentProvider, 'confirmed'):
|
||||
new_config[curTorrentProvider.getID().upper()][curTorrentProvider.getID() + '_confirmed'] = int(
|
||||
curTorrentProvider.confirmed)
|
||||
|
@ -393,7 +393,6 @@ def delete_dir(processPath):
|
||||
|
||||
|
||||
def get_path_dir_files(dirName, nzbName, type):
|
||||
path, dirs, files = None
|
||||
|
||||
if dirName == sickbeard.TV_DOWNLOAD_DIR and not nzbName or type == "manual": #Scheduled Post Processing Active
|
||||
#Get at first all the subdir in the dirName
|
||||
|
@ -45,9 +45,7 @@ class HDBitsProvider(generic.TorrentProvider):
|
||||
|
||||
self.enabled = False
|
||||
self.username = None
|
||||
self.password = None
|
||||
self.uid = None
|
||||
self.hash = None
|
||||
self.passkey = None
|
||||
self.ratio = None
|
||||
|
||||
self.cache = HDBitsCache(self)
|
||||
@ -62,7 +60,7 @@ class HDBitsProvider(generic.TorrentProvider):
|
||||
|
||||
def _checkAuth(self):
|
||||
|
||||
if not self.username or not self.password:
|
||||
if not self.username or not self.passkey:
|
||||
raise AuthException("Your authentication credentials for " + self.name + " are missing, check your config.")
|
||||
|
||||
return True
|
||||
@ -95,42 +93,10 @@ class HDBitsProvider(generic.TorrentProvider):
|
||||
if title:
|
||||
title = title.replace(' ', '.')
|
||||
|
||||
url = self.download_url + urllib.urlencode({'id': item['id'], 'passkey': self.password})
|
||||
url = self.download_url + urllib.urlencode({'id': item['id'], 'passkey': self.passkey})
|
||||
|
||||
return (title, url)
|
||||
|
||||
def getURL(self, url, post_data=None, headers=None, json=False):
|
||||
|
||||
if not self.session:
|
||||
self.session = requests.Session()
|
||||
|
||||
try:
|
||||
# Remove double-slashes from url
|
||||
parsed = list(urlparse.urlparse(url))
|
||||
parsed[2] = re.sub("/{2,}", "/", parsed[2]) # replace two or more / with one
|
||||
url = urlparse.urlunparse(parsed)
|
||||
|
||||
if sickbeard.PROXY_SETTING:
|
||||
proxies = {
|
||||
"http": sickbeard.PROXY_SETTING,
|
||||
"https": sickbeard.PROXY_SETTING,
|
||||
}
|
||||
|
||||
r = self.session.get(url, data=post_data, proxies=proxies, verify=False)
|
||||
else:
|
||||
r = self.session.get(url, data=post_data, verify=False)
|
||||
except (requests.exceptions.ConnectionError, requests.exceptions.HTTPError), e:
|
||||
logger.log(u"Error loading " + self.name + " URL: " + str(sys.exc_info()) + " - " + ex(e), logger.ERROR)
|
||||
return None
|
||||
|
||||
if r.status_code != 200:
|
||||
logger.log(self.name + u" page requested with url " + url + " returned status code is " + str(
|
||||
r.status_code) + ': ' + clients.http_error_code[r.status_code], logger.WARNING)
|
||||
return None
|
||||
if json:
|
||||
return r.json()
|
||||
return r.content
|
||||
|
||||
def _doSearch(self, search_params, epcount=0, age=0):
|
||||
results = []
|
||||
|
||||
@ -180,7 +146,7 @@ class HDBitsProvider(generic.TorrentProvider):
|
||||
|
||||
post_data = {
|
||||
'username': self.username,
|
||||
'passkey': self.password,
|
||||
'passkey': self.passkey,
|
||||
'category': [2],
|
||||
# TV Category
|
||||
}
|
||||
|
@ -1609,6 +1609,12 @@ class ConfigProviders:
|
||||
except:
|
||||
curTorrentProvider.password = None
|
||||
|
||||
if hasattr(curTorrentProvider, 'passkey'):
|
||||
try:
|
||||
curTorrentProvider.passkey = str(kwargs[curTorrentProvider.getID() + '_passkey']).strip()
|
||||
except:
|
||||
curTorrentProvider.passkey = None
|
||||
|
||||
if hasattr(curTorrentProvider, 'confirmed'):
|
||||
try:
|
||||
curTorrentProvider.confirmed = config.checkbox_to_value(kwargs[curTorrentProvider.getID() + '_confirmed'])
|
||||
|
Loading…
Reference in New Issue
Block a user