1
0
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:
echel0n 2014-05-19 13:06:32 -07:00
parent d616ca2298
commit f0bd8e5e4a
5 changed files with 31 additions and 44 deletions

View File

@ -299,6 +299,15 @@ var show_nzb_providers = #if $sickbeard.USE_NZBS then "true" else "false"#;
</div> </div>
#end if #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'): #if $hasattr($curTorrentProvider, 'ratio'):
<div class="field-pair"> <div class="field-pair">
<label class="clearfix"> <label class="clearfix">

View File

@ -432,8 +432,8 @@ def initialize(consoleLogging=True):
USE_PLEX, PLEX_NOTIFY_ONSNATCH, PLEX_NOTIFY_ONDOWNLOAD, PLEX_NOTIFY_ONSUBTITLEDOWNLOAD, PLEX_UPDATE_LIBRARY, \ USE_PLEX, PLEX_NOTIFY_ONSNATCH, PLEX_NOTIFY_ONDOWNLOAD, PLEX_NOTIFY_ONSUBTITLEDOWNLOAD, PLEX_UPDATE_LIBRARY, \
PLEX_SERVER_HOST, PLEX_HOST, PLEX_USERNAME, PLEX_PASSWORD, DEFAULT_BACKLOG_FREQUENCY, MIN_BACKLOG_FREQUENCY, BACKLOG_STARTUP, SKIP_REMOVED_FILES, \ PLEX_SERVER_HOST, PLEX_HOST, PLEX_USERNAME, PLEX_PASSWORD, DEFAULT_BACKLOG_FREQUENCY, MIN_BACKLOG_FREQUENCY, BACKLOG_STARTUP, SKIP_REMOVED_FILES, \
showUpdateScheduler, __INITIALIZED__, LAUNCH_BROWSER, UPDATE_SHOWS_ON_START, SORT_ARTICLE, showList, loadingShowList, \ showUpdateScheduler, __INITIALIZED__, LAUNCH_BROWSER, UPDATE_SHOWS_ON_START, SORT_ARTICLE, showList, loadingShowList, \
NEWZNAB_DATA, NZBS, NZBS_UID, NZBS_HASH, INDEXER_DEFAULT, USENET_RETENTION, TORRENT_DIR,\ NEWZNAB_DATA, NZBS, NZBS_UID, NZBS_HASH, INDEXER_DEFAULT, USENET_RETENTION, TORRENT_DIR, \
QUALITY_DEFAULT, FLATTEN_FOLDERS_DEFAULT, SUBTITLES_DEFAULT, STATUS_DEFAULT, DAILYSEARCH_STARTUP,\ QUALITY_DEFAULT, FLATTEN_FOLDERS_DEFAULT, SUBTITLES_DEFAULT, STATUS_DEFAULT, DAILYSEARCH_STARTUP, \
GROWL_NOTIFY_ONSNATCH, GROWL_NOTIFY_ONDOWNLOAD, GROWL_NOTIFY_ONSUBTITLEDOWNLOAD, TWITTER_NOTIFY_ONSNATCH, TWITTER_NOTIFY_ONDOWNLOAD, TWITTER_NOTIFY_ONSUBTITLEDOWNLOAD, \ GROWL_NOTIFY_ONSNATCH, GROWL_NOTIFY_ONDOWNLOAD, GROWL_NOTIFY_ONSUBTITLEDOWNLOAD, TWITTER_NOTIFY_ONSNATCH, TWITTER_NOTIFY_ONDOWNLOAD, TWITTER_NOTIFY_ONSUBTITLEDOWNLOAD, \
USE_GROWL, GROWL_HOST, GROWL_PASSWORD, USE_PROWL, PROWL_NOTIFY_ONSNATCH, PROWL_NOTIFY_ONDOWNLOAD, PROWL_NOTIFY_ONSUBTITLEDOWNLOAD, PROWL_API, PROWL_PRIORITY, PROG_DIR, \ USE_GROWL, GROWL_HOST, GROWL_PASSWORD, USE_PROWL, PROWL_NOTIFY_ONSNATCH, PROWL_NOTIFY_ONDOWNLOAD, PROWL_NOTIFY_ONSUBTITLEDOWNLOAD, PROWL_API, PROWL_PRIORITY, PROG_DIR, \
USE_PYTIVO, PYTIVO_NOTIFY_ONSNATCH, PYTIVO_NOTIFY_ONDOWNLOAD, PYTIVO_NOTIFY_ONSUBTITLEDOWNLOAD, PYTIVO_UPDATE_LIBRARY, PYTIVO_HOST, PYTIVO_SHARE_NAME, PYTIVO_TIVO_NAME, \ USE_PYTIVO, PYTIVO_NOTIFY_ONSNATCH, PYTIVO_NOTIFY_ONDOWNLOAD, PYTIVO_NOTIFY_ONSUBTITLEDOWNLOAD, PYTIVO_UPDATE_LIBRARY, PYTIVO_HOST, PYTIVO_SHARE_NAME, PYTIVO_TIVO_NAME, \
@ -608,7 +608,8 @@ def initialize(consoleLogging=True):
USENET_RETENTION = check_setting_int(CFG, 'General', 'usenet_retention', 500) 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: if DAILYSEARCH_FREQUENCY < MIN_DAILYSEARCH_FREQUENCY:
DAILYSEARCH_FREQUENCY = MIN_DAILYSEARCH_FREQUENCY DAILYSEARCH_FREQUENCY = MIN_DAILYSEARCH_FREQUENCY
@ -1002,6 +1003,9 @@ def initialize(consoleLogging=True):
if hasattr(curTorrentProvider, 'password'): if hasattr(curTorrentProvider, 'password'):
curTorrentProvider.password = check_setting_str(CFG, curTorrentProvider.getID().upper(), curTorrentProvider.password = check_setting_str(CFG, curTorrentProvider.getID().upper(),
curTorrentProvider.getID() + '_password', '') curTorrentProvider.getID() + '_password', '')
if hasattr(curTorrentProvider, 'passkey'):
curTorrentProvider.passkey = check_setting_str(CFG, curTorrentProvider.getID().upper(),
curTorrentProvider.getID() + '_passkey', '')
if hasattr(curTorrentProvider, 'proxy'): if hasattr(curTorrentProvider, 'proxy'):
curTorrentProvider.proxy.enabled = bool(check_setting_int(CFG, curTorrentProvider.getID().upper(), curTorrentProvider.proxy.enabled = bool(check_setting_int(CFG, curTorrentProvider.getID().upper(),
curTorrentProvider.getID() + '_proxy', 0)) curTorrentProvider.getID() + '_proxy', 0))
@ -1030,8 +1034,8 @@ def initialize(consoleLogging=True):
0)) 0))
if hasattr(curTorrentProvider, 'backlog_only'): if hasattr(curTorrentProvider, 'backlog_only'):
curTorrentProvider.backlog_only = bool(check_setting_int(CFG, curTorrentProvider.getID().upper(), curTorrentProvider.backlog_only = bool(check_setting_int(CFG, curTorrentProvider.getID().upper(),
curTorrentProvider.getID() + '_backlog_only', curTorrentProvider.getID() + '_backlog_only',
0)) 0))
try: try:
url = 'http://raw.github.com/echel0n/sickrage-init/master/settings.ini' url = 'http://raw.github.com/echel0n/sickrage-init/master/settings.ini'
clear_cache = ElementTree.XML(helpers.getURL(url)).find('cache/clear').text clear_cache = ElementTree.XML(helpers.getURL(url)).find('cache/clear').text
@ -1395,6 +1399,9 @@ def save_config():
if hasattr(curTorrentProvider, 'password'): if hasattr(curTorrentProvider, 'password'):
new_config[curTorrentProvider.getID().upper()][curTorrentProvider.getID() + '_password'] = helpers.encrypt( new_config[curTorrentProvider.getID().upper()][curTorrentProvider.getID() + '_password'] = helpers.encrypt(
curTorrentProvider.password, ENCRYPTION_VERSION) curTorrentProvider.password, ENCRYPTION_VERSION)
if hasattr(curTorrentProvider, 'passkey'):
new_config[curTorrentProvider.getID().upper()][
curTorrentProvider.getID() + '_passkey'] = curTorrentProvider.passkey
if hasattr(curTorrentProvider, 'confirmed'): if hasattr(curTorrentProvider, 'confirmed'):
new_config[curTorrentProvider.getID().upper()][curTorrentProvider.getID() + '_confirmed'] = int( new_config[curTorrentProvider.getID().upper()][curTorrentProvider.getID() + '_confirmed'] = int(
curTorrentProvider.confirmed) curTorrentProvider.confirmed)

View File

@ -393,7 +393,6 @@ def delete_dir(processPath):
def get_path_dir_files(dirName, nzbName, type): 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 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 #Get at first all the subdir in the dirName

View File

@ -45,9 +45,7 @@ class HDBitsProvider(generic.TorrentProvider):
self.enabled = False self.enabled = False
self.username = None self.username = None
self.password = None self.passkey = None
self.uid = None
self.hash = None
self.ratio = None self.ratio = None
self.cache = HDBitsCache(self) self.cache = HDBitsCache(self)
@ -62,7 +60,7 @@ class HDBitsProvider(generic.TorrentProvider):
def _checkAuth(self): 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.") raise AuthException("Your authentication credentials for " + self.name + " are missing, check your config.")
return True return True
@ -95,42 +93,10 @@ class HDBitsProvider(generic.TorrentProvider):
if title: if title:
title = title.replace(' ', '.') 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) 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): def _doSearch(self, search_params, epcount=0, age=0):
results = [] results = []
@ -180,7 +146,7 @@ class HDBitsProvider(generic.TorrentProvider):
post_data = { post_data = {
'username': self.username, 'username': self.username,
'passkey': self.password, 'passkey': self.passkey,
'category': [2], 'category': [2],
# TV Category # TV Category
} }

View File

@ -1609,6 +1609,12 @@ class ConfigProviders:
except: except:
curTorrentProvider.password = None curTorrentProvider.password = None
if hasattr(curTorrentProvider, 'passkey'):
try:
curTorrentProvider.passkey = str(kwargs[curTorrentProvider.getID() + '_passkey']).strip()
except:
curTorrentProvider.passkey = None
if hasattr(curTorrentProvider, 'confirmed'): if hasattr(curTorrentProvider, 'confirmed'):
try: try:
curTorrentProvider.confirmed = config.checkbox_to_value(kwargs[curTorrentProvider.getID() + '_confirmed']) curTorrentProvider.confirmed = config.checkbox_to_value(kwargs[curTorrentProvider.getID() + '_confirmed'])