+
+ def get_netflix_service_url (self):
+ """Returns URL & Port of the internal Netflix HTTP Proxy service
+
+ Returns
+ -------
+ str
+ Url + Port
+ """
+ return 'http://localhost:' + str(self.kodi_helper.addon.getSetting('netflix_service_port'))
+
+ def call_netflix_service (self, params):
+ """Makes a GET request to the internal Netflix HTTP proxy and returns the result
+
+ Parameters
+ ----------
+ params : :obj:`dict` of :obj:`str`
+ List of paramters to be url encoded
+
+ Returns
+ -------
+ :obj:`dict`
+ Netflix Service RPC result
+ """
+ url_values = urllib.urlencode(params)
+ # check for cached items
+ if self.kodi_helper.has_cached_item(cache_id=url_values) and params.get('cache', False) == True:
+ self.log(msg='Fetching item from cache: (cache_id=' + url_values + ')')
+ return self.kodi_helper.get_cached_item(cache_id=url_values)
+ url = self.get_netflix_service_url()
+ full_url = url + '?' + url_values
+ data = urllib2.urlopen(full_url).read()
+ parsed_json = json.loads(data)
+ result = parsed_json.get('result', None)
+ if params.get('cache', False) == True:
+ self.log(msg='Adding item to cache: (cache_id=' + url_values + ')')
+ self.kodi_helper.add_cached_item(cache_id=url_values, contents=result)
+ return result
+
+ def open_settings(self, url):
+ """Opens a foreign settings dialog"""
+ is_addon = self.kodi_helper.get_inputstream_addon()
+ url = is_addon if url == 'is' else url
+ return Addon(url).openSettings()