feat(settings): Adds shortcut to inputstream settings
[plugin.video.netflix.git] / resources / lib / Navigation.py
index 813b6444e11f4a4a936c3bcfdd08a257c21b48f6..37fa6ec2a94282d6feb3c4d728d6fdf6477a2202 100644 (file)
@@ -6,6 +6,7 @@
 import urllib
 import urllib2
 import json
+from xbmcaddon import Addon
 from urlparse import parse_qsl
 from utils import noop, log
 
@@ -45,6 +46,10 @@ class Navigation:
         """
         params = self.parse_paramters(paramstring=paramstring)
 
+        # open foreign settings dialog
+        if 'mode' in params.keys() and params['mode'] == 'openSettings':
+            return self.open_settings(params['url'])
+
         # log out the user
         if 'action' in params.keys() and params['action'] == 'logout':
             return self.call_netflix_service({'method': 'logout'})
@@ -415,7 +420,6 @@ class Navigation:
             self.call_netflix_service({'method': 'switch_profile', 'profile_id': params['profile_id']})
         # check login, in case of main menu
         if 'action' not in params:
-            self.kodi_helper.log('ES Called - Zeile 428')
             self.establish_session(account=credentials)
         return options
 
@@ -486,7 +490,6 @@ class Navigation:
         if 'error' in response:
             # check if we do not have a valid session, in case that happens: (re)login
             if self._is_expired_session(response=response):
-                self.kodi_helper.log('ES Called - Zeile 499')
                 if self.establish_session(account=self.kodi_helper.get_credentials()):
                     return True
             message = response['message'] if 'message' in response else ''
@@ -539,3 +542,9 @@ class Navigation:
         data = urllib2.urlopen(full_url).read()
         parsed_json = json.loads(data)
         return parsed_json.get('result', None)
+
+    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()