Fixes KeyError
[plugin.video.netflix.git] / resources / lib / Navigation.py
index e9346453580acdcf48976f83f2571821c0215f15..c89b7cec271b7aeb657e2f1c7aaa3f8c1664dffc 100644 (file)
@@ -110,7 +110,7 @@ class Navigation:
                 adult_pin = self.kodi_helper.show_adult_pin_dialog()
                 if self.netflix_session.send_adult_pin(adult_pin=adult_pin) != True:
                     return self.kodi_helper.show_wrong_adult_pin_notification()
-            self.play_video(video_id=params['video_id'], start_offset=params['start_offset'])
+            self.play_video(video_id=params['video_id'], start_offset=params.get('start_offset', -1))
         elif params['action'] == 'user-items' and params['type'] == 'search':
             # if the user requested a search, ask for the term
             term = self.kodi_helper.show_search_term_dialog()
@@ -162,6 +162,12 @@ class Navigation:
             for key in search_results_raw['value']['search'].keys():
                 if self.netflix_session._is_size_key(key=key) == False:
                     has_search_results = search_results_raw['value']['search'][key]['titles']['length'] > 0
+                    if has_search_results == False:
+                        for entry in search_results_raw['value']['search'][key]['suggestions']:
+                            if self.netflix_session._is_size_key(key=entry) == False:
+                                if search_results_raw['value']['search'][key]['suggestions'][entry]['relatedvideos']['length'] > 0:
+                                    has_search_results = True
+
 
         # display that we haven't found a thing
         if has_search_results == False: