mirror of
https://github.com/moparisthebest/SickRage
synced 2024-12-04 15:12:23 -05:00
Merge pull request #1269 from LinuxBozo/trakt-fixes
Trakt 2.0 API fixes
This commit is contained in:
commit
225b1171da
@ -1375,30 +1375,39 @@
|
||||
<span class="component-title">Trakt username</span>
|
||||
<input type="text" name="trakt_username" id="trakt_username" value="$sickbeard.TRAKT_USERNAME" class="form-control input-sm input250" />
|
||||
</label>
|
||||
<label>
|
||||
<span class="component-title"> </span>
|
||||
<p>
|
||||
<span class="component-desc">username of your Trakt account.</span>
|
||||
</label>
|
||||
</p>
|
||||
</div>
|
||||
<div class="field-pair">
|
||||
<label for="trakt_password">
|
||||
<span class="component-title">Trakt password</span>
|
||||
<input type="password" name="trakt_password" id="trakt_password" value="$sickbeard.TRAKT_PASSWORD" class="form-control input-sm input250" />
|
||||
</label>
|
||||
<label>
|
||||
<span class="component-title"> </span>
|
||||
<p>
|
||||
<span class="component-desc">password of your Trakt account.</span>
|
||||
</label>
|
||||
</p>
|
||||
</div>
|
||||
<div class="field-pair">
|
||||
<label for="trakt_disable_ssl_verify">
|
||||
<span class="component-title">Disable SSL Verification:</span>
|
||||
<span class="component-desc">
|
||||
<input type="checkbox" class="enabler" name="trakt_disable_ssl_verify" id="trakt_disable_ssl_verify" #if $sickbeard.TRAKT_DISABLE_SSL_VERIFY then "checked=\"checked\"" else ""# />
|
||||
<p>Disable SSL certificate verification on systems with broken SSL implementations, like the QNAP NAS.</p>
|
||||
<p>Disable SSL certificate verification for broken SSL installs (like QNAP NAS)</p>
|
||||
</span>
|
||||
</label>
|
||||
</div>
|
||||
<div class="field-pair">
|
||||
<label for="trakt_timeout">
|
||||
<span class="component-title">API Timeout:</span>
|
||||
<input type="text" name="trakt_timeout" id="trakt_timeout" value="$sickbeard.TRAKT_TIMEOUT" class="form-control input-sm input75" />
|
||||
</label>
|
||||
<p>
|
||||
<span class="component-desc">
|
||||
Seconds to wait for Trakt API to respond. (Use 0 to wait forever)
|
||||
</span>
|
||||
</p>
|
||||
</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',
|
||||
|
@ -403,6 +403,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
|
||||
@ -505,7 +506,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, \
|
||||
@ -926,6 +927,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))
|
||||
@ -1800,6 +1802,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:
|
||||
|
@ -51,7 +51,7 @@ from sickbeard.scene_numbering import get_scene_numbering, set_scene_numbering,
|
||||
get_xem_numbering_for_show, get_scene_absolute_numbering_for_show, get_xem_absolute_numbering_for_show, \
|
||||
get_scene_absolute_numbering
|
||||
|
||||
from lib.dateutil import tz
|
||||
from lib.dateutil import tz, parser as dateutil_parser
|
||||
from lib.unrar2 import RarFile
|
||||
from lib import adba, subliminal
|
||||
from lib.trakt import TraktAPI
|
||||
@ -2236,7 +2236,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")
|
||||
@ -2244,12 +2244,12 @@ class HomeAddShows(Home):
|
||||
if recommendedlist:
|
||||
indexers = ['tvdb', 'tvrage']
|
||||
map(final_results.append, (
|
||||
[int(show['show']['ids'][indexers[sickbeard.TRAKT_DEFAULT_INDEXER - 1]]),
|
||||
'http://www.trakt.tv/shows/%s' % show['show']['ids']['slug'], show['show']['title'],
|
||||
show['show']['overview'],
|
||||
datetime.date.fromtimestamp(int(show['show']['first_aired']) / 1000.0).strftime('%Y%m%d')]
|
||||
[int(show['ids'][indexers[sickbeard.TRAKT_DEFAULT_INDEXER - 1]]),
|
||||
'http://www.trakt.tv/shows/%s' % show['ids']['slug'], show['title'],
|
||||
show['overview'],
|
||||
None if show['first_aired'] is None else dateutil_parser.parse(show['first_aired']).strftime('%Y%m%d')]
|
||||
for show in recommendedlist if not helpers.findCertainShow(sickbeard.showList, [
|
||||
int(show['show']['ids'][indexers[sickbeard.TRAKT_DEFAULT_INDEXER - 1]])])))
|
||||
int(show['ids'][indexers[sickbeard.TRAKT_DEFAULT_INDEXER - 1]])])))
|
||||
except (traktException, traktAuthException, traktServerBusy) as e:
|
||||
logger.log(u"Could not connect to Trakt service: %s" % ex(e), logger.WARNING)
|
||||
|
||||
@ -2292,7 +2292,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 []
|
||||
@ -3527,7 +3527,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)
|
||||
@ -4415,7 +4415,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,
|
||||
@ -4537,6 +4537,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