def add_to_trakt_collection(type, imdb_id, title): Trakt.configuration.defaults.app(id=8835) Trakt.configuration.defaults.client( id="aa1c239000c56319a64014d0b169c0dbf03f7770204261c9edbe8ae5d4e50332", secret= "250284a95fd22e389b565661c98d0f33ac222e9d03c43b5931e03946dbf858dc") Trakt.on('oauth.token_refreshed', on_token_refreshed) if not plugin.get_setting('authorization'): if not authenticate(): return authorization = json.loads(plugin.get_setting('authorization')) with Trakt.configuration.oauth.from_response(authorization, refresh=True): result = Trakt['sync/collection'].add( {type: [{ 'ids': { 'imdb': imdb_id } }]}) if type == "shows": result = Trakt['sync/history'].add( {type: [{ 'ids': { 'imdb': imdb_id } }]}) dialog = xbmcgui.Dialog() dialog.notification("Trakt: add to collection", title)
def __init__(self): self.is_authenticating = Condition() self.authorization = None self.recent_days = 30 self.radarr_use = True self.radarr_address = '' self.radarr_apikey = '' self.radarr_tag_id = False self.radarr_unmonitor = True self.sonarr_use = True self.sonarr_address = '' self.sonarr_apikey = '' self.sonarr_tag_id = False self.sonarr_unmonitor = True self.medusa_use = False self.medusa_address = '' self.medusa_username = '' self.medusa_password = '' # Bind trakt events Trakt.on('oauth.token_refreshed', self.on_token_refreshed)
def __init__(self, config) -> None: super().__init__(config) self.now_playing_metadata = None self.now_playing_description = None self.current_player = None self.playback_rate = None self.last_elapsed_time = None self.last_elapsed_time_timestamp = None self.netflix_titles = {} self.itunes_titles = {} self.amazon_titles = {} self.app_handlers = { 'com.apple.TVShows': self.handle_tvshows, 'com.apple.TVWatchList': self.handle_tv_app, 'com.apple.TVMovies': self.handle_movies, 'com.netflix.Netflix': self.handle_netflix, 'com.amazon.aiv.AIVApp': self.handle_amazon } Trakt.configuration.defaults.client( id= 'dc705f550f50706bdd7bd55db120235cc68899dbbfb4fbc171384c1c1d30d7d4', secret= 'f9aba211b886ea9f31a57c952cd0b5ab702501808db50584a24a5cc07466179d') Trakt.on('oauth.token_refreshed', self.on_trakt_token_refreshed) self.authenticate_trakt()
def __init__(self): self.is_authenticating = Condition() self.authorization = None # Bind trakt events Trakt.on('oauth.token_refreshed', self.on_token_refreshed)
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()
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()
def __init__(self): logger.debug("Initializing.") proxyURL = checkAndConfigureProxy() if proxyURL: Trakt.http.proxies = {'http': proxyURL, 'https': proxyURL} # Get user login data self.__pin = getSetting('PIN') if getSetting('authorization'): self.authorization = loads(getSetting('authorization')) else: self.authorization = {} # Bind trakt events Trakt.on('oauth.token_refreshed', self.on_token_refreshed) Trakt.configuration.defaults.app(id=999) # Configure Trakt.configuration.defaults.client(id=self.__client_id, secret=self.__client_secret) #Set defaults Trakt.configuration.defaults.oauth(refresh=True) if not self.authorization: self.authenticate()
def add_to_trakt_watchlist(type,imdb_id,title): Trakt.configuration.defaults.app( id=8835 ) Trakt.configuration.defaults.client( id="aa1c239000c56319a64014d0b169c0dbf03f7770204261c9edbe8ae5d4e50332", secret="250284a95fd22e389b565661c98d0f33ac222e9d03c43b5931e03946dbf858dc" ) Trakt.on('oauth.token_refreshed', on_token_refreshed) if not __settings__.getSetting('authorization'): if not authenticate(): return authorization = loads(__settings__.getSetting('authorization')) with Trakt.configuration.oauth.from_response(authorization, refresh=True): result = Trakt['sync/watchlist'].add({ type: [ { 'ids': { 'tmdb': imdb_id } } ] }) dialog = xbmcgui.Dialog() dialog.notification("Trakt: add to watchlist",title)
def __init__(self): logger.debug("Initializing.") proxyURL = checkAndConfigureProxy() if proxyURL: Trakt.http.proxies = { 'http': proxyURL, 'https': proxyURL } if getSetting('authorization'): self.authorization = loads(getSetting('authorization')) else: self.authorization = {} # Bind trakt events Trakt.on('oauth.token_refreshed', self.on_token_refreshed) Trakt.configuration.defaults.app( id=999 ) # Configure Trakt.configuration.defaults.client( id=self.__client_id, secret=self.__client_secret ) #Set defaults Trakt.configuration.defaults.oauth( refresh=True )
def __init__(self, wf): self.wf = wf # load authorization from settings if 'access_token' in self.wf.settings: self.authorization['access_token'] = self.wf.settings[ 'access_token'] self.authorization['created_at'] = self.wf.settings['created_at'] self.authorization['expires_in'] = self.wf.settings['expires_in'] self.authorization['refresh_token'] = self.wf.settings[ 'refresh_token'] self.authorization['scope'] = self.wf.settings['scope'] self.authorization['token_type'] = self.wf.settings['token_type'] else: self.authorization = {} # bind trakt events Trakt.on('oauth.token_refreshed', self.__on_token_refreshed) # set base url Trakt.base_url = 'https://api-v2launch.trakt.tv' # set app defaults Trakt.configuration.defaults.app(id=self.__app_id) # set client defaults Trakt.configuration.defaults.client(id=self.__client_id, secret=self.__client_secret) # set oauth defaults Trakt.configuration.defaults.oauth(refresh=True)
def init_trakt(cls): config = Configuration.advanced['trakt'] # Build timeout value timeout = ( config.get_float('connect_timeout', 6.05), config.get_float('read_timeout', 24) ) # Client Trakt.configuration.defaults.client( id='c9ccd3684988a7862a8542ae0000535e0fbd2d1c0ca35583af7ea4e784650a61', secret='bf00575b1ad252b514f14b2c6171fe650d474091daad5eb6fa890ef24d581f65' ) # Application Trakt.configuration.defaults.app( name='trakt (for Plex)', version=PLUGIN_VERSION ) # Http Trakt.base_url = ( config.get('protocol', 'https') + '://' + config.get('hostname', 'api.trakt.tv') ) Trakt.configuration.defaults.http( timeout=timeout ) # Configure keep-alive Trakt.http.keep_alive = config.get_boolean('keep_alive', True) # Configure requests adapter Trakt.http.adapter_kwargs = { 'pool_connections': config.get_int('pool_connections', 10), 'pool_maxsize': config.get_int('pool_size', 10), 'max_retries': Retry( total=config.get_int('connect_retries', 3), read=0 ) } Trakt.http.rebuild() # Bind to events Trakt.on('oauth.refresh', cls.on_trakt_refresh) Trakt.on('oauth.refresh.rejected', cls.on_trakt_refresh_rejected) log.info( 'Configured trakt.py (timeout=%r, base_url=%r, keep_alive=%r, adapter_kwargs=%r)', timeout, Trakt.base_url, Trakt.http.keep_alive, Trakt.http.adapter_kwargs, )
def init_trakt(cls): config = Configuration.advanced['trakt'] # Build timeout value timeout = (config.get_float('connect_timeout', 6.05), config.get_float('read_timeout', 24)) # Client Trakt.configuration.defaults.client( id= 'c9ccd3684988a7862a8542ae0000535e0fbd2d1c0ca35583af7ea4e784650a61', secret= 'bf00575b1ad252b514f14b2c6171fe650d474091daad5eb6fa890ef24d581f65') # Application Trakt.configuration.defaults.app(name='trakt (for Plex)', version=PLUGIN_VERSION) # Http Trakt.base_url = (config.get('protocol', 'https') + '://' + config.get('hostname', 'api.trakt.tv')) Trakt.configuration.defaults.http(timeout=timeout) # Configure keep-alive Trakt.http.keep_alive = config.get_boolean('keep_alive', True) # Configure requests adapter Trakt.http.adapter_kwargs = { 'pool_connections': config.get_int('pool_connections', 10), 'pool_maxsize': config.get_int('pool_size', 10), 'max_retries': Retry(total=config.get_int('connect_retries', 3), read=0) } Trakt.http.rebuild() # Bind to events Trakt.on('oauth.refresh', cls.on_trakt_refresh) Trakt.on('oauth.refresh.rejected', cls.on_trakt_refresh_rejected) log.info( 'Configured trakt.py (timeout=%r, base_url=%r, keep_alive=%r, adapter_kwargs=%r)', timeout, Trakt.base_url, Trakt.http.keep_alive, Trakt.http.adapter_kwargs, )
def __init__(self): # Trakt client configuration Trakt.base_url = 'https://api.trakt.tv' Trakt.configuration.defaults.app(**TRAKT_APP) Trakt.configuration.defaults.client(**TRAKT_CLIENT) # Bind trakt events Trakt.on('oauth.refresh', self._on_token_refreshed) self.main_tk = None self.main_win = None self._authorization = None self.username = None self.fullname = None self.playback_ids = []
def __init__(self, username='******'): credentials = read_credentials() self.username = username self.client_id = credentials['client_id'] self.client_secret = credentials['client_secret'] self.trakt = Trakt.configuration.defaults.client( id=self.client_id, secret=self.client_secret) self.is_authenticating = Condition() # Bind trakt events Trakt.on('oauth.token_refreshed', self.on_token_refreshed) self.authorization = self.read_auth() if self.authorization is None: self.authenticate()
def init_trakt(cls): # Client Trakt.configuration.defaults.client( id= 'c9ccd3684988a7862a8542ae0000535e0fbd2d1c0ca35583af7ea4e784650a61', secret= 'bf00575b1ad252b514f14b2c6171fe650d474091daad5eb6fa890ef24d581f65') # Application Trakt.configuration.defaults.app(name='trakt (for Plex)', version=PLUGIN_VERSION) # Setup request retrying Trakt.http.adapter_kwargs = {'max_retries': Retry(total=3, read=0)} Trakt.http.rebuild() Trakt.on('oauth.token_refreshed', cls.on_token_refreshed)
def __init__(self): # Set trakt app id Trakt.configuration.defaults.app(id=sickrage.app.trakt_app_id) # Set trakt client id/secret Trakt.configuration.defaults.client( id=sickrage.app.trakt_api_key, secret=sickrage.app.trakt_api_secret) # Bind trakt events Trakt.on('oauth.token_refreshed', self.on_token_refreshed) Trakt.configuration.defaults.oauth(refresh=True) if sickrage.app.config.trakt.oauth_token: Trakt.configuration.defaults.oauth.from_response( sickrage.app.config.trakt.oauth_token)
def init_trakt(cls): # Client Trakt.configuration.defaults.client( id='c9ccd3684988a7862a8542ae0000535e0fbd2d1c0ca35583af7ea4e784650a61', secret='bf00575b1ad252b514f14b2c6171fe650d474091daad5eb6fa890ef24d581f65' ) # Application Trakt.configuration.defaults.app( name='trakt (for Plex)', version=PLUGIN_VERSION ) # Setup request retrying Trakt.http.adapter_kwargs = {'max_retries': Retry(total=3, read=0)} Trakt.http.rebuild() Trakt.on('oauth.token_refreshed', cls.on_token_refreshed)
def __init__(self): # Set trakt app id Trakt.configuration.defaults.app( id=sickrage.srCore.srConfig.TRAKT_APP_ID) # Set trakt client id/secret Trakt.configuration.defaults.client( id=sickrage.srCore.srConfig.TRAKT_API_KEY, secret=sickrage.srCore.srConfig.TRAKT_API_SECRET) # Bind trakt events Trakt.on('oauth.token_refreshed', self.on_token_refreshed) Trakt.configuration.defaults.oauth(refresh=True) if sickrage.srCore.srConfig.TRAKT_OAUTH_TOKEN: Trakt.configuration.defaults.oauth.from_response( sickrage.srCore.srConfig.TRAKT_OAUTH_TOKEN)
def __init__(self, force=False): debug("TRAKT Initializing.") Trakt.configuration.defaults.client(id=self.__client_id, secret=self.__client_secret) Trakt.on('oauth.token_refreshed', self.on_token_refreshed) Trakt.configuration.defaults.oauth(refresh=True) Trakt.configuration.defaults.http(retry=True, timeout=90) from resources.lib.services.Monitor import monitor self.monitor = monitor if not get_setting_as_bool('trakt.enabled'): debug('Trak nieje zapnuty') return self.initialize(force=force)
def __init__(self): # Set trakt app id Trakt.configuration.defaults.app( id=sickrage.app.config.trakt_app_id ) # Set trakt client id/secret Trakt.configuration.defaults.client( id=sickrage.app.config.trakt_api_key, secret=sickrage.app.config.trakt_api_secret ) # Bind trakt events Trakt.on('oauth.token_refreshed', self.on_token_refreshed) Trakt.configuration.defaults.oauth( refresh=True ) if sickrage.app.config.trakt_oauth_token: Trakt.configuration.defaults.oauth.from_response( sickrage.app.config.trakt_oauth_token )
def __init__(self, username='******', mq_=None): credentials = read_credentials() self.username = username self.client_id = credentials['client_id'] self.client_secret = credentials['client_secret'] self.trakt = Trakt.configuration.defaults.client( id=self.client_id, secret=self.client_secret) if mq_ is not None: self.mq_ = mq_ else: self.mq_ = MovieCollection() self.imdb_show_map = {v['link']: k for k, v in self.mq_.imdb_ratings.items()} self.is_authenticating = Condition() # Bind trakt events Trakt.on('oauth.token_refreshed', self.on_token_refreshed) self.authorization = self.read_auth() if self.authorization is None: self.authenticate()
def __init__(self, wf): self.wf = wf # load authorization from settings if 'access_token' in self.wf.settings: self.authorization['access_token'] = self.wf.settings['access_token'] self.authorization['created_at'] = self.wf.settings['created_at'] self.authorization['expires_in'] = self.wf.settings['expires_in'] self.authorization['refresh_token'] = self.wf.settings['refresh_token'] self.authorization['scope'] = self.wf.settings['scope'] self.authorization['token_type'] = self.wf.settings['token_type'] else: self.authorization = {} # bind trakt events Trakt.on('oauth.token_refreshed', self.__on_token_refreshed) # set base url #Trakt.base_url = 'https://api-v2launch.trakt.tv' Trakt.base_url = 'https://api.trakt.tv' # set app defaults Trakt.configuration.defaults.app( id=self.__app_id ) # set client defaults Trakt.configuration.defaults.client( id=self.__client_id, secret=self.__client_secret ) # set oauth defaults Trakt.configuration.defaults.oauth( refresh=True )
def __init__(self): self.authorization = None # Bind trakt events Trakt.on('oauth.token_refreshed', self.on_token_refreshed)
return authorization # Configure Trakt.configuration.defaults.client(id=args.client_id, secret=args.client_secret) if args.reauth: try: os.remove(auth_file) finally: authenticate() exit(0) # Authenticate Trakt.on('oauth.refresh', on_token_refreshed) Trakt.configuration.defaults.oauth.from_response(authenticate(), refresh=True) if Trakt['sync/collection'].movies() is None: print("Error, can't connect to trakt api") exit(2) if args.history: count_items = 20 list = {} for item in Trakt['sync/history'].get(pagination=True, per_page=25): # print() if isinstance(item, objects.episode.Episode): if item.show.title not in list: count_items = count_items - 1 print("%s %s" % (item.show.title, ("S%02dE%02d" % item.pk)))
def __init__(self): self.authorization = None # Bind trakt events Trakt.on('oauth.token_refreshed', self.on_token_refreshed)