예제 #1
0
 def _get_data(self, url, params):
     apikey = settings.get_apikey('tadb')
     if not apikey:
         raise build_key_error('tadb')
     self.log('uncached', xbmc.LOGINFO)
     response = self.doget(url, params=params)
     if response is None:
         raise build_key_error('tadb')
     return 'Empty' if response is None else json.loads(response.text,
                                                        cls=UTF8JSONDecoder)
예제 #2
0
 def _get_data(self, url, params=None):
     self.log('uncached', xbmc.LOGINFO)
     if params is None:
         params = {}
     response = self.doget(url, params=params)
     if response is None:
         raise build_key_error('tadb')
     return 'Empty' if response is None else response.json()
예제 #3
0
 def get_data(self, url, params=None):
     apikey = settings.get_apikey('tadb')
     if not apikey:
         raise build_key_error('tadb')
     result = cache.cacheFunction(self._get_data,
                                  url.format(settings.get_apikey('tadb')),
                                  params)
     return result if result != 'Empty' else None
예제 #4
0
 def _get_data(self, mediaid):
     apikey = settings.get_apikey('fanarttv')
     if not apikey:
         raise build_key_error('fanarttv')
     self.log('uncached', xbmc.LOGINFO)
     headers = {'api-key': apikey}
     if settings.fanarttv_clientkey:
         headers['client-key'] = settings.fanarttv_clientkey
     response = self.doget(self.apiurl % (self.api_section, mediaid), headers=headers)
     return 'Empty' if response is None else json.loads(response.text, cls=UTF8JSONDecoder)
예제 #5
0
 def baseurl(self):
     if not self._baseurl:
         apikey = settings.get_apikey('tmdb')
         if not apikey:
             raise build_key_error('tmdb')
         response = self.doget(cfgurl, params={'api_key': apikey})
         if response is None:
             return
         self._baseurl = response.json()['images']['secure_base_url']
     return self._baseurl
예제 #6
0
 def _get_data(self, url, params=None):
     apikey = settings.get_apikey('tmdb')
     if not apikey:
         raise build_key_error('tmdb')
     self.log('uncached', xbmc.LOGINFO)
     if params is None:
         params = {'api_key': apikey}
     else:
         params = dict(params, api_key=apikey)
     response = self.doget(url, params=params)
     return 'Empty' if response is None else response.json()
예제 #7
0
 def _get_data(self, mediaid, arttype, language):
     if not settings.get_apikey('tvdb'):
         raise build_key_error('tvdb')
     self.log('uncached', xbmc.LOGINFO)
     getparams = {
         'params': {
             'keyType': arttype
         },
         'headers': {
             'Accept-Language': language
         }
     }
     response = self.doget(self.apiurl % mediaid, **getparams)
     return 'Empty' if response is None else json.loads(response.text,
                                                        cls=UTF8JSONDecoder)
예제 #8
0
 def login(self):
     response = self.getter.session.post(
         self.loginurl,
         json={'apikey': settings.get_apikey('tvdb')},
         headers={
             'Content-Type': 'application/json',
             'User-Agent': settings.useragent
         },
         timeout=15)
     if response is not None and response.status_code == 401:
         raise build_key_error('tvdb')
     if not response or not response.headers['Content-Type'].startswith(
             'application/json'):
         raise ProviderError("Provider returned unexected content")
     self.getter.session.headers[
         'authorization'] = 'Bearer %s' % response.json()['token']
     return True
예제 #9
0
 def login(self):
     raise build_key_error('fanarttv')
예제 #10
0
 def login(self):
     raise build_key_error('tmdb')