Пример #1
0
    def __init__(self, force=False):
        logger.debug("Initializing.")

        proxyURL = checkAndConfigureProxy()
        if proxyURL:
            Trakt.http.proxies = {
                'http': proxyURL,
                'https': proxyURL
            }

        Trakt.configuration.defaults.app(
            id=999
        )

        # Configure
        Trakt.configuration.defaults.client(
            id=self.__client_id,
            secret=self.__client_secret
        )

        # Bind event
        Trakt.on('oauth.token_refreshed', self.on_token_refreshed)

        Trakt.configuration.defaults.oauth(
            refresh=True
        )

        if getSetting('authorization') and not force:
            self.authorization = loads(getSetting('authorization'))
        else:
            last_reminder = getSettingAsInt('last_reminder')
            now = int(time.time())
            if last_reminder >= 0 and last_reminder < now - (24 * 60 * 60) or force:
                self.login()
Пример #2
0
 def __get_settings(self):
     """get users settings and launch actions"""
     logger.debug("reading settings")
     self.service = globals.Service(
         getSettingAsBool("betaactive"),
         getSettingAsBool("betafirst"),
         getSetting("betauser"),
         getSetting("betapass"),
         getSettingAsBool("betabulk"),
         getSettingAsBool("betamark"),
         getSettingAsBool("betaunmark"),
         getSettingAsBool("betafollow"),
         getSettingAsBool("betanotify"),
         getSettingAsBool("betaupdate"),
     )
     if self.service.active and self.service.user and self.service.password:
         globals.betaseriesapi = ServiceApi(self)
         globals.betaseriesapi._service_authenticate(
             self.service.user, self.service.password
         )
         self.Player = MyPlayer(
             action=globals.betaseriesapi._service_betaserie, service=self.service
         )
         if self.service.notify:
             notification(getString(32010), getString(30003))
Пример #3
0
    def __init__(self, force=False):
        logger.debug("Initializing.")

        proxyURL = checkAndConfigureProxy()
        if proxyURL:
            Trakt.http.proxies = {
                'http': proxyURL,
                'https': proxyURL
            }

        # Configure
        Trakt.configuration.defaults.client(
            id=self.__client_id,
            secret=self.__client_secret
        )

        # Bind event
        Trakt.on('oauth.token_refreshed', self.on_token_refreshed)

        Trakt.configuration.defaults.oauth(
            refresh=True
        )

        if getSetting('authorization') and not force:
            self.authorization = loads(getSetting('authorization'))
        else:
            last_reminder = getSettingAsInt('last_reminder')
            now = int(time.time())
            if last_reminder >= 0 and last_reminder < now - (24 * 60 * 60) or force:
                self.login()
Пример #4
0
# -*- coding: utf-8 -*-
#
import xbmcaddon
import logging
from resources.lib import kodilogging
from resources.lib.service import traktService
from resources.lib.utilities import createError, checkIfNewVersion
from resources.lib.kodiUtilities import setSetting, getSetting

__addon__ = xbmcaddon.Addon('script.trakt')
__addonversion__ = __addon__.getAddonInfo('version')
__addonid__ = __addon__.getAddonInfo('id')
kodilogging.config()
logger = logging.getLogger(__name__)

logger.debug("Loading '%s' version '%s'" % (__addonid__, __addonversion__))
if checkIfNewVersion(str(getSetting('version')), str(__addonversion__)):
    setSetting('version', __addonversion__)

try:
    traktService().run()
except Exception as ex:
    message = createError(ex)
    logger.fatal(message)

logger.debug("'%s' shutting down." % __addonid__)
Пример #5
0
# -*- coding: utf-8 -*-
#
import logging
import xbmcaddon
from resources.lib import kodilogging
from resources.lib.service import traktService
from resources.lib.utilities import createError, checkIfNewVersion
from resources.lib.kodiUtilities import setSetting, getSetting

__addon__ = xbmcaddon.Addon('script.trakt')
__addonversion__ = __addon__.getAddonInfo('version')
__addonid__ = __addon__.getAddonInfo('id')
kodilogging.config()
logger = logging.getLogger(__name__)

logger.debug("Loading '%s' version '%s'" % (__addonid__, __addonversion__))
if checkIfNewVersion(str(getSetting('version')), str(__addonversion__)):
    setSetting('version', __addonversion__)

try:
    traktService().run()
except Exception as ex:
    message = createError(ex)
    logger.fatal(message)

logger.debug("'%s' shutting down." % __addonid__)