fix(adult-pin): Remove adult pin as it´s not needed. People should adapt that in...
authorSebastian Golasch <public@asciidisco.com>
Thu, 2 Mar 2017 10:47:07 +0000 (11:47 +0100)
committerSebastian Golasch <public@asciidisco.com>
Thu, 2 Mar 2017 10:47:07 +0000 (11:47 +0100)
resources/lib/KodiHelper.py
resources/lib/Library.py
resources/lib/Navigation.py

index 85bbd44b87161c57c663c46ef1d5c69b3d47da5c..b07efaf3cb4b3d95eec40e85f165ca9692e4f64a 100644 (file)
@@ -61,17 +61,6 @@ class KodiHelper:
         dlg = xbmcgui.Dialog()
         return dlg.numeric(heading=self.get_local_string(string_id=30019) + ' ' + self.get_local_string(string_id=30022), type=0)
 
         dlg = xbmcgui.Dialog()
         return dlg.numeric(heading=self.get_local_string(string_id=30019) + ' ' + self.get_local_string(string_id=30022), type=0)
 
-    def show_adult_pin_dialog (self):
-        """Asks the user for the adult pin
-
-        Returns
-        -------
-        :obj:`int`
-            4 digit adult pin needed for adult movies
-        """
-        dlg = xbmcgui.Dialog()
-        return dlg.input(self.get_local_string(string_id=30002), type=xbmcgui.INPUT_NUMERIC)
-
     def show_search_term_dialog (self):
         """Asks the user for a term to query the netflix search for
 
     def show_search_term_dialog (self):
         """Asks the user for a term to query the netflix search for
 
@@ -124,18 +113,6 @@ class KodiHelper:
         dlg = xbmcgui.Dialog()
         return dlg.input(self.get_local_string(string_id=30005), type=xbmcgui.INPUT_ALPHANUM)
 
         dlg = xbmcgui.Dialog()
         return dlg.input(self.get_local_string(string_id=30005), type=xbmcgui.INPUT_ALPHANUM)
 
-    def show_wrong_adult_pin_notification (self):
-        """Shows notification that a wrong adult pin was given
-
-        Returns
-        -------
-        bool
-            Dialog shown
-        """
-        dialog = xbmcgui.Dialog()
-        dialog.notification(self.get_local_string(string_id=30006), self.get_local_string(string_id=30007), xbmcgui.NOTIFICATION_ERROR, 5000)
-        return True
-
     def show_login_failed_notification (self):
         """Shows notification that the login failed
 
     def show_login_failed_notification (self):
         """Shows notification that the login failed
 
@@ -432,9 +409,7 @@ class KodiHelper:
                 if video_list[video_list_id]['type'] == 'movie':
                     # it´s a movie, so we need no subfolder & a route to play it
                     isFolder = False
                 if video_list[video_list_id]['type'] == 'movie':
                     # it´s a movie, so we need no subfolder & a route to play it
                     isFolder = False
-                    # check maturity index, to determine if we need the adult pin
-                    needs_pin = (True, False)[int(video['maturity']['level']) >= 1000]
-                    url = build_url({'action': 'play_video', 'video_id': video_list_id, 'pin': needs_pin})
+                    url = build_url({'action': 'play_video', 'video_id': video_list_id})
                 # add list item info
                 li = self._generate_entry_info(entry=video, li=li)
                 li = self._generate_context_menu_items(entry=video, li=li)
                 # add list item info
                 li = self._generate_entry_info(entry=video, li=li)
                 li = self._generate_context_menu_items(entry=video, li=li)
@@ -604,9 +579,7 @@ class KodiHelper:
                     # add list item info
                     li = self._generate_entry_info(entry=episode, li=li, base_info={'mediatype': 'episode'})
                     li = self._generate_context_menu_items(entry=episode, li=li)
                     # add list item info
                     li = self._generate_entry_info(entry=episode, li=li, base_info={'mediatype': 'episode'})
                     li = self._generate_context_menu_items(entry=episode, li=li)
-                    # check maturity index, to determine if we need the adult pin
-                    needs_pin = (True, False)[int(episode['maturity']['rating']['maturityLevel']) >= 1000]
-                    url = build_url({'action': 'play_video', 'video_id': episode_id, 'pin': needs_pin, 'start_offset': episode['bookmark']})
+                    url = build_url({'action': 'play_video', 'video_id': episode_id, 'start_offset': episode['bookmark']})
                     xbmcplugin.addDirectoryItem(handle=self.plugin_handle, url=url, listitem=li, isFolder=False)
 
         xbmcplugin.addSortMethod(handle=self.plugin_handle, sortMethod=xbmcplugin.SORT_METHOD_EPISODE)
                     xbmcplugin.addDirectoryItem(handle=self.plugin_handle, url=url, listitem=li, isFolder=False)
 
         xbmcplugin.addSortMethod(handle=self.plugin_handle, sortMethod=xbmcplugin.SORT_METHOD_EPISODE)
@@ -657,7 +630,7 @@ class KodiHelper:
 
         # check if we have a bookmark e.g. start offset position
         if int(start_offset) > 0:
 
         # check if we have a bookmark e.g. start offset position
         if int(start_offset) > 0:
-            play_item.setProperty('StartOffset', str(start_offset))
+            play_item.setProperty('StartOffset', str(start_offset) + '.0')
         return xbmcplugin.setResolvedUrl(self.plugin_handle, True, listitem=play_item)
 
     def _generate_art_info (self, entry, li):
         return xbmcplugin.setResolvedUrl(self.plugin_handle, True, listitem=play_item)
 
     def _generate_art_info (self, entry, li):
index 8c1d841217d786f23ae27af9abcd8fe9e7b62c74..3dd8475226dc1ad7e91d92a6b073d9afbfc5aed4 100644 (file)
@@ -218,7 +218,7 @@ class Library:
         episode_entry = 'S%02dE%02d' % (season, episode)
         return episode_entry in show_entry['episodes']
 
         episode_entry = 'S%02dE%02d' % (season, episode)
         return episode_entry in show_entry['episodes']
 
-    def add_movie (self, title, alt_title, year, video_id, pin, build_url):
+    def add_movie (self, title, alt_title, year, video_id, build_url):
         """Adds a movie to the local db, generates & persists the strm file
 
         Parameters
         """Adds a movie to the local db, generates & persists the strm file
 
         Parameters
@@ -235,9 +235,6 @@ class Library:
         video_id : :obj:`str`
             ID of the video to be played
 
         video_id : :obj:`str`
             ID of the video to be played
 
-        pin : bool
-            Needs adult pin
-
         build_url : :obj:`fn`
             Function to generate the stream url
         """
         build_url : :obj:`fn`
             Function to generate the stream url
         """
@@ -253,7 +250,7 @@ class Library:
         if self.movie_exists(title=title, year=year) == False:
             self.db[self.movies_label][movie_meta] = {'alt_title': alt_title}
             self._update_local_db(filename=self.db_filepath, db=self.db)
         if self.movie_exists(title=title, year=year) == False:
             self.db[self.movies_label][movie_meta] = {'alt_title': alt_title}
             self._update_local_db(filename=self.db_filepath, db=self.db)
-        self.write_strm_file(path=filename, url=build_url({'action': 'play_video', 'video_id': video_id, 'pin': pin}))
+        self.write_strm_file(path=filename, url=build_url({'action': 'play_video', 'video_id': video_id}))
 
     def add_show (self, title, alt_title, episodes, build_url):
         """Adds a show to the local db, generates & persists the strm files
 
     def add_show (self, title, alt_title, episodes, build_url):
         """Adds a show to the local db, generates & persists the strm files
@@ -283,11 +280,11 @@ class Library:
         if self.show_exists(title) == False:
             self.db[self.series_label][show_meta] = {'seasons': [], 'episodes': [], 'alt_title': alt_title}
         for episode in episodes:
         if self.show_exists(title) == False:
             self.db[self.series_label][show_meta] = {'seasons': [], 'episodes': [], 'alt_title': alt_title}
         for episode in episodes:
-            self._add_episode(show_dir=show_dir, title=title, season=episode['season'], episode=episode['episode'], video_id=episode['id'], pin=episode['pin'], build_url=build_url)
+            self._add_episode(show_dir=show_dir, title=title, season=episode['season'], episode=episode['episode'], video_id=episode['id'], build_url=build_url)
         self._update_local_db(filename=self.db_filepath, db=self.db)
         return show_dir
 
         self._update_local_db(filename=self.db_filepath, db=self.db)
         return show_dir
 
-    def _add_episode (self, title, show_dir, season, episode, video_id, pin, build_url):
+    def _add_episode (self, title, show_dir, season, episode, video_id, build_url):
         """Adds a single episode to the local DB, generates & persists the strm file
 
         Parameters
         """Adds a single episode to the local DB, generates & persists the strm file
 
         Parameters
@@ -307,9 +304,6 @@ class Library:
         video_id : :obj:`str`
             ID of the video to be played
 
         video_id : :obj:`str`
             ID of the video to be played
 
-        pin : bool
-            Needs adult pin
-
         build_url : :obj:`fn`
             Function to generate the stream url
         """
         build_url : :obj:`fn`
             Function to generate the stream url
         """
@@ -330,7 +324,7 @@ class Library:
         filepath = os.path.join(show_dir, filename)
         if os.path.exists(filepath):
             return
         filepath = os.path.join(show_dir, filename)
         if os.path.exists(filepath):
             return
-        self.write_strm_file(path=filepath, url=build_url({'action': 'play_video', 'video_id': video_id, 'pin': pin}))
+        self.write_strm_file(path=filepath, url=build_url({'action': 'play_video', 'video_id': video_id}))
 
     def remove_movie (self, title, year):
         """Removes the DB entry & the strm file for the movie given
 
     def remove_movie (self, title, year):
         """Removes the DB entry & the strm file for the movie given
index 43cdf05a5f5293d554d54a870a9188ed2b24f22e..16c0a6d0b26ae20c581c7cbe1198094d55428d69 100644 (file)
@@ -104,12 +104,6 @@ class Navigation:
             # display the lists (recommendations, genres, etc.)
             return self.show_user_list(type=params['type'])
         elif params['action'] == 'play_video':
             # display the lists (recommendations, genres, etc.)
             return self.show_user_list(type=params['type'])
         elif params['action'] == 'play_video':
-            # play a video, check for adult pin if needed
-            adult_pin = None
-            if self.check_for_adult_pin(params=params):
-                adult_pin = self.kodi_helper.show_adult_pin_dialog()
-                if self.netflix_session.send_adult_pin(pin=adult_pin) != True:
-                    return self.kodi_helper.show_wrong_adult_pin_notification()
             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
             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
@@ -372,12 +366,12 @@ class Navigation:
         video = metadata['video']
 
         if video['type'] == 'movie':
         video = metadata['video']
 
         if video['type'] == 'movie':
-            self.library.add_movie(title=video['title'], alt_title=alt_title, year=video['year'], video_id=video_id, pin=video['requiresPin'], build_url=self.build_url)
+            self.library.add_movie(title=video['title'], alt_title=alt_title, year=video['year'], video_id=video_id, build_url=self.build_url)
         if video['type'] == 'show':
             episodes = []
             for season in video['seasons']:
                 for episode in season['episodes']:
         if video['type'] == 'show':
             episodes = []
             for season in video['seasons']:
                 for episode in season['episodes']:
-                    episodes.append({'season': season['seq'], 'episode': episode['seq'], 'id': episode['id'], 'pin': episode['requiresAdultVerification']})
+                    episodes.append({'season': season['seq'], 'episode': episode['seq'], 'id': episode['id']})
 
             self.library.add_show(title=video['title'], alt_title=alt_title, episodes=episodes, build_url=self.build_url)
         return self.kodi_helper.refresh()
 
             self.library.add_show(title=video['title'], alt_title=alt_title, episodes=episodes, build_url=self.build_url)
         return self.kodi_helper.refresh()
@@ -480,21 +474,6 @@ class Navigation:
         current_profile_id = self.netflix_session.user_data['guid']
         return 'profile_id' in params and current_profile_id != params['profile_id']
 
         current_profile_id = self.netflix_session.user_data['guid']
         return 'profile_id' in params and current_profile_id != params['profile_id']
 
-    def check_for_adult_pin (self, params):
-        """Checks if an adult pin is given in the query params
-
-        Parameters
-        ----------
-        params : :obj:`dict` of :obj:`str`
-            Url query params
-
-        Returns
-        -------
-        bool
-            Adult pin parameter exists or not
-        """
-        return (True, False)[params['pin'] == 'True']
-
     def parse_paramters (self, paramstring):
         """Tiny helper to convert a url paramstring into a dictionary
 
     def parse_paramters (self, paramstring):
         """Tiny helper to convert a url paramstring into a dictionary