1
0
mirror of https://github.com/moparisthebest/SickRage synced 2024-10-31 15:35:01 -04:00

Fix for TPB proxy issues.

Fix for save config issues.
This commit is contained in:
echel0n 2014-05-16 23:38:00 -07:00
parent e96035ff4f
commit 5453c8c6df
4 changed files with 42 additions and 43 deletions

View File

@ -292,28 +292,28 @@ var show_nzb_providers = #if $sickbeard.USE_NZBS then "true" else "false"#;
#if $hasattr($curTorrentProvider, 'proxy'):
<div class="field-pair">
<input type="checkbox" class="enabler" name="${curTorrentProvider.getID()}_proxy" id="${curTorrentProvider.getID()}_proxy" #if $curTorrentProvider.proxy then "checked=\"checked\"" else ""#/>
<input type="checkbox" class="enabler" name="${curTorrentProvider.getID()}_proxy" id="${curTorrentProvider.getID()}_proxy" #if $curTorrentProvider.proxy.enabled then "checked=\"checked\"" else ""#/>
<label class="clearfix">
<span class="component-title">Access Provider via Proxy</span>
<span class="component-desc">To bypass Country Blocking Mechanism</span>
</label>
</div>
#end if
#if $hasattr($curTorrentProvider, 'proxy_url'):
#if $hasattr($curTorrentProvider.proxy, 'url'):
<div class="field-pair content_${curTorrentProvider.getID()}_proxy" id="content_${curTorrentProvider.getID()}_proxy">
<label class="nocheck clearfix">
<span class="component-title">Proxy URL:</span>
<span class="component-desc">
<select name="${curTorrentProvider.getID()}_proxy_url" id="${curTorrentProvider.getID()}_proxy_url">
#for $i in $curTorrentProvider.proxy_dict.keys():
<option value="$curTorrentProvider.proxy_dict[$i]" #if $curTorrentProvider.proxy_dict[$i] == $curTorrentProvider.proxy_url then "selected=\"selected\"" else ""#>$i</option>
#end for
</select>
<select name="${curTorrentProvider.getID()}_proxy_url" id="${curTorrentProvider.getID()}_proxy_url">
#for $i in $curTorrentProvider.proxy.urls.keys():
<option value="$curTorrentProvider.proxy.urls[$i]" #if $curTorrentProvider.proxy.urls[$i] == $curTorrentProvider.proxy.url then "selected=\"selected\"" else ""#>$i</option>
#end for
</select>
</span>
</label>
</div>
#end if
#end if
#if $hasattr($curTorrentProvider, 'confirmed'):
<div class="field-pair">

View File

@ -425,10 +425,10 @@ def initialize(consoleLogging=True):
XBMC_UPDATE_LIBRARY, XBMC_HOST, XBMC_USERNAME, XBMC_PASSWORD, \
USE_TRAKT, TRAKT_USERNAME, TRAKT_PASSWORD, TRAKT_API, TRAKT_REMOVE_WATCHLIST, TRAKT_USE_WATCHLIST, TRAKT_METHOD_ADD, TRAKT_START_PAUSED, traktWatchListCheckerSchedular, \
USE_PLEX, PLEX_NOTIFY_ONSNATCH, PLEX_NOTIFY_ONDOWNLOAD, PLEX_NOTIFY_ONSUBTITLEDOWNLOAD, PLEX_UPDATE_LIBRARY, \
PLEX_SERVER_HOST, PLEX_HOST, PLEX_USERNAME, PLEX_PASSWORD, \
PLEX_SERVER_HOST, PLEX_HOST, PLEX_USERNAME, PLEX_PASSWORD, BACKLOG_STARTUP, \
showUpdateScheduler, __INITIALIZED__, LAUNCH_BROWSER, UPDATE_SHOWS_ON_START, SORT_ARTICLE, showList, loadingShowList, \
NEWZNAB_DATA, NZBS, NZBS_UID, NZBS_HASH,\
QUALITY_DEFAULT, FLATTEN_FOLDERS_DEFAULT, SUBTITLES_DEFAULT, STATUS_DEFAULT, \
NEWZNAB_DATA, NZBS, NZBS_UID, NZBS_HASH, INDEXER_DEFAULT, USENET_RETENTION, TORRENT_DIR, RSSUPDATE_FREQUENCY, \
QUALITY_DEFAULT, FLATTEN_FOLDERS_DEFAULT, SUBTITLES_DEFAULT, STATUS_DEFAULT, RSSUPDATE_STARTUP, \
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_PYTIVO, PYTIVO_NOTIFY_ONSNATCH, PYTIVO_NOTIFY_ONDOWNLOAD, PYTIVO_NOTIFY_ONSUBTITLEDOWNLOAD, PYTIVO_UPDATE_LIBRARY, PYTIVO_HOST, PYTIVO_SHARE_NAME, PYTIVO_TIVO_NAME, \
@ -1011,12 +1011,11 @@ def initialize(consoleLogging=True):
curTorrentProvider.getID() + '_passkey', '')
if hasattr(curTorrentProvider, 'proxy'):
curTorrentProvider.proxy = bool(check_setting_int(CFG, curTorrentProvider.getID().upper(),
curTorrentProvider.getID() + '_proxy', 0))
if hasattr(curTorrentProvider, 'proxy_url'):
curTorrentProvider.proxy_url = check_setting_str(CFG, curTorrentProvider.getID().upper(),
curTorrentProvider.getID() + '_proxy_url', '')
curTorrentProvider.proxy.enabled = bool(check_setting_int(CFG, curTorrentProvider.getID().upper(),
curTorrentProvider.getID() + '_proxy', 0))
if hasattr(curTorrentProvider.proxy, 'url'):
curTorrentProvider.proxy.url = check_setting_str(CFG, curTorrentProvider.getID().upper(),
curTorrentProvider.getID() + '_proxy_url', '')
if hasattr(curTorrentProvider, 'confirmed'):
curTorrentProvider.confirmed = bool(check_setting_int(CFG, curTorrentProvider.getID().upper(),
@ -1420,9 +1419,9 @@ def save_config():
if hasattr(curTorrentProvider, 'options'):
new_config[curTorrentProvider.getID().upper()][curTorrentProvider.getID() + '_options'] = curTorrentProvider.options
if hasattr(curTorrentProvider, 'proxy'):
new_config[curTorrentProvider.getID().upper()][curTorrentProvider.getID() + '_proxy'] = curTorrentProvider.proxy
if hasattr(curTorrentProvider, 'proxy_url'):
new_config[curTorrentProvider.getID().upper()][curTorrentProvider.getID() + '_proxy_url'] = curTorrentProvider.proxy_url
new_config[curTorrentProvider.getID().upper()][curTorrentProvider.getID() + '_proxy'] = curTorrentProvider.proxy.enabled
if hasattr(curTorrentProvider.proxy, 'url'):
new_config[curTorrentProvider.getID().upper()][curTorrentProvider.getID() + '_proxy_url'] = curTorrentProvider.proxy.url
if hasattr(curTorrentProvider, 'freeleech'):
new_config[curTorrentProvider.getID().upper()][curTorrentProvider.getID() + '_freeleech'] = int(curTorrentProvider.freeleech)
if hasattr(curTorrentProvider, 'search_mode'):

View File

@ -43,18 +43,6 @@ from lib import requests
from lib.requests import exceptions
from lib.unidecode import unidecode
proxy_dict = {
'Getprivate.eu (NL)': 'http://getprivate.eu/',
'15bb51.info (US)': 'http://15bb51.info/',
'Hideme.nl (NL)': 'http://hideme.nl/',
'Proxite.eu (DE)': 'http://proxite.eu/',
'Webproxy.cz (CZ)': 'http://webproxy.cz/',
'2me2u (CZ)': 'http://2me2u.me/',
'Interproxy.net (EU)': 'http://interproxy.net/',
'Unblockersurf.info (DK)': 'http://unblockersurf.info',
'Hiload.org (NL)': 'http://hiload.org',
}
class ThePirateBayProvider(generic.TorrentProvider):
def __init__(self):
@ -449,16 +437,28 @@ class ThePirateBayWebproxy:
self.Type = 'GlypeProxy'
self.param = 'browse.php?u='
self.option = '&b=32'
self.proxy = False
self.proxy_url = None
self.enabled = False
self.url = None
self.urls = {
'Getprivate.eu (NL)': 'http://getprivate.eu/',
'15bb51.info (US)': 'http://15bb51.info/',
'Hideme.nl (NL)': 'http://hideme.nl/',
'Proxite.eu (DE)': 'http://proxite.eu/',
'Webproxy.cz (CZ)': 'http://webproxy.cz/',
'2me2u (CZ)': 'http://2me2u.me/',
'Interproxy.net (EU)': 'http://interproxy.net/',
'Unblockersurf.info (DK)': 'http://unblockersurf.info',
'Hiload.org (NL)': 'http://hiload.org',
}
def isEnabled(self):
""" Return True if we Choose to call TPB via Proxy """
return self.proxy
return self.enabled
def getProxyURL(self):
""" Return the Proxy URL Choosen via Provider Setting """
return str(self.proxy_url)
return str(self.url)
def _buildURL(self, url):
""" Return the Proxyfied URL of the page """

View File

@ -1614,15 +1614,15 @@ class ConfigProviders:
if hasattr(curTorrentProvider, 'proxy'):
try:
curTorrentProvider.proxy = config.checkbox_to_value(kwargs[curTorrentProvider.getID() + '_proxy'])
curTorrentProvider.proxy.enabled = config.checkbox_to_value(kwargs[curTorrentProvider.getID() + '_proxy'])
except:
curTorrentProvider.proxy = 0
curTorrentProvider.proxy.enabled = 0
if hasattr(curTorrentProvider, 'proxy_url'):
try:
curTorrentProvider.proxy_url = kwargs[curTorrentProvider.getID() + '_proxy_url'].strip()
except:
curTorrentProvider.proxy_url = None
if hasattr(curTorrentProvider.proxy, 'url'):
try:
curTorrentProvider.proxy.url = kwargs[curTorrentProvider.getID() + '_proxy_url'].strip()
except:
curTorrentProvider.proxy.url = None
if hasattr(curTorrentProvider, 'freeleech'):
try: