mirror of
https://github.com/moparisthebest/SickRage
synced 2025-01-05 10:58:01 -05:00
Make the timeout configurable
This commit is contained in:
parent
c62d8f2c79
commit
7f5d0ff375
@ -1399,6 +1399,15 @@
|
||||
</span>
|
||||
</label>
|
||||
</div>
|
||||
<div class="field-pair">
|
||||
<label for="trakt_timeout">
|
||||
<span class="component-title">API Timeout:</span>
|
||||
<span class="component-desc">
|
||||
<input type="text" name="trakt_timeout" id="trakt_timeout" value="$sickbeard.TRAKT_TIMEOUT" class="form-control input-sm input75" />
|
||||
<p>Seconds to wait for Trakt API to respond (0 to wait forever)</p>
|
||||
</span>
|
||||
</label>
|
||||
</div>
|
||||
<div class="field-pair">
|
||||
<label for="trakt_default_indexer">
|
||||
<span class="component-title">Default indexer:</span>
|
||||
|
@ -9,7 +9,7 @@ class TraktAPI():
|
||||
self.username = username
|
||||
self.password = password
|
||||
self.verify = not disable_ssl_verify
|
||||
self.timeout = timeout
|
||||
self.timeout = timeout if timeout else None
|
||||
self.api_url = 'https://api.trakt.tv/'
|
||||
self.headers = {
|
||||
'Content-Type': 'application/json',
|
||||
|
@ -402,6 +402,7 @@ TRAKT_USE_RECOMMENDED = False
|
||||
TRAKT_SYNC = False
|
||||
TRAKT_DEFAULT_INDEXER = None
|
||||
TRAKT_DISABLE_SSL_VERIFY = False
|
||||
TRAKT_TIMEOUT = 30
|
||||
|
||||
USE_PYTIVO = False
|
||||
PYTIVO_NOTIFY_ONSNATCH = False
|
||||
@ -504,7 +505,7 @@ def initialize(consoleLogging=True):
|
||||
TORRENT_USERNAME, TORRENT_PASSWORD, TORRENT_HOST, TORRENT_PATH, TORRENT_SEED_TIME, TORRENT_PAUSED, TORRENT_HIGH_BANDWIDTH, TORRENT_LABEL, TORRENT_LABEL_ANIME, TORRENT_VERIFY_CERT, TORRENT_RPCURL, \
|
||||
USE_KODI, KODI_ALWAYS_ON, KODI_NOTIFY_ONSNATCH, KODI_NOTIFY_ONDOWNLOAD, KODI_NOTIFY_ONSUBTITLEDOWNLOAD, KODI_UPDATE_FULL, KODI_UPDATE_ONLYFIRST, \
|
||||
KODI_UPDATE_LIBRARY, KODI_HOST, KODI_USERNAME, KODI_PASSWORD, BACKLOG_FREQUENCY, \
|
||||
USE_TRAKT, TRAKT_USERNAME, TRAKT_PASSWORD, TRAKT_REMOVE_WATCHLIST, TRAKT_USE_WATCHLIST, TRAKT_METHOD_ADD, TRAKT_START_PAUSED, traktCheckerScheduler, TRAKT_USE_RECOMMENDED, TRAKT_SYNC, TRAKT_DEFAULT_INDEXER, TRAKT_REMOVE_SERIESLIST, TRAKT_DISABLE_SSL_VERIFY, \
|
||||
USE_TRAKT, TRAKT_USERNAME, TRAKT_PASSWORD, TRAKT_REMOVE_WATCHLIST, TRAKT_USE_WATCHLIST, TRAKT_METHOD_ADD, TRAKT_START_PAUSED, traktCheckerScheduler, TRAKT_USE_RECOMMENDED, TRAKT_SYNC, TRAKT_DEFAULT_INDEXER, TRAKT_REMOVE_SERIESLIST, TRAKT_DISABLE_SSL_VERIFY, TRAKT_TIMEOUT, \
|
||||
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, \
|
||||
showUpdateScheduler, __INITIALIZED__, LAUNCH_BROWSER, UPDATE_SHOWS_ON_START, TRASH_REMOVE_SHOW, TRASH_ROTATE_LOGS, SORT_ARTICLE, showList, loadingShowList, \
|
||||
@ -922,6 +923,7 @@ def initialize(consoleLogging=True):
|
||||
TRAKT_SYNC = bool(check_setting_int(CFG, 'Trakt', 'trakt_sync', 0))
|
||||
TRAKT_DEFAULT_INDEXER = check_setting_int(CFG, 'Trakt', 'trakt_default_indexer', 1)
|
||||
TRAKT_DISABLE_SSL_VERIFY = bool(check_setting_int(CFG, 'Trakt', 'trakt_disable_ssl_verify', 0))
|
||||
TRAKT_TIMEOUT = check_setting_int(CFG, 'Trakt', 'trakt_timeout', 30)
|
||||
|
||||
CheckSection(CFG, 'pyTivo')
|
||||
USE_PYTIVO = bool(check_setting_int(CFG, 'pyTivo', 'use_pytivo', 0))
|
||||
@ -1795,6 +1797,7 @@ def save_config():
|
||||
new_config['Trakt']['trakt_sync'] = int(TRAKT_SYNC)
|
||||
new_config['Trakt']['trakt_default_indexer'] = int(TRAKT_DEFAULT_INDEXER)
|
||||
new_config['Trakt']['trakt_disable_ssl_verify'] = int(TRAKT_DISABLE_SSL_VERIFY)
|
||||
new_config['Trakt']['trakt_timeout'] = int(TRAKT_TIMEOUT)
|
||||
|
||||
new_config['pyTivo'] = {}
|
||||
new_config['pyTivo']['use_pytivo'] = int(USE_PYTIVO)
|
||||
|
@ -47,7 +47,7 @@ class TraktNotifier:
|
||||
"""
|
||||
|
||||
trakt_id = sickbeard.indexerApi(ep_obj.show.indexer).config['trakt_id']
|
||||
trakt_api = TraktAPI(sickbeard.TRAKT_API_KEY, sickbeard.TRAKT_USERNAME, sickbeard.TRAKT_PASSWORD, sickbeard.TRAKT_DISABLE_SSL_VERIFY)
|
||||
trakt_api = TraktAPI(sickbeard.TRAKT_API_KEY, sickbeard.TRAKT_USERNAME, sickbeard.TRAKT_PASSWORD, sickbeard.TRAKT_DISABLE_SSL_VERIFY, sickbeard.TRAKT_TIMEOUT)
|
||||
|
||||
if sickbeard.USE_TRAKT:
|
||||
try:
|
||||
@ -117,7 +117,7 @@ class TraktNotifier:
|
||||
Returns: True if the request succeeded, False otherwise
|
||||
"""
|
||||
try:
|
||||
trakt_api = TraktAPI(sickbeard.TRAKT_API_KEY, username, password, disable_ssl)
|
||||
trakt_api = TraktAPI(sickbeard.TRAKT_API_KEY, username, password, disable_ssl, sickbeard.TRAKT_TIMEOUT)
|
||||
trakt_api.validateAccount()
|
||||
return "Test notice sent successfully to Trakt"
|
||||
except (traktException, traktAuthException, traktServerBusy) as e:
|
||||
|
@ -37,7 +37,7 @@ class TraktChecker():
|
||||
|
||||
def __init__(self):
|
||||
self.todoWanted = []
|
||||
self.trakt_api = TraktAPI(sickbeard.TRAKT_API_KEY, sickbeard.TRAKT_USERNAME, sickbeard.TRAKT_PASSWORD, sickbeard.TRAKT_DISABLE_SSL_VERIFY)
|
||||
self.trakt_api = TraktAPI(sickbeard.TRAKT_API_KEY, sickbeard.TRAKT_USERNAME, sickbeard.TRAKT_PASSWORD, sickbeard.TRAKT_DISABLE_SSL_VERIFY, sickbeard.TRAKT_TIMEOUT)
|
||||
|
||||
def run(self, force=False):
|
||||
try:
|
||||
|
@ -2234,7 +2234,7 @@ class HomeAddShows(Home):
|
||||
|
||||
logger.log(u"Getting recommended shows from Trakt.tv", logger.DEBUG)
|
||||
|
||||
trakt_api = TraktAPI(sickbeard.TRAKT_API_KEY, sickbeard.TRAKT_USERNAME, sickbeard.TRAKT_PASSWORD, sickbeard.TRAKT_DISABLE_SSL_VERIFY)
|
||||
trakt_api = TraktAPI(sickbeard.TRAKT_API_KEY, sickbeard.TRAKT_USERNAME, sickbeard.TRAKT_PASSWORD, sickbeard.TRAKT_DISABLE_SSL_VERIFY, sickbeard.TRAKT_TIMEOUT)
|
||||
|
||||
try:
|
||||
recommendedlist = trakt_api.traktRequest("recommendations/shows?extended=full,images")
|
||||
@ -2290,7 +2290,7 @@ class HomeAddShows(Home):
|
||||
|
||||
t.trending_shows = []
|
||||
|
||||
trakt_api = TraktAPI(sickbeard.TRAKT_API_KEY, sickbeard.TRAKT_USERNAME, sickbeard.TRAKT_PASSWORD, sickbeard.TRAKT_DISABLE_SSL_VERIFY)
|
||||
trakt_api = TraktAPI(sickbeard.TRAKT_API_KEY, sickbeard.TRAKT_USERNAME, sickbeard.TRAKT_PASSWORD, sickbeard.TRAKT_DISABLE_SSL_VERIFY, sickbeard.TRAKT_TIMEOUT)
|
||||
|
||||
try:
|
||||
shows = trakt_api.traktRequest("shows/trending?limit=50&extended=full,images") or []
|
||||
@ -3525,7 +3525,7 @@ class ConfigGeneral(Config):
|
||||
sickbeard.ENCRYPTION_VERSION = config.checkbox_to_value(encryption_version)
|
||||
sickbeard.WEB_USERNAME = web_username
|
||||
sickbeard.WEB_PASSWORD = web_password
|
||||
|
||||
|
||||
sickbeard.DISPLAY_FILESIZE = config.checkbox_to_value(display_filesize)
|
||||
sickbeard.FUZZY_DATING = config.checkbox_to_value(fuzzy_dating)
|
||||
sickbeard.TRIM_ZERO = config.checkbox_to_value(trim_zero)
|
||||
@ -4413,7 +4413,7 @@ class ConfigNotifications(Config):
|
||||
use_trakt=None, trakt_username=None, trakt_password=None,
|
||||
trakt_remove_watchlist=None, trakt_use_watchlist=None, trakt_method_add=None,
|
||||
trakt_start_paused=None, trakt_use_recommended=None, trakt_sync=None,
|
||||
trakt_default_indexer=None, trakt_remove_serieslist=None, trakt_disable_ssl_verify=None,
|
||||
trakt_default_indexer=None, trakt_remove_serieslist=None, trakt_disable_ssl_verify=None, trakt_timeout=None,
|
||||
use_synologynotifier=None, synologynotifier_notify_onsnatch=None,
|
||||
synologynotifier_notify_ondownload=None, synologynotifier_notify_onsubtitledownload=None,
|
||||
use_pytivo=None, pytivo_notify_onsnatch=None, pytivo_notify_ondownload=None,
|
||||
@ -4535,6 +4535,7 @@ class ConfigNotifications(Config):
|
||||
sickbeard.TRAKT_SYNC = config.checkbox_to_value(trakt_sync)
|
||||
sickbeard.TRAKT_DEFAULT_INDEXER = int(trakt_default_indexer)
|
||||
sickbeard.TRAKT_DISABLE_SSL_VERIFY = config.checkbox_to_value(trakt_disable_ssl_verify)
|
||||
sickbeard.TRAKT_TIMEOUT = int(trakt_timeout)
|
||||
|
||||
if sickbeard.USE_TRAKT:
|
||||
sickbeard.traktCheckerScheduler.silent = False
|
||||
|
Loading…
Reference in New Issue
Block a user