if __name__ == '__main__':
# Call the router function and pass the plugin call parameters to it.
# We use string slicing to trim the leading '?' from the plugin call paramstring
- kodi_helper.log('started')
+ kodi_helper.log('Started (Version ' + kodi_helper.version + ')')
navigation.router(paramstring=sys.argv[2][1:])
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
-<addon id="plugin.video.netflix" name="Netflix" version="0.11.6" provider-name="libdev + jojo + asciidisco">
+<addon id="plugin.video.netflix" name="Netflix" version="0.11.7" provider-name="libdev + jojo + asciidisco">
<requires>
<import addon="xbmc.python" version="2.24.0"/>
<import addon="script.module.beautifulsoup4" version="4.3.2"/>
<license>MIT</license>
<forum>http://www.kodinerds.net/index.php/Thread/55607-Inputstream-Agile-Betatest-Netflix/</forum>
<source>https://github.com/asciidisco/plugin.video.netflix</source>
- <news>v0.11.5 (2017-3-17)
- - Speed up display of main menu, genre and recommendation list</news>
+ <news>v0.11.7 (2017-3-17)
+ - Remove initial connection check as it´s causing trouble</news>
</extension>
</addon>
# Kodi Media Center language file
# Addon Name: Netflix
# Addon id: plugin.video.netflix
-# Addon version: 0.11.6
+# Addon version: 0.11.7
# Addon Provider: libdev + jojo + asciidisco
msgid ""
msgstr ""
# Kodi Media Center language file
# Addon Name: Netflix
# Addon id: plugin.video.netflix
-# Addon version: 0.11.6
+# Addon version: 0.11.7
# Addon Provider: libdev + jojo + asciidisco
msgid ""
msgstr ""
# Kodi Media Center language file
# Addon Name: Netflix
# Addon id: plugin.video.netflix
-# Addon version: 0.11.6
+# Addon version: 0.11.7
# Addon Provider: libdev + jojo + asciidisco
msgid ""
msgstr ""
# Kodi Media Center language file
# Addon Name: Netflix
# Addon id: plugin.video.netflix
-# Addon version: 0.11.6
+# Addon version: 0.11.7
# Addon Provider: libdev + jojo + asciidisco
msgid ""
msgstr ""
self.base_url = base_url
self.addon = Addon()
self.plugin = self.addon.getAddonInfo('name')
+ self.version = self.addon.getAddonInfo('version')
self.base_data_path = xbmc.translatePath(self.addon.getAddonInfo('profile'))
self.home_path = xbmc.translatePath('special://home')
self.plugin_path = self.addon.getAddonInfo('path')
# Module: NetflixHttpSubRessourceHandler
# Created on: 07.03.2017
-from urllib2 import urlopen, URLError
-from time import sleep
-
class NetflixHttpSubRessourceHandler:
""" Represents the callable internal server routes & translates/executes them to requests for Netflix"""
self.netflix_session = netflix_session
self.credentials = self.kodi_helper.get_credentials()
self.profiles = []
- self.prefetch_login()
self.video_list_cache = {}
- self.lolomo = None
+ self.prefetch_login()
def prefetch_login (self):
"""Check if we have stored credentials.
If so, do the login before the user requests it
If that is done, we cache the profiles
"""
- if self._network_availble():
- if self.credentials['email'] != '' and self.credentials['password'] != '':
- if self.netflix_session.is_logged_in(account=self.credentials):
- self.netflix_session.refresh_session_data(account=self.credentials)
- self.profiles = self.netflix_session.profiles
- else:
- self.netflix_session.login(account=self.credentials)
- self.profiles = self.netflix_session.profiles
+ if self.credentials['email'] != '' and self.credentials['password'] != '':
+ if self.netflix_session.is_logged_in(account=self.credentials):
+ self.netflix_session.refresh_session_data(account=self.credentials)
+ self.profiles = self.netflix_session.profiles
else:
- self.profiles = []
+ self.netflix_session.login(account=self.credentials)
+ self.profiles = self.netflix_session.profiles
else:
- sleep(1)
- self.prefetch_login()
+ self.profiles = []
def is_logged_in (self, params):
"""Existing login proxy function
"""
self.profiles = []
self.credentials = {'email': '', 'password': ''}
- self.lolomo = None
return self.netflix_session.logout()
def login (self, params):
Response of the remote call
"""
profile_id = params.get('profile_id', [''])[0]
- self.lolomo = None
return self.netflix_session.switch_profile(profile_id=profile_id, account=self.credentials)
def get_user_data (self, params):
if 'error' in raw_search_contents:
return raw_search_contents
return self.netflix_session.parse_video_list(response_data=raw_search_contents)
-
- def _network_availble(self):
- """Check if the network is available
- Returns
- -------
- bool
- Network can be accessed
- """
- try:
- urlopen('http://216.58.192.142', timeout=1)
- return True
- except URLError as err:
- return False
import SocketServer
import socket
from xbmc import Monitor
-from xbmcaddon import Addon
from resources.lib.KodiHelper import KodiHelper
from resources.lib.MSLHttpRequestHandler import MSLHttpRequestHandler
from resources.lib.NetflixHttpRequestHandler import NetflixHttpRequestHandler
# helper function to select an unused port on the host machine
def select_unused_port():
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
- sock.bind(('localhost', 0))
+ sock.bind(('127.0.0.1', 0))
addr, port = sock.getsockname()
sock.close()
return port
-addon = Addon()
kodi_helper = KodiHelper()
# pick & store a port for the MSL service
msl_port = select_unused_port()
-addon.setSetting('msl_service_port', str(msl_port))
+kodi_helper.set_setting('msl_service_port', str(msl_port))
kodi_helper.log(msg='[MSL] Picked Port: ' + str(msl_port))
# pick & store a port for the internal Netflix HTTP proxy service
ns_port = select_unused_port()
-addon.setSetting('netflix_service_port', str(ns_port))
+kodi_helper.set_setting('netflix_service_port', str(ns_port))
kodi_helper.log(msg='[NS] Picked Port: ' + str(ns_port))
# server defaults