Merge branch 'master' of https://github.com/asciidisco/plugin.video.netflix
authorJohannes Trum <johannes@die-trums.de>
Thu, 2 Mar 2017 13:12:54 +0000 (14:12 +0100)
committerJohannes Trum <johannes@die-trums.de>
Thu, 2 Mar 2017 13:12:54 +0000 (14:12 +0100)
README.md
addon.xml
resources/fanart.jpg
resources/icon.png
resources/lib/KodiHelper.py
resources/lib/Library.py
resources/lib/Navigation.py

index 47683a7d61edcb9ad873633bfc5697107d190690..ae246f0a5aeed19daa6391076b07bcd4e4772e6a 100644 (file)
--- a/README.md
+++ b/README.md
@@ -2,7 +2,6 @@
 
 ## Netflix Plugin for Kodi 18
 
-
 ###Prerequisites
 ----------------
 
 
 ###ToDo
 ----------------
+
+> Note: Those Todos are considered enhancements, they´re not issues, nor they prevent the usage of the plugin for everyday business
+
+If you feel, you´d like to contribute to this plugin or directly work on one of these items,
+please open an issue & we can provide you with some help to get started
+
 - [ ] Add missing meta data for episodes/seasons (Cast, bookmark position, etc.)
 - [ ] Change list of shows to actual list of episodes in the "Continue watching"" section, like it´s done on the website
 - [ ] Enable possibility to export single episodes or seasons to the Library
-- [ ] Evaluate idea of an auto updating library exporter that keeps track
+- [ ] Evaluate idea of an auto updating library exporter that keeps track (on Plugin start/on Service start maybe)
+- [ ] If a new user has been created, they need to select their movie/show preferences to actually get started, we could provide the same mechanisms in Kodi
+- [ ] Enable aggressive fetching of data in background (maybe using Futures), like the Netflix website does, to enhance the speed and the user experience when browsing the frontend
 
-###Error Handling
------------------
+###Something doesn't work
+-------------------------
 
 If something doesn't work for you, please:
 
@@ -40,10 +47,9 @@ If something doesn't work for you, please:
        - Your OS and OS version
        - Libwedevine version
        - A Kodi debug log that represents your issue
-       
+
 ###Licence
------------------      
+-----------------
 
 Licenced under The MIT License.
 Includes [pyjsparser](https://github.com/PiotrDabkowski/pyjsparser) by [Piotr Dabkowski](https://github.com/PiotrDabkowski)
-
index 8c093832e75a5ecb1d5e1fd7d748a277990fbc35..7b6113c06f71ba370894e1ca64b51576966d76d5 100644 (file)
--- a/addon.xml
+++ b/addon.xml
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
-<addon id="plugin.video.netflix" name="Netflix" version="0.9.0" provider-name="libdev,jojo,asciidisco">
+<addon id="plugin.video.netflix" name="Netflix" version="0.9.1" provider-name="libdev + jojo + asciidisco">
   <requires>
     <import addon="xbmc.python" version="2.24.0"/>
     <import addon="script.module.beautifulsoup4" version="4.3.2"/>
index 099eaa8ede176af73f55c682a2fefd1745a0912f..f0318bb4d25b4adc8b6949176f45c04e7c1fd791 100644 (file)
Binary files a/resources/fanart.jpg and b/resources/fanart.jpg differ
index 4b47f9d9d6c5016019de6c13e59dab5dfc716da4..c2c352c57d868c126ceab042a6aea2b9a47d1f9b 100644 (file)
Binary files a/resources/icon.png and b/resources/icon.png differ
index bafede639f6d8e55e3c272af0c93e8a6827d62e9..364fd7a82115786bf0d8560e640929d0f01c4ea4 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)
 
-    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
 
@@ -124,18 +113,6 @@ class KodiHelper:
         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
 
@@ -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
-                    # 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)
@@ -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)
-                    # 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)
@@ -657,7 +630,7 @@ class KodiHelper:
 
         # 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):
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']
 
-    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
@@ -235,9 +235,6 @@ class Library:
         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
         """
@@ -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)
-        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
@@ -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:
-            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
 
-    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
@@ -307,9 +304,6 @@ class Library:
         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
         """
@@ -330,7 +324,7 @@ class Library:
         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
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':
-            # 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
@@ -372,12 +366,12 @@ class Navigation:
         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']:
-                    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()
@@ -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']
 
-    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