mirror of
https://github.com/moparisthebest/SickRage
synced 2024-12-04 15:12:23 -05:00
Quickfix for last commit of Trakt.tv overhaul
This commit is contained in:
parent
c6b7348c37
commit
091c9419c8
@ -1,2 +1 @@
|
||||
from trakt import TraktAPI
|
||||
from trakt.exceptions import traktException, traktAuthException, traktServerBusy
|
||||
from trakt import TraktAPI
|
@ -1,7 +1,7 @@
|
||||
import hashlib
|
||||
import requests
|
||||
|
||||
from . import traktException, traktAuthException, traktServerBusy
|
||||
from exceptions import traktException, traktAuthException, traktServerBusy
|
||||
|
||||
class TraktAPI():
|
||||
def __init__(self, apikey, username=None, password=None, use_https=False, timeout=5):
|
||||
|
@ -22,8 +22,6 @@ from sickbeard import logger
|
||||
from lib.trakt import TraktAPI
|
||||
from lib.trakt.exceptions import traktException, traktServerBusy, traktAuthException
|
||||
|
||||
trakt_api = TraktAPI(sickbeard.TRAKT_API, sickbeard.TRAKT_USERNAME, sickbeard.TRAKT_USERNAME)
|
||||
|
||||
class TraktNotifier:
|
||||
"""
|
||||
A "notifier" for trakt.tv which keeps track of what has and hasn't been added to your library.
|
||||
@ -49,6 +47,7 @@ class TraktNotifier:
|
||||
"""
|
||||
|
||||
trakt_id = sickbeard.indexerApi(ep_obj.show.indexer).config['trakt_id']
|
||||
trakt_api = TraktAPI(sickbeard.TRAKT_API, sickbeard.TRAKT_USERNAME, sickbeard.TRAKT_USERNAME)
|
||||
|
||||
if sickbeard.USE_TRAKT:
|
||||
try:
|
||||
@ -122,6 +121,8 @@ class TraktNotifier:
|
||||
Returns: True if the request succeeded, False otherwise
|
||||
"""
|
||||
|
||||
trakt_api = TraktAPI(sickbeard.TRAKT_API, sickbeard.TRAKT_USERNAME, sickbeard.TRAKT_USERNAME)
|
||||
|
||||
try:
|
||||
if trakt_api.validateAccount():
|
||||
return True
|
||||
|
@ -26,16 +26,16 @@ from sickbeard import logger
|
||||
from sickbeard import helpers
|
||||
from sickbeard import search_queue
|
||||
from sickbeard.common import SKIPPED, WANTED
|
||||
|
||||
from lib.trakt import *
|
||||
from trakt.exceptions import traktException
|
||||
from trakt.exceptions import traktException, traktAuthException, traktServerBusy
|
||||
|
||||
|
||||
trakt_api = TraktAPI(sickbeard.TRAKT_API, sickbeard.TRAKT_USERNAME, sickbeard.TRAKT_USERNAME)
|
||||
|
||||
class TraktChecker():
|
||||
|
||||
def __init__(self):
|
||||
self.todoWanted = []
|
||||
self.trakt_api = TraktAPI(sickbeard.TRAKT_API, sickbeard.TRAKT_USERNAME, sickbeard.TRAKT_USERNAME)
|
||||
|
||||
def run(self, force=False):
|
||||
try:
|
||||
@ -58,7 +58,7 @@ class TraktChecker():
|
||||
traktShow = None
|
||||
|
||||
try:
|
||||
library = trakt_api.traktRequest("user/library/shows/all.json/%APIKEY%/%USER%")
|
||||
library = self.trakt_api.traktRequest("user/library/shows/all.json/%APIKEY%/%USER%")
|
||||
|
||||
if not library:
|
||||
logger.log(u"Could not connect to trakt service, aborting library check", logger.ERROR)
|
||||
@ -93,7 +93,7 @@ class TraktChecker():
|
||||
logger.log(u"Removing " + show_obj.name + " from trakt.tv library", logger.DEBUG)
|
||||
|
||||
try:
|
||||
trakt_api.traktRequest("show/unlibrary/%APIKEY%", data)
|
||||
self.trakt_api.traktRequest("show/unlibrary/%APIKEY%", data)
|
||||
except (traktException, traktAuthException, traktServerBusy) as e:
|
||||
logger.log(u"Could not connect to Trakt service: %s" % e.message, logger.ERROR)
|
||||
|
||||
@ -116,7 +116,7 @@ class TraktChecker():
|
||||
logger.log(u"Adding " + show_obj.name + " to trakt.tv library", logger.DEBUG)
|
||||
|
||||
try:
|
||||
trakt_api.traktRequest("show/library/%APIKEY%", data)
|
||||
self.trakt_api.traktRequest("show/library/%APIKEY%", data)
|
||||
except (traktException, traktAuthException, traktServerBusy) as e:
|
||||
logger.log(u"Could not connect to Trakt service: %s" % e.message, logger.ERROR)
|
||||
|
||||
@ -124,7 +124,7 @@ class TraktChecker():
|
||||
logger.log(u"Starting trakt show watchlist check", logger.DEBUG)
|
||||
|
||||
try:
|
||||
watchlist = trakt_api.traktRequest("user/watchlist/shows.json/%APIKEY%/%USER%")
|
||||
watchlist = self.trakt_api.traktRequest("user/watchlist/shows.json/%APIKEY%/%USER%")
|
||||
except (traktException, traktAuthException, traktServerBusy) as e:
|
||||
logger.log(u"Could not connect to Trakt service: %s" % e.message, logger.ERROR)
|
||||
return
|
||||
@ -159,7 +159,7 @@ class TraktChecker():
|
||||
logger.log(u"Starting trakt episode watchlist check", logger.DEBUG)
|
||||
|
||||
try:
|
||||
watchlist = trakt_api.traktRequest("user/watchlist/episodes.json/%APIKEY%/%USER%")
|
||||
watchlist = self.trakt_api.traktRequest("user/watchlist/episodes.json/%APIKEY%/%USER%")
|
||||
except (traktException, traktAuthException, traktServerBusy) as e:
|
||||
logger.log(u"Could not connect to Trakt service: %s" % e.message, logger.ERROR)
|
||||
return
|
||||
|
Loading…
Reference in New Issue
Block a user