author
int64 658
755k
| date
stringlengths 19
19
| timezone
int64 -46,800
43.2k
| hash
stringlengths 40
40
| message
stringlengths 5
490
| mods
list | language
stringclasses 20
values | license
stringclasses 3
values | repo
stringlengths 5
68
| original_message
stringlengths 12
491
|
---|---|---|---|---|---|---|---|---|---|
106,046 | 22.11.2019 15:33:00 | -3,600 | 9c8f9f11abaa1ed1ec17a37dc9ae827a5ca2c48e | Allow custom paths in custom_video_list | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/api/shakti.py",
"new_path": "resources/lib/api/shakti.py",
"diff": "@@ -150,13 +150,14 @@ def video_list_sorted(context_name, context_id=None, perpetual_range_start=None,\n@common.time_execution(immediate=False)\n-def custom_video_list(video_ids):\n+def custom_video_list(video_ids, custom_paths=None):\n\"\"\"Retrieve a video list which contains the videos specified by\nvideo_ids\"\"\"\ncommon.debug('Requesting custom video list with {} videos', len(video_ids))\nreturn CustomVideoList(common.make_call(\n'path_request',\n- build_paths(['videos', video_ids], VIDEO_LIST_PARTIAL_PATHS)))\n+ build_paths(['videos', video_ids],\n+ custom_paths if custom_paths else VIDEO_LIST_PARTIAL_PATHS)))\n@common.time_execution(immediate=False)\n"
}
]
| Python | MIT License | castagnait/plugin.video.netflix | Allow custom paths in custom_video_list |
106,046 | 22.11.2019 15:34:33 | -3,600 | 55e1b52fbbcde8439c60f5aa7731312ddcb2f371 | Added thumb rating system
*the old numerical rating system will remain inactive, it could be
useful in the future | [
{
"change_type": "MODIFY",
"old_path": "resources/language/resource.language.en_gb/strings.po",
"new_path": "resources/language/resource.language.en_gb/strings.po",
"diff": "@@ -205,7 +205,7 @@ msgid \"View for profiles\"\nmsgstr \"\"\nmsgctxt \"#30045\"\n-msgid \"[COLOR cyan][B]-- NEXT PAGE --[/B][/COLOR]\"\n+msgid \"Thumb rating removed|You rated a thumb down|You rated a thumb up\"\nmsgstr \"\"\nmsgctxt \"#30046\"\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/api/paths.py",
"new_path": "resources/lib/api/paths.py",
"diff": "@@ -82,6 +82,10 @@ TRAILER_PARTIAL_PATHS = [\n[['availability', 'summary', 'synopsis', 'title', 'trackId', 'delivery', 'runtime']]\n] + ART_PARTIAL_PATHS\n+VIDEO_LIST_RATING_THUMB_PATHS = [\n+ [['summary', 'title', 'userRating', 'trackIds']]\n+]\n+\nINFO_TRANSFORMATIONS = {\n'rating': lambda r: r / 10,\n'playcount': lambda w: int(w) # pylint: disable=unnecessary-lambda\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/api/shakti.py",
"new_path": "resources/lib/api/shakti.py",
"diff": "@@ -332,12 +332,35 @@ def rate(videoid, rating):\ncommon.make_call(\n'post',\n{'component': 'set_video_rating',\n- 'params': {\n- 'titleid': videoid.value,\n+ 'data': {\n+ 'titleId': int(videoid.value),\n'rating': rating}})\nui.show_notification(common.get_local_string(30127).format(rating * 2))\n+@catch_api_errors\n+@common.time_execution(immediate=False)\n+def rate_thumb(videoid, rating, track_id_jaw):\n+ \"\"\"Rate a video on Netflix\"\"\"\n+ common.debug('Thumb rating {} as {}', videoid.value, rating)\n+ event_uuid = common.get_random_uuid()\n+ response = common.make_call(\n+ 'post',\n+ {'component': 'set_thumb_rating',\n+ 'data': {\n+ 'eventUuid': event_uuid,\n+ 'titleId': int(videoid.value),\n+ 'trackId': track_id_jaw,\n+ 'rating': rating,\n+ }})\n+ if response.get('status', '') == 'success':\n+ ui.show_notification(common.get_local_string(30045).split('|')[rating])\n+ else:\n+ common.error('Rating thumb error, response detail: {}', response)\n+ ui.show_error_info('Rating error', 'Error type: {}' + response.get('status', '--'),\n+ True, True)\n+\n+\n@catch_api_errors\n@common.time_execution(immediate=False)\ndef update_my_list(videoid, operation):\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/kodi/context_menu.py",
"new_path": "resources/lib/kodi/context_menu.py",
"diff": "@@ -39,6 +39,9 @@ CONTEXT_MENU_ACTIONS = {\n'rate': {\n'label': common.get_local_string(30019),\n'url': ctx_item_url(['rate'])},\n+ 'rate_thumb': {\n+ 'label': common.get_local_string(30019),\n+ 'url': ctx_item_url(['rate_thumb'])},\n'add_to_list': {\n'label': common.get_local_string(30021),\n'url': ctx_item_url(['my_list', 'add'])},\n@@ -68,9 +71,13 @@ def generate_context_menu_items(videoid):\n\"\"\"Generate context menu items for a listitem\"\"\"\nitems = _generate_library_ctx_items(videoid)\n- if videoid.mediatype != common.VideoId.SEASON and \\\n- videoid.mediatype != common.VideoId.SUPPLEMENTAL:\n- items.insert(0, _ctx_item('rate', videoid))\n+ # Old rating system\n+ # if videoid.mediatype != common.VideoId.SEASON and \\\n+ # videoid.mediatype != common.VideoId.SUPPLEMENTAL:\n+ # items.insert(0, _ctx_item('rate', videoid))\n+\n+ if videoid.mediatype in [common.VideoId.MOVIE, common.VideoId.SHOW]:\n+ items.insert(0, _ctx_item('rate_thumb', videoid))\nif videoid.mediatype != common.VideoId.SUPPLEMENTAL and \\\nvideoid.mediatype in [common.VideoId.MOVIE, common.VideoId.SHOW]:\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/kodi/ui/xmldialogs.py",
"new_path": "resources/lib/kodi/ui/xmldialogs.py",
"diff": "@@ -173,6 +173,64 @@ class ParentalControl(xbmcgui.WindowXMLDialog):\nreturn True\n+class RatingThumb(xbmcgui.WindowXMLDialog):\n+ \"\"\"\n+ Dialog for rating a tvshow or movie\n+ \"\"\"\n+ def __init__(self, *args, **kwargs):\n+ self.videoid = kwargs['videoid']\n+ self.track_id_jaw = kwargs['track_id_jaw']\n+ self.title = kwargs.get('title', '--')\n+ self.user_rating = kwargs.get('user_rating', 0)\n+ # Netflix user rating thumb values\n+ # 0 = No rated\n+ # 1 = thumb down\n+ # 2 = thumb up\n+ self.action_exitkeys_id = [ACTION_PREVIOUS_MENU,\n+ ACTION_PLAYER_STOP,\n+ ACTION_NAV_BACK]\n+ if OS_MACHINE[0:5] == 'armv7':\n+ xbmcgui.WindowXMLDialog.__init__(self)\n+ else:\n+ xbmcgui.WindowXMLDialog.__init__(self, *args, **kwargs)\n+\n+ def onInit(self):\n+ self.getControl(10000).setLabel(self.title)\n+ # Kodi does not allow to change button textures in runtime\n+ # and you can not add nested controls via code,\n+ # so the only alternative is to create double XML buttons\n+ # and eliminate those that are not needed\n+ focus_id = 10010\n+ if self.user_rating == 0: # No rated\n+ self.removeControl(self.getControl(10012))\n+ self.removeControl(self.getControl(10022))\n+ if self.user_rating == 1: # Thumb down set\n+ self.removeControl(self.getControl(10012))\n+ self.removeControl(self.getControl(10020))\n+ self.getControl(10010).controlRight(self.getControl(10022))\n+ self.getControl(10040).controlLeft(self.getControl(10022))\n+ if self.user_rating == 2: # Thumb up set\n+ focus_id = 10012\n+ self.removeControl(self.getControl(10010))\n+ self.removeControl(self.getControl(10022))\n+ self.getControl(10020).controlLeft(self.getControl(10012))\n+ self.setFocusId(focus_id)\n+\n+ def onClick(self, controlID):\n+ if controlID in [10010, 10020, 10012, 10022]: # Rating and close\n+ rating_map = {10010: 2, 10020: 1, 10012: 0, 10022: 0}\n+ rating_value = rating_map[controlID]\n+ from resources.lib.api.shakti import rate_thumb\n+ rate_thumb(self.videoid, rating_value, self.track_id_jaw)\n+ self.close()\n+ if controlID in [10040, 100]: # Close\n+ self.close()\n+\n+ def onAction(self, action):\n+ if action.getId() in self.action_exitkeys_id:\n+ self.close()\n+\n+\nclass SaveStreamSettings(xbmcgui.WindowXMLDialog):\n\"\"\"\nDialog for skipping video parts (intro, recap, ...)\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/navigation/actions.py",
"new_path": "resources/lib/navigation/actions.py",
"diff": "@@ -56,12 +56,37 @@ class AddonActionExecutor(object):\n@common.inject_video_id(path_offset=1)\n@common.time_execution(immediate=False)\n- def rate(self, videoid):\n- \"\"\"Rate an item on Netflix. Ask for a rating if there is none supplied\n- in the path.\"\"\"\n- rating = self.params.get('rating') or ui.ask_for_rating()\n- if rating is not None:\n- api.rate(videoid, rating)\n+ def rate_thumb(self, videoid):\n+ \"\"\"Rate an item on Netflix. Ask for a thumb rating\"\"\"\n+ # Get updated user rating info for this videoid\n+ from resources.lib.api.paths import VIDEO_LIST_RATING_THUMB_PATHS\n+ video_list = api.custom_video_list([videoid.value], VIDEO_LIST_RATING_THUMB_PATHS)\n+ if video_list.videos:\n+ videoid_value, video_data = list(video_list.videos.items())[0]\n+ title = video_data.get('title')\n+ track_id_jaw = video_data.get('trackIds', {})['trackId_jaw']\n+ is_thumb_rating = video_data.get('userRating', {}).get('type', '') == 'thumb'\n+ user_rating = video_data.get('userRating', {}).get('userRating') \\\n+ if is_thumb_rating else None\n+ ui.show_modal_dialog(ui.xmldialogs.RatingThumb,\n+ 'plugin-video-netflix-RatingThumb.xml',\n+ g.ADDON.getAddonInfo('path'),\n+ videoid=videoid,\n+ title=title,\n+ track_id_jaw=track_id_jaw,\n+ user_rating=user_rating)\n+ else:\n+ common.warn('Rating thumb video list api request no got results for {}', videoid)\n+\n+ # Old rating system\n+ # @common.inject_video_id(path_offset=1)\n+ # @common.time_execution(immediate=False)\n+ # def rate(self, videoid):\n+ # \"\"\"Rate an item on Netflix. Ask for a rating if there is none supplied\n+ # in the path.\"\"\"\n+ # rating = self.params.get('rating') or ui.ask_for_rating()\n+ # if rating is not None:\n+ # api.rate(videoid, rating)\n@common.inject_video_id(path_offset=2, inject_remaining_pathitems=True)\n@common.time_execution(immediate=False)\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/nfsession/nfsession.py",
"new_path": "resources/lib/services/nfsession/nfsession.py",
"diff": "@@ -40,7 +40,8 @@ URLS = {\n'pin_reset': {'endpoint': '/pin/reset', 'is_api_call': True},\n'pin_service': {'endpoint': '/pin/service', 'is_api_call': True},\n'metadata': {'endpoint': '/metadata', 'is_api_call': True},\n- 'set_video_rating': {'endpoint': '/setVideoRating', 'is_api_call': True},\n+ 'set_video_rating': {'endpoint': '/setVideoRating', 'is_api_call': True}, # Old rating system\n+ 'set_thumb_rating': {'endpoint': '/setThumbRating', 'is_api_call': True},\n'update_my_list': {'endpoint': '/playlistop', 'is_api_call': True},\n# Don't know what these could be used for. Keeping for reference\n# 'video_list_ids': {'endpoint': '/preflight', 'is_api_call': True},\n@@ -559,7 +560,7 @@ class NetflixSession(object):\ndata = kwargs.get('data', {})\nheaders = kwargs.get('headers', {})\nparams = kwargs.get('params', {})\n- if component in ['set_video_rating', 'update_my_list', 'pin_service']:\n+ if component in ['set_video_rating', 'set_thumb_rating', 'update_my_list', 'pin_service']:\nheaders.update({\n'Content-Type': 'application/json',\n'Accept': 'application/json, text/javascript, */*'})\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "resources/skins/default/1080i/plugin-video-netflix-RatingThumb.xml",
"diff": "+<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n+<window>\n+ <controls>\n+ <control type=\"group\">\n+ <!-- Note: some tags to the controls have been set even if not necessary to ensure compatibility with the custom skins of kodi -->\n+ <!-- Warning using low id numbers cause problems with moving focus an onClick events -->\n+ <top>250</top>\n+ <centerleft>50%</centerleft>\n+ <width>910</width>\n+ <!-- Screen background -->\n+ <control type=\"image\">\n+ <left>-2000</left>\n+ <top>-2000</top>\n+ <width>6000</width>\n+ <height>6000</height>\n+ <animation effect=\"fade\" time=\"300\">VisibleChange</animation>\n+ <animation effect=\"fade\" start=\"0\" end=\"100\" time=\"300\">WindowOpen</animation>\n+ <animation effect=\"fade\" start=\"100\" end=\"0\" time=\"200\">WindowClose</animation>\n+ <texture colordiffuse=\"C2FFFFFF\">colors/black.png</texture>\n+ </control>\n+\n+ <control type=\"group\">\n+ <width>910</width>\n+ <height>300</height>\n+ <!-- Window Background -->\n+ <control type=\"image\">\n+ <left>0</left>\n+ <top>0</top>\n+ <right>0</right>\n+ <bottom>0</bottom>\n+ <texture colordiffuse=\"FF1A2123\">colors/white.png</texture>\n+ <aspectratio>stretch</aspectratio>\n+ </control>\n+ <!-- Window header -->\n+ <control type=\"image\">\n+ <left>0</left>\n+ <top>0</top>\n+ <right>0</right>\n+ <height>66</height>\n+ <texture colordiffuse=\"FFFAFAFA\" border=\"2\">colors/white70.png</texture>\n+ <aspectratio>stretch</aspectratio>\n+ </control>\n+ <!-- Window text header -->\n+ <control type=\"label\" id=\"99\">\n+ <posy>0</posy> <!-- estouchy skin with label control use posy/posx tag instead of top/left -->\n+ <posx>40</posx>\n+ <top>0</top>\n+ <left>40</left>\n+ <right>100</right>\n+ <height>66</height>\n+ <textcolor>FF000000</textcolor>\n+ <font>font32_title</font>\n+ <label>$ADDON[plugin.video.netflix 30019]</label>\n+ <align>left</align>\n+ <aligny>center</aligny>\n+ <shadowcolor>white</shadowcolor>\n+ </control>\n+ <!-- Window close button -->\n+ <control type=\"button\" id=\"100\">\n+ <right>10</right>\n+ <left>840</left>\n+ <top>11</top>\n+ <width>42</width>\n+ <height>42</height>\n+ <texturefocus>dialogs/close.png</texturefocus>\n+ <texturenofocus>nf_icon.png</texturenofocus>\n+ <textoffsetx>0</textoffsetx>\n+ <align>right</align>\n+ <aligny>center</aligny>\n+ <pulseonselect>no</pulseonselect>\n+ </control>\n+ </control>\n+ <!-- Background color that encloses and highlights the controls of the window -->\n+ <control type=\"image\">\n+ <left>10</left>\n+ <top>80</top>\n+ <width>600</width>\n+ <height>210</height>\n+ <texture border=\"40\">buttons/dialogbutton-nofo.png</texture>\n+ <aspectratio>stretch</aspectratio>\n+ </control>\n+\n+ <!-- Controls -->\n+ <control type=\"group\">\n+ <left>0</left>\n+ <top>0</top>\n+ <width>800</width>\n+ <height>300</height>\n+\n+ <control type=\"label\" id=\"10000\">\n+ <description>Title of tvshow-movie</description>\n+ <posy>110</posy>\n+ <posx>65</posx>\n+ <top>110</top>\n+ <left>65</left>\n+ <width>500</width>\n+ <scroll>true</scroll>\n+ <label>--</label>\n+ <haspath>false</haspath>\n+ <font>font12</font>\n+ <wrapmultiline>false</wrapmultiline>\n+ </control>\n+\n+ <control type=\"button\" id=\"10010\">\n+ <top>190</top>\n+ <left>180</left>\n+ <description>Thumb up</description>\n+ <width>48</width>\n+ <height>48</height>\n+ <texturefocus border=\"0\" colordiffuse=\"red\">buttons/thumb_up_filled.png</texturefocus>\n+ <texturenofocus border=\"0\">buttons/thumb_up.png</texturenofocus>\n+ <align>center</align>\n+ <aligny>center</aligny>\n+ <pulseonselect>no</pulseonselect>\n+ <onright>10020</onright>\n+ </control>\n+\n+ <control type=\"button\" id=\"10012\">\n+ <top>190</top>\n+ <left>180</left>\n+ <description>Remove previous thumb up</description>\n+ <width>48</width>\n+ <height>48</height>\n+ <texturefocus border=\"0\" colordiffuse=\"red\">buttons/thumb_up.png</texturefocus>\n+ <texturenofocus border=\"0\">buttons/thumb_up_filled.png</texturenofocus>\n+ <align>center</align>\n+ <aligny>center</aligny>\n+ <pulseonselect>no</pulseonselect>\n+ <onright>10020</onright>\n+ </control>\n+\n+ <control type=\"button\" id=\"10020\">\n+ <top>190</top>\n+ <left>380</left>\n+ <description>Thumb down</description>\n+ <width>48</width>\n+ <height>48</height>\n+ <texturefocus border=\"0\" colordiffuse=\"red\">buttons/thumb_down_filled.png</texturefocus>\n+ <texturenofocus border=\"0\">buttons/thumb_down.png</texturenofocus>\n+ <align>center</align>\n+ <aligny>center</aligny>\n+ <pulseonselect>no</pulseonselect>\n+ <onleft>10010</onleft>\n+ <onright>10040</onright>\n+ </control>\n+\n+ <control type=\"button\" id=\"10022\">\n+ <top>190</top>\n+ <left>380</left>\n+ <description>Remove previous thumb down</description>\n+ <width>48</width>\n+ <height>48</height>\n+ <texturefocus border=\"0\" colordiffuse=\"red\">buttons/thumb_down.png</texturefocus>\n+ <texturenofocus border=\"0\">buttons/thumb_down_filled.png</texturenofocus>\n+ <align>center</align>\n+ <aligny>center</aligny>\n+ <pulseonselect>no</pulseonselect>\n+ <onleft>10010</onleft>\n+ <onright>10040</onright>\n+ </control>\n+\n+ <control type=\"button\" id=\"10040\">\n+ <top>90</top>\n+ <left>600</left>\n+ <description>Cancel button</description>\n+ <width>300</width>\n+ <height>100</height>\n+ <label>$LOCALIZE[222]</label>\n+ <font>font25_title</font>\n+ <texturefocus border=\"40\" colordiffuse=\"red\">buttons/dialogbutton-fo.png</texturefocus>\n+ <texturenofocus border=\"40\">buttons/dialogbutton-nofo.png</texturenofocus>\n+ <textcolor>white</textcolor>\n+ <disabledcolor>white</disabledcolor>\n+ <textoffsetx>20</textoffsetx>\n+ <align>center</align>\n+ <aligny>center</aligny>\n+ <pulseonselect>no</pulseonselect>\n+ <onleft>10020</onleft>\n+ </control>\n+ </control>\n+ </control>\n+ </controls>\n+</window>\n"
},
{
"change_type": "ADD",
"old_path": "resources/skins/default/media/buttons/thumb_down.png",
"new_path": "resources/skins/default/media/buttons/thumb_down.png",
"diff": "Binary files /dev/null and b/resources/skins/default/media/buttons/thumb_down.png differ\n"
},
{
"change_type": "ADD",
"old_path": "resources/skins/default/media/buttons/thumb_down_filled.png",
"new_path": "resources/skins/default/media/buttons/thumb_down_filled.png",
"diff": "Binary files /dev/null and b/resources/skins/default/media/buttons/thumb_down_filled.png differ\n"
},
{
"change_type": "ADD",
"old_path": "resources/skins/default/media/buttons/thumb_up.png",
"new_path": "resources/skins/default/media/buttons/thumb_up.png",
"diff": "Binary files /dev/null and b/resources/skins/default/media/buttons/thumb_up.png differ\n"
},
{
"change_type": "ADD",
"old_path": "resources/skins/default/media/buttons/thumb_up_filled.png",
"new_path": "resources/skins/default/media/buttons/thumb_up_filled.png",
"diff": "Binary files /dev/null and b/resources/skins/default/media/buttons/thumb_up_filled.png differ\n"
}
]
| Python | MIT License | castagnait/plugin.video.netflix | Added thumb rating system
*the old numerical rating system will remain inactive, it could be
useful in the future |
106,046 | 22.11.2019 15:55:34 | -3,600 | c21129ee88288a92f1d6ea1751158c9d486b1f3e | Add test stubs and pylist fixes | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/kodi/ui/xmldialogs.py",
"new_path": "resources/lib/kodi/ui/xmldialogs.py",
"diff": "@@ -173,6 +173,7 @@ class ParentalControl(xbmcgui.WindowXMLDialog):\nreturn True\n+# pylint: disable=no-member\nclass RatingThumb(xbmcgui.WindowXMLDialog):\n\"\"\"\nDialog for rating a tvshow or movie\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/navigation/actions.py",
"new_path": "resources/lib/navigation/actions.py",
"diff": "@@ -62,7 +62,7 @@ class AddonActionExecutor(object):\nfrom resources.lib.api.paths import VIDEO_LIST_RATING_THUMB_PATHS\nvideo_list = api.custom_video_list([videoid.value], VIDEO_LIST_RATING_THUMB_PATHS)\nif video_list.videos:\n- videoid_value, video_data = list(video_list.videos.items())[0]\n+ videoid_value, video_data = list(video_list.videos.items())[0] # pylint: disable=unused-variable\ntitle = video_data.get('title')\ntrack_id_jaw = video_data.get('trackIds', {})['trackId_jaw']\nis_thumb_rating = video_data.get('userRating', {}).get('type', '') == 'thumb'\n"
},
{
"change_type": "MODIFY",
"old_path": "test/xbmcgui.py",
"new_path": "test/xbmcgui.py",
"diff": "@@ -58,6 +58,14 @@ class ControlGeneric(Control):\ndef setInt(value=0, min=0, delta=1, max=1): # pylint: disable=redefined-builtin\n''' A stub implementation for the xbmcgui Control slider class getLabel() method '''\n+ @staticmethod\n+ def controlRight(control):\n+ ''' A stub implementation for the xbmcgui Control class method '''\n+\n+ @staticmethod\n+ def controlLeft(control):\n+ ''' A stub implementation for the xbmcgui Control class method '''\n+\nclass Dialog:\n''' A reimplementation of the xbmcgui Dialog class '''\n"
}
]
| Python | MIT License | castagnait/plugin.video.netflix | Add test stubs and pylist fixes |
106,046 | 23.11.2019 10:51:54 | -3,600 | 62cf816c963e661aa7410556699278a85f3714e0 | Removed SaveStreamSettings class no more used | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/kodi/ui/xmldialogs.py",
"new_path": "resources/lib/kodi/ui/xmldialogs.py",
"diff": "@@ -230,22 +230,3 @@ class RatingThumb(xbmcgui.WindowXMLDialog):\ndef onAction(self, action):\nif action.getId() in self.action_exitkeys_id:\nself.close()\n-\n-\n-class SaveStreamSettings(xbmcgui.WindowXMLDialog):\n- \"\"\"\n- Dialog for skipping video parts (intro, recap, ...)\n- \"\"\"\n- def __init__(self, *args, **kwargs): # pylint: disable=super-on-old-class\n- super(SaveStreamSettings, self).__init__(*args, **kwargs)\n- self.new_show_settings = kwargs['new_show_settings']\n- self.tvshowid = kwargs['tvshowid']\n- self.storage = kwargs['storage']\n-\n- def onInit(self):\n- self.action_exitkeys_id = [10, 13]\n-\n- def onClick(self, controlID):\n- if controlID == 6012:\n- self.storage[self.tvshowid] = self.new_show_settings\n- self.close()\n"
}
]
| Python | MIT License | castagnait/plugin.video.netflix | Removed SaveStreamSettings class no more used |
106,046 | 23.11.2019 11:01:45 | -3,600 | 757536082e5c66d53c0d6fe043ad52431395289d | Languages id fixes for thumb rating | [
{
"change_type": "MODIFY",
"old_path": "resources/language/resource.language.es_es/strings.po",
"new_path": "resources/language/resource.language.es_es/strings.po",
"diff": "@@ -193,8 +193,8 @@ msgid \"View for profiles\"\nmsgstr \"Vista para los perfiles\"\nmsgctxt \"#30045\"\n-msgid \"[COLOR cyan][B]-- NEXT PAGE --[/B][/COLOR]\"\n-msgstr \"[COLOR cyan][B]-- SIGUIENTE --[/B][/COLOR]\"\n+msgid \"Thumb rating removed|You rated a thumb down|You rated a thumb up\"\n+msgstr \"\"\nmsgctxt \"#30046\"\nmsgid \"InputStream addon is not enabled\"\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/language/resource.language.fr_fr/strings.po",
"new_path": "resources/language/resource.language.fr_fr/strings.po",
"diff": "@@ -205,8 +205,8 @@ msgid \"View for profiles\"\nmsgstr \"Voir les profils\"\nmsgctxt \"#30045\"\n-msgid \"[COLOR cyan][B]-- NEXT PAGE --[/B][/COLOR]\"\n-msgstr \"[COLOR cyan][B]-- PAGE SUIVANTE --[/B][/COLOR]\"\n+msgid \"Thumb rating removed|You rated a thumb down|You rated a thumb up\"\n+msgstr \"\"\nmsgctxt \"#30046\"\nmsgid \"InputStream addon is not enabled\"\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/language/resource.language.it_it/strings.po",
"new_path": "resources/language/resource.language.it_it/strings.po",
"diff": "@@ -205,8 +205,8 @@ msgid \"View for profiles\"\nmsgstr \"Vista per profili\"\nmsgctxt \"#30045\"\n-msgid \"[COLOR cyan][B]-- NEXT PAGE --[/B][/COLOR]\"\n-msgstr \"[COLOR cyan][B]-- PAGINA SUCCESSIVA --[/B][/COLOR]\"\n+msgid \"Thumb rating removed|You rated a thumb down|You rated a thumb up\"\n+msgstr \"\"\nmsgctxt \"#30046\"\nmsgid \"InputStream addon is not enabled\"\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/language/resource.language.nl_nl/strings.po",
"new_path": "resources/language/resource.language.nl_nl/strings.po",
"diff": "@@ -205,8 +205,8 @@ msgid \"View for profiles\"\nmsgstr \"View voor profielen\"\nmsgctxt \"#30045\"\n-msgid \"[COLOR cyan][B]-- NEXT PAGE --[/B][/COLOR]\"\n-msgstr \"[COLOR cyan][B]-- VOLGENDE PAGINA --[/B][/COLOR]\"\n+msgid \"Thumb rating removed|You rated a thumb down|You rated a thumb up\"\n+msgstr \"\"\nmsgctxt \"#30046\"\nmsgid \"InputStream addon is not enabled\"\n"
}
]
| Python | MIT License | castagnait/plugin.video.netflix | Languages id fixes for thumb rating |
106,046 | 24.11.2019 09:47:35 | -3,600 | 1343911a2de9e30845e3c5e3a0207788331b7f8d | Added internet connection check | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/common/kodiops.py",
"new_path": "resources/lib/common/kodiops.py",
"diff": "@@ -197,3 +197,35 @@ def _adjust_locale(locale_code, lang_code_without_country_exists):\ndebug('AdjustLocale - missing mapping conversion for locale: {}'.format(locale_code))\nreturn locale_code\n+\n+\n+def is_internet_connected():\n+ \"\"\"\n+ Check internet status\n+ :return: True if connected\n+ \"\"\"\n+ if not xbmc.getCondVisibility('System.InternetState'):\n+ # Double check when Kodi say that it is not connected\n+ # i'm not sure the InfoLabel will work properly when Kodi was started a few seconds ago\n+ # using getInfoLabel instead of getCondVisibility often return delayed results..\n+ return _check_internet()\n+ return True\n+\n+\n+def _check_internet():\n+ \"\"\"\n+ Checks via socket if the internet works (in about 0,7sec with no timeout error)\n+ :return: True if connected\n+ \"\"\"\n+ import socket\n+ for timeout in [1, 1]:\n+ try:\n+ socket.setdefaulttimeout(timeout)\n+ host = socket.gethostbyname(\"www.google.com\")\n+ s = socket.create_connection((host, 80), timeout)\n+ s.close()\n+ return True\n+ except Exception: # pylint: disable=broad-except\n+ # Error when is not reachable\n+ pass\n+ return False\n"
}
]
| Python | MIT License | castagnait/plugin.video.netflix | Added internet connection check |
106,046 | 24.11.2019 09:50:57 | -3,600 | b9c055a40bf37a5ed76a52893e0b5b49cd8c9a64 | Raise the exception when update_profile_data
Allow show to the user a possible error | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/nfsession/nfsession.py",
"new_path": "resources/lib/services/nfsession/nfsession.py",
"diff": "@@ -207,7 +207,7 @@ class NetflixSession(object):\nreturn True\n@common.time_execution(immediate=True)\n- def _refresh_session_data(self):\n+ def _refresh_session_data(self, raise_exception=False):\n\"\"\"Refresh session_data from the Netflix website\"\"\"\n# pylint: disable=broad-except\ntry:\n@@ -220,15 +220,24 @@ class NetflixSession(object):\n# it should be due to updates in the website,\n# this can happen when opening the addon while executing update_profiles_data\nimport traceback\n- common.debug(traceback.format_exc())\ncommon.warn('Failed to refresh session data, login expired (WebsiteParsingError)')\n+ common.debug(traceback.format_exc())\nself.session.cookies.clear()\nreturn self._login()\n+ except requests.exceptions.RequestException:\n+ import traceback\n+ common.warn('Failed to refresh session data, request error (RequestException)')\n+ common.warn(traceback.format_exc())\n+ if raise_exception:\n+ raise\n+ return False\nexcept Exception:\nimport traceback\n- common.debug(traceback.format_exc())\ncommon.warn('Failed to refresh session data, login expired (Exception)')\n+ common.debug(traceback.format_exc())\nself.session.cookies.clear()\n+ if raise_exception:\n+ raise\nreturn False\ncommon.debug('Successfully refreshed session data')\nreturn True\n@@ -349,7 +358,7 @@ class NetflixSession(object):\n@needs_login\n@common.time_execution(immediate=True)\ndef update_profiles_data(self):\n- return self._refresh_session_data()\n+ return self._refresh_session_data(raise_exception=True)\n@common.addonsignals_return_call\n@needs_login\n"
}
]
| Python | MIT License | castagnait/plugin.video.netflix | Raise the exception when update_profile_data
Allow show to the user a possible error |
106,046 | 24.11.2019 09:57:30 | -3,600 | 4836b4fcda1160a14f1e914f97a4f9fdd6fa74f1 | Verify internet connection before any operation that need to be logged in
can prevents strange http errors that often the normal user does not understand,
continuing to open pull requests for a simple network problem | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/api/exceptions.py",
"new_path": "resources/lib/api/exceptions.py",
"diff": "@@ -47,3 +47,7 @@ class NotLoggedInError(Exception):\nclass APIError(Exception):\n\"\"\"The requested API operation has resulted in an error\"\"\"\n+\n+\n+class NotConnected(Exception):\n+ \"\"\"Internet status not connected\"\"\"\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/nfsession/nfsession.py",
"new_path": "resources/lib/services/nfsession/nfsession.py",
"diff": "@@ -19,7 +19,7 @@ import resources.lib.kodi.ui as ui\nfrom resources.lib.api.exceptions import (NotLoggedInError, LoginFailedError, LoginValidateError,\nAPIError, MissingCredentialsError, WebsiteParsingError,\n- InvalidMembershipStatusError)\n+ InvalidMembershipStatusError, NotConnected)\ntry: # Python 2\nunicode\n@@ -61,6 +61,10 @@ def needs_login(func):\n@wraps(func)\ndef ensure_login(*args, **kwargs):\nsession = args[0]\n+ # I make sure that the connection is present..\n+ if not common.is_internet_connected():\n+ raise NotConnected('Internet connection not available')\n+ # ..this check verifies only if locally there are the data to correctly perform the login\nif not session._is_logged_in():\nraise NotLoggedInError\nreturn func(*args, **kwargs)\n"
}
]
| Python | MIT License | castagnait/plugin.video.netflix | Verify internet connection before any operation that need to be logged in
can prevents strange http errors that often the normal user does not understand,
continuing to open pull requests for a simple network problem |
106,046 | 24.11.2019 10:10:06 | -3,600 | d513c8022ba5458d1a1b8c1212225c58d49c3c2e | Prefetch fixes
no longer crashes the service in the case of an error
if prefetch fail set session header data at first login | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/nfsession/nfsession.py",
"new_path": "resources/lib/services/nfsession/nfsession.py",
"diff": "@@ -101,6 +101,7 @@ class NetflixSession(object):\ncommon.register_slot(play_callback, signal=g.ADDON_ID + '_play_action',\nsource_id='upnextprovider')\nself._init_session()\n+ self.is_prefetch_login = False\nself._prefetch_login()\n@property\n@@ -152,8 +153,12 @@ class NetflixSession(object):\ncommon.get_credentials()\nif not self._is_logged_in():\nself._login()\n- else:\n- self.set_session_header_data()\n+ self.is_prefetch_login = True\n+ except requests.exceptions.RequestException as exc:\n+ # It was not possible to connect to the web service, no connection, network problem, etc\n+ import traceback\n+ common.error('Login prefetch: request exception {}', exc)\n+ common.debug(traceback.format_exc())\nexcept MissingCredentialsError:\ncommon.info('Login prefetch: No stored credentials are available')\nexcept (LoginFailedError, LoginValidateError):\n@@ -164,9 +169,12 @@ class NetflixSession(object):\n@common.time_execution(immediate=True)\ndef _is_logged_in(self):\n\"\"\"Check if the user is logged in and if so refresh session data\"\"\"\n- return self._load_cookies() and \\\n+ valid_login = self._load_cookies() and \\\nself._verify_session_cookies() and \\\nself._verify_esn_existence()\n+ if valid_login and not self.is_prefetch_login:\n+ self.set_session_header_data()\n+ return valid_login\n@common.time_execution(immediate=True)\ndef _verify_session_cookies(self):\n"
}
]
| Python | MIT License | castagnait/plugin.video.netflix | Prefetch fixes
-no longer crashes the service in the case of an error
-if prefetch fail set session header data at first login |
106,046 | 24.11.2019 10:30:55 | -3,600 | e9e7f3abfec074a5487144c4220857a3501d4e1c | Do not ask for credentials when the first login fails
credentials will be deleted only when netflix returns an error, if this does not happen, in the second attempt should be to use the saved credentials | [
{
"change_type": "MODIFY",
"old_path": "addon.py",
"new_path": "addon.py",
"diff": "@@ -42,7 +42,9 @@ def lazy_login(func):\ndebug('Tried to perform an action without being logged in')\ntry:\nfrom resources.lib.api.shakti import login\n- login()\n+ if not login(ask_credentials=not check_credentials()):\n+ _handle_endofdirectory()\n+ return\ndebug('Now that we\\'re logged in, let\\'s try again')\nreturn func(*args, **kwargs)\nexcept MissingCredentialsError:\n"
}
]
| Python | MIT License | castagnait/plugin.video.netflix | Do not ask for credentials when the first login fails
credentials will be deleted only when netflix returns an error, if this does not happen, in the second attempt should be to use the saved credentials |
106,046 | 24.11.2019 14:45:48 | -3,600 | 1f6280bed54395fb8ef41674c08487f91d85a901 | Added yes-no dialog | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/kodi/ui/dialogs.py",
"new_path": "resources/lib/kodi/ui/dialogs.py",
"diff": "@@ -106,6 +106,10 @@ def show_ok_dialog(title, message):\nreturn xbmcgui.Dialog().ok(title, message)\n+def show_yesno_dialog(title, message, yeslabel=None, nolabel=None):\n+ return xbmcgui.Dialog().yesno(title, message, yeslabel=yeslabel, nolabel=nolabel)\n+\n+\ndef show_error_info(title, message, unknown_error=False, netflix_error=False):\n\"\"\"Show a dialog that displays the error message\"\"\"\nprefix = (30104, 30102, 30101)[unknown_error + netflix_error]\n"
}
]
| Python | MIT License | castagnait/plugin.video.netflix | Added yes-no dialog |
106,046 | 24.11.2019 15:01:12 | -3,600 | 4b040d09094ed1c1d3d175bca1b38d609aa48b66 | Better handle settings monitor suspend | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/globals.py",
"new_path": "resources/lib/globals.py",
"diff": "@@ -247,7 +247,7 @@ class GlobalVariables(object):\nshared_db_class = db_shared.get_shareddb_class(force_sqlite=True)\nself.SHARED_DB = shared_db_class()\n- self.settings_monitor_suspended(False) # Reset the value in case of addon crash\n+ self.settings_monitor_suspend(False) # Reset the value in case of addon crash\ntry:\nos.mkdir(self.DATA_PATH)\n@@ -281,7 +281,7 @@ class GlobalVariables(object):\nif run_initial_config:\nfrom resources.lib.common import (debug, get_system_platform, get_local_string)\nfrom resources.lib.kodi.ui import (ask_for_confirmation, show_ok_dialog)\n- self.settings_monitor_suspended(True)\n+ self.settings_monitor_suspend(True, False)\nsystem = get_system_platform()\ndebug('Running initial addon configuration dialogs on system: {}', system)\n@@ -325,24 +325,34 @@ class GlobalVariables(object):\nself.ADDON.setSettingBool('enable_vp9_profiles', False)\nself.ADDON.setSettingBool('enable_hevc_profiles', False)\nself.ADDON.setSettingBool('run_init_configuration', False)\n- self.settings_monitor_suspended(False)\n+ self.settings_monitor_suspend(False)\n- def settings_monitor_suspended(self, suspend):\n+ def settings_monitor_suspend(self, is_suspended=True, at_first_change=False):\n\"\"\"\n- Suspends for the necessary time the settings monitor\n- that otherwise cause the reinitialization of global settings\n- and possible consequent actions to settings changes or unnecessary checks\n+ Suspends for the necessary time the settings monitor of the service\n+ that otherwise cause the reinitialization of global settings and possible consequent actions\n+ to settings changes or unnecessary checks when a setting will be changed.\n+ :param is_suspended: True/False - allows or denies the execution of the settings monitor\n+ :param at_first_change:\n+ True - monitor setting is automatically reactivated after the FIRST change to the settings\n+ False - monitor setting MUST BE REACTIVATED MANUALLY\n+ :return: None\n\"\"\"\n- is_suspended = g.LOCAL_DB.get_value('suspend_settings_monitor', False)\n- if (is_suspended and suspend) or (not is_suspended and not suspend):\n+ if is_suspended and at_first_change:\n+ new_value = 'First'\n+ else:\n+ new_value = str(is_suspended)\n+ # Accepted values in string: First, True, False\n+ current_value = g.LOCAL_DB.get_value('suspend_settings_monitor', 'False')\n+ if new_value == current_value:\nreturn\n- g.LOCAL_DB.set_value('suspend_settings_monitor', suspend)\n+ g.LOCAL_DB.set_value('suspend_settings_monitor', new_value)\n- def settings_monitor_is_suspended(self):\n+ def settings_monitor_suspend_status(self):\n\"\"\"\n- Returns True when the setting monitor must be suspended\n+ Returns the suspend status of settings monitor\n\"\"\"\n- return g.LOCAL_DB.get_value('suspend_settings_monitor', False)\n+ return g.LOCAL_DB.get_value('suspend_settings_monitor', 'False')\ndef get_esn(self):\n\"\"\"Get the generated esn or if set get the custom esn\"\"\"\n@@ -363,9 +373,8 @@ class GlobalVariables(object):\nfor _ in range(0, 30):\nesn.append(random.choice(possible))\nedge_esn = ''.join(esn)\n- self.settings_monitor_suspended(True)\n+ self.settings_monitor_suspend(True)\nself.ADDON.setSetting('edge_esn', edge_esn)\n- self.settings_monitor_suspended(False)\nreturn edge_esn\ndef is_known_menu_context(self, context):\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/navigation/actions.py",
"new_path": "resources/lib/navigation/actions.py",
"diff": "@@ -26,12 +26,11 @@ class AddonActionExecutor(object):\ndef save_autologin(self, pathitems):\n\"\"\"Save autologin data\"\"\"\ntry:\n- g.settings_monitor_suspended(True)\n- g.ADDON.setSetting('autologin_user',\n- self.params['autologin_user'])\n+ g.settings_monitor_suspend(True)\n+ g.ADDON.setSetting('autologin_user', self.params['autologin_user'])\ng.ADDON.setSetting('autologin_id', pathitems[1])\ng.ADDON.setSetting('autologin_enable', 'true')\n- g.settings_monitor_suspended(False)\n+ g.settings_monitor_suspend(False)\nexcept (KeyError, IndexError):\ncommon.error('Cannot save autologin - invalid params')\ng.CACHE.invalidate()\n@@ -135,14 +134,13 @@ class AddonActionExecutor(object):\nif not ui.ask_for_confirmation(common.get_local_string(30217),\ncommon.get_local_string(30218)):\nreturn\n- g.settings_monitor_suspended(True)\n# Reset the ESN obtained from website/generated\ng.LOCAL_DB.set_value('esn', '', TABLE_SESSION)\n# Reset the custom ESN (manual ESN from settings)\n+ g.settings_monitor_suspend(at_first_change=True)\ng.ADDON.setSetting('esn', '')\n# Reset the custom ESN (backup of manual ESN from settings, used in settings_monitor.py)\ng.LOCAL_DB.set_value('custom_esn', '', TABLE_SETTINGS_MONITOR)\n- g.settings_monitor_suspended(False)\n# Perform a new login to get/generate a new ESN\napi.login(ask_credentials=False)\n# Warning after login netflix switch to the main profile! so return to the main screen\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/nfsession/nfsession.py",
"new_path": "resources/lib/services/nfsession/nfsession.py",
"diff": "@@ -350,10 +350,10 @@ class NetflixSession(object):\ncommon.debug('Logging out of current account')\n# Disable and reset auto-update / auto-sync features\n- g.settings_monitor_suspended(True)\n+ g.settings_monitor_suspend(True)\ng.ADDON.setSettingInt('lib_auto_upd_mode', 0)\ng.ADDON.setSettingBool('lib_sync_mylist', False)\n- g.settings_monitor_suspended(False)\n+ g.settings_monitor_suspend(False)\ng.SHARED_DB.delete_key('sync_mylist_profile_guid')\ncookies.delete(self.account_hash)\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/settings_monitor.py",
"new_path": "resources/lib/services/settings_monitor.py",
"diff": "@@ -22,7 +22,14 @@ class SettingsMonitor(xbmc.Monitor):\nxbmc.Monitor.__init__(self)\ndef onSettingsChanged(self):\n- if not g.settings_monitor_is_suspended():\n+ status = g.settings_monitor_suspend_status()\n+ if status == 'First':\n+ common.warn('SettingsMonitor: triggered but in suspend status (at first change)')\n+ g.settings_monitor_suspend(False)\n+ return\n+ if status == 'True':\n+ common.warn('SettingsMonitor: triggered but in suspend status (permanent)')\n+ return\nself._on_change()\ndef _on_change(self):\n"
}
]
| Python | MIT License | castagnait/plugin.video.netflix | Better handle settings monitor suspend |
106,046 | 24.11.2019 16:48:08 | -3,600 | 1fe245fd5e7962c8fa6aed25fb5ed7113f511316 | Introducing watched status marks by profile
Initial transition, in the future the temporary options will have to be removed, maintaining the distinction of the watched status by profile is mandatory. Required for a possible future sync with netflix. | [
{
"change_type": "MODIFY",
"old_path": "resources/language/resource.language.en_gb/strings.po",
"new_path": "resources/language/resource.language.en_gb/strings.po",
"diff": "@@ -975,3 +975,11 @@ msgstr \"\"\nmsgctxt \"#30237\"\nmsgid \"Content for {} will require the PIN to start playback.\"\nmsgstr \"\"\n+\n+msgctxt \"#30238\"\n+msgid \"\"\n+msgstr \"\"\n+\n+msgctxt \"#30239\" # This is a temporary transition option\n+msgid \"Keep watched status marks separate for each profile (this option will be removed in future versions)\"\n+msgstr \"\"\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/kodi/listings.py",
"new_path": "resources/lib/kodi/listings.py",
"diff": "@@ -251,7 +251,8 @@ def _create_subgenre_item(video_list_id, subgenre_data, menu_data):\n@common.time_execution(immediate=False)\ndef build_video_listing(video_list, menu_data, pathitems=None, genre_id=None):\n\"\"\"Build a video listing\"\"\"\n- directory_items = [_create_video_item(videoid_value, video, video_list, menu_data)\n+ params = get_param_watched_status_by_profile()\n+ directory_items = [_create_video_item(videoid_value, video, video_list, menu_data, params)\nfor videoid_value, video\nin list(video_list.videos.items())]\n# If genre_id exists add possibility to browse lolomos subgenres\n@@ -290,7 +291,7 @@ def build_video_listing(video_list, menu_data, pathitems=None, genre_id=None):\n@common.time_execution(immediate=False)\n-def _create_video_item(videoid_value, video, video_list, menu_data):\n+def _create_video_item(videoid_value, video, video_list, menu_data, params):\n\"\"\"Create a tuple that can be added to a Kodi directory that represents\na video as listed in a videolist\"\"\"\nis_movie = video['summary']['type'] == 'movie'\n@@ -305,7 +306,8 @@ def _create_video_item(videoid_value, video, video_list, menu_data):\nurl = common.build_url(videoid=videoid,\nmode=(g.MODE_PLAY\nif is_movie\n- else g.MODE_DIRECTORY))\n+ else g.MODE_DIRECTORY),\n+ params=params)\nlist_item.addContextMenuItems(generate_context_menu_items(videoid))\nreturn (url, list_item, not is_movie)\n@@ -341,8 +343,9 @@ def _create_season_item(tvshowid, seasonid_value, season, season_list):\n@common.time_execution(immediate=False)\ndef build_episode_listing(seasonid, episode_list, pathitems=None):\n\"\"\"Build a season listing\"\"\"\n+ params = get_param_watched_status_by_profile()\ndirectory_items = [_create_episode_item(seasonid, episodeid_value, episode,\n- episode_list)\n+ episode_list, params)\nfor episodeid_value, episode\nin list(episode_list.episodes.items())]\nadd_items_previous_next_page(directory_items, pathitems, episode_list.perpetual_range_selector)\n@@ -353,7 +356,7 @@ def build_episode_listing(seasonid, episode_list, pathitems=None):\n@common.time_execution(immediate=False)\n-def _create_episode_item(seasonid, episodeid_value, episode, episode_list):\n+def _create_episode_item(seasonid, episodeid_value, episode, episode_list, params):\n\"\"\"Create a tuple that can be added to a Kodi directory that represents\nan episode as listed in an episode listing\"\"\"\nepisodeid = seasonid.derive_episode(episodeid_value)\n@@ -361,7 +364,7 @@ def _create_episode_item(seasonid, episodeid_value, episode, episode_list):\nadd_info(episodeid, list_item, episode, episode_list.data, True)\nadd_art(episodeid, list_item, episode)\nlist_item.addContextMenuItems(generate_context_menu_items(episodeid))\n- url = common.build_url(videoid=episodeid, mode=g.MODE_PLAY)\n+ url = common.build_url(videoid=episodeid, mode=g.MODE_PLAY, params=params)\nreturn (url, list_item, False)\n@@ -369,7 +372,8 @@ def _create_episode_item(seasonid, episodeid_value, episode, episode_list):\n@common.time_execution(immediate=False)\ndef build_supplemental_listing(video_list, pathitems=None): # pylint: disable=unused-argument\n\"\"\"Build a supplemental listing (eg. trailers)\"\"\"\n- directory_items = [_create_supplemental_item(videoid_value, video, video_list)\n+ params = get_param_watched_status_by_profile()\n+ directory_items = [_create_supplemental_item(videoid_value, video, video_list, params)\nfor videoid_value, video\nin list(video_list.videos.items())]\nfinalize_directory(directory_items, g.CONTENT_SHOW, 'sort_label',\n@@ -377,7 +381,7 @@ def build_supplemental_listing(video_list, pathitems=None): # pylint: disable=u\n@common.time_execution(immediate=False)\n-def _create_supplemental_item(videoid_value, video, video_list):\n+def _create_supplemental_item(videoid_value, video, video_list, params):\n\"\"\"Create a tuple that can be added to a Kodi directory that represents\na video as listed in a videolist\"\"\"\nvideoid = common.VideoId(\n@@ -386,7 +390,8 @@ def _create_supplemental_item(videoid_value, video, video_list):\nadd_info(videoid, list_item, video, video_list.data, True)\nadd_art(videoid, list_item, video)\nurl = common.build_url(videoid=videoid,\n- mode=g.MODE_PLAY)\n+ mode=g.MODE_PLAY,\n+ params=params)\n# replaceItems still look broken because it does not remove the default ctx menu\n# i hope in the future Kodi fix this\nlist_item.addContextMenuItems(generate_context_menu_items(videoid), replaceItems=True)\n@@ -463,3 +468,17 @@ def add_sort_methods(sort_type):\nxbmcplugin.addSortMethod(g.PLUGIN_HANDLE, xbmcplugin.SORT_METHOD_EPISODE)\nxbmcplugin.addSortMethod(g.PLUGIN_HANDLE, xbmcplugin.SORT_METHOD_LABEL)\nxbmcplugin.addSortMethod(g.PLUGIN_HANDLE, xbmcplugin.SORT_METHOD_VIDEO_TITLE)\n+\n+\n+# This method is a temporary option transition for the current users to avoid causing frustration\n+# because when enabled causes the loss of all watched status already assigned to the videos,\n+# in future versions will have to be eliminated, keeping params.\n+def get_param_watched_status_by_profile():\n+ \"\"\"\n+ When enabled, the value to be used as parameter in the ListItem (of videos) will be created,\n+ in order to differentiate the watched status by profiles\n+ :return: when enabled return a dictionary to be add to 'build_url' params\n+ \"\"\"\n+ if g.ADDON.getSettingBool('watched_status_by_profile'):\n+ return {'profile_guid': g.LOCAL_DB.get_active_profile_guid()}\n+ return None\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/upgrade_controller.py",
"new_path": "resources/lib/upgrade_controller.py",
"diff": "@@ -41,6 +41,17 @@ def _perform_addon_changes(previous_ver, current_ver):\nmsg = ('This update resets the settings to auto-update library.\\r\\n'\n'Therefore only in case you are using auto-update must be reconfigured.')\nui.show_ok_dialog('Netflix upgrade', msg)\n+ if previous_ver and is_less_version(previous_ver, '0.15.12'):\n+ import resources.lib.kodi.ui as ui\n+ msg = (\n+ 'Has been introduced watched status marks for the videos separate for each profile:\\r\\n'\n+ '[Use new feature] watched status will be separate by profile, [B]existing watched status will be lost.[/B]\\r\\n'\n+ '[Leave unchanged] existing watched status will be kept, [B]but in future versions will be lost.[/B]\\r\\n'\n+ 'This option can be temporarily changed in expert settings')\n+ choice = ui.show_yesno_dialog('Netflix upgrade - watched status marks', msg,\n+ 'Use new feature', 'Leave unchanged')\n+ g.settings_monitor_suspend(at_first_change=True)\n+ g.ADDON.setSettingBool('watched_status_by_profile', choice)\n# Clear cache (prevents problems when netflix change data structures)\ng.CACHE.invalidate(True)\n# Always leave this to last - After the operations set current version\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/settings.xml",
"new_path": "resources/settings.xml",
"diff": "<setting id=\"enable_timing\" type=\"bool\" label=\"30134\" default=\"false\"/>\n<setting id=\"disable_modal_error_display\" type=\"bool\" label=\"30130\" default=\"false\"/>\n<setting id=\"ssl_verification\" type=\"bool\" label=\"30024\" default=\"true\"/>\n+ <setting id=\"watched_status_by_profile\" type=\"bool\" label=\"30239\" default=\"true\"/> <!-- This is a temporary transition option -->\n<setting label=\"30117\" type=\"lsep\"/><!--Cache-->\n<setting id=\"cache_ttl\" type=\"slider\" option=\"int\" range=\"0,10,525600\" label=\"30084\" default=\"120\"/>\n<setting id=\"cache_metadata_ttl\" type=\"slider\" option=\"int\" range=\"0,1,365\" label=\"30085\" default=\"30\"/>\n"
}
]
| Python | MIT License | castagnait/plugin.video.netflix | Introducing watched status marks by profile
Initial transition, in the future the temporary options will have to be removed, maintaining the distinction of the watched status by profile is mandatory. Required for a possible future sync with netflix. |
106,046 | 25.11.2019 20:15:41 | -3,600 | 749c132a60b5287b0496e6591a779b5be67dc60c | Updated mysql connector to v8.0.18 | [
{
"change_type": "MODIFY",
"old_path": "modules/mysql-connector-python/CHANGES.txt",
"new_path": "modules/mysql-connector-python/CHANGES.txt",
"diff": "@@ -8,6 +8,15 @@ Copyright (c) 2009, 2019, Oracle and/or its affiliates. All rights reserved.\nFull release notes:\nhttp://dev.mysql.com/doc/relnotes/connector-python/en/\n+v8.0.18\n+=======\n+\n+- WL#13330: Single C/Python (Win) MSI installer\n+- WL#13335: Connectors should handle expired password sandbox without SET operations\n+- WL#13194: Add support for Python 3.8\n+- BUG#29909157: Table scans of floats causes memory leak with the C extension\n+- BUG#25349794: Add read_default_file alias for option_files in connect()\n+\nv8.0.17\n=======\n"
},
{
"change_type": "MODIFY",
"old_path": "modules/mysql-connector-python/LICENSE.txt",
"new_path": "modules/mysql-connector-python/LICENSE.txt",
"diff": "@@ -10,7 +10,7 @@ Introduction\nthird-party software which may be included in this distribution of\nMySQL Connector/Python 8.0.\n- Last updated: June 2019\n+ Last updated: September 2019\nLicensing Information\n@@ -556,6 +556,43 @@ code is not standalone and requires a support library to be\nlinked with it. This support library is itself covered by\nthe above license.\n+ISC\n+\n+ The following software may be included in this product:\n+ISC License\n+\n+Copyright (C) Dnspython Contributors\n+\n+Permission to use, copy, modify, and/or distribute this software for\n+any purpose with or without fee is hereby granted, provided that the\n+above copyright notice and this permission notice appear in all\n+copies.\n+\n+THE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL\n+WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED\n+WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE\n+AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL\n+DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR\n+PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER\n+TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\n+PERFORMANCE OF THIS SOFTWARE.\n+\n+Copyright (C) 2001-2017 Nominum, Inc.\n+Copyright (C) Google Inc.\n+\n+Permission to use, copy, modify, and distribute this software and its\n+documentation for any purpose with or without fee is hereby granted,\n+provided that the above copyright notice and this permission notice\n+appear in all copies.\n+\n+THE SOFTWARE IS PROVIDED \"AS IS\" AND NOMINUM DISCLAIMS ALL WARRANTIES\n+WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF\n+MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NOMINUM BE LIABLE FOR\n+ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES\n+WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN\n+ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT\n+OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\n+\nOpenSSL License\nYou are receiving a copy of OpenSSL as part of this product in object\n"
},
{
"change_type": "MODIFY",
"old_path": "modules/mysql-connector-python/PKG-INFO",
"new_path": "modules/mysql-connector-python/PKG-INFO",
"diff": "Metadata-Version: 1.1\nName: mysql-connector-python\n-Version: 8.0.17\n+Version: 8.0.18\nSummary: MySQL driver written in Python\nHome-page: http://dev.mysql.com/doc/connector-python/en/index.html\nAuthor: Oracle and/or its affiliates\n@@ -27,6 +27,7 @@ Classifier: Programming Language :: Python :: 3.4\nClassifier: Programming Language :: Python :: 3.5\nClassifier: Programming Language :: Python :: 3.6\nClassifier: Programming Language :: Python :: 3.7\n+Classifier: Programming Language :: Python :: 3.8\nClassifier: Topic :: Database\nClassifier: Topic :: Software Development\nClassifier: Topic :: Software Development :: Libraries :: Application Frameworks\n"
},
{
"change_type": "MODIFY",
"old_path": "modules/mysql-connector-python/mysql/connector/__init__.py",
"new_path": "modules/mysql-connector-python/mysql/connector/__init__.py",
"diff": "-# Copyright (c) 2009, 2018, Oracle and/or its affiliates. All rights reserved.\n+# Copyright (c) 2009, 2019, Oracle and/or its affiliates. All rights reserved.\n#\n# This program is free software; you can redistribute it and/or modify\n# it under the terms of the GNU General Public License, version 2.0, as\n@@ -143,6 +143,10 @@ def connect(*args, **kwargs):\nReturns MySQLConnection or PooledMySQLConnection.\n\"\"\"\n# Option files\n+ if 'read_default_file' in kwargs:\n+ kwargs['option_files'] = kwargs['read_default_file']\n+ kwargs.pop('read_default_file')\n+\nif 'option_files' in kwargs:\nnew_config = read_option_files(**kwargs)\nreturn connect(**new_config)\n"
},
{
"change_type": "MODIFY",
"old_path": "modules/mysql-connector-python/mysql/connector/abstracts.py",
"new_path": "modules/mysql-connector-python/mysql/connector/abstracts.py",
"diff": "@@ -281,6 +281,7 @@ class MySQLConnectionAbstract(object):\n('username', 'user'),\n('passwd', 'password'),\n('connect_timeout', 'connection_timeout'),\n+ ('read_default_file', 'option_files'),\n]\nfor compat, translate in compat_map:\ntry:\n@@ -778,6 +779,9 @@ class MySQLConnectionAbstract(object):\nself.disconnect()\nself._open_connection()\n+ # Server does not allow to run any other statement different from ALTER\n+ # when user's password has been expired.\n+ if not self._client_flags & ClientFlag.CAN_HANDLE_EXPIRED_PASSWORDS:\nself._post_connection()\ndef reconnect(self, attempts=1, delay=0):\n"
},
{
"change_type": "MODIFY",
"old_path": "modules/mysql-connector-python/mysql/connector/connection.py",
"new_path": "modules/mysql-connector-python/mysql/connector/connection.py",
"diff": "-# Copyright (c) 2009, 2018, Oracle and/or its affiliates. All rights reserved.\n+# Copyright (c) 2009, 2019, Oracle and/or its affiliates. All rights reserved.\n#\n# This program is free software; you can redistribute it and/or modify\n# it under the terms of the GNU General Public License, version 2.0, as\n@@ -51,7 +51,7 @@ from .cursor import (\nMySQLCursorBufferedNamedTuple)\nfrom .network import MySQLUnixSocket, MySQLTCPSocket\nfrom .protocol import MySQLProtocol\n-from .utils import int4store\n+from .utils import int4store, linux_distribution\nfrom .abstracts import MySQLConnectionAbstract\n@@ -123,7 +123,7 @@ class MySQLConnection(MySQLConnectionAbstract):\nif platform.system() == \"Darwin\":\nos_ver = \"{}-{}\".format(\"macOS\", platform.mac_ver()[0])\nelse:\n- os_ver = \"-\".join(platform.linux_distribution()[0:2]) # pylint: disable=W1505\n+ os_ver = \"-\".join(linux_distribution()[0:2])\nlicense_chunks = version.LICENSE.split(\" \")\nif license_chunks[0] == \"GPLv2\":\n"
},
{
"change_type": "MODIFY",
"old_path": "modules/mysql-connector-python/mysql/connector/utils.py",
"new_path": "modules/mysql-connector-python/mysql/connector/utils.py",
"diff": "-# Copyright (c) 2009, 2018, Oracle and/or its affiliates. All rights reserved.\n+# Copyright (c) 2009, 2019, Oracle and/or its affiliates. All rights reserved.\n#\n# This program is free software; you can redistribute it and/or modify\n# it under the terms of the GNU General Public License, version 2.0, as\n\"\"\"Utilities\n\"\"\"\n-from __future__ import print_function\n+import os\n+import subprocess\n+import struct\n+import sys\n-__MYSQL_DEBUG__ = False\n+from .catch23 import struct_unpack, PY2\n-import struct\n-from .catch23 import struct_unpack\n+__MYSQL_DEBUG__ = False\n+\ndef intread(buf):\n\"\"\"Unpacks the given buffer to an integer\"\"\"\n@@ -330,6 +333,7 @@ def _digest_buffer(buf):\nreturn ''.join([\"\\\\x%02x\" % c for c in buf])\nreturn ''.join([\"\\\\x%02x\" % ord(c) for c in buf])\n+\ndef print_buffer(abuffer, prefix=None, limit=30):\n\"\"\"Debug function printing output of _digest_buffer()\"\"\"\nif prefix:\n@@ -340,3 +344,100 @@ def print_buffer(abuffer, prefix=None, limit=30):\nprint(prefix + ': ' + digest)\nelse:\nprint(_digest_buffer(abuffer))\n+\n+\n+def _parse_os_release():\n+ \"\"\"Parse the contents of /etc/os-release file.\n+\n+ Returns:\n+ A dictionary containing release information.\n+ \"\"\"\n+ distro = {}\n+ os_release_file = os.path.join(\"/etc\", \"os-release\")\n+ if not os.path.exists(os_release_file):\n+ return distro\n+ with open(os_release_file) as file_obj:\n+ for line in file_obj:\n+ key_value = line.split(\"=\")\n+ if len(key_value) != 2:\n+ continue\n+ key = key_value[0].lower()\n+ value = key_value[1].rstrip(\"\\n\").strip('\"')\n+ distro[key] = value\n+ return distro\n+\n+\n+def _parse_lsb_release():\n+ \"\"\"Parse the contents of /etc/lsb-release file.\n+\n+ Returns:\n+ A dictionary containing release information.\n+ \"\"\"\n+ distro = {}\n+ lsb_release_file = os.path.join(\"/etc\", \"lsb-release\")\n+ if os.path.exists(lsb_release_file):\n+ with open(lsb_release_file) as file_obj:\n+ for line in file_obj:\n+ key_value = line.split(\"=\")\n+ if len(key_value) != 2:\n+ continue\n+ key = key_value[0].lower()\n+ value = key_value[1].rstrip(\"\\n\").strip('\"')\n+ distro[key] = value\n+ return distro\n+\n+\n+def _parse_lsb_release_command():\n+ \"\"\"Parse the output of the lsb_release command.\n+\n+ Returns:\n+ A dictionary containing release information.\n+ \"\"\"\n+ distro = {}\n+ with open(os.devnull, \"w\") as devnull:\n+ try:\n+ stdout = subprocess.check_output(\n+ (\"lsb_release\", \"-a\"), stderr=devnull)\n+ except OSError:\n+ return None\n+ lines = stdout.decode(sys.getfilesystemencoding()).splitlines()\n+ for line in lines:\n+ key_value = line.split(\":\")\n+ if len(key_value) != 2:\n+ continue\n+ key = key_value[0].replace(\" \", \"_\").lower()\n+ value = key_value[1].strip(\"\\t\")\n+ distro[key] = value.encode(\"utf-8\") if PY2 else value\n+ return distro\n+\n+\n+def linux_distribution():\n+ \"\"\"Tries to determine the name of the Linux OS distribution name.\n+\n+ First tries to get information from ``/etc/os-release`` file.\n+ If fails, tries to get the information of ``/etc/lsb-release`` file.\n+ And finally the information of ``lsb-release`` command.\n+\n+ Returns:\n+ A tuple with (`name`, `version`, `codename`)\n+ \"\"\"\n+ distro = _parse_lsb_release()\n+ if distro:\n+ return (distro.get(\"distrib_id\", \"\"),\n+ distro.get(\"distrib_release\", \"\"),\n+ distro.get(\"distrib_codename\", \"\"))\n+\n+ if not PY2:\n+ distro = _parse_lsb_release_command()\n+ if distro:\n+ return (distro.get(\"distributor_id\", \"\"),\n+ distro.get(\"release\", \"\"),\n+ distro.get(\"codename\", \"\"))\n+\n+ distro = _parse_os_release()\n+ if distro:\n+ return (distro.get(\"name\", \"\"),\n+ distro.get(\"version_id\", \"\"),\n+ distro.get(\"version_codename\", \"\"))\n+\n+ return (\"\", \"\", \"\")\n"
},
{
"change_type": "MODIFY",
"old_path": "modules/mysql-connector-python/mysql/connector/version.py",
"new_path": "modules/mysql-connector-python/mysql/connector/version.py",
"diff": "@@ -32,7 +32,7 @@ The file version.py gets installed and is available after installation\nas mysql.connector.version.\n\"\"\"\n-VERSION = (8, 0, 17, '', 1)\n+VERSION = (8, 0, 18, '', 1)\nif VERSION[3] and VERSION[4]:\nVERSION_TEXT = '{0}.{1}.{2}{3}{4}'.format(*VERSION)\n"
}
]
| Python | MIT License | castagnait/plugin.video.netflix | Updated mysql connector to v8.0.18 |
106,046 | 26.11.2019 14:24:08 | -3,600 | ab14813bbe5c0fa2cfa245e1dd3390e9ad0cf705 | kodi-addon-checker fixes | [
{
"change_type": "MODIFY",
"old_path": "addon.py",
"new_path": "addon.py",
"diff": "@@ -11,11 +11,6 @@ import sys\nfrom functools import wraps\nfrom xbmcgui import Window\n-try: # Python 3\n- import itertools.ifilter as filter # pylint: disable=redefined-builtin\n-except ImportError: # Python 2\n- pass\n-\n# Import and initialize globals right away to avoid stale values from the last\n# addon invocation. Otherwise Kodi's reuseLanguageInvoker will cause some\n# really quirky behavior!\n@@ -132,7 +127,7 @@ if __name__ == '__main__':\nif _check_valid_credentials():\ncheck_addon_upgrade()\ng.initial_addon_configuration()\n- route(list(filter(None, g.PATH.split('/'))))\n+ route([part for part in g.PATH.split('/') if part])\nexcept BackendNotReady:\nfrom resources.lib.kodi.ui import show_backend_not_ready\nshow_backend_not_ready()\n"
},
{
"change_type": "MODIFY",
"old_path": "addon.xml",
"new_path": "addon.xml",
"diff": "@@ -53,109 +53,6 @@ v0.15.11 (2019-11-20)\nv0.15.10 (2019-11-17)\n-Fixed error in exporting to Kodi library due to wrong settings name\n-Updated de_de, pt_br translations\n-\n-v0.15.9 (2019-11-16)\n--Removed limit to perform auto-update and auto-sync with my list only with main profile\n--Added possibility to choose the profile to perform auto-sync with my list\n--Auto-sync with my list now sync also the movies\n--Auto-update now can be performed in manual and scheduled mode\n--Purge library now ensures complete cleaning of the database and files\n--Added possibility to disable sort order of my list from addon settings\n--Updated user agents\n--Modified debug logging in order to save cpu load\n--Fixed pagination of episodes\n--Fixed unhandled error of membership user account status\n--When set to one profile the Kodi library is no longer modified by other profiles\n--A lot of fixes/improvements to compatibility between py2 and py3\n--Updated it, pl, pt_BR, hr_HR translations\n--Minor fixes\n-\n-v0.15.8 (2019-10-31)\n--Fixed addon open issue caused to a broken cookies\n--Updated de translations\n--Fixed an issue that cause UpNext sometimes to fail\n--Minor fixes\n-\n-v0.15.7 (2019-10-26)\n--Do not start auto-sync if disabled\n--Updated polish translation\n-\n-v0.15.6 (2019-10-24)\n--Added customizable color to titles already contained in mylist\n--Added menu to mylist menu to force update of the list\n--Added trailers video length\n--Added supplemental info to tvshow/movie plot (shown in green)\n--Added add/remove to my-list also in childrens profiles\n--Added owner/kids account profile infos to profiles menu items\n--Added notification when library auto-sync is completed (customizable)\n--Library auto-sync now take in account of changes made to mylist from other apps\n--Library auto-sync now can export automatically NFOs\n--Increased default cache ttl from 10m to 120m\n--Improved speed of add/remove operations to mylist\n--More intuitive settings menus\n--Updated addon screenshots\n--Fixed generate ESN on android\n--Fixed \"Perform full sync\" setting now work without close settings window\n--Fixed HTTPError 401 on add/remove to mylist\n--Fixed cache on sorted lists\n--Fixed library full sync when mylist have huge list\n--Fixed wrong cache identifier\n--Fixed videoid error when play a trailer\n--Fixed purge cache that didn't delete the files\n--Fixed mixed language of plot/titles when more profiles have different languages\n--Other fixes\n-\n-v0.15.5 (2019-10-12)\n--Speedup loading lists due to the new login validity check\n--Cookies expires are now used to check a valid login\n--Fixed an issue introduced with previous version causing login error\n--Fixed double handshake request on first run\n-\n-v0.15.4 (2019-10-11)\n--Added InputStream Helper settings in settings menu\n--Fixed add/remove to mylist on huge lists\n--Fixed expired mastertoken key issue\n--Fixed skipping sections due to netflix changes\n--Manifests now are requested only once\n--Updated pt-br, de, es translations\n--Minor improvements\n-\n-v0.15.3 (2019-09-19)\n--Initial conversion to python 3\n--Initial integration tests\n--Implemented device uuid to avoid always asking credentials\n--Fixed a problem when library source is special:// or a direct path\n--Fixed run library update on slow system like RPI\n--Updated dutch language\n--Minor fixes\n-\n-v0.15.2 (2019-08-30)\n--Fixed key handshake at addon first run\n--Fixed library update service at first run\n--Local database now dynamically created by code\n--Profile data is not deleted if an problem occurred\n--Minor fixes\n-\n-v0.15.1 (2019-08-25)\n--Fixed wrong path to linux systems\n-\n-v0.15.0 (2019-08-20)\n--Implemented data management through database\n--Implemented automatic export of new episodes\n--Implemented a version upgrade system\n--Implemented management of login errors\n--Added a new context menu \"Export new episodes\" for a single tv show\n--Added ability to exclude (and re-include) a tv show from library auto update\n--Added possibility to share the same library with multiple devices (MySQL server is required)\n--No more concurrency and data loss problems of previous \"persistent storage\"\n--Fixed continuous \"new access\" email notification from netflix\n--Fixed locale id error\n--Fixed automatic library updates\n--Fixed logout now the profiles are no longer accessible and you can enter your credentials\n--Fixed exporting tvshow.nfo for a single episode\n--Fixed UpNext watched status from Kodi library\n--Fixed issue with library items that containing % in the path\n--Other minor improvements and fixes\n</news>\n</extension>\n</addon>\n"
},
{
"change_type": "MODIFY",
"old_path": "changelog.txt",
"new_path": "changelog.txt",
"diff": "+v0.15.9 (2019-11-16)\n+-Removed limit to perform auto-update and auto-sync with my list only with main profile\n+-Added possibility to choose the profile to perform auto-sync with my list\n+-Auto-sync with my list now sync also the movies\n+-Auto-update now can be performed in manual and scheduled mode\n+-Purge library now ensures complete cleaning of the database and files\n+-Added possibility to disable sort order of my list from addon settings\n+-Updated user agents\n+-Modified debug logging in order to save cpu load\n+-Fixed pagination of episodes\n+-Fixed unhandled error of membership user account status\n+-When set to one profile the Kodi library is no longer modified by other profiles\n+-A lot of fixes/improvements to compatibility between py2 and py3\n+-Updated it, pl, pt_BR, hr_HR translations\n+-Minor fixes\n+\n+v0.15.8 (2019-10-31)\n+-Fixed addon open issue caused to a broken cookies\n+-Updated de translations\n+-Fixed an issue that cause UpNext sometimes to fail\n+-Minor fixes\n+\n+v0.15.7 (2019-10-26)\n+-Do not start auto-sync if disabled\n+-Updated polish translation\n+\n+v0.15.6 (2019-10-24)\n+-Added customizable color to titles already contained in mylist\n+-Added menu to mylist menu to force update of the list\n+-Added trailers video length\n+-Added supplemental info to tvshow/movie plot (shown in green)\n+-Added add/remove to my-list also in childrens profiles\n+-Added owner/kids account profile infos to profiles menu items\n+-Added notification when library auto-sync is completed (customizable)\n+-Library auto-sync now take in account of changes made to mylist from other apps\n+-Library auto-sync now can export automatically NFOs\n+-Increased default cache ttl from 10m to 120m\n+-Improved speed of add/remove operations to mylist\n+-More intuitive settings menus\n+-Updated addon screenshots\n+-Fixed generate ESN on android\n+-Fixed \"Perform full sync\" setting now work without close settings window\n+-Fixed HTTPError 401 on add/remove to mylist\n+-Fixed cache on sorted lists\n+-Fixed library full sync when mylist have huge list\n+-Fixed wrong cache identifier\n+-Fixed videoid error when play a trailer\n+-Fixed purge cache that didn't delete the files\n+-Fixed mixed language of plot/titles when more profiles have different languages\n+-Other fixes\n+\n+v0.15.5 (2019-10-12)\n+-Speedup loading lists due to the new login validity check\n+-Cookies expires are now used to check a valid login\n+-Fixed an issue introduced with previous version causing login error\n+-Fixed double handshake request on first run\n+\n+v0.15.4 (2019-10-11)\n+-Added InputStream Helper settings in settings menu\n+-Fixed add/remove to mylist on huge lists\n+-Fixed expired mastertoken key issue\n+-Fixed skipping sections due to netflix changes\n+-Manifests now are requested only once\n+-Updated pt-br, de, es translations\n+-Minor improvements\n+\n+v0.15.3 (2019-09-19)\n+-Initial conversion to python 3\n+-Initial integration tests\n+-Implemented device uuid to avoid always asking credentials\n+-Fixed a problem when library source is special:// or a direct path\n+-Fixed run library update on slow system like RPI\n+-Updated dutch language\n+-Minor fixes\n+\nv0.15.2 (2019-08-30)\n-Fixed key handshake at addon first run\n-Fixed library update service at first run\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/common/uuid_device.py",
"new_path": "resources/lib/common/uuid_device.py",
"diff": "@@ -140,9 +140,9 @@ def _get_macos_uuid():\nexcept Exception as exc:\ndebug('Failed to fetch OSX/IOS system profile {}'.format(exc))\nif sp_dict_values:\n- if 'UUID' in sp_dict_values.keys():\n+ if 'UUID' in list(sp_dict_values.keys()):\nreturn sp_dict_values['UUID']\n- if 'serialnumber' in sp_dict_values.keys():\n+ if 'serialnumber' in list(sp_dict_values.keys()):\nreturn sp_dict_values['serialnumber']\nreturn None\n@@ -159,12 +159,12 @@ def _parse_osx_xml_plist_data(data):\nitems_dict = xml_data[0]['_items'][0]\nr = re.compile(r'.*UUID.*') # Find to example \"platform_UUID\" key\n- uuid_keys = list(filter(r.match, items_dict.keys()))\n+ uuid_keys = list(filter(r.match, list(items_dict.keys())))\nif uuid_keys:\ndict_values['UUID'] = items_dict[uuid_keys[0]]\nif not uuid_keys:\nr = re.compile(r'.*serial.*number.*') # Find to example \"serial_number\" key\n- serialnumber_keys = list(filter(r.match, items_dict.keys()))\n+ serialnumber_keys = list(filter(r.match, list(items_dict.keys())))\nif serialnumber_keys:\ndict_values['serialnumber'] = items_dict[serialnumber_keys[0]]\nreturn dict_values\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/database/db_base_sqlite.py",
"new_path": "resources/lib/database/db_base_sqlite.py",
"diff": "@@ -123,7 +123,7 @@ class SQLiteDatabase(db_base.BaseDatabase):\ndef get_cursor_for_dict_results(self):\nconn_cursor = self.conn.cursor()\n- conn_cursor.row_factory = lambda c, r: dict(zip([col[0] for col in c.description], r))\n+ conn_cursor.row_factory = lambda c, r: dict(list(zip([col[0] for col in c.description], r)))\nreturn conn_cursor\ndef get_cursor_for_list_results(self):\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/nfsession/nfsession.py",
"new_path": "resources/lib/services/nfsession/nfsession.py",
"diff": "@@ -184,7 +184,7 @@ class NetflixSession(object):\nif not self.session.cookies:\nreturn False\nfor cookie_name in LOGIN_COOKIES:\n- if cookie_name not in self.session.cookies.keys():\n+ if cookie_name not in list(self.session.cookies.keys()):\ncommon.error(\n'The cookie \"{}\" do not exist. It is not possible to check expiration. '\n'Fallback to old validate method.',\n"
},
{
"change_type": "DELETE",
"old_path": "resources/media/fanart.xcf",
"new_path": "resources/media/fanart.xcf",
"diff": "Binary files a/resources/media/fanart.xcf and /dev/null differ\n"
},
{
"change_type": "DELETE",
"old_path": "resources/media/netflix_logo.xcf",
"new_path": "resources/media/netflix_logo.xcf",
"diff": "Binary files a/resources/media/netflix_logo.xcf and /dev/null differ\n"
}
]
| Python | MIT License | castagnait/plugin.video.netflix | kodi-addon-checker fixes |
106,046 | 26.11.2019 17:43:50 | -3,600 | 2ad11a84484f351b57d709e8e1b54834e26b7aed | Fixed complex entry point | [
{
"change_type": "MODIFY",
"old_path": "addon.py",
"new_path": "addon.py",
"diff": "# Module: default\n# Created on: 13.01.2017\n# License: MIT https://goo.gl/5bMj3H\n-# pylint: disable=wrong-import-position\n\"\"\"Kodi plugin for Netflix (https://netflix.com)\"\"\"\nfrom __future__ import absolute_import, division, unicode_literals\n-import sys\n-from functools import wraps\n-from xbmcgui import Window\n+from resources.lib.run_addon import run\n-# Import and initialize globals right away to avoid stale values from the last\n-# addon invocation. Otherwise Kodi's reuseLanguageInvoker will cause some\n-# really quirky behavior!\n-# PR: https://github.com/xbmc/xbmc/pull/13814\n-from resources.lib.globals import g\n-g.init_globals(sys.argv)\n-\n-from resources.lib.common import (info, debug, warn, error, check_credentials, BackendNotReady,\n- log_time_trace, reset_log_level_global_var)\n-from resources.lib.upgrade_controller import check_addon_upgrade\n-\n-\n-def lazy_login(func):\n- \"\"\"\n- Decorator to ensure that a valid login is present when calling a method\n- \"\"\"\n- # pylint: disable=protected-access, missing-docstring\n- @wraps(func)\n- def lazy_login_wrapper(*args, **kwargs):\n- from resources.lib.api.exceptions import (NotLoggedInError, MissingCredentialsError)\n- try:\n- return func(*args, **kwargs)\n- except NotLoggedInError:\n- debug('Tried to perform an action without being logged in')\n- try:\n- from resources.lib.api.shakti import login\n- if not login(ask_credentials=not check_credentials()):\n- _handle_endofdirectory()\n- return\n- debug('Now that we\\'re logged in, let\\'s try again')\n- return func(*args, **kwargs)\n- except MissingCredentialsError:\n- # Aborted from user or left an empty field\n- _handle_endofdirectory()\n- return lazy_login_wrapper\n-\n-\n-@lazy_login\n-def route(pathitems):\n- \"\"\"Route to the appropriate handler\"\"\"\n- debug('Routing navigation request')\n- root_handler = pathitems[0] if pathitems else g.MODE_DIRECTORY\n- if root_handler == g.MODE_PLAY:\n- from resources.lib.navigation.player import play\n- play(videoid=pathitems[1:])\n- return\n- if root_handler == 'extrafanart':\n- warn('Route: ignoring extrafanart invocation')\n- _handle_endofdirectory()\n- return\n- nav_handler = _get_nav_handler(root_handler)\n- if not nav_handler:\n- from resources.lib.navigation import InvalidPathError\n- raise InvalidPathError('No root handler for path {}'.format('/'.join(pathitems)))\n- from resources.lib.navigation import execute\n- execute(_get_nav_handler(root_handler), pathitems[1:], g.REQUEST_PARAMS)\n-\n-\n-def _get_nav_handler(root_handler):\n- if root_handler == g.MODE_DIRECTORY:\n- from resources.lib.navigation.directory import DirectoryBuilder\n- return DirectoryBuilder\n- if root_handler == g.MODE_ACTION:\n- from resources.lib.navigation.actions import AddonActionExecutor\n- return AddonActionExecutor\n- if root_handler == g.MODE_LIBRARY:\n- from resources.lib.navigation.library import LibraryActionExecutor\n- return LibraryActionExecutor\n- if root_handler == g.MODE_HUB:\n- from resources.lib.navigation.hub import HubBrowser\n- return HubBrowser\n- return None\n-\n-\n-def _check_valid_credentials():\n- \"\"\"Check that credentials are valid otherwise request user credentials\"\"\"\n- # This function check only if credentials exist, instead lazy_login\n- # only works in conjunction with nfsession and also performs other checks\n- if not check_credentials():\n- from resources.lib.api.exceptions import MissingCredentialsError\n- try:\n- from resources.lib.api.shakti import login\n- if not login():\n- # Wrong login try again\n- return _check_valid_credentials()\n- except MissingCredentialsError:\n- # Aborted from user or left an empty field\n- return False\n- return True\n-\n-\n-def _handle_endofdirectory(succeeded=False):\n- from xbmcplugin import endOfDirectory\n- endOfDirectory(handle=g.PLUGIN_HANDLE, succeeded=succeeded)\n-\n-\n-if __name__ == '__main__':\n- # pylint: disable=broad-except,ungrouped-imports\n- # Initialize variables in common module scope\n- # (necessary when reusing language invoker)\n- reset_log_level_global_var()\n- info('Started (Version {})'.format(g.VERSION))\n- info('URL is {}'.format(g.URL))\n- success = True\n-\n- window_cls = Window(10000)\n- if not bool(window_cls.getProperty('is_service_running')):\n- from resources.lib.kodi.ui import show_backend_not_ready\n- show_backend_not_ready()\n- success = False\n-\n- if success:\n- try:\n- if _check_valid_credentials():\n- check_addon_upgrade()\n- g.initial_addon_configuration()\n- route([part for part in g.PATH.split('/') if part])\n- except BackendNotReady:\n- from resources.lib.kodi.ui import show_backend_not_ready\n- show_backend_not_ready()\n- success = False\n- except Exception as exc:\n- import traceback\n- from resources.lib.kodi.ui import show_addon_error_info\n- error(traceback.format_exc())\n- show_addon_error_info(exc)\n- success = False\n-\n- if not success:\n- _handle_endofdirectory()\n-\n- g.CACHE.commit()\n- log_time_trace()\n+run()\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "resources/lib/run_addon.py",
"diff": "+# -*- coding: utf-8 -*-\n+# Author: asciidisco\n+# Module: default\n+# Created on: 13.01.2017\n+# License: MIT https://goo.gl/5bMj3H\n+# pylint: disable=wrong-import-position\n+\"\"\"Kodi plugin for Netflix (https://netflix.com)\"\"\"\n+from __future__ import absolute_import, division, unicode_literals\n+\n+import sys\n+from functools import wraps\n+from xbmcgui import Window\n+\n+# Import and initialize globals right away to avoid stale values from the last\n+# addon invocation. Otherwise Kodi's reuseLanguageInvoker will cause some\n+# really quirky behavior!\n+# PR: https://github.com/xbmc/xbmc/pull/13814\n+from resources.lib.globals import g\n+g.init_globals(sys.argv)\n+\n+from resources.lib.common import (info, debug, warn, error, check_credentials, BackendNotReady,\n+ log_time_trace, reset_log_level_global_var)\n+from resources.lib.upgrade_controller import check_addon_upgrade\n+\n+\n+def lazy_login(func):\n+ \"\"\"\n+ Decorator to ensure that a valid login is present when calling a method\n+ \"\"\"\n+ # pylint: missing-docstring\n+ @wraps(func)\n+ def lazy_login_wrapper(*args, **kwargs):\n+ from resources.lib.api.exceptions import (NotLoggedInError, MissingCredentialsError)\n+ try:\n+ return func(*args, **kwargs)\n+ except NotLoggedInError:\n+ debug('Tried to perform an action without being logged in')\n+ try:\n+ from resources.lib.api.shakti import login\n+ if not login(ask_credentials=not check_credentials()):\n+ _handle_endofdirectory()\n+ raise MissingCredentialsError\n+ debug('Now that we\\'re logged in, let\\'s try again')\n+ return func(*args, **kwargs)\n+ except MissingCredentialsError:\n+ # Aborted from user or left an empty field\n+ _handle_endofdirectory()\n+ raise\n+ return lazy_login_wrapper\n+\n+\n+@lazy_login\n+def route(pathitems):\n+ \"\"\"Route to the appropriate handler\"\"\"\n+ debug('Routing navigation request')\n+ root_handler = pathitems[0] if pathitems else g.MODE_DIRECTORY\n+ if root_handler == g.MODE_PLAY:\n+ from resources.lib.navigation.player import play\n+ play(videoid=pathitems[1:])\n+ return\n+ if root_handler == 'extrafanart':\n+ warn('Route: ignoring extrafanart invocation')\n+ _handle_endofdirectory()\n+ return\n+ nav_handler = _get_nav_handler(root_handler)\n+ if not nav_handler:\n+ from resources.lib.navigation import InvalidPathError\n+ raise InvalidPathError('No root handler for path {}'.format('/'.join(pathitems)))\n+ from resources.lib.navigation import execute\n+ execute(_get_nav_handler(root_handler), pathitems[1:], g.REQUEST_PARAMS)\n+\n+\n+def _get_nav_handler(root_handler):\n+ if root_handler == g.MODE_DIRECTORY:\n+ from resources.lib.navigation.directory import DirectoryBuilder\n+ return DirectoryBuilder\n+ if root_handler == g.MODE_ACTION:\n+ from resources.lib.navigation.actions import AddonActionExecutor\n+ return AddonActionExecutor\n+ if root_handler == g.MODE_LIBRARY:\n+ from resources.lib.navigation.library import LibraryActionExecutor\n+ return LibraryActionExecutor\n+ if root_handler == g.MODE_HUB:\n+ from resources.lib.navigation.hub import HubBrowser\n+ return HubBrowser\n+ return None\n+\n+\n+def _check_valid_credentials():\n+ \"\"\"Check that credentials are valid otherwise request user credentials\"\"\"\n+ # This function check only if credentials exist, instead lazy_login\n+ # only works in conjunction with nfsession and also performs other checks\n+ if not check_credentials():\n+ from resources.lib.api.exceptions import MissingCredentialsError\n+ try:\n+ from resources.lib.api.shakti import login\n+ if not login():\n+ # Wrong login try again\n+ return _check_valid_credentials()\n+ except MissingCredentialsError:\n+ # Aborted from user or left an empty field\n+ return False\n+ return True\n+\n+\n+def _handle_endofdirectory(succeeded=False):\n+ from xbmcplugin import endOfDirectory\n+ endOfDirectory(handle=g.PLUGIN_HANDLE, succeeded=succeeded)\n+\n+\n+def run():\n+ # pylint: disable=broad-except,ungrouped-imports\n+ # Initialize variables in common module scope\n+ # (necessary when reusing language invoker)\n+ reset_log_level_global_var()\n+ info('Started (Version {})'.format(g.VERSION))\n+ info('URL is {}'.format(g.URL))\n+ success = True\n+\n+ window_cls = Window(10000)\n+ if not bool(window_cls.getProperty('is_service_running')):\n+ from resources.lib.kodi.ui import show_backend_not_ready\n+ show_backend_not_ready()\n+ success = False\n+\n+ if success:\n+ try:\n+ if _check_valid_credentials():\n+ check_addon_upgrade()\n+ g.initial_addon_configuration()\n+ route([part for part in g.PATH.split('/') if part])\n+ except BackendNotReady:\n+ from resources.lib.kodi.ui import show_backend_not_ready\n+ show_backend_not_ready()\n+ success = False\n+ except Exception as exc:\n+ import traceback\n+ from resources.lib.kodi.ui import show_addon_error_info\n+ error(traceback.format_exc())\n+ show_addon_error_info(exc)\n+ success = False\n+\n+ if not success:\n+ _handle_endofdirectory()\n+\n+ g.CACHE.commit()\n+ log_time_trace()\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "resources/lib/run_service.py",
"diff": "+# -*- coding: utf-8 -*-\n+# Author: asciidisco\n+# Module: service\n+# Created on: 13.01.2017\n+# License: MIT https://goo.gl/5bMj3H\n+# pylint: disable=wrong-import-position\n+\"\"\"Kodi plugin for Netflix (https://netflix.com)\"\"\"\n+from __future__ import absolute_import, division, unicode_literals\n+\n+import sys\n+import threading\n+\n+# Import and initialize globals right away to avoid stale values from the last\n+# addon invocation. Otherwise Kodi's reuseLanguageInvoker option will cause\n+# some really quirky behavior!\n+from resources.lib.globals import g\n+g.init_globals(sys.argv)\n+\n+# Global cache must not be used within these modules, because stale values may\n+# be used and cause inconsistencies!\n+import resources.lib.services as services\n+from resources.lib.upgrade_controller import check_service_upgrade\n+from resources.lib.common import (info, error, select_port, get_local_string)\n+\n+\n+try: # Python 2\n+ unicode\n+except NameError: # Python 3\n+ unicode = str # pylint: disable=redefined-builtin\n+\n+\n+class NetflixService(object):\n+ \"\"\"\n+ Netflix addon service\n+ \"\"\"\n+ SERVERS = [\n+ {\n+ 'name': 'MSL',\n+ 'class': services.MSLTCPServer,\n+ 'instance': None,\n+ 'thread': None},\n+ {\n+ 'name': 'NS',\n+ 'class': services.NetflixTCPServer,\n+ 'instance': None,\n+ 'thread': None},\n+ ]\n+\n+ def __init__(self):\n+ for server in self.SERVERS:\n+ self.init_server(server)\n+ self.controller = None\n+ self.library_updater = None\n+ self.settings_monitor = None\n+\n+ def init_server(self, server):\n+ server['class'].allow_reuse_address = True\n+ server['instance'] = server['class'](\n+ ('127.0.0.1', select_port(server['name'])))\n+ server['thread'] = threading.Thread(\n+ target=server['instance'].serve_forever)\n+\n+ def start_services(self):\n+ \"\"\"\n+ Start the background services\n+ \"\"\"\n+ for server in self.SERVERS:\n+ server['instance'].server_activate()\n+ server['instance'].timeout = 1\n+ server['thread'].start()\n+ info('[{}] Thread started'.format(server['name']))\n+ self.controller = services.PlaybackController()\n+ self.library_updater = services.LibraryUpdateService()\n+ self.settings_monitor = services.SettingsMonitor()\n+ # Mark the service as active\n+ from xbmcgui import Window\n+ window_cls = Window(10000)\n+ window_cls.setProperty('is_service_running', 'true')\n+ if not g.ADDON.getSettingBool('disable_startup_notification'):\n+ from resources.lib.kodi.ui import show_notification\n+ show_notification(get_local_string(30110))\n+\n+ def shutdown(self):\n+ \"\"\"\n+ Stop the background services\n+ \"\"\"\n+ for server in self.SERVERS:\n+ server['instance'].server_close()\n+ server['instance'].shutdown()\n+ server['instance'] = None\n+ server['thread'].join()\n+ server['thread'] = None\n+ info('Stopped MSL Service')\n+\n+ def run(self):\n+ \"\"\"Main loop. Runs until xbmc.Monitor requests abort\"\"\"\n+ # pylint: disable=broad-except\n+ try:\n+ self.start_services()\n+ except Exception as exc:\n+ import traceback\n+ from resources.lib.kodi.ui import show_addon_error_info\n+ error(traceback.format_exc())\n+ show_addon_error_info(exc)\n+ return\n+\n+ while not self.controller.abortRequested():\n+ if self._tick_and_wait_for_abort():\n+ break\n+ self.shutdown()\n+\n+ def _tick_and_wait_for_abort(self):\n+ try:\n+ self.controller.on_playback_tick()\n+ self.library_updater.on_tick()\n+ except Exception as exc: # pylint: disable=broad-except\n+ import traceback\n+ from resources.lib.kodi.ui import show_notification\n+ error(traceback.format_exc())\n+ show_notification(': '.join((exc.__class__.__name__, unicode(exc))))\n+ return self.controller.waitForAbort(1)\n+\n+\n+def run():\n+ check_service_upgrade()\n+ NetflixService().run()\n"
},
{
"change_type": "MODIFY",
"old_path": "service.py",
"new_path": "service.py",
"diff": "# Module: service\n# Created on: 13.01.2017\n# License: MIT https://goo.gl/5bMj3H\n-# pylint: disable=wrong-import-position\n\"\"\"Kodi plugin for Netflix (https://netflix.com)\"\"\"\nfrom __future__ import absolute_import, division, unicode_literals\n-import sys\n-import threading\n+from resources.lib.run_service import run\n-# Import and initialize globals right away to avoid stale values from the last\n-# addon invocation. Otherwise Kodi's reuseLanguageInvoker option will cause\n-# some really quirky behavior!\n-from resources.lib.globals import g\n-g.init_globals(sys.argv)\n-\n-# Global cache must not be used within these modules, because stale values may\n-# be used and cause inconsistencies!\n-import resources.lib.services as services\n-from resources.lib.upgrade_controller import check_service_upgrade\n-from resources.lib.common import (info, error, select_port, get_local_string)\n-\n-\n-try: # Python 2\n- unicode\n-except NameError: # Python 3\n- unicode = str # pylint: disable=redefined-builtin\n-\n-\n-class NetflixService(object):\n- \"\"\"\n- Netflix addon service\n- \"\"\"\n- SERVERS = [\n- {\n- 'name': 'MSL',\n- 'class': services.MSLTCPServer,\n- 'instance': None,\n- 'thread': None},\n- {\n- 'name': 'NS',\n- 'class': services.NetflixTCPServer,\n- 'instance': None,\n- 'thread': None},\n- ]\n-\n- def __init__(self):\n- for server in self.SERVERS:\n- self.init_server(server)\n- self.controller = None\n- self.library_updater = None\n- self.settings_monitor = None\n-\n- def init_server(self, server):\n- server['class'].allow_reuse_address = True\n- server['instance'] = server['class'](\n- ('127.0.0.1', select_port(server['name'])))\n- server['thread'] = threading.Thread(\n- target=server['instance'].serve_forever)\n-\n- def start_services(self):\n- \"\"\"\n- Start the background services\n- \"\"\"\n- for server in self.SERVERS:\n- server['instance'].server_activate()\n- server['instance'].timeout = 1\n- server['thread'].start()\n- info('[{}] Thread started'.format(server['name']))\n- self.controller = services.PlaybackController()\n- self.library_updater = services.LibraryUpdateService()\n- self.settings_monitor = services.SettingsMonitor()\n- # Mark the service as active\n- from xbmcgui import Window\n- window_cls = Window(10000)\n- window_cls.setProperty('is_service_running', 'true')\n- if not g.ADDON.getSettingBool('disable_startup_notification'):\n- from resources.lib.kodi.ui import show_notification\n- show_notification(get_local_string(30110))\n-\n- def shutdown(self):\n- \"\"\"\n- Stop the background services\n- \"\"\"\n- for server in self.SERVERS:\n- server['instance'].server_close()\n- server['instance'].shutdown()\n- server['instance'] = None\n- server['thread'].join()\n- server['thread'] = None\n- info('Stopped MSL Service')\n-\n- def run(self):\n- \"\"\"Main loop. Runs until xbmc.Monitor requests abort\"\"\"\n- # pylint: disable=broad-except\n- try:\n- self.start_services()\n- except Exception as exc:\n- import traceback\n- from resources.lib.kodi.ui import show_addon_error_info\n- error(traceback.format_exc())\n- show_addon_error_info(exc)\n- return\n-\n- while not self.controller.abortRequested():\n- if self._tick_and_wait_for_abort():\n- break\n- self.shutdown()\n-\n- def _tick_and_wait_for_abort(self):\n- try:\n- self.controller.on_playback_tick()\n- self.library_updater.on_tick()\n- except Exception as exc: # pylint: disable=broad-except\n- import traceback\n- from resources.lib.kodi.ui import show_notification\n- error(traceback.format_exc())\n- show_notification(': '.join((exc.__class__.__name__, unicode(exc))))\n- return self.controller.waitForAbort(1)\n-\n-\n-if __name__ == '__main__':\n- check_service_upgrade()\n- NetflixService().run()\n+run()\n"
},
{
"change_type": "MODIFY",
"old_path": "test/run.py",
"new_path": "test/run.py",
"diff": "@@ -24,12 +24,12 @@ uri = 'plugin://plugin.video.netflix/{path}'.format(path=path)\nsys.argv = [uri, '0', '']\n-import addon # pylint: disable=wrong-import-position\n-addon.g.init_globals(sys.argv)\n-addon.info('Started (Version {})'.format(addon.g.VERSION))\n-addon.info('URL is {}'.format(addon.g.URL))\n-if addon._check_valid_credentials(): # pylint: disable=protected-access\n- addon.check_addon_upgrade()\n- addon.g.initial_addon_configuration()\n- addon.route(path.split('/'))\n-addon.g.CACHE.commit()\n+from resources.lib import run_addon # pylint: disable=wrong-import-position\n+run_addon.g.init_globals(sys.argv)\n+run_addon.info('Started (Version {})'.format(run_addon.g.VERSION))\n+run_addon.info('URL is {}'.format(run_addon.g.URL))\n+if run_addon._check_valid_credentials(): # pylint: disable=protected-access\n+ run_addon.check_addon_upgrade()\n+ run_addon.g.initial_addon_configuration()\n+ run_addon.route(path.split('/'))\n+run_addon.g.CACHE.commit()\n"
}
]
| Python | MIT License | castagnait/plugin.video.netflix | Fixed complex entry point |
106,046 | 27.11.2019 08:22:47 | -3,600 | eb9aa78ee2df70af2ded035608cfab4b2174b37f | Load maturity levels dynamically from webpage
levels change by country and region, so it is not possible to make a
static list. To solve this, i perform a complete parse of the data from
the web page | [
{
"change_type": "MODIFY",
"old_path": "resources/language/resource.language.en_gb/strings.po",
"new_path": "resources/language/resource.language.en_gb/strings.po",
"diff": "@@ -957,29 +957,9 @@ msgid \"Restrict by Maturity Level\"\nmsgstr \"\"\nmsgctxt \"#30233\"\n-msgid \"Little Kids [T]\"\n-msgstr \"\"\n-\n-msgctxt \"#30234\"\n-msgid \"Older Kids\"\n-msgstr \"\"\n-\n-msgctxt \"#30235\"\n-msgid \"Teens [VM14]\"\n-msgstr \"\"\n-\n-msgctxt \"#30236\"\n-msgid \"Adults [VM18]\"\n-msgstr \"\"\n-\n-msgctxt \"#30237\"\nmsgid \"Content for {} will require the PIN to start playback.\"\nmsgstr \"\"\n-msgctxt \"#30238\"\n-msgid \"\"\n-msgstr \"\"\n-\n-msgctxt \"#30239\" # This is a temporary transition option\n+msgctxt \"#30234\"\nmsgid \"Keep watched status marks separate for each profile (this option will be removed in future versions)\"\nmsgstr \"\"\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/language/resource.language.hr_hr/strings.po",
"new_path": "resources/language/resource.language.hr_hr/strings.po",
"diff": "@@ -968,23 +968,3 @@ msgstr \"\"\nmsgctxt \"#30232\"\nmsgid \"Restrict by Maturity Level\"\nmsgstr \"\"\n-\n-msgctxt \"#30233\"\n-msgid \"Little Kids [T]\"\n-msgstr \"\"\n-\n-msgctxt \"#30234\"\n-msgid \"Older Kids\"\n-msgstr \"\"\n-\n-msgctxt \"#30235\"\n-msgid \"Teens [VM14]\"\n-msgstr \"\"\n-\n-msgctxt \"#30236\"\n-msgid \"Adults [VM18]\"\n-msgstr \"\"\n-\n-msgctxt \"#30237\"\n-msgid \"Content for {} will require the PIN to start playback.\"\n-msgstr \"\"\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/language/resource.language.nl_nl/strings.po",
"new_path": "resources/language/resource.language.nl_nl/strings.po",
"diff": "@@ -955,23 +955,3 @@ msgstr \"Wil je nu controleren voor een update?\"\nmsgctxt \"#30232\"\nmsgid \"Restrict by Maturity Level\"\nmsgstr \"\"\n-\n-msgctxt \"#30233\"\n-msgid \"Little Kids [T]\"\n-msgstr \"\"\n-\n-msgctxt \"#30234\"\n-msgid \"Older Kids\"\n-msgstr \"\"\n-\n-msgctxt \"#30235\"\n-msgid \"Teens [VM14]\"\n-msgstr \"\"\n-\n-msgctxt \"#30236\"\n-msgid \"Adults [VM18]\"\n-msgstr \"\"\n-\n-msgctxt \"#30237\"\n-msgid \"Content for {} will require the PIN to start playback.\"\n-msgstr \"\"\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/kodi/ui/xmldialogs.py",
"new_path": "resources/lib/kodi/ui/xmldialogs.py",
"diff": "@@ -17,6 +17,13 @@ ACTION_PLAYER_STOP = 13\nACTION_NAV_BACK = 92\nACTION_NOOP = 999\n+XBFONT_LEFT = 0x00000000\n+XBFONT_RIGHT = 0x00000001\n+XBFONT_CENTER_X = 0x00000002\n+XBFONT_CENTER_Y = 0x00000004\n+XBFONT_TRUNCATED = 0x00000008\n+XBFONT_JUSTIFY = 0x00000010\n+\nOS_MACHINE = machine()\nCMD_CLOSE_DIALOG_BY_NOOP = 'AlarmClock(closedialog,Action(noop),{},silent)'\n@@ -73,33 +80,22 @@ class Skip(xbmcgui.WindowXMLDialog):\nself.close()\n+# pylint: disable=no-member\nclass ParentalControl(xbmcgui.WindowXMLDialog):\n\"\"\"\nDialog for parental control settings\n\"\"\"\ndef __init__(self, *args, **kwargs):\n- # Convert slider value to Netflix maturity levels\n- self.nf_maturity_levels = {\n- 0: 0,\n- 1: 41,\n- 2: 80,\n- 3: 100,\n- 4: 9999\n- }\nself.current_pin = kwargs.get('pin')\n- self.current_maturity_level = kwargs.get('maturity_level', 4)\n- self.maturity_level_desc = {\n- 0: g.ADDON.getLocalizedString(30232),\n- 1: g.ADDON.getLocalizedString(30233),\n- 2: g.ADDON.getLocalizedString(30234),\n- 3: g.ADDON.getLocalizedString(30235),\n- 4: g.ADDON.getLocalizedString(30236)\n- }\n+ self.maturity_levels = kwargs['maturity_levels']\n+ self.maturity_names = kwargs['maturity_names']\n+ self.current_level = kwargs['current_level']\n+ self.levels_count = len(self.maturity_levels)\nself.maturity_level_edge = {\n0: g.ADDON.getLocalizedString(30108),\n- 4: g.ADDON.getLocalizedString(30107)\n+ self.levels_count - 1: g.ADDON.getLocalizedString(30107)\n}\n- self.status_base_desc = g.ADDON.getLocalizedString(30237)\n+ self.status_base_desc = g.ADDON.getLocalizedString(30233)\nself.action_exitkeys_id = [ACTION_PREVIOUS_MENU,\nACTION_PLAYER_STOP,\nACTION_NAV_BACK]\n@@ -109,26 +105,27 @@ class ParentalControl(xbmcgui.WindowXMLDialog):\nxbmcgui.WindowXMLDialog.__init__(self, *args, **kwargs)\ndef onInit(self):\n+ self._generate_levels_labels()\n# Set maturity level status description\n- self._update_status_desc(self.current_maturity_level)\n+ self._update_status_desc(self.current_level)\n# PIN input\n- edit_control = self.getControl(2)\n+ edit_control = self.getControl(10002)\nedit_control.setType(xbmcgui.INPUT_TYPE_NUMBER, g.ADDON.getLocalizedString(30002))\nedit_control.setText(self.current_pin)\n# Maturity level slider\n- slider_control = self.getControl(4)\n+ slider_control = self.getControl(10004)\n# setInt(value, min, delta, max)\n- slider_control.setInt(self.current_maturity_level, 0, 1, 4)\n+ slider_control.setInt(self.current_level, 0, 1, self.levels_count - 1)\ndef onClick(self, controlID):\n- if controlID == 28: # Save and close dialog\n- pin = self.getControl(2).getText()\n+ if controlID == 10028: # Save and close dialog\n+ pin = self.getControl(10002).getText()\n# Validate pin length\nif not self._validate_pin(pin):\nreturn\nimport resources.lib.api.shakti as api\ndata = {'pin': pin,\n- 'maturity_level': self.nf_maturity_levels[self.current_maturity_level]}\n+ 'maturity_level': self.maturity_levels[self.current_level]['value']}\n# Send changes to the service\nif not api.set_parental_control_data(data).get('success', False):\n# Only in case of service problem\n@@ -139,7 +136,7 @@ class ParentalControl(xbmcgui.WindowXMLDialog):\nfrom resources.lib.cache import CACHE_METADATA\ng.CACHE.invalidate(True, [CACHE_METADATA])\nself.close()\n- if controlID in [29, 100]: # Close dialog\n+ if controlID in [10029, 100]: # Close dialog\nself.close()\ndef onAction(self, action):\n@@ -147,24 +144,26 @@ class ParentalControl(xbmcgui.WindowXMLDialog):\nself.close()\nreturn\n# Bad thing to check for changes in this way, but i have not found any other ways\n- slider_value = self.getControl(4).getInt()\n- if slider_value != self.current_maturity_level:\n+ slider_value = self.getControl(10004).getInt()\n+ if slider_value != self.current_level:\nself._update_status_desc(slider_value)\ndef _update_status_desc(self, maturity_level):\n- self.current_maturity_level = \\\n- maturity_level if maturity_level else self.getControl(4).getInt()\n- if self.current_maturity_level in self.maturity_level_edge:\n- status_desc = self.maturity_level_edge[self.current_maturity_level]\n+ self.current_level = \\\n+ maturity_level if maturity_level else self.getControl(10004).getInt()\n+ if self.current_level == 0 or self.current_level == self.levels_count - 1:\n+ status_desc = self.maturity_level_edge[self.current_level]\nelse:\n- ml_included = [self.maturity_level_desc[n] for n in\n- range(self.current_maturity_level + 1, 5)]\n+ ml_included = [self.maturity_names[n]['name'] for n in\n+ range(self.current_level, self.levels_count - 1)]\nstatus_desc = self.status_base_desc.format(', '.join(ml_included))\n- for ml in range(1, 5):\n- ml_label = '[COLOR red]{}[/COLOR]'.format(self.maturity_level_desc[ml]) \\\n- if ml in range(self.current_maturity_level + 1, 5) else self.maturity_level_desc[ml]\n- self.getControl(200 + ml).setLabel(ml_label)\n- self.getControl(9).setLabel(status_desc)\n+ self.getControl(10009).setLabel(status_desc)\n+ # Update labels color\n+ for ml in range(0, self.levels_count - 1):\n+ maturity_name = self.maturity_names[ml]['name'] + self.maturity_names[ml]['rating']\n+ ml_label = '[COLOR red]{}[/COLOR]'.format(maturity_name) \\\n+ if ml in range(self.current_level, self.levels_count - 1) else maturity_name\n+ self.controls[ml].setLabel(ml_label)\ndef _validate_pin(self, pin_value):\nif len(pin_value or '') != 4:\n@@ -172,6 +171,24 @@ class ParentalControl(xbmcgui.WindowXMLDialog):\nreturn False\nreturn True\n+ def _generate_levels_labels(self):\n+ \"\"\"Generate descriptions for the levels dynamically\"\"\"\n+ # Limit to 1050 px max (to slider end)\n+ width = int(1050 / (self.levels_count - 1))\n+ height = 100\n+ pos_x = 275\n+ pos_y = 668\n+ self.controls = {}\n+ for lev_n in range(0, self.levels_count - 1):\n+ current_x = pos_x + (width * lev_n)\n+ maturity_name = self.maturity_names[lev_n]['name'] + \\\n+ self.maturity_names[lev_n]['rating']\n+ lbl = xbmcgui.ControlLabel(current_x, pos_y, width, height, maturity_name,\n+ font='font12',\n+ alignment=XBFONT_CENTER_X)\n+ self.controls.update({lev_n: lbl})\n+ self.addControl(lbl)\n+\n# pylint: disable=no-member\nclass RatingThumb(xbmcgui.WindowXMLDialog):\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/navigation/actions.py",
"new_path": "resources/lib/navigation/actions.py",
"diff": "@@ -46,8 +46,7 @@ class AddonActionExecutor(object):\nui.show_modal_dialog(ui.xmldialogs.ParentalControl,\n'plugin-video-netflix-ParentalControl.xml',\ng.ADDON.getAddonInfo('path'),\n- pin=parental_control_data['pin'],\n- maturity_level=parental_control_data['maturity_level'])\n+ **parental_control_data)\nexcept MissingCredentialsError:\nui.show_ok_dialog('Netflix', common.get_local_string(30009))\nexcept WebsiteParsingError as exc:\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/nfsession/nfsession.py",
"new_path": "resources/lib/services/nfsession/nfsession.py",
"diff": "@@ -332,16 +332,45 @@ class NetflixSession(object):\n# Unauthorized for url ...\nraise MissingCredentialsError\nraise\n- # Parse web page to get the current maturity level\n- # I have not found how to get it through the API\n+ # Warning - parental control levels vary by country or region, no fixed values can be used\n+ # I have not found how to get it through the API, so parse web page to get all info\n+ # Note: The language of descriptions change in base of the language of selected profile\npin_response = self._get('pin', data={'password': password})\n- # so counts the number of occurrences of the \"maturity-input-item included\" class\nfrom re import findall\n- num_items = len(findall(r'<div class=\"maturity-input-item.*?included.*?<\\/div>',\n- pin_response.decode('utf-8')))\n- if not num_items:\n- raise WebsiteParsingError('Unable to find maturity level div tag')\n- return {'pin': pin, 'maturity_level': num_items - 1}\n+ html_ml_points = findall(r'<div class=\"maturity-input-item\\s.*?<\\/div>',\n+ pin_response.decode('utf-8'))\n+ maturity_levels = []\n+ maturity_names = []\n+ current_level = -1\n+ for ml_point in html_ml_points:\n+ is_included = bool(findall(r'class=\"maturity-input-item[^\"<>]*?included', ml_point))\n+ value = findall(r'value=\"(\\d+)\"', ml_point)\n+ name = findall(r'<span class=\"maturity-name\">([^\"]+?)<\\/span>', ml_point)\n+ rating = findall(r'<li[^<>]+class=\"pin-rating-item\">([^\"]+?)<\\/li>', ml_point)\n+ if not value:\n+ raise WebsiteParsingError('Unable to find maturity level value: {}'.format(ml_point))\n+ if name:\n+ maturity_names.append({\n+ 'name': name[0],\n+ 'rating': '[CR][' + rating[0] + ']' if rating else ''\n+ })\n+ maturity_levels.append({\n+ 'level': len(maturity_levels),\n+ 'value': value[0],\n+ 'is_included': is_included\n+ })\n+ if is_included:\n+ current_level += 1\n+ if not html_ml_points:\n+ raise WebsiteParsingError('Unable to find html maturity level points')\n+ if not maturity_levels:\n+ raise WebsiteParsingError('Unable to find maturity levels')\n+ if not maturity_names:\n+ raise WebsiteParsingError('Unable to find maturity names')\n+ common.debug('Parsed maturity levels: {}', maturity_levels)\n+ common.debug('Parsed maturity names: {}', maturity_names)\n+ return {'pin': pin, 'maturity_levels': maturity_levels, 'maturity_names': maturity_names,\n+ 'current_level': current_level}\n@common.addonsignals_return_call\n@common.time_execution(immediate=True)\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/settings.xml",
"new_path": "resources/settings.xml",
"diff": "<setting id=\"enable_timing\" type=\"bool\" label=\"30134\" default=\"false\"/>\n<setting id=\"disable_modal_error_display\" type=\"bool\" label=\"30130\" default=\"false\"/>\n<setting id=\"ssl_verification\" type=\"bool\" label=\"30024\" default=\"true\"/>\n- <setting id=\"watched_status_by_profile\" type=\"bool\" label=\"30239\" default=\"true\"/> <!-- This is a temporary transition option -->\n+ <setting id=\"watched_status_by_profile\" type=\"bool\" label=\"30234\" default=\"true\"/> <!-- This is a temporary transition option -->\n<setting label=\"30117\" type=\"lsep\"/><!--Cache-->\n<setting id=\"cache_ttl\" type=\"slider\" option=\"int\" range=\"0,10,525600\" label=\"30084\" default=\"120\"/>\n<setting id=\"cache_metadata_ttl\" type=\"slider\" option=\"int\" range=\"0,1,365\" label=\"30085\" default=\"30\"/>\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/skins/default/1080i/plugin-video-netflix-ParentalControl.xml",
"new_path": "resources/skins/default/1080i/plugin-video-netflix-ParentalControl.xml",
"diff": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<window>\n- <defaultcontrol>2</defaultcontrol>\n+ <defaultcontrol>10002</defaultcontrol>\n<controls>\n<control type=\"group\">\n<!-- Note: some tags to the controls have been set even if not necessary to ensure compatibility with the custom skins of kodi -->\n<top>250</top>\n- <centerleft>50%</centerleft>\n+ <left>200</left>\n<width>1520</width>\n<!-- Screen background -->\n<control type=\"image\">\n</control>\n<!-- Controls -->\n- <control type=\"group\" id=\"80\">\n+ <control type=\"group\" id=\"10080\">\n<left>0</left>\n<top>0</top>\n<width>1200</width>\n<height>500</height>\n<defaultcontrol>2</defaultcontrol>\n<visible>true</visible>\n- <onright>90</onright>\n+ <onright>10090</onright>\n- <control type=\"label\" id=\"1\">\n+ <control type=\"label\" id=\"10001\">\n<description>PIN description</description>\n<posy>135</posy>\n<posx>65</posx>\n<wrapmultiline>false</wrapmultiline>\n</control>\n- <control type=\"edit\" id=\"2\">\n+ <control type=\"edit\" id=\"10002\">\n<description>4 PIN digits</description>\n<left>45</left>\n<top>180</top>\n<texturefocus border=\"40\" colordiffuse=\"red\">buttons/dialogbutton-fo.png</texturefocus>\n<texturenofocus border=\"40\">buttons/dialogbutton-nofo.png</texturenofocus>\n<pulseonselect>no</pulseonselect>\n- <onup>90</onup>\n- <ondown>4</ondown>\n+ <onup>10090</onup>\n+ <ondown>10004</ondown>\n</control>\n- <control type=\"label\" id=\"3\">\n+ <control type=\"label\" id=\"10003\">\n<description>Maturity Level description</description>\n<posy>296</posy>\n<posx>65</posx>\n<font>font14</font>\n<wrapmultiline>false</wrapmultiline>\n</control>\n- <control type=\"slider\" id=\"4\">\n+ <control type=\"slider\" id=\"10004\">\n<description>Maturity Level</description>\n<left>75</left>\n<top>360</top>\n<textureslidernib>buttons/slider-nib.png</textureslidernib>\n<textureslidernibfocus colordiffuse=\"red\">buttons/slider-nib.png</textureslidernibfocus>\n<orientation>horizontal</orientation>\n- <onup>2</onup>\n- <ondown>90</ondown>\n+ <onup>10002</onup>\n+ <ondown>10090</ondown>\n</control>\n- <control type=\"label\" id=\"201\">\n- <description>ML Little Kids</description>\n- <posy>418</posy>\n- <posx>75</posx>\n- <top>418</top>\n- <left>75</left>\n- <width>262</width>\n- <visible>true</visible>\n- <scroll>true</scroll>\n- <label>$ADDON[plugin.video.netflix 30233]</label>\n- <haspath>false</haspath>\n- <font>font12</font>\n- <wrapmultiline>true</wrapmultiline>\n- <align>center</align>\n- </control>\n- <control type=\"label\" id=\"202\">\n- <description>ML Older Kids</description>\n- <posy>418</posy>\n- <posx>337</posx>\n- <top>418</top>\n- <left>337</left>\n- <width>262</width>\n- <visible>true</visible>\n- <scroll>true</scroll>\n- <label>$ADDON[plugin.video.netflix 30234]</label>\n- <haspath>false</haspath>\n- <font>font12</font>\n- <wrapmultiline>true</wrapmultiline>\n- <align>center</align>\n- </control>\n- <control type=\"label\" id=\"203\">\n- <description>ML Teens</description>\n- <posy>418</posy>\n- <posx>600</posx>\n- <top>418</top>\n- <left>600</left>\n- <width>262</width>\n- <visible>true</visible>\n- <scroll>true</scroll>\n- <label>$ADDON[plugin.video.netflix 30235]</label>\n- <haspath>false</haspath>\n- <font>font12</font>\n- <wrapmultiline>true</wrapmultiline>\n- <align>center</align>\n- </control>\n- <control type=\"label\" id=\"204\">\n- <description>ML Adults</description>\n- <posy>418</posy>\n- <posx>863</posx>\n- <top>418</top>\n- <left>863</left>\n- <width>262</width>\n- <visible>true</visible>\n- <scroll>true</scroll>\n- <label>$ADDON[plugin.video.netflix 30236]</label>\n- <haspath>false</haspath>\n- <font>font12</font>\n- <wrapmultiline>true</wrapmultiline>\n- <align>center</align>\n- </control>\n- <control type=\"label\" id=\"9\">\n+ <control type=\"label\" id=\"10009\">\n<description>ML Current status</description>\n- <posy>480</posy>\n+ <posy>500</posy>\n<posx>75</posx>\n- <top>480</top>\n+ <top>500</top>\n<left>75</left>\n<width>1050</width>\n<visible>true</visible>\n</control>\n</control>\n<!-- Window default side buttons -->\n- <control type=\"grouplist\" id=\"90\">\n+ <control type=\"grouplist\" id=\"10090\">\n<left>1210</left>\n<top>92</top>\n<orientation>vertical</orientation>\n<width>300</width>\n<height>250</height>\n<itemgap>-10</itemgap>\n- <onleft>80</onleft>\n+ <onleft>10080</onleft>\n- <control type=\"button\" id=\"28\">\n+ <control type=\"button\" id=\"10028\">\n<description>OK button</description>\n<width>300</width>\n<height>100</height>\n<aligny>center</aligny>\n<pulseonselect>no</pulseonselect>\n</control>\n- <control type=\"button\" id=\"29\">\n+ <control type=\"button\" id=\"10029\">\n<description>Cancel button</description>\n<width>300</width>\n<height>100</height>\n"
},
{
"change_type": "MODIFY",
"old_path": "test/xbmcgui.py",
"new_path": "test/xbmcgui.py",
"diff": "@@ -21,6 +21,13 @@ class Control:\n''' A stub constructor for the xbmcgui Control class '''\n+class ControlLabel:\n+ ''' A reimplementation of the xbmcgui ControlLabel class '''\n+\n+ def __init__(self, x=0, y=0, width=0, height=0, label='', font=None, textColor=None, disabledColor=None, alignment=None, hasPath=False, angle=None):\n+ ''' A stub constructor for the xbmcgui ControlLabel class '''\n+\n+\nclass ControlGeneric(Control):\n''' A reimplementation of the xbmcgui Control methods of all control classes '''\n"
}
]
| Python | MIT License | castagnait/plugin.video.netflix | Load maturity levels dynamically from webpage
levels change by country and region, so it is not possible to make a
static list. To solve this, i perform a complete parse of the data from
the web page |
106,046 | 27.11.2019 18:36:04 | -3,600 | 27ce4d31ee970ab7c0c1e6494604c5f697201fd8 | Fixed the order of loading modules
and also eliminated the workaround that forced import and forced initialization
of the globals module before the others | [
{
"change_type": "MODIFY",
"old_path": "addon.py",
"new_path": "addon.py",
"diff": "\"\"\"Kodi plugin for Netflix (https://netflix.com)\"\"\"\nfrom __future__ import absolute_import, division, unicode_literals\n+import sys\n+\nfrom resources.lib.run_addon import run\n-run()\n+run(sys.argv)\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/globals.py",
"new_path": "resources/lib/globals.py",
"diff": "@@ -178,6 +178,11 @@ class GlobalVariables(object):\ndef __init__(self):\n\"\"\"Do nothing on constructing the object\"\"\"\n+ # Define here any variables necessary for the correct loading of the modules\n+ self.ADDON = None\n+ self.ADDON_DATA_PATH = None\n+ self.DATA_PATH = None\n+ self.CACHE_METADATA_TTL = None\ndef init_globals(self, argv, skip_database_initialize=False):\n\"\"\"Initialized globally used module variables.\n@@ -421,7 +426,7 @@ class GlobalVariables(object):\n# pylint: disable=invalid-name\n# This will have no effect most of the time, as it doesn't seem to be executed\n# on subsequent addon invocations when reuseLanguageInvoker is being used.\n-# We initialize an empty instance so the instance is importable from addon.py\n-# and service.py, where g.init_globals(sys.argv) MUST be called before doing\n+# We initialize an empty instance so the instance is importable from run_addon.py\n+# and run_service.py, where g.init_globals(sys.argv) MUST be called before doing\n# anything else (even BEFORE OTHER IMPORTS from this addon)\ng = GlobalVariables()\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/run_addon.py",
"new_path": "resources/lib/run_addon.py",
"diff": "# Module: default\n# Created on: 13.01.2017\n# License: MIT https://goo.gl/5bMj3H\n-# pylint: disable=wrong-import-position\n\"\"\"Kodi plugin for Netflix (https://netflix.com)\"\"\"\nfrom __future__ import absolute_import, division, unicode_literals\n-import sys\nfrom functools import wraps\n+\nfrom xbmcgui import Window\n-# Import and initialize globals right away to avoid stale values from the last\n-# addon invocation. Otherwise Kodi's reuseLanguageInvoker will cause some\n-# really quirky behavior!\n-# PR: https://github.com/xbmc/xbmc/pull/13814\nfrom resources.lib.globals import g\n-g.init_globals(sys.argv)\n-\nfrom resources.lib.common import (info, debug, warn, error, check_credentials, BackendNotReady,\nlog_time_trace, reset_log_level_global_var)\nfrom resources.lib.upgrade_controller import check_addon_upgrade\n@@ -108,10 +101,13 @@ def _handle_endofdirectory(succeeded=False):\nendOfDirectory(handle=g.PLUGIN_HANDLE, succeeded=succeeded)\n-def run():\n+def run(argv):\n# pylint: disable=broad-except,ungrouped-imports\n- # Initialize variables in common module scope\n- # (necessary when reusing language invoker)\n+ # Initialize globals right away to avoid stale values from the last addon invocation.\n+ # Otherwise Kodi's reuseLanguageInvoker will cause some really quirky behavior!\n+ # PR: https://github.com/xbmc/xbmc/pull/13814\n+ g.init_globals(argv)\n+\nreset_log_level_global_var()\ninfo('Started (Version {})'.format(g.VERSION))\ninfo('URL is {}'.format(g.URL))\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/run_service.py",
"new_path": "resources/lib/run_service.py",
"diff": "# Module: service\n# Created on: 13.01.2017\n# License: MIT https://goo.gl/5bMj3H\n-# pylint: disable=wrong-import-position\n\"\"\"Kodi plugin for Netflix (https://netflix.com)\"\"\"\nfrom __future__ import absolute_import, division, unicode_literals\n-import sys\nimport threading\n-# Import and initialize globals right away to avoid stale values from the last\n-# addon invocation. Otherwise Kodi's reuseLanguageInvoker option will cause\n-# some really quirky behavior!\n-from resources.lib.globals import g\n-g.init_globals(sys.argv)\n-\n# Global cache must not be used within these modules, because stale values may\n# be used and cause inconsistencies!\n-import resources.lib.services as services\n-from resources.lib.upgrade_controller import check_service_upgrade\n+from resources.lib.globals import g\nfrom resources.lib.common import (info, error, select_port, get_local_string)\n+from resources.lib.upgrade_controller import check_service_upgrade\ntry: # Python 2\n@@ -33,15 +25,17 @@ class NetflixService(object):\n\"\"\"\nNetflix addon service\n\"\"\"\n+ from resources.lib.services.msl.http_server import MSLTCPServer\n+ from resources.lib.services.nfsession.http_server import NetflixTCPServer\nSERVERS = [\n{\n'name': 'MSL',\n- 'class': services.MSLTCPServer,\n+ 'class': MSLTCPServer,\n'instance': None,\n'thread': None},\n{\n'name': 'NS',\n- 'class': services.NetflixTCPServer,\n+ 'class': NetflixTCPServer,\n'instance': None,\n'thread': None},\n]\n@@ -64,14 +58,17 @@ class NetflixService(object):\n\"\"\"\nStart the background services\n\"\"\"\n+ from resources.lib.services.playback.controller import PlaybackController\n+ from resources.lib.services.library_updater import LibraryUpdateService\n+ from resources.lib.services.settings_monitor import SettingsMonitor\nfor server in self.SERVERS:\nserver['instance'].server_activate()\nserver['instance'].timeout = 1\nserver['thread'].start()\ninfo('[{}] Thread started'.format(server['name']))\n- self.controller = services.PlaybackController()\n- self.library_updater = services.LibraryUpdateService()\n- self.settings_monitor = services.SettingsMonitor()\n+ self.controller = PlaybackController()\n+ self.library_updater = LibraryUpdateService()\n+ self.settings_monitor = SettingsMonitor()\n# Mark the service as active\nfrom xbmcgui import Window\nwindow_cls = Window(10000)\n@@ -121,6 +118,10 @@ class NetflixService(object):\nreturn self.controller.waitForAbort(1)\n-def run():\n+def run(argv):\n+ # Initialize globals right away to avoid stale values from the last addon invocation.\n+ # Otherwise Kodi's reuseLanguageInvoker will cause some really quirky behavior!\n+ # PR: https://github.com/xbmc/xbmc/pull/13814\n+ g.init_globals(argv)\ncheck_service_upgrade()\nNetflixService().run()\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/__init__.py",
"new_path": "resources/lib/services/__init__.py",
"diff": "-# -*- coding: utf-8 -*-\n-\n-\"\"\"Background services for the plugin\"\"\"\n-from __future__ import absolute_import, division, unicode_literals\n-\n-from .msl.http_server import MSLTCPServer\n-from .nfsession.http_server import NetflixTCPServer\n-from .library_updater import LibraryUpdateService\n-from .playback.controller import PlaybackController\n-from .settings_monitor import SettingsMonitor\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/nfsession/nfsession.py",
"new_path": "resources/lib/services/nfsession/nfsession.py",
"diff": "@@ -80,7 +80,7 @@ class NetflixSession(object):\nsession = None\n\"\"\"The requests.session object to handle communication to Netflix\"\"\"\n- verify_ssl = bool(g.ADDON.getSettingBool('ssl_verification'))\n+ verify_ssl = True\n\"\"\"Use SSL verification when performing requests\"\"\"\ndef __init__(self):\n@@ -100,6 +100,7 @@ class NetflixSession(object):\ncommon.register_slot(slot)\ncommon.register_slot(play_callback, signal=g.ADDON_ID + '_play_action',\nsource_id='upnextprovider')\n+ self.verify_ssl = bool(g.ADDON.getSettingBool('ssl_verification'))\nself._init_session()\nself.is_prefetch_login = False\nself._prefetch_login()\n"
},
{
"change_type": "MODIFY",
"old_path": "service.py",
"new_path": "service.py",
"diff": "\"\"\"Kodi plugin for Netflix (https://netflix.com)\"\"\"\nfrom __future__ import absolute_import, division, unicode_literals\n+import sys\n+\nfrom resources.lib.run_service import run\n-run()\n+run(sys.argv)\n"
}
]
| Python | MIT License | castagnait/plugin.video.netflix | Fixed the order of loading modules
and also eliminated the workaround that forced import and forced initialization
of the globals module before the others |
106,046 | 28.11.2019 09:29:44 | -3,600 | 9c92891f752508bb28292c1ca3851d7a14591abf | Fixed player id assignment
this caused the impossibility to get the player data through json_rpc in _get_player_state | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/playback/controller.py",
"new_path": "resources/lib/services/playback/controller.py",
"diff": "@@ -76,7 +76,10 @@ class PlaybackController(xbmc.Monitor):\nplayer_state)\ndef _on_playback_started(self, data):\n- self.active_player_id = max(data['player']['playerid'], 1)\n+ # When UpNext addon play a video while we are inside Netflix addon and\n+ # not externally like Kodi library, the playerid become -1 this id does not exist\n+ player_id = data['player']['playerid'] if data['player']['playerid'] > -1 else 1\n+ self.active_player_id = player_id\nself._notify_all(PlaybackActionManager.on_playback_started,\nself._get_player_state())\n"
}
]
| Python | MIT License | castagnait/plugin.video.netflix | Fixed player id assignment
this caused the impossibility to get the player data through json_rpc in _get_player_state |
106,046 | 28.11.2019 17:34:07 | -3,600 | 57e441f83fb6c04c557f0a63518c4707bb6dda9e | Fixed cache set/get Property with pickle data | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/cache.py",
"new_path": "resources/lib/cache.py",
"diff": "@@ -10,7 +10,6 @@ resources.lib.kodi.ui\nresources.lib.services.nfsession\n\"\"\"\nfrom __future__ import absolute_import, division, unicode_literals\n-import base64\nimport os\nimport sys\nfrom time import time\n@@ -58,10 +57,13 @@ class UnknownCacheBucketError(Exception):\n# Logic to get the identifier\n# cache_output: called without params, use the first argument value of the function as identifier\n-# cache_output: with identify_from_kwarg_name, get value identifier from kwarg name specified, if None value fallback to first function argument value\n+# cache_output: with identify_from_kwarg_name, get value identifier from kwarg name specified,\n+# if None value fallback to first function argument value\n-# identify_append_from_kwarg_name - if specified append the value after the kwarg identify_from_kwarg_name, to creates a more specific identifier\n-# identify_fallback_arg_index - to change the default fallback arg index (0), where the identifier get the value from the func arguments\n+# identify_append_from_kwarg_name - if specified append the value after the kwarg identify_from\n+# _kwarg_name, to creates a more specific identifier\n+# identify_fallback_arg_index - to change the default fallback arg index (0), where the identifier\n+# get the value from the func arguments\n# fixed_identifier - note if specified all other params are ignored\ndef cache_output(g, bucket, fixed_identifier=None,\n@@ -154,6 +156,7 @@ class Cache(object):\nself.metadata_ttl = metadata_ttl\nself.buckets = {}\nself.window = xbmcgui.Window(10000)\n+ self.PY_IS_VER2 = sys.version_info.major == 2\ndef lock_marker(self):\n\"\"\"Return a lock marker for this instance and the current time\"\"\"\n@@ -235,39 +238,34 @@ class Cache(object):\nreturn self.buckets[key]\ndef _load_bucket(self, bucket):\n- wnd_property = None\n# Try 10 times to acquire a lock\nfor _ in range(1, 10):\n- wnd_property_data = base64.b64decode(self.window.getProperty(_window_property(bucket)))\n- if wnd_property_data:\n- try:\n- wnd_property = pickle.loads(wnd_property_data)\n- except Exception: # pylint: disable=broad-except\n- self.common.debug('No instance of {} found. Creating new instance.', bucket)\n- if isinstance(wnd_property, unicode) and wnd_property.startswith('LOCKED'):\n+ wnd_property_data = self.window.getProperty(_window_property(bucket))\n+ if wnd_property_data.startswith(str('LOCKED_BY_')):\nself.common.debug('Waiting for release of {}', bucket)\nxbmc.sleep(50)\nelse:\n- return self._load_bucket_from_wndprop(bucket, wnd_property)\n+ return self._load_bucket_from_wndprop(bucket, wnd_property_data)\nself.common.warn('{} is locked. Working with an empty instance...', bucket)\nreturn {}\n- def _load_bucket_from_wndprop(self, bucket, wnd_property):\n- if wnd_property is None:\n- bucket_instance = {}\n+ def _load_bucket_from_wndprop(self, bucket, wnd_property_data):\n+ try:\n+ if self.PY_IS_VER2:\n+ # pickle.loads on py2 wants string\n+ bucket_instance = pickle.loads(wnd_property_data)\nelse:\n- bucket_instance = wnd_property\n+ bucket_instance = pickle.loads(wnd_property_data.encode('latin-1'))\n+ except Exception: # pylint: disable=broad-except\n+ # When window.getProperty does not have the property here happen an error\n+ self.common.debug('No instance of {} found. Creating new instance.'.format(bucket))\n+ bucket_instance = {}\nself._lock(bucket)\nself.common.debug('Acquired lock on {}', bucket)\nreturn bucket_instance\ndef _lock(self, bucket):\n- # Note pickle.dumps produces byte not str cannot be passed as is in setProperty (with py3)\n- # because with getProperty cause UnicodeDecodeError due to not decodable characters\n- # an Py2/Py3 compatible way is encode pickle data in to base64 string\n- # requires additional conversion step work but works\n- self.window.setProperty(_window_property(bucket),\n- base64.b64encode(pickle.dumps(self.lock_marker())).decode('utf-8'))\n+ self.window.setProperty(_window_property(bucket), self.lock_marker())\ndef _get_from_disk(self, bucket, identifier):\n\"\"\"Load a cache entry from disk and add it to the in memory bucket\"\"\"\n@@ -276,7 +274,7 @@ class Cache(object):\nraise CacheMiss()\nhandle = xbmcvfs.File(cache_filename, 'rb')\ntry:\n- if sys.version_info.major == 2:\n+ if self.PY_IS_VER2:\n# pickle.loads on py2 wants string\nreturn pickle.loads(handle.read())\n# py3\n@@ -289,13 +287,12 @@ class Cache(object):\ndef _add_to_disk(self, bucket, identifier, cache_entry):\n\"\"\"Write a cache entry to disk\"\"\"\n- # pylint: disable=broad-except\ncache_filename = self._entry_filename(bucket, identifier)\nhandle = xbmcvfs.File(cache_filename, 'wb')\ntry:\n# return pickle.dump(cache_entry, handle)\nhandle.write(bytearray(pickle.dumps(cache_entry)))\n- except Exception as exc:\n+ except Exception as exc: # pylint: disable=broad-except\nself.common.error('Failed to write cache entry to {}: {}', cache_filename, exc)\nfinally:\nhandle.close()\n@@ -305,21 +302,23 @@ class Cache(object):\nreturn xbmc.translatePath(os.path.join(*file_loc))\ndef _persist_bucket(self, bucket, contents):\n- # pylint: disable=broad-except\nif not self.is_safe_to_persist(bucket):\nself.common.warn(\n'{} is locked by another instance. Discarding changes'\n.format(bucket))\nreturn\n-\ntry:\n- # Note pickle.dumps produces byte not str cannot be passed as is in setProperty (with py3)\n- # because with getProperty cause UnicodeDecodeError due to not decodable characters\n- # an Py2/Py3 compatible way is encode pickle data in to base64 string\n- # requires additional conversion step work but works\n+ if self.PY_IS_VER2 == 2:\n+ self.window.setProperty(_window_property(bucket), pickle.dumps(contents))\n+ else:\n+ # Note: On python 3 pickle.dumps produces byte not str cannot be passed as is in\n+ # setProperty because cannot receive arbitrary byte sequences if they contain\n+ # null bytes \\x00, the stored value will be truncated by this null byte (Kodi bug).\n+ # To store pickled data in Python 3, you should use protocol 0 explicitly and decode\n+ # the resulted value with latin-1 encoding to str and then pass it to setPropety.\nself.window.setProperty(_window_property(bucket),\n- base64.b64encode(pickle.dumps(contents)).decode('utf-8'))\n- except Exception as exc:\n+ pickle.dumps(contents, protocol=0).decode('latin-1'))\n+ except Exception as exc: # pylint: disable=broad-except\nself.common.error('Failed to persist {} to wnd properties: {}', bucket, exc)\nself.window.clearProperty(_window_property(bucket))\nfinally:\n@@ -328,18 +327,20 @@ class Cache(object):\ndef is_safe_to_persist(self, bucket):\n# Only persist if we acquired the original lock or if the lock is older\n# than 15 seconds (override stale locks)\n- lock_data = base64.b64decode(self.window.getProperty(_window_property(bucket)))\n- lock = ''\n- if lock_data:\n- lock = pickle.loads(lock_data)\n- is_own_lock = lock[:14] == self.lock_marker()[:14]\n+ lock_data = self.window.getProperty(_window_property(bucket))\n+ if lock_data.startswith(str('LOCKED_BY_')):\n+ # Eg. LOCKED_BY_0001_AT_1574951301\n+ # Check if is same add-on invocation: 'LOCKED_BY_0001'\n+ is_own_lock = lock_data[:14] == self.lock_marker()[:14]\ntry:\n- is_stale_lock = int(lock[18:] or 1) <= time() - 15\n+ # Check if is time is older then 15 sec (last part after AT_)\n+ is_stale_lock = int(lock_data[18:] or 1) <= time() - 15\nexcept ValueError:\nis_stale_lock = False\nif is_stale_lock:\n- self.common.info('Overriding stale cache lock {} on {}', lock, bucket)\n+ self.common.info('Overriding stale cache lock {} on {}', lock_data, bucket)\nreturn is_own_lock or is_stale_lock\n+ return True\ndef verify_ttl(self, bucket, identifier, cache_entry):\n\"\"\"Verify if cache_entry has reached its EOL.\n"
}
]
| Python | MIT License | castagnait/plugin.video.netflix | Fixed cache set/get Property with pickle data |
106,046 | 29.11.2019 19:33:46 | -3,600 | ecb5bd10fc3c144a68951c8ac1619fa0c26e107b | Version bump (0.16.0) | [
{
"change_type": "MODIFY",
"old_path": "addon.xml",
"new_path": "addon.xml",
"diff": "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n-<addon id=\"plugin.video.netflix\" name=\"Netflix\" version=\"0.15.11\" provider-name=\"libdev + jojo + asciidisco + caphm + castagnait\">\n+<addon id=\"plugin.video.netflix\" name=\"Netflix\" version=\"0.16.0\" provider-name=\"libdev + jojo + asciidisco + caphm + castagnait\">\n<requires>\n<import addon=\"xbmc.python\" version=\"2.26.0\"/>\n<import addon=\"script.module.addon.signals\" version=\"0.0.3\"/>\n<forum>https://forum.kodi.tv/showthread.php?tid=329767</forum>\n<source>https://github.com/CastagnaIT/plugin.video.netflix</source>\n<news>\n+v0.16.0 (2019-11-29)\n+-Added new parental control settings\n+-Added new thumb rating to movies/tv shows\n+-Started migrating to watched status marks by profile\n+-Optimized startup code\n+-Better handled no internet connection\n+-Fixed an issue that breaks the service when there is no internet connection\n+-Fixed an issue in some specific cases request at startup credentials even if already saved\n+-Fixed an issue did not show any error to the user when the loading of profiles fails\n+-Fixed an issue that did not allow the display of the skip button in the Kodi library\n+-New Hungarian language\n+-Updated de, hr, it, pl, pt_br translations\n+-Other minor improvements/fixes\n+\nv0.15.11 (2019-11-20)\n-Fixed a critical error on auto-update\n-Fixed some error on py3\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/upgrade_controller.py",
"new_path": "resources/lib/upgrade_controller.py",
"diff": "@@ -41,7 +41,7 @@ def _perform_addon_changes(previous_ver, current_ver):\nmsg = ('This update resets the settings to auto-update library.\\r\\n'\n'Therefore only in case you are using auto-update must be reconfigured.')\nui.show_ok_dialog('Netflix upgrade', msg)\n- if previous_ver and is_less_version(previous_ver, '0.15.12'):\n+ if previous_ver and is_less_version(previous_ver, '0.16.0'):\nimport resources.lib.kodi.ui as ui\nmsg = (\n'Has been introduced watched status marks for the videos separate for each profile:\\r\\n'\n"
}
]
| Python | MIT License | castagnait/plugin.video.netflix | Version bump (0.16.0) (#341) |
106,046 | 02.12.2019 20:48:54 | -3,600 | 9b4bed3b5d975090f4dd0864541e210a955b8f91 | Fixed unicodedecode error when using non ascii char on inputdialog | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/kodi/ui/dialogs.py",
"new_path": "resources/lib/kodi/ui/dialogs.py",
"diff": "@@ -32,9 +32,9 @@ def ask_credentials():\n\"\"\"\nShow some dialogs and ask the user for account credentials\n\"\"\"\n- email = xbmcgui.Dialog().input(\n+ email = g.py2_decode(xbmcgui.Dialog().input(\nheading=common.get_local_string(30005),\n- type=xbmcgui.INPUT_ALPHANUM) or None\n+ type=xbmcgui.INPUT_ALPHANUM)) or None\ncommon.verify_credentials(email)\npassword = ask_for_password()\ncommon.verify_credentials(password)\n@@ -47,10 +47,10 @@ def ask_credentials():\ndef ask_for_password():\n\"\"\"Ask the user for the password\"\"\"\n- return xbmcgui.Dialog().input(\n+ return g.py2_decode(xbmcgui.Dialog().input(\nheading=common.get_local_string(30004),\ntype=xbmcgui.INPUT_ALPHANUM,\n- option=xbmcgui.ALPHANUM_HIDE_INPUT) or None\n+ option=xbmcgui.ALPHANUM_HIDE_INPUT)) or None\ndef ask_for_rating():\n"
}
]
| Python | MIT License | castagnait/plugin.video.netflix | Fixed unicodedecode error when using non ascii char on inputdialog |
106,046 | 03.12.2019 20:14:10 | -3,600 | 6669482e20b4b595e4e3f50c7c98b760154a2512 | Add Python 3.5 testing support | [
{
"change_type": "MODIFY",
"old_path": ".travis.yml",
"new_path": ".travis.yml",
"diff": "@@ -4,6 +4,7 @@ language: python\npython:\n- '2.7'\n+- '3.5'\n- '3.6'\n- '3.7'\n"
},
{
"change_type": "MODIFY",
"old_path": "Makefile",
"new_path": "Makefile",
"diff": "-ENVS := flake8,py27,py36\nexport PYTHONPATH := .:$(CURDIR)/modules/mysql-connector-python:$(CURDIR)/resources/lib:$(CURDIR)/test\naddon_xml := addon.xml\n@@ -34,7 +33,7 @@ sanity: tox pylint language\ntox:\n@echo -e \"$(white)=$(blue) Starting sanity tox test$(reset)\"\n- tox -q -e $(ENVS)\n+ tox -q -e\npylint:\n@echo -e \"$(white)=$(blue) Starting sanity pylint test$(reset)\"\n"
},
{
"change_type": "MODIFY",
"old_path": "tox.ini",
"new_path": "tox.ini",
"diff": "[tox]\n-envlist = py27,py36,py37,flake8\n+envlist = py27,py35,py36,py37,flake8\nskipsdist = True\n+skip_missing_interpreters = True\n[testenv:flake8]\ncommands =\n"
}
]
| Python | MIT License | castagnait/plugin.video.netflix | Add Python 3.5 testing support |
106,046 | 04.12.2019 13:53:55 | -3,600 | e0386b16dc9d0240a7adb42b0acc5cf94a12ee6f | Fixed unicodedecode error on android device
Beelink
in the ro.product.model instead of number 2 has a special char and this is the cause of the errors | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/api/website.py",
"new_path": "resources/lib/api/website.py",
"diff": "@@ -221,18 +221,22 @@ def generate_esn(user_data):\nimport subprocess\ntry:\nmanufacturer = subprocess.check_output(\n- ['/system/bin/getprop', 'ro.product.manufacturer']).strip(' \\t\\n\\r')\n+ ['/system/bin/getprop',\n+ 'ro.product.manufacturer']).decode('utf-8').strip(' \\t\\n\\r')\nif manufacturer:\nmodel = subprocess.check_output(\n- ['/system/bin/getprop', 'ro.product.model']).strip(' \\t\\n\\r')\n+ ['/system/bin/getprop',\n+ 'ro.product.model']).decode('utf-8').strip(' \\t\\n\\r')\nproduct_characteristics = subprocess.check_output(\n- ['/system/bin/getprop', 'ro.build.characteristics']).strip(' \\t\\n\\r')\n+ ['/system/bin/getprop',\n+ 'ro.build.characteristics']).decode('utf-8').strip(' \\t\\n\\r')\n# Property ro.build.characteristics may also contain more then one value\nhas_product_characteristics_tv = any(\nvalue.strip(' ') == 'tv' for value in product_characteristics.split(','))\n# Netflix Ready Device Platform (NRDP)\nnrdp_modelgroup = subprocess.check_output(\n- ['/system/bin/getprop', 'ro.nrdp.modelgroup']).strip(' \\t\\n\\r')\n+ ['/system/bin/getprop',\n+ 'ro.nrdp.modelgroup']).decode('utf-8').strip(' \\t\\n\\r')\nesn = ('NFANDROID2-PRV-' if has_product_characteristics_tv else 'NFANDROID1-PRV-')\nif has_product_characteristics_tv:\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/common/uuid_device.py",
"new_path": "resources/lib/common/uuid_device.py",
"diff": "@@ -129,7 +129,7 @@ def _get_android_uuid():\nvalues += value_splitted[1]\nexcept Exception:\npass\n- return values\n+ return values.encode('utf-8')\ndef _get_macos_uuid():\n"
}
]
| Python | MIT License | castagnait/plugin.video.netflix | Fixed unicodedecode error on android device
Beelink GT1mini-2
in the ro.product.model instead of number 2 has a special char and this is the cause of the errors |
106,046 | 04.12.2019 18:25:13 | -3,600 | 9a850ba30b496d923aca177e8619f7296b5664a1 | Some fixes for non default Skins | [
{
"change_type": "MODIFY",
"old_path": "resources/skins/default/1080i/plugin-video-netflix-ParentalControl.xml",
"new_path": "resources/skins/default/1080i/plugin-video-netflix-ParentalControl.xml",
"diff": "<visible>true</visible>\n<scroll>false</scroll>\n<label>$ADDON[plugin.video.netflix 30007]</label>\n+ <textcolor>FFFFFFFF</textcolor>\n+ <aligny>top</aligny>\n<haspath>false</haspath>\n<font>font14</font>\n<wrapmultiline>false</wrapmultiline>\n<visible>true</visible>\n<scroll>true</scroll>\n<label>$ADDON[plugin.video.netflix 30232]</label>\n+ <textcolor>FFFFFFFF</textcolor>\n+ <aligny>top</aligny>\n<haspath>false</haspath>\n<font>font14</font>\n<wrapmultiline>false</wrapmultiline>\n<visible>true</visible>\n<scroll>true</scroll>\n<label>--</label>\n+ <textcolor>FFFFFFFF</textcolor>\n<haspath>false</haspath>\n<font>font12</font>\n<wrapmultiline>false</wrapmultiline>\n+ <aligny>top</aligny>\n<align>center</align>\n</control>\n</control>\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/skins/default/1080i/plugin-video-netflix-RatingThumb.xml",
"new_path": "resources/skins/default/1080i/plugin-video-netflix-RatingThumb.xml",
"diff": "<!-- Note: some tags to the controls have been set even if not necessary to ensure compatibility with the custom skins of kodi -->\n<!-- Warning using low id numbers cause problems with moving focus an onClick events -->\n<top>250</top>\n- <centerleft>50%</centerleft>\n+ <left>505</left>\n<width>910</width>\n<!-- Screen background -->\n<control type=\"image\">\n<left>65</left>\n<width>500</width>\n<scroll>true</scroll>\n+ <aligny>top</aligny>\n<label>--</label>\n+ <textcolor>FFFFFFFF</textcolor>\n<haspath>false</haspath>\n<font>font12</font>\n<wrapmultiline>false</wrapmultiline>\n"
}
]
| Python | MIT License | castagnait/plugin.video.netflix | Some fixes for non default Skins |
106,046 | 08.12.2019 16:26:11 | -3,600 | 25305d4a9bb607ae05571ddfc649684c349f639b | Improved and fixed gui path | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/api/shakti.py",
"new_path": "resources/lib/api/shakti.py",
"diff": "@@ -39,8 +39,7 @@ def catch_api_errors(func):\ndef logout():\n\"\"\"Logout of the current account\"\"\"\n- url = common.build_url(['root'], mode=g.MODE_DIRECTORY)\n- common.make_call('logout', url)\n+ common.make_call('logout', g.BASE_URL)\ng.CACHE.invalidate()\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/navigation/actions.py",
"new_path": "resources/lib/navigation/actions.py",
"diff": "@@ -150,9 +150,9 @@ class AddonActionExecutor(object):\n# Perform a new login to get/generate a new ESN\napi.login(ask_credentials=False)\n# Warning after login netflix switch to the main profile! so return to the main screen\n- url = 'plugin://plugin.video.netflix/directory/root'\n- xbmc.executebuiltin('XBMC.Container.Update(path,replace)') # Clean path history\n- xbmc.executebuiltin('Container.Update({})'.format(url)) # Open root page\n+ url = 'plugin://plugin.video.netflix'\n+ # Open root page\n+ xbmc.executebuiltin('Container.Update({},replace)'.format(url)) # replace=reset history\ndef _sync_library(videoid, operation):\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/navigation/directory.py",
"new_path": "resources/lib/navigation/directory.py",
"diff": "@@ -204,7 +204,11 @@ def _ask_search_term_and_redirect():\nxbmcplugin.endOfDirectory(g.PLUGIN_HANDLE, succeeded=True)\nxbmc.executebuiltin('Container.Update({})'.format(url))\nelse:\n- xbmcplugin.endOfDirectory(g.PLUGIN_HANDLE, succeeded=False)\n+ url = common.build_url(pathitems=['home'],\n+ params={'profile_id': g.LOCAL_DB.get_active_profile_guid()},\n+ mode=g.MODE_DIRECTORY)\n+ xbmcplugin.endOfDirectory(g.PLUGIN_HANDLE, succeeded=True)\n+ xbmc.executebuiltin('Container.Update({},replace)'.format(url)) # replace=reset history\n@common.time_execution(immediate=False)\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/run_addon.py",
"new_path": "resources/lib/run_addon.py",
"diff": "@@ -127,6 +127,8 @@ def run(argv):\ncheck_addon_upgrade()\ng.initial_addon_configuration()\nroute([part for part in g.PATH.split('/') if part])\n+ else:\n+ success = False\nexcept BackendNotReady:\nfrom resources.lib.kodi.ui import show_backend_not_ready\nshow_backend_not_ready()\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/nfsession/nfsession.py",
"new_path": "resources/lib/services/nfsession/nfsession.py",
"diff": "@@ -400,8 +400,9 @@ class NetflixSession(object):\ncommon.info('Logout successful')\nui.show_notification(common.get_local_string(30113))\nself._init_session()\n- xbmc.executebuiltin('XBMC.Container.Update(path,replace)') # Clean path history\n- xbmc.executebuiltin('Container.Update({})'.format(url)) # Open root page\n+ xbmc.executebuiltin('Container.Update(path,replace)') # Go to a fake page to clear screen\n+ # Open root page\n+ xbmc.executebuiltin('Container.Update({},replace)'.format(url)) # replace=reset history\n@common.addonsignals_return_call\n@needs_login\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/settings_monitor.py",
"new_path": "resources/lib/services/settings_monitor.py",
"diff": "@@ -115,5 +115,5 @@ class SettingsMonitor(xbmc.Monitor):\nif reboot_addon:\ncommon.debug('SettingsMonitor: addon will be rebooted')\nurl = 'plugin://plugin.video.netflix/directory/root'\n- xbmc.executebuiltin('XBMC.Container.Update(path,replace)') # Clean path history\n- xbmc.executebuiltin('Container.Update({})'.format(url)) # Open root page\n+ # Open root page\n+ xbmc.executebuiltin('Container.Update({})'.format(url)) # replace=reset history\n"
}
]
| Python | MIT License | castagnait/plugin.video.netflix | Improved and fixed gui path |
106,046 | 08.12.2019 20:04:47 | -3,600 | af46572cb541b9682505fee7a8dec8990a91d5a7 | Override default timeout also in ipc over http | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/common/ipc.py",
"new_path": "resources/lib/common/ipc.py",
"diff": "@@ -86,7 +86,7 @@ def make_http_call(callname, data):\ninstall_opener(build_opener(ProxyHandler({})))\ntry:\nresult = json.loads(\n- urlopen(url=url, data=json.dumps(data).encode('utf-8')).read(),\n+ urlopen(url=url, data=json.dumps(data).encode('utf-8'), timeout=16).read(),\nobject_pairs_hook=OrderedDict)\nexcept URLError:\nraise BackendNotReady\n"
}
]
| Python | MIT License | castagnait/plugin.video.netflix | Override default timeout also in ipc over http |
106,046 | 07.12.2019 10:54:57 | -3,600 | 08c3a23bcc699972f68d6f4cb0a660483f6e44dc | Add compare dict with excluded keys option | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/common/misc_utils.py",
"new_path": "resources/lib/common/misc_utils.py",
"diff": "@@ -236,6 +236,15 @@ def merge_dicts(dict_to_merge, merged_dict):\nreturn merged_dict\n+def compare_dicts(dict_a, dict_b, excluded_keys=None):\n+ \"\"\"\n+ Compare two dict with same keys, with optional keys to exclude from compare\n+ \"\"\"\n+ if excluded_keys is None:\n+ excluded_keys = []\n+ return all(dict_a[k] == dict_b[k] for k in dict_a if k not in excluded_keys)\n+\n+\ndef any_value_except(mapping, excluded_keys):\n\"\"\"Return a random value from a dict that is not associated with\nexcluded_key. Raises StopIteration if there are no other keys than\n"
}
]
| Python | MIT License | castagnait/plugin.video.netflix | Add compare dict with excluded keys option |
106,046 | 07.12.2019 11:04:35 | -3,600 | 492f6712772b3c8a9dcb2f7dab1af31bf67c96b2 | Fixed possible cases of fake data in player_state | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/playback/controller.py",
"new_path": "resources/lib/services/playback/controller.py",
"diff": "@@ -119,6 +119,12 @@ class PlaybackController(xbmc.Monitor):\nexcept IOError:\nreturn {}\n+ # Sometime may happen that when you stop playback, a player status without data is read,\n+ # so all dict values are returned with a default empty value,\n+ # then return an empty status instead of fake data\n+ if not player_state['audiostreams']:\n+ return {}\n+\n# convert time dict to elapsed seconds\nplayer_state['elapsed_seconds'] = (\nplayer_state['time']['hours'] * 3600 +\n"
}
]
| Python | MIT License | castagnait/plugin.video.netflix | Fixed possible cases of fake data in player_state |
106,046 | 09.12.2019 11:21:14 | -3,600 | 187c1761e7fe0486a7a12a01fedcfb0b158ccc40 | Code climate update config | [
{
"change_type": "MODIFY",
"old_path": ".codeclimate.yml",
"new_path": ".codeclimate.yml",
"diff": "----\n-engines:\n+version: \"2\"\n+plugins:\npep8:\nenabled: true\n- checks:\n- E402:\n- # Disable module order check because we need to work around this\n- enabled: false\nradon:\nenabled: true\n- config:\n- python_version: 2\nmarkdownlint:\nenabled: true\nratings:\n@@ -17,23 +11,18 @@ ratings:\n- \"**.py\"\n- \"**.md\"\nexclude_paths:\n- - \"docs\"\n- - \"resources/test/\"\n+ - \"docs/\"\n+ - \"LICENSES/\"\n+ - \"modules/\"\n- \"resources/language/\"\n- \"resources/media/\"\n- \"resources/skins/\"\n- - \"resources/fanart.jpg\"\n- - \"resources/icon.png\"\n- - \"resources/screenshot-01.jpg\"\n- - \"resources/screenshot-02.jpg\"\n- - \"resources/screenshot-03.jpg\"\n- \"resources/settings.xml\"\n- - \"resources/__init__.py\"\n- - \"resources/lib/__init__.py\"\n- - \"__init__.py\"\n+ - \"test/\"\n- \"addon.xml\"\n- - \"LICENSE.txt\"\n- - \"makefile\"\n+ - \"Contributing.md\"\n+ - \"Code_of_Conduct.md\"\n+ - \"LICENSE.md\"\n- \"requirements.txt\"\n- - \"ISSUE_TEMPLATE.md\"\n- - \"PULL_REQUEST_TEMPLATE.md\"\n+ - \"Makefile\"\n+ - \"tox.ini\"\n"
},
{
"change_type": "MODIFY",
"old_path": "README.md",
"new_path": "README.md",
"diff": "[](https://github.com/castagnait/plugin.video.netflix/releases)\n[](https://travis-ci.org/castagnait/plugin.video.netflix)\n+[](https://codeclimate.com/github/CastagnaIT/plugin.video.netflix/maintainability)\n[](https://codecov.io/gh/castagnait/plugin.video.netflix/branch/master)\n[](https://opensource.org/licenses/MIT)\n[](https://github.com/castagnait/plugin.video.netflix/graphs/contributors)\n"
}
]
| Python | MIT License | castagnait/plugin.video.netflix | Code climate update config (#370) |
106,046 | 09.12.2019 13:16:50 | -3,600 | a88452456df48268072ff4d5435b1ce8cb22eb94 | code climate: avoid too many return statements | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/api/shakti.py",
"new_path": "resources/lib/api/shakti.py",
"diff": "@@ -402,17 +402,17 @@ def update_my_list(videoid, operation):\n@common.time_execution(immediate=False)\ndef metadata(videoid, refresh=False):\n\"\"\"Retrieve additional metadata for the given VideoId\"\"\"\n-\n# Invalidate cache if we need to refresh the all metadata\nif refresh:\ng.CACHE.invalidate_entry(cache.CACHE_METADATA, videoid, True)\n-\n+ metadata_data = {}, None\nif videoid.mediatype not in [common.VideoId.EPISODE, common.VideoId.SEASON]:\n- return _metadata(videoid), None\n- if videoid.mediatype == common.VideoId.SEASON:\n- return _metadata(videoid.derive_parent(None)), None\n+ metadata_data = _metadata(videoid), None\n+ elif videoid.mediatype == common.VideoId.SEASON:\n+ metadata_data = _metadata(videoid.derive_parent(None)), None\n+ else:\ntry:\n- return _episode_metadata(videoid)\n+ metadata_data = _episode_metadata(videoid)\nexcept KeyError as exc:\n# Episode metadata may not exist if its a new episode and cached\n# data is outdated. In this case, invalidate the cache entry and\n@@ -421,10 +421,10 @@ def metadata(videoid, refresh=False):\ncommon.debug('{}, refreshing cache', exc)\ng.CACHE.invalidate_entry(cache.CACHE_METADATA, videoid.tvshowid)\ntry:\n- return _episode_metadata(videoid)\n+ metadata_data = _episode_metadata(videoid)\nexcept KeyError as exc:\ncommon.error(exc)\n- return {}, None\n+ return metadata_data\n@common.time_execution(immediate=False)\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/kodi/library.py",
"new_path": "resources/lib/kodi/library.py",
"diff": "@@ -237,32 +237,35 @@ def purge():\ndef compile_tasks(videoid, task_handler, nfo_settings=None):\n\"\"\"Compile a list of tasks for items based on the videoid\"\"\"\ncommon.debug('Compiling library tasks for {}', videoid)\n+ task = None\nif task_handler == export_item:\nmetadata = api.metadata(videoid)\nif videoid.mediatype == common.VideoId.MOVIE:\n- return _create_export_movie_task(videoid, metadata[0], nfo_settings)\n- if videoid.mediatype in common.VideoId.TV_TYPES:\n- return _create_export_tv_tasks(videoid, metadata, nfo_settings)\n+ task = _create_export_movie_task(videoid, metadata[0], nfo_settings)\n+ elif videoid.mediatype in common.VideoId.TV_TYPES:\n+ task = _create_export_tv_tasks(videoid, metadata, nfo_settings)\n+ else:\nraise ValueError('Cannot handle {}'.format(videoid))\nif task_handler == export_new_item:\nmetadata = api.metadata(videoid, True)\n- return _create_new_episodes_tasks(videoid, metadata, nfo_settings)\n+ task = _create_new_episodes_tasks(videoid, metadata, nfo_settings)\nif task_handler == remove_item:\nif videoid.mediatype == common.VideoId.MOVIE:\n- return _create_remove_movie_task(videoid)\n+ task = _create_remove_movie_task(videoid)\nif videoid.mediatype == common.VideoId.SHOW:\n- return _compile_remove_tvshow_tasks(videoid)\n+ task = _compile_remove_tvshow_tasks(videoid)\nif videoid.mediatype == common.VideoId.SEASON:\n- return _compile_remove_season_tasks(videoid)\n+ task = _compile_remove_season_tasks(videoid)\nif videoid.mediatype == common.VideoId.EPISODE:\n- return _create_remove_episode_task(videoid)\n+ task = _create_remove_episode_task(videoid)\n+ if task is None:\ncommon.debug('compile_tasks: task_handler {} did not match any task for {}',\ntask_handler, videoid)\n- return None\n+ return task\ndef _create_export_movie_task(videoid, movie, nfo_settings):\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/run_addon.py",
"new_path": "resources/lib/run_addon.py",
"diff": "@@ -66,19 +66,20 @@ def route(pathitems):\ndef _get_nav_handler(root_handler):\n+ nav_handler = None\nif root_handler == g.MODE_DIRECTORY:\nfrom resources.lib.navigation.directory import DirectoryBuilder\n- return DirectoryBuilder\n+ nav_handler = DirectoryBuilder\nif root_handler == g.MODE_ACTION:\nfrom resources.lib.navigation.actions import AddonActionExecutor\n- return AddonActionExecutor\n+ nav_handler = AddonActionExecutor\nif root_handler == g.MODE_LIBRARY:\nfrom resources.lib.navigation.library import LibraryActionExecutor\n- return LibraryActionExecutor\n+ nav_handler = LibraryActionExecutor\nif root_handler == g.MODE_HUB:\nfrom resources.lib.navigation.hub import HubBrowser\n- return HubBrowser\n- return None\n+ nav_handler = HubBrowser\n+ return nav_handler\ndef _check_valid_credentials():\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/msl/converter.py",
"new_path": "resources/lib/services/msl/converter.py",
"diff": "@@ -107,6 +107,8 @@ def _limit_video_resolution(video_tracks, drm_streams):\nres_limit = 1080\nelif max_resolution == 'UHD 4K':\nres_limit = 4096\n+ else:\n+ return None\n# At least an equal or lower resolution must exist otherwise disable the imposed limit\nfor downloadable in video_tracks:\nif downloadable['isDrm'] != drm_streams:\n@@ -238,7 +240,8 @@ def _convert_text_track(text_track, period, default):\nadaptation_set, # Parent\n'Representation', # Tag\nnflxProfile=content_profile)\n- _add_base_url(representation, list(downloadable[content_profile]['downloadUrls'].values())[0])\n+ _add_base_url(representation,\n+ list(downloadable[content_profile]['downloadUrls'].values())[0])\ndef _add_base_url(representation, base_url):\n@@ -254,31 +257,36 @@ def _add_segment_base(representation, init_length):\ndef _get_default_audio_language(manifest):\n- channelList = {'1.0': '1', '2.0': '2'}\n- channelListDolby = {'5.1': '6', '7.1': '8'}\n+ channel_list = {'1.0': '1', '2.0': '2'}\n+ channel_list_dolby = {'5.1': '6', '7.1': '8'}\naudio_language = common.get_kodi_audio_language()\n-\n+ index = 0\n# Try to find the preferred language with the right channels\nif g.ADDON.getSettingBool('enable_dolby_sound'):\n- for index, audio_track in enumerate(manifest['audio_tracks']):\n- if audio_track['language'] == audio_language and audio_track['channels'] in channelListDolby:\n- return index\n+ index = _find_audio_track_index(manifest, 'language', audio_language, channel_list_dolby)\n+\n# If dolby audio track not exists check other channels list\n- for index, audio_track in enumerate(manifest['audio_tracks']):\n- if audio_track['language'] == audio_language and audio_track['channels'] in channelList:\n- return index\n- # If there is no matches to preferred language, try to sets the original language track as default\n+ if index is None:\n+ index = _find_audio_track_index(manifest, 'language', audio_language, channel_list)\n+\n+ # If there is no matches to preferred language,\n+ # try to sets the original language track as default\n# Check if the dolby audio track in selected language exists\n- if g.ADDON.getSettingBool('enable_dolby_sound'):\n- for index, audio_track in enumerate(manifest['audio_tracks']):\n- if audio_track['isNative'] and audio_track['channels'] in channelListDolby:\n- return index\n+ if index is None and g.ADDON.getSettingBool('enable_dolby_sound'):\n+ index = _find_audio_track_index(manifest, 'isNative', True, channel_list_dolby)\n+\n# If dolby audio track not exists check other channels list\n+ if index is None:\n+ index = _find_audio_track_index(manifest, 'isNative', True, channel_list)\n+ return index\n+\n+\n+def _find_audio_track_index(manifest, property_name, property_value, channel_list):\nfor index, audio_track in enumerate(manifest['audio_tracks']):\n- if audio_track['isNative'] and audio_track['channels'] in channelList:\n+ if audio_track[property_name] == property_value and audio_track['channels'] in channel_list:\nreturn index\n- return 0\n+ return None\ndef _get_default_subtitle_language(manifest):\n@@ -298,10 +306,12 @@ def _get_default_subtitle_language(manifest):\n# When we set \"forced only\" subtitles in Kodi Player, Kodi use this behavior:\n# 1) try to select forced subtitle that matches audio language\n# 2) when missing, try to select the first \"regular\" subtitle that matches audio language\n- # This Kodi behavior is totally non sense. If forced is selected you must not view the regular subtitles\n+ # This Kodi behavior is totally non sense.\n+ # If forced is selected you must not view the regular subtitles\n# There is no other solution than to disable the subtitles manually.\naudio_language = common.get_kodi_audio_language()\n- if not any(text_track.get('isForcedNarrative', False) is True and text_track['language'] == audio_language\n+ if not any(text_track.get('isForcedNarrative', False) is True and\n+ text_track['language'] == audio_language\nfor text_track in manifest['timedtexttracks']):\nxbmc.Player().showSubtitles(False)\n"
}
]
| Python | MIT License | castagnait/plugin.video.netflix | code climate: avoid too many return statements |
106,046 | 09.12.2019 14:21:58 | -3,600 | 4ca3e78e1b024fc60e8e31b283642f973e407e65 | code climate: number of line exceeded | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/globals.py",
"new_path": "resources/lib/globals.py",
"diff": "@@ -240,6 +240,18 @@ class GlobalVariables(object):\nself.IPC_OVER_HTTP = self.ADDON.getSettingBool('enable_ipc_over_http')\nif not skip_database_initialize:\n+ self._init_database()\n+\n+ self.settings_monitor_suspend(False) # Reset the value in case of addon crash\n+\n+ try:\n+ os.mkdir(self.DATA_PATH)\n+ except OSError:\n+ pass\n+\n+ self._init_cache()\n+\n+ def _init_database(self):\n# Initialize local database\nimport resources.lib.database.db_local as db_local\nself.LOCAL_DB = db_local.NFLocalDatabase()\n@@ -259,15 +271,6 @@ class GlobalVariables(object):\nshared_db_class = db_shared.get_shareddb_class(force_sqlite=True)\nself.SHARED_DB = shared_db_class()\n- self.settings_monitor_suspend(False) # Reset the value in case of addon crash\n-\n- try:\n- os.mkdir(self.DATA_PATH)\n- except OSError:\n- pass\n-\n- self._init_cache()\n-\ndef _init_cache(self):\nif not os.path.exists(g.py2_decode(xbmc.translatePath(self.CACHE_PATH))):\nself._init_filesystem_cache()\n"
}
]
| Python | MIT License | castagnait/plugin.video.netflix | code climate: number of line exceeded |
106,046 | 09.12.2019 14:34:32 | -3,600 | 4e442c2d6f824135e273e26b674a330cbd8a8804 | code climate: exceeded arguments | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/kodi/infolabels.py",
"new_path": "resources/lib/kodi/infolabels.py",
"diff": "@@ -188,28 +188,28 @@ def parse_art(videoid, item, raw_data): # pylint: disable=unused-argument\nfanart = common.get_path_safe(\npaths.ART_PARTIAL_PATHS[4] + [0, 'url'], item)\nreturn assign_art(videoid,\n- boxarts[paths.ART_SIZE_FHD],\n- boxarts[paths.ART_SIZE_SD],\n- boxarts[paths.ART_SIZE_POSTER],\n- interesting_moment,\n- clearlogo,\n- fanart)\n+ boxart_large=boxarts[paths.ART_SIZE_FHD],\n+ boxart_small=boxarts[paths.ART_SIZE_SD],\n+ poster=boxarts[paths.ART_SIZE_POSTER],\n+ interesting_moment=interesting_moment,\n+ clearlogo=clearlogo,\n+ fanart=fanart)\n-def assign_art(videoid, boxart_large, boxart_small, poster, interesting_moment,\n- clearlogo, fanart):\n+def assign_art(videoid, **kwargs):\n\"\"\"Assign the art available from Netflix to appropriate Kodi art\"\"\"\n- # pylint: disable=too-many-arguments\n- art = {'poster': _best_art([poster]),\n- 'fanart': _best_art([fanart, interesting_moment, boxart_large,\n- boxart_small]),\n- 'thumb': ((interesting_moment\n+ art = {'poster': _best_art([kwargs['poster']]),\n+ 'fanart': _best_art([kwargs['fanart'],\n+ kwargs['interesting_moment'],\n+ kwargs['boxart_large'],\n+ kwargs['boxart_small']]),\n+ 'thumb': ((kwargs['interesting_moment']\nif videoid.mediatype == common.VideoId.EPISODE or\nvideoid.mediatype == common.VideoId.SUPPLEMENTAL else '')\n- or boxart_large or boxart_small)}\n+ or kwargs['boxart_large'] or kwargs['boxart_small'])}\nart['landscape'] = art['thumb']\nif videoid.mediatype != common.VideoId.UNSPECIFIED:\n- art['clearlogo'] = _best_art([clearlogo])\n+ art['clearlogo'] = _best_art([kwargs['clearlogo']])\nreturn art\n"
}
]
| Python | MIT License | castagnait/plugin.video.netflix | code climate: exceeded arguments |
106,046 | 09.12.2019 17:04:01 | -3,600 | f5904a53d03c5d719cc0cc0d7f92639555a0bc87 | Moved parental control data extraction to website | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/api/website.py",
"new_path": "resources/lib/api/website.py",
"diff": "from __future__ import absolute_import, division, unicode_literals\nimport json\n-from re import compile as recompile, DOTALL, sub\n+from re import compile as recompile, DOTALL, sub, findall\nfrom collections import OrderedDict\nimport resources.lib.common as common\n@@ -277,3 +277,41 @@ def extract_json(content, name):\nimport traceback\ncommon.error(traceback.format_exc())\nraise WebsiteParsingError('Unable to extract {}'.format(name))\n+\n+\n+def extract_parental_control_data(content):\n+ \"\"\"Extract the content of parental control data\"\"\"\n+ html_ml_points = findall(r'<div class=\"maturity-input-item\\s.*?<\\/div>',\n+ content.decode('utf-8'))\n+ maturity_levels = []\n+ maturity_names = []\n+ current_level = -1\n+ for ml_point in html_ml_points:\n+ is_included = bool(findall(r'class=\"maturity-input-item[^\"<>]*?included', ml_point))\n+ value = findall(r'value=\"(\\d+)\"', ml_point)\n+ name = findall(r'<span class=\"maturity-name\">([^\"]+?)<\\/span>', ml_point)\n+ rating = findall(r'<li[^<>]+class=\"pin-rating-item\">([^\"]+?)<\\/li>', ml_point)\n+ if not value:\n+ raise WebsiteParsingError('Unable to find maturity level value: {}'.format(ml_point))\n+ if name:\n+ maturity_names.append({\n+ 'name': name[0],\n+ 'rating': '[CR][' + rating[0] + ']' if rating else ''\n+ })\n+ maturity_levels.append({\n+ 'level': len(maturity_levels),\n+ 'value': value[0],\n+ 'is_included': is_included\n+ })\n+ if is_included:\n+ current_level += 1\n+ if not html_ml_points:\n+ raise WebsiteParsingError('Unable to find html maturity level points')\n+ if not maturity_levels:\n+ raise WebsiteParsingError('Unable to find maturity levels')\n+ if not maturity_names:\n+ raise WebsiteParsingError('Unable to find maturity names')\n+ common.debug('Parsed maturity levels: {}', maturity_levels)\n+ common.debug('Parsed maturity names: {}', maturity_names)\n+ return {'maturity_levels': maturity_levels, 'maturity_names': maturity_names,\n+ 'current_level': current_level}\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/nfsession/nfsession.py",
"new_path": "resources/lib/services/nfsession/nfsession.py",
"diff": "@@ -343,42 +343,10 @@ class NetflixSession(object):\n# Warning - parental control levels vary by country or region, no fixed values can be used\n# I have not found how to get it through the API, so parse web page to get all info\n# Note: The language of descriptions change in base of the language of selected profile\n- pin_response = self._get('pin', data={'password': password})\n- from re import findall\n- html_ml_points = findall(r'<div class=\"maturity-input-item\\s.*?<\\/div>',\n- pin_response.decode('utf-8'))\n- maturity_levels = []\n- maturity_names = []\n- current_level = -1\n- for ml_point in html_ml_points:\n- is_included = bool(findall(r'class=\"maturity-input-item[^\"<>]*?included', ml_point))\n- value = findall(r'value=\"(\\d+)\"', ml_point)\n- name = findall(r'<span class=\"maturity-name\">([^\"]+?)<\\/span>', ml_point)\n- rating = findall(r'<li[^<>]+class=\"pin-rating-item\">([^\"]+?)<\\/li>', ml_point)\n- if not value:\n- raise WebsiteParsingError('Unable to find maturity level value: {}'.format(ml_point))\n- if name:\n- maturity_names.append({\n- 'name': name[0],\n- 'rating': '[CR][' + rating[0] + ']' if rating else ''\n- })\n- maturity_levels.append({\n- 'level': len(maturity_levels),\n- 'value': value[0],\n- 'is_included': is_included\n- })\n- if is_included:\n- current_level += 1\n- if not html_ml_points:\n- raise WebsiteParsingError('Unable to find html maturity level points')\n- if not maturity_levels:\n- raise WebsiteParsingError('Unable to find maturity levels')\n- if not maturity_names:\n- raise WebsiteParsingError('Unable to find maturity names')\n- common.debug('Parsed maturity levels: {}', maturity_levels)\n- common.debug('Parsed maturity names: {}', maturity_names)\n- return {'pin': pin, 'maturity_levels': maturity_levels, 'maturity_names': maturity_names,\n- 'current_level': current_level}\n+ response_content = self._get('pin', data={'password': password})\n+ extracted_content = website.extract_parental_control_data(response_content)\n+ extracted_content['pin'] = pin\n+ return extracted_content\n@common.addonsignals_return_call\n@common.time_execution(immediate=True)\n"
}
]
| Python | MIT License | castagnait/plugin.video.netflix | Moved parental control data extraction to website |
106,046 | 10.12.2019 11:21:58 | -3,600 | e262dc7abf2359b85abc559651fbf2c8882001c5 | prefetch_login is not as internal method | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/nfsession/nfsession.py",
"new_path": "resources/lib/services/nfsession/nfsession.py",
"diff": "@@ -43,7 +43,7 @@ class NetflixSession(NFSessionAccess):\ncommon.register_slot(slot)\ncommon.register_slot(play_callback, signal=g.ADDON_ID + '_play_action',\nsource_id='upnextprovider')\n- self._prefetch_login()\n+ self.prefetch_login()\n@common.addonsignals_return_call\n@needs_login\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/nfsession/nfsession_access.py",
"new_path": "resources/lib/services/nfsession/nfsession_access.py",
"diff": "@@ -34,7 +34,7 @@ class NFSessionAccess(NFSessionRequests, NFSessionCookie):\n\"\"\"Handle the authentication access\"\"\"\n@common.time_execution(immediate=True)\n- def _prefetch_login(self):\n+ def prefetch_login(self):\n\"\"\"Check if we have stored credentials.\nIf so, do the login before the user requests it\"\"\"\ntry:\n"
}
]
| Python | MIT License | castagnait/plugin.video.netflix | prefetch_login is not as internal method |
106,046 | 10.12.2019 14:32:27 | -3,600 | 34f3b70481df30d40b27c2892f64a78285638952 | Subtitle property adj for future versions of InputStream Adaptive
allow to show/set multiple property to each subtitle track | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/msl/converter.py",
"new_path": "resources/lib/services/msl/converter.py",
"diff": "from __future__ import absolute_import, division, unicode_literals\nimport uuid\nimport xml.etree.ElementTree as ET\n-import xbmc\nfrom resources.lib.globals import g\nimport resources.lib.common as common\n@@ -18,6 +17,8 @@ import resources.lib.common as common\ndef convert_to_dash(manifest):\n\"\"\"Convert a Netflix style manifest to MPEGDASH manifest\"\"\"\n+ from xbmcaddon import Addon\n+ isa_version = Addon('inputstream.adaptive').getAddonInfo('version')\nseconds = manifest['duration'] / 1000\ninit_length = seconds / 2 * 12 + 20 * 1000\nduration = \"PT\" + str(seconds) + \".00S\"\n@@ -43,8 +44,8 @@ def convert_to_dash(manifest):\nfor index, text_track in enumerate(manifest['timedtexttracks']):\nif text_track['isNoneTrack']:\ncontinue\n- _convert_text_track(text_track, period,\n- default=(index == default_subtitle_language_index))\n+ _convert_text_track(text_track, period, (index == default_subtitle_language_index),\n+ isa_version)\nxml = ET.tostring(root, encoding='utf-8', method='xml')\ncommon.save_file('manifest.mpd', xml)\n@@ -210,7 +211,7 @@ def _convert_audio_downloadable(downloadable, adaptation_set, init_length,\n_add_segment_base(representation, init_length)\n-def _convert_text_track(text_track, period, default):\n+def _convert_text_track(text_track, period, default, isa_version):\nif text_track.get('ttDownloadables'):\n# Only one subtitle representation per adaptationset\ndownloadable = text_track['ttDownloadables']\n@@ -218,6 +219,9 @@ def _convert_text_track(text_track, period, default):\ncontent_profile = list(downloadable)[0]\nis_ios8 = content_profile == 'webvtt-lssdh-ios8'\n+ impaired = 'true' if text_track['trackType'] == 'ASSISTIVE' else 'false'\n+ forced = 'true' if text_track['isForcedNarrative'] else 'false'\n+ default = 'true' if default else 'false'\nadaptation_set = ET.SubElement(\nperiod, # Parent\n@@ -230,11 +234,20 @@ def _convert_text_track(text_track, period, default):\nadaptation_set, # Parent\n'Role', # Tag\nschemeIdUri='urn:mpeg:dash:role:2011')\n- if text_track.get('isForcedNarrative'):\n- role.set(\"value\", \"forced\")\n+ # In the future version of InputStream Adaptive, you can set the stream parameters\n+ # in the same way as the video stream\n+ if common.is_less_version(isa_version, '2.4.3'):\n+ # To be removed when the new version is released\n+ if forced == 'true':\n+ role.set('value', 'forced')\n+ else:\n+ if default == 'true':\n+ role.set('value', 'main')\nelse:\n- if default:\n- role.set(\"value\", \"main\")\n+ adaptation_set.set('impaired', impaired)\n+ adaptation_set.set('forced', forced)\n+ adaptation_set.set('default', default)\n+ role.set('value', 'subtitle')\nrepresentation = ET.SubElement(\nadaptation_set, # Parent\n@@ -291,29 +304,16 @@ def _find_audio_track_index(manifest, property_name, property_value, channel_lis\ndef _get_default_subtitle_language(manifest):\nsubtitle_language = common.get_kodi_subtitle_language()\n- if subtitle_language != 'forced_only':\n+ is_forced = subtitle_language == 'forced_only'\n+ if is_forced:\n+ subtitle_language = common.get_kodi_audio_language()\nfor index, text_track in enumerate(manifest['timedtexttracks']):\nif text_track['isNoneTrack']:\ncontinue\n- if text_track.get('isForcedNarrative'):\n+ if text_track.get('isForcedNarrative', False) != is_forced:\ncontinue\nif text_track['language'] != subtitle_language:\ncontinue\nreturn index\n- return -1\n-\n- if g.ADDON.getSettingBool('forced_subtitle_workaround'):\n- # When we set \"forced only\" subtitles in Kodi Player, Kodi use this behavior:\n- # 1) try to select forced subtitle that matches audio language\n- # 2) when missing, try to select the first \"regular\" subtitle that matches audio language\n- # This Kodi behavior is totally non sense.\n- # If forced is selected you must not view the regular subtitles\n- # There is no other solution than to disable the subtitles manually.\n- audio_language = common.get_kodi_audio_language()\n- if not any(text_track.get('isForcedNarrative', False) is True and\n- text_track['language'] == audio_language\n- for text_track in manifest['timedtexttracks']):\n- xbmc.Player().showSubtitles(False)\n-\n# Leave the selection of forced subtitles to Kodi\nreturn -1\n"
}
]
| Python | MIT License | castagnait/plugin.video.netflix | Subtitle property adj for future versions of InputStream Adaptive
-allow to show/set multiple property to each subtitle track |
106,046 | 10.12.2019 16:59:38 | -3,600 | c6b0305d6bb8e1e87610062d70c458ebb164a0fe | Fixed stream continuity after | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/playback/stream_continuity.py",
"new_path": "resources/lib/services/playback/stream_continuity.py",
"diff": "@@ -46,6 +46,7 @@ class StreamContinuityManager(PlaybackActionManager):\nsuper(StreamContinuityManager, self).__init__()\nself.current_videoid = None\nself.current_streams = {}\n+ self.sc_settings = {}\nself.player = xbmc.Player()\nself.player_state = {}\nself.did_restore = False\n@@ -53,36 +54,26 @@ class StreamContinuityManager(PlaybackActionManager):\nself.legacy_kodi_version = bool('18.' in common.GetKodiVersion().version)\nself.kodi_only_forced_subtitles = None\n- @property\n- def sc_settings(self):\n- \"\"\"Read stored stream settings for the current videoid\"\"\"\n- return g.SHARED_DB.get_stream_continuity(g.LOCAL_DB.get_active_profile_guid(),\n- self.current_videoid.value, {})\n-\n- @sc_settings.setter\n- def sc_settings(self, value):\n- \"\"\"Save stream settings for the current videoid\"\"\"\n- g.SHARED_DB.set_stream_continuity(g.LOCAL_DB.get_active_profile_guid(),\n- self.current_videoid.value,\n- value)\n-\ndef _initialize(self, data):\n- videoid = common.VideoId.from_dict(data['videoid'])\n- if videoid.mediatype in [common.VideoId.MOVIE, common.VideoId.EPISODE]:\nself.did_restore = False\n+ videoid = common.VideoId.from_dict(data['videoid'])\n+ if videoid.mediatype not in [common.VideoId.MOVIE, common.VideoId.EPISODE]:\n+ self.enabled = False\n+ return\nself.current_videoid = videoid \\\nif videoid.mediatype == common.VideoId.MOVIE \\\nelse videoid.derive_parent(0)\n- else:\n- self.enabled = False\n+ self.sc_settings = g.SHARED_DB.get_stream_continuity(g.LOCAL_DB.get_active_profile_guid(),\n+ self.current_videoid.value, {})\nself.kodi_only_forced_subtitles = common.get_kodi_subtitle_language() == 'forced_only'\ndef _on_playback_started(self, player_state):\nxbmc.sleep(500) # Wait for slower systems\nself.player_state = player_state\n- if self.legacy_kodi_version and g.ADDON.getSettingBool('forced_subtitle_workaround') and \\\n- self.kodi_only_forced_subtitles:\n- # --- VARIABLE ONLY FOR KODI VERSION 18 ---\n+ if self.kodi_only_forced_subtitles and g.ADDON.getSettingBool('forced_subtitle_workaround')\\\n+ and self.sc_settings.get('subtitleenabled') is None:\n+ # Use the forced subtitle workaround if enabled\n+ # and if user did not change the subtitle setting\nself._show_only_forced_subtitle()\nfor stype in sorted(STREAMS):\n# Save current stream info from the player to local dict\n@@ -113,12 +104,15 @@ class StreamContinuityManager(PlaybackActionManager):\ncurrent_stream = self.current_streams['subtitle']\nplayer_stream = player_state.get(STREAMS['subtitle']['current'])\nis_sub_stream_equal = self._is_stream_value_equal(current_stream, player_stream)\n+\ncurrent_sub_enabled = self.current_streams['subtitleenabled']\nplayer_sub_enabled = player_state.get(STREAMS['subtitleenabled']['current'])\nis_sub_enabled_equal = self._is_stream_value_equal(current_sub_enabled, player_sub_enabled)\n+\nif not is_sub_stream_equal or not is_sub_enabled_equal:\nself._set_current_stream('subtitle', player_state)\nself._save_changed_stream('subtitle', player_stream)\n+\nself._set_current_stream('subtitleenabled', player_state)\nself._save_changed_stream('subtitleenabled', player_sub_enabled)\nif not is_sub_stream_equal:\n@@ -171,9 +165,10 @@ class StreamContinuityManager(PlaybackActionManager):\ndef _save_changed_stream(self, stype, stream):\ncommon.debug('Save changed stream {} for {}', stream, stype)\n- new_sc_settings = self.sc_settings.copy()\n- new_sc_settings[stype] = stream\n- self.sc_settings = new_sc_settings\n+ self.sc_settings[stype] = stream\n+ g.SHARED_DB.set_stream_continuity(g.LOCAL_DB.get_active_profile_guid(),\n+ self.current_videoid.value,\n+ self.sc_settings)\ndef _find_stream_index(self, streams, stored_stream):\n\"\"\"\n@@ -237,7 +232,6 @@ class StreamContinuityManager(PlaybackActionManager):\nreturn streams[0]['index'] if streams else None\ndef _show_only_forced_subtitle(self):\n- # --- ONLY FOR KODI VERSION 18 ---\n# Forced stream not found, then fix Kodi bug if user chose to apply the workaround\n# Kodi bug???:\n# If the kodi player is set with \"forced only\" subtitle setting, Kodi use this behavior:\n@@ -248,15 +242,23 @@ class StreamContinuityManager(PlaybackActionManager):\n# So can cause a wrong subtitle language or in a permanent display of subtitles!\n# This does not reflect the setting chosen in the Kodi player and is very annoying!\n# There is no other solution than to disable the subtitles manually.\n- # NOTE: With Kodi 18 it is not possible to read the properties of the streams so the only\n- # possible way is to read the data from the manifest file\n+ audio_language = common.get_kodi_audio_language()\n+ if self.legacy_kodi_version:\n+ # --- ONLY FOR KODI VERSION 18 ---\n+ # NOTE: With Kodi 18 it is not possible to read the properties of the streams\n+ # so the only possible way is to read the data from the manifest file\nmanifest_data = json.loads(common.load_file('manifest.json'))\ncommon.fix_locale_languages(manifest_data['timedtexttracks'])\n- audio_language = common.get_kodi_audio_language()\nif not any(text_track.get('isForcedNarrative', False) is True and\ntext_track['language'] == audio_language\nfor text_track in manifest_data['timedtexttracks']):\nself.sc_settings.update({'subtitleenabled': False})\n+ else:\n+ # --- ONLY FOR KODI VERSION 19 ---\n+ # Check the current stream\n+ player_stream = self.player_state.get(STREAMS['subtitle']['current'])\n+ if not player_stream['isforced'] or player_stream['language'] != audio_language:\n+ self.sc_settings.update({'subtitleenabled': False})\ndef _is_stream_value_equal(self, stream_a, stream_b):\nif self.legacy_kodi_version:\n"
}
]
| Python | MIT License | castagnait/plugin.video.netflix | Fixed stream continuity after 34f3b70481df30d40b27c2892f64a7 |
106,046 | 10.12.2019 20:33:54 | -3,600 | 8e452635f55f86f7daf96b4a77eeee96f240f374 | Fixed wrong content type to lists of movies | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/globals.py",
"new_path": "resources/lib/globals.py",
"diff": "@@ -119,16 +119,14 @@ class GlobalVariables(object):\n'lolomo_known': False,\n'label_id': 30001,\n'description_id': 30094,\n- 'icon': 'DefaultUser.png',\n- 'content_type': CONTENT_FOLDER}),\n+ 'icon': 'DefaultUser.png'}),\n('tvshowsGenres', {'path': ['subgenres', 'tvshowsGenres', '83'],\n'lolomo_contexts': None,\n'lolomo_known': False,\n'request_context_name': 'genres', # Used for sub-menus\n'label_id': 30174,\n'description_id': None,\n- 'icon': 'DefaultTVShows.png',\n- 'content_type': CONTENT_FOLDER}),\n+ 'icon': 'DefaultTVShows.png'}),\n('moviesGenres', {'path': ['subgenres', 'moviesGenres', '34399'],\n'lolomo_contexts': None,\n'lolomo_known': False,\n@@ -136,15 +134,14 @@ class GlobalVariables(object):\n'label_id': 30175,\n'description_id': None,\n'icon': 'DefaultMovies.png',\n- 'content_type': CONTENT_FOLDER}),\n+ 'content_type': CONTENT_MOVIE}),\n('tvshows', {'path': ['genres', 'tvshows', '83'],\n'lolomo_contexts': None,\n'lolomo_known': False,\n'request_context_name': 'genres', # Used for sub-menus\n'label_id': 30095,\n'description_id': None,\n- 'icon': 'DefaultTVShows.png',\n- 'content_type': CONTENT_FOLDER}),\n+ 'icon': 'DefaultTVShows.png'}),\n('movies', {'path': ['genres', 'movies', '34399'],\n'lolomo_contexts': None,\n'lolomo_known': False,\n@@ -152,15 +149,14 @@ class GlobalVariables(object):\n'label_id': 30096,\n'description_id': None,\n'icon': 'DefaultMovies.png',\n- 'content_type': CONTENT_FOLDER}),\n+ 'content_type': CONTENT_MOVIE}),\n('genres', {'path': ['genres', 'genres'],\n'lolomo_contexts': ['genre'],\n'lolomo_known': False,\n'request_context_name': 'genres', # Used for sub-menus\n'label_id': 30010,\n'description_id': 30093,\n- 'icon': 'DefaultGenre.png',\n- 'content_type': CONTENT_FOLDER}),\n+ 'icon': 'DefaultGenre.png'}),\n('search', {'path': ['search', 'search'],\n'lolomo_contexts': None,\n'lolomo_known': False,\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/kodi/listings.py",
"new_path": "resources/lib/kodi/listings.py",
"diff": "@@ -171,7 +171,7 @@ def build_lolomo_listing(lolomo, menu_data, force_videolistbyid=False, exclude_l\nsub_menu_data['path'] = [menu_data['path'][0], sel_video_list_id, sel_video_list_id]\nsub_menu_data['lolomo_known'] = False\nsub_menu_data['lolomo_contexts'] = None\n- sub_menu_data['content_type'] = g.CONTENT_SHOW\n+ sub_menu_data['content_type'] = menu_data.get('content_type', g.CONTENT_SHOW)\nsub_menu_data['force_videolistbyid'] = force_videolistbyid\nsub_menu_data['main_menu'] = menu_data['main_menu']\\\nif menu_data.get('main_menu') else menu_data.copy()\n@@ -182,7 +182,7 @@ def build_lolomo_listing(lolomo, menu_data, force_videolistbyid=False, exclude_l\nsub_menu_data))\nparent_menu_data = g.LOCAL_DB.get_value(menu_data['path'][1],\ntable=TABLE_MENU_DATA, data_type=dict)\n- finalize_directory(directory_items, menu_data.get('content_type', g.CONTENT_SHOW),\n+ finalize_directory(directory_items, g.CONTENT_FOLDER,\ntitle=parent_menu_data['title'],\nsort_type='sort_label')\nreturn menu_data.get('view')\n@@ -228,7 +228,7 @@ def build_subgenre_listing(subgenre_list, menu_data):\nsub_menu_data['path'] = [menu_data['path'][0], sel_video_list_id, sel_video_list_id]\nsub_menu_data['lolomo_known'] = False\nsub_menu_data['lolomo_contexts'] = None\n- sub_menu_data['content_type'] = g.CONTENT_SHOW\n+ sub_menu_data['content_type'] = menu_data.get('content_type', g.CONTENT_SHOW)\nsub_menu_data['main_menu'] = menu_data['main_menu']\\\nif menu_data.get('main_menu') else menu_data.copy()\nsub_menu_data.update({'title': subgenre_data['name']})\n@@ -238,7 +238,7 @@ def build_subgenre_listing(subgenre_list, menu_data):\nsub_menu_data))\nparent_menu_data = g.LOCAL_DB.get_value(menu_data['path'][1],\ntable=TABLE_MENU_DATA, data_type=dict)\n- finalize_directory(directory_items, menu_data.get('content_type', g.CONTENT_SHOW),\n+ finalize_directory(directory_items, g.CONTENT_FOLDER,\ntitle=parent_menu_data['title'],\nsort_type='sort_label')\nreturn menu_data.get('view')\n@@ -269,7 +269,7 @@ def build_video_listing(video_list, menu_data, pathitems=None, genre_id=None):\nsub_menu_data['path'] = [menu_data['path'][0], menu_id, genre_id]\nsub_menu_data['lolomo_known'] = False\nsub_menu_data['lolomo_contexts'] = None\n- sub_menu_data['content_type'] = g.CONTENT_SHOW\n+ sub_menu_data['content_type'] = menu_data.get('content_type', g.CONTENT_SHOW)\nsub_menu_data['main_menu'] = menu_data['main_menu']\\\nif menu_data.get('main_menu') else menu_data.copy()\nsub_menu_data.update({'title': common.get_local_string(30089)})\n"
}
]
| Python | MIT License | castagnait/plugin.video.netflix | Fixed wrong content type to lists of movies |
106,046 | 11.12.2019 10:55:31 | -3,600 | 465a7548ae350887e199822d58f7563de4f5e106 | Workaround to intercept skin widget calls
This freeze the add-on instance until service starts,
this is not a safe solution because depends on which window is open,
for now there is no better solution | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/run_addon.py",
"new_path": "resources/lib/run_addon.py",
"diff": "@@ -10,6 +10,7 @@ from __future__ import absolute_import, division, unicode_literals\nfrom functools import wraps\n+from xbmc import getCondVisibility, Monitor\nfrom xbmcgui import Window\nfrom resources.lib.globals import g\n@@ -65,6 +66,34 @@ def route(pathitems):\nexecute(_get_nav_handler(root_handler), pathitems[1:], g.REQUEST_PARAMS)\n+def _skin_widget_call(window_cls):\n+ \"\"\"\n+ Workaround to intercept calls made by the Skin Widgets currently in use.\n+ Currently, the Skin widgets associated with add-ons are executed at Kodi startup immediately\n+ without respecting any services needed by the add-ons. This is causing different\n+ kinds of problems like widgets not loaded, add-on warning message, etc...\n+ this loop freeze the add-on instance until the service is ready.\n+ \"\"\"\n+ # Note to \"Window.IsMedia\":\n+ # All widgets will be either on Home or in a Custom Window, so \"Window.IsMedia\" will be false\n+ # When the user is browsing the plugin, Window.IsMedia will be true because video add-ons open\n+ # in MyVideoNav.xml (which is a Media window)\n+ # This is not a safe solution, because DEPENDS ON WHICH WINDOW IS OPEN,\n+ # for example it can fail if you open add-on video browser while widget is still loading.\n+ # Needed a proper solution by script.skinshortcuts / script.skin.helper.service, and forks\n+ limit_sec = 10\n+ if not getCondVisibility(\"Window.IsMedia\"):\n+ monitor = Monitor()\n+ sec_elapsed = 0\n+ while not window_cls.getProperty('nf_service_status') == 'running':\n+ if sec_elapsed >= limit_sec or monitor.abortRequested() or monitor.waitForAbort(0.5):\n+ break\n+ sec_elapsed += 0.5\n+ debug('Skin widget workaround enabled - time elapsed: {}', sec_elapsed)\n+ return True\n+ return False\n+\n+\ndef _get_nav_handler(root_handler):\nnav_handler = None\nif root_handler == g.MODE_DIRECTORY:\n@@ -117,7 +146,10 @@ def run(argv):\nsuccess = True\nwindow_cls = Window(10000)\n- if not bool(window_cls.getProperty('is_service_running')):\n+ is_widget_skin_call = _skin_widget_call(window_cls)\n+\n+ if window_cls.getProperty('nf_service_status') != 'running':\n+ if not is_widget_skin_call:\nfrom resources.lib.kodi.ui import show_backend_not_ready\nshow_backend_not_ready()\nsuccess = False\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/run_service.py",
"new_path": "resources/lib/run_service.py",
"diff": "@@ -74,7 +74,7 @@ class NetflixService(object):\n# Mark the service as active\nfrom xbmcgui import Window\nwindow_cls = Window(10000)\n- window_cls.setProperty('is_service_running', 'true')\n+ window_cls.setProperty('nf_service_status', 'running')\nif not g.ADDON.getSettingBool('disable_startup_notification'):\nfrom resources.lib.kodi.ui import show_notification\nshow_notification(get_local_string(30110))\n@@ -83,6 +83,9 @@ class NetflixService(object):\n\"\"\"\nStop the background services\n\"\"\"\n+ from xbmcgui import Window\n+ window_cls = Window(10000)\n+ window_cls.setProperty('nf_service_status', 'stopped')\nfor server in self.SERVERS:\nserver['instance'].server_close()\nserver['instance'].shutdown()\n@@ -97,6 +100,9 @@ class NetflixService(object):\ntry:\nself.start_services()\nexcept Exception as exc:\n+ from xbmcgui import Window\n+ window_cls = Window(10000)\n+ window_cls.setProperty('nf_service_status', 'stopped')\nimport traceback\nfrom resources.lib.kodi.ui import show_addon_error_info\nerror(traceback.format_exc())\n"
}
]
| Python | MIT License | castagnait/plugin.video.netflix | Workaround to intercept skin widget calls
This freeze the add-on instance until service starts,
this is not a safe solution because depends on which window is open,
for now there is no better solution |
106,046 | 12.12.2019 17:41:42 | -3,600 | 194b7b2db7c0a64360ab4e99f05797f8ce072d1d | Allow to distinguish dolby atmos streams | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/msl/converter.py",
"new_path": "resources/lib/services/msl/converter.py",
"diff": "@@ -181,6 +181,10 @@ def _convert_audio_track(audio_track, period, init_length, default, drm_streams)\nimpaired=impaired,\noriginal=original,\ndefault=default)\n+ if audio_track['profile'].startswith('ddplus-atmos'):\n+ # Append 'ATMOS' description to the dolby atmos streams,\n+ # allows users to distinguish the atmos tracks in the audio stream dialog\n+ adaptation_set.set('name', 'ATMOS')\nfor downloadable in audio_track['streams']:\n# Some audio stream has no drm\n# if downloadable['isDrm'] != drm_streams:\n"
}
]
| Python | MIT License | castagnait/plugin.video.netflix | Allow to distinguish dolby atmos streams |
106,046 | 13.12.2019 17:21:06 | -3,600 | 2320171a6d410b683fe6e0229f5b7bddfb864218 | Updated user agent for windows | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/common/misc_utils.py",
"new_path": "resources/lib/common/misc_utils.py",
"diff": "@@ -109,7 +109,7 @@ def get_user_agent():\nreturn base.replace('%PL%', '(Macintosh; Intel Mac OS X 10_14_6)')\n# Windows\nif system == 'Windows':\n- return base.replace('%PL%', '(Windows NT 6.1; WOW64)')\n+ return base.replace('%PL%', '(Windows NT 10; Win64; x64)')\n# ARM based Linux\nif platform.machine().startswith('arm'):\n# Last number is the platform version of Chrome OS\n"
}
]
| Python | MIT License | castagnait/plugin.video.netflix | Updated user agent for windows |
106,046 | 13.12.2019 17:22:01 | -3,600 | 6703400a32ff83ad72573d71e069c266ba32c5ce | Updated some manifest parameters | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/msl/msl_handler.py",
"new_path": "resources/lib/services/msl/msl_handler.py",
"diff": "@@ -208,7 +208,9 @@ class MSLHandler(object):\n'drmVersion': 25,\n'usePsshBox': True,\n'isBranching': False,\n- 'useHttpsStreams': False,\n+ 'isNonMember': False,\n+ 'isUIAutoPlay': False,\n+ 'useHttpsStreams': True,\n'imageSubtitleHeight': 1080,\n'uiVersion': 'shakti-v93016808',\n'uiPlatform': 'SHAKTI',\n@@ -229,8 +231,7 @@ class MSLHandler(object):\n'supportedHdcpVersions': hdcp_version,\n'isHdcpEngaged': hdcp\n}],\n- 'preferAssistiveAudio': False,\n- 'isNonMember': False\n+ 'preferAssistiveAudio': False\n},\n'echo': ''\n}\n"
}
]
| Python | MIT License | castagnait/plugin.video.netflix | Updated some manifest parameters |
106,046 | 13.12.2019 19:19:53 | -3,600 | fa58e2e6eaa338628859f3158732ba65b503a976 | Changed library context menu behaviour
Allow exports a single season in manual mode library update
Do not allow library operations to the single episodes | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/kodi/context_menu.py",
"new_path": "resources/lib/kodi/context_menu.py",
"diff": "@@ -102,11 +102,14 @@ def generate_context_menu_items(videoid):\ndef _generate_library_ctx_items(videoid):\nlibrary_actions = []\n- if videoid.mediatype == common.VideoId.SUPPLEMENTAL:\n+ # Do not allow operations for supplemental (trailers etc) and single episodes\n+ if videoid.mediatype in [common.VideoId.SUPPLEMENTAL, common.VideoId.EPISODE]:\nreturn library_actions\nallow_lib_operations = True\n- lib_is_sync_with_mylist = g.ADDON.getSettingBool('lib_sync_mylist')\n+ lib_is_sync_with_mylist = g.ADDON.getSettingBool('lib_sync_mylist') and \\\n+ g.ADDON.getSettingInt('lib_auto_upd_mode') != 0\n+\nif lib_is_sync_with_mylist:\n# If the synchronization of Netflix \"My List\" with the Kodi library is enabled\n# only in the chosen profile allow to do operations in the Kodi library otherwise\n@@ -122,10 +125,6 @@ def _generate_library_ctx_items(videoid):\nlibrary_actions = ['update']\nelse:\nlibrary_actions = ['remove', 'update'] if _is_in_library else ['export']\n- # If auto-update mode is Manual and mediatype is season/episode do not allow operations\n- if g.ADDON.getSettingInt('lib_auto_upd_mode') == 0 and \\\n- videoid.mediatype in [common.VideoId.SEASON, common.VideoId.EPISODE]:\n- library_actions = []\nif videoid.mediatype == common.VideoId.SHOW and _is_in_library:\nlibrary_actions.append('export_new_episodes')\n"
}
]
| Python | MIT License | castagnait/plugin.video.netflix | Changed library context menu behaviour
Allow exports a single season in manual mode library update
Do not allow library operations to the single episodes |
106,046 | 14.12.2019 10:20:33 | -3,600 | 182a73f53c3deb8f0f3e42ec8dc62ceaeeab015b | Version bump (0.16.1) | [
{
"change_type": "MODIFY",
"old_path": "addon.xml",
"new_path": "addon.xml",
"diff": "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n-<addon id=\"plugin.video.netflix\" name=\"Netflix\" version=\"0.16.0\" provider-name=\"libdev + jojo + asciidisco + caphm + castagnait\">\n+<addon id=\"plugin.video.netflix\" name=\"Netflix\" version=\"0.16.1\" provider-name=\"libdev + jojo + asciidisco + caphm + castagnait\">\n<requires>\n<import addon=\"xbmc.python\" version=\"2.26.0\"/>\n<import addon=\"script.module.addon.signals\" version=\"0.0.3\"/>\n<forum>https://forum.kodi.tv/showthread.php?tid=329767</forum>\n<source>https://github.com/CastagnaIT/plugin.video.netflix</source>\n<news>\n+v0.16.1 (2019-12-14)\n+-Allowed to export individual seasons to the library (manual mode)\n+-Dolby atmos audio streams are now specified (Kodi 19)\n+-Added workaround to fix skin widgets\n+-Handled subtitle properties for next version of InputStream Adaptive\n+-Introduced accurate handling of subtitles (Kodi 19)\n+-Improved handling of subtitles (Kodi 18)\n+-Improved return to main page from search dialog\n+-Improved cancel login dialog after the logout\n+-Improved timeout on IPC over HTTP\n+-Fixed an issue that showed the wrong label while browsing movies\n+-Fixed ParentalControl/Rating GUI on custom skins\n+-Fixed an issue that cause unicodedecode error on some android devices\n+-Fixed an issue that can cause unicodedecode error in user/password\n+-Added japanese language\n+-Updated kr, hu, pt_br, fr\n+-Many improvements to the code\n+\nv0.16.0 (2019-11-29)\n-Added new parental control settings\n-Added new thumb rating to movies/tv shows\n@@ -65,17 +83,6 @@ v0.16.0 (2019-11-29)\n-New Hungarian language\n-Updated de, hr, it, pl, pt_br translations\n-Other minor improvements/fixes\n-\n-v0.15.11 (2019-11-20)\n--Fixed a critical error on auto-update\n--Fixed some error on py3\n--Fix to handle dolby vision on Kodi 19\n--Updated fr_fr, nl_nl translations\n--Minor fixes\n-\n-v0.15.10 (2019-11-17)\n--Fixed error in exporting to Kodi library due to wrong settings name\n--Updated de_de, pt_br translations\n</news>\n</extension>\n</addon>\n"
},
{
"change_type": "MODIFY",
"old_path": "changelog.txt",
"new_path": "changelog.txt",
"diff": "+v0.15.11 (2019-11-20)\n+-Fixed a critical error on auto-update\n+-Fixed some error on py3\n+-Fix to handle dolby vision on Kodi 19\n+-Updated fr_fr, nl_nl translations\n+-Minor fixes\n+\n+v0.15.10 (2019-11-17)\n+-Fixed error in exporting to Kodi library due to wrong settings name\n+-Updated de_de, pt_br translations\n+\nv0.15.9 (2019-11-16)\n-Removed limit to perform auto-update and auto-sync with my list only with main profile\n-Added possibility to choose the profile to perform auto-sync with my list\n"
}
]
| Python | MIT License | castagnait/plugin.video.netflix | Version bump (0.16.1) |
106,046 | 18.12.2019 20:09:06 | -3,600 | 16397520de7dea9adfd86134d63d1c98fbaeb05f | Removed per profile watched settings
No longer required | [
{
"change_type": "MODIFY",
"old_path": "resources/language/resource.language.en_gb/strings.po",
"new_path": "resources/language/resource.language.en_gb/strings.po",
"diff": "@@ -959,7 +959,3 @@ msgstr \"\"\nmsgctxt \"#30233\"\nmsgid \"Content for {} will require the PIN to start playback.\"\nmsgstr \"\"\n-\n-msgctxt \"#30234\"\n-msgid \"Keep watched status marks separate for each profile (this option will be removed in future versions)\"\n-msgstr \"\"\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/kodi/listings.py",
"new_path": "resources/lib/kodi/listings.py",
"diff": "@@ -477,15 +477,10 @@ def add_sort_methods(sort_type):\nxbmcplugin.addSortMethod(g.PLUGIN_HANDLE, xbmcplugin.SORT_METHOD_VIDEO_TITLE)\n-# This method is a temporary option transition for the current users to avoid causing frustration\n-# because when enabled causes the loss of all watched status already assigned to the videos,\n-# in future versions will have to be eliminated, keeping params.\ndef get_param_watched_status_by_profile():\n\"\"\"\n- When enabled, the value to be used as parameter in the ListItem (of videos) will be created,\n- in order to differentiate the watched status by profiles\n- :return: when enabled return a dictionary to be add to 'build_url' params\n+ Get a value used as parameter in the ListItem (of videos),\n+ in order to differentiate the watched status and other Kodi data by profiles\n+ :return: a dictionary to be add to 'build_url' params\n\"\"\"\n- if g.ADDON.getSettingBool('watched_status_by_profile'):\nreturn {'profile_guid': g.LOCAL_DB.get_active_profile_guid()}\n- return None\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/upgrade_controller.py",
"new_path": "resources/lib/upgrade_controller.py",
"diff": "@@ -48,17 +48,6 @@ def _perform_addon_changes(previous_ver, current_ver):\nmsg = ('This update resets the settings to auto-update library.\\r\\n'\n'Therefore only in case you are using auto-update must be reconfigured.')\nui.show_ok_dialog('Netflix upgrade', msg)\n- if previous_ver and is_less_version(previous_ver, '0.16.0'):\n- import resources.lib.kodi.ui as ui\n- msg = (\n- 'Has been introduced watched status marks for the videos separate for each profile:\\r\\n'\n- '[Use new feature] watched status will be separate by profile, [B]existing watched status will be lost.[/B]\\r\\n'\n- '[Leave unchanged] existing watched status will be kept, [B]but in future versions will be lost.[/B]\\r\\n'\n- 'This option can be temporarily changed in expert settings')\n- choice = ui.show_yesno_dialog('Netflix upgrade - watched status marks', msg,\n- 'Use new feature', 'Leave unchanged')\n- g.settings_monitor_suspend(at_first_change=True)\n- g.ADDON.setSettingBool('watched_status_by_profile', choice)\n# Clear cache (prevents problems when netflix change data structures)\ng.CACHE.invalidate(True)\n# Always leave this to last - After the operations set current version\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/settings.xml",
"new_path": "resources/settings.xml",
"diff": "<setting id=\"enable_timing\" type=\"bool\" label=\"30134\" default=\"false\"/>\n<setting id=\"disable_modal_error_display\" type=\"bool\" label=\"30130\" default=\"false\"/>\n<setting id=\"ssl_verification\" type=\"bool\" label=\"30024\" default=\"true\"/>\n- <setting id=\"watched_status_by_profile\" type=\"bool\" label=\"30234\" default=\"true\"/> <!-- This is a temporary transition option -->\n<setting label=\"30117\" type=\"lsep\"/><!--Cache-->\n<setting id=\"cache_ttl\" type=\"slider\" option=\"int\" range=\"0,10,525600\" label=\"30084\" default=\"120\"/>\n<setting id=\"cache_metadata_ttl\" type=\"slider\" option=\"int\" range=\"0,1,365\" label=\"30085\" default=\"30\"/>\n"
}
]
| Python | MIT License | castagnait/plugin.video.netflix | Removed per profile watched settings
No longer required |
106,046 | 19.12.2019 08:49:56 | -3,600 | 386a29beb3187c3ff28afabd57339dd2b68154c8 | Updated it, de translation | [
{
"change_type": "MODIFY",
"old_path": "resources/language/resource.language.it_it/strings.po",
"new_path": "resources/language/resource.language.it_it/strings.po",
"diff": "@@ -62,7 +62,7 @@ msgstr \"Accesso non riuscito\"\nmsgctxt \"#30009\"\nmsgid \"Please check your e-mail and password\"\n-msgstr \"Verifica le tue credenziali\"\n+msgstr \"Controlla la tua e-mail e password\"\nmsgctxt \"#30010\"\nmsgid \"Lists of all kinds\"\n"
}
]
| Python | MIT License | castagnait/plugin.video.netflix | Updated it, de translation |
106,046 | 22.12.2019 10:25:49 | -3,600 | cfeef642609468baec7c3da9f636aa100651f4fd | Some python 3 fixes | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/msl/android_crypto.py",
"new_path": "resources/lib/services/msl/android_crypto.py",
"diff": "@@ -59,7 +59,7 @@ class AndroidMSLCrypto(MSLBaseCrypto):\n# No key update supported -> remove existing keys\nself.crypto_session.RemoveKeys()\nkey_request = self.crypto_session.GetKeyRequest( # pylint: disable=assignment-from-none\n- bytes([10, 122, 0, 108, 56, 43]), 'application/xml', True, dict())\n+ bytearray([10, 122, 0, 108, 56, 43]), 'application/xml', True, dict())\nif not key_request:\nraise MSLError('Widevine CryptoSession getKeyRequest failed!')\n@@ -75,11 +75,12 @@ class AndroidMSLCrypto(MSLBaseCrypto):\ndef _provide_key_response(self, data):\nif not data:\nraise MSLError('Missing key response data')\n- self.keyset_id = self.crypto_session.ProvideKeyResponse(data) # pylint: disable=assignment-from-none\n+ self.keyset_id = self.crypto_session.ProvideKeyResponse(bytearray(data)) # pylint: disable=assignment-from-none\nif not self.keyset_id:\nraise MSLError('Widevine CryptoSession provideKeyResponse failed')\ncommon.debug('Widevine CryptoSession provideKeyResponse successful')\ncommon.debug('keySetId: {}', self.keyset_id)\n+ self.keyset_id = self.keyset_id.encode('utf-8')\ndef encrypt(self, plaintext, esn): # pylint: disable=unused-argument\n\"\"\"\n@@ -88,12 +89,12 @@ class AndroidMSLCrypto(MSLBaseCrypto):\n:return: Serialized JSON String of the encryption Envelope\n\"\"\"\nfrom os import urandom\n- init_vector = urandom(16)\n- plaintext = plaintext.encode('utf-8')\n+ init_vector = bytearray(urandom(16))\n# Add PKCS5Padding\npad = 16 - len(plaintext) % 16\n- padded_data = plaintext + str('').join([chr(pad)] * pad)\n- encrypted_data = self.crypto_session.Encrypt(self.key_id, padded_data,\n+ padded_data = plaintext + ''.join([chr(pad)] * pad)\n+ encrypted_data = self.crypto_session.Encrypt(bytearray(self.key_id),\n+ bytearray(padded_data.encode('utf-8')),\ninit_vector)\nif not encrypted_data:\n@@ -110,8 +111,8 @@ class AndroidMSLCrypto(MSLBaseCrypto):\ndef decrypt(self, init_vector, ciphertext):\n\"\"\"Decrypt a ciphertext\"\"\"\n- decrypted_data = self.crypto_session.Decrypt(self.key_id, ciphertext,\n- init_vector)\n+ decrypted_data = self.crypto_session.Decrypt(bytearray(self.key_id), bytearray(ciphertext),\n+ bytearray(init_vector))\nif not decrypted_data:\nraise MSLError('Widevine CryptoSession decrypt failed!')\n@@ -121,7 +122,8 @@ class AndroidMSLCrypto(MSLBaseCrypto):\ndef sign(self, message):\n\"\"\"Sign a message\"\"\"\n- signature = self.crypto_session.Sign(self.hmac_key_id, message.encode('utf-8'))\n+ signature = self.crypto_session.Sign(bytearray(self.hmac_key_id),\n+ bytearray(message.encode('utf-8')))\nif not signature:\nraise MSLError('Widevine CryptoSession sign failed!')\nreturn base64.standard_b64encode(signature).decode('utf-8')\n"
}
]
| Python | MIT License | castagnait/plugin.video.netflix | Some python 3 fixes |
106,046 | 29.12.2019 13:30:24 | -3,600 | fac54d0bee7b1827b4b744b7f4b0adcb101bec72 | Add season number in infolabel to season items | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/api/paths.py",
"new_path": "resources/lib/api/paths.py",
"diff": "@@ -71,11 +71,20 @@ EPISODES_PARTIAL_PATHS = [\n{'from': 0, 'to': 10}, ['id', 'name']]\n] + ART_PARTIAL_PATHS\n+TRAILER_PARTIAL_PATHS = [\n+ [['availability', 'summary', 'synopsis', 'title', 'trackId', 'delivery', 'runtime']]\n+] + ART_PARTIAL_PATHS\n+\n+VIDEO_LIST_RATING_THUMB_PATHS = [\n+ [['summary', 'title', 'userRating', 'trackIds']]\n+]\n+\nINFO_MAPPINGS = {\n'title': 'title',\n'year': 'releaseYear',\n'plot': 'synopsis',\n'season': ['summary', 'season'],\n+ 'season_shortname': ['summary', 'shortName'], # Add info to item listings._create_season_item\n'episode': ['summary', 'episode'],\n'rating': ['userRating', 'matchScore'],\n'userrating': ['userRating', 'userRating'],\n@@ -85,15 +94,8 @@ INFO_MAPPINGS = {\n# 'playcount': 'watched'\n}\n-TRAILER_PARTIAL_PATHS = [\n- [['availability', 'summary', 'synopsis', 'title', 'trackId', 'delivery', 'runtime']]\n-] + ART_PARTIAL_PATHS\n-\n-VIDEO_LIST_RATING_THUMB_PATHS = [\n- [['summary', 'title', 'userRating', 'trackIds']]\n-]\n-\nINFO_TRANSFORMATIONS = {\n+ 'season_shortname': lambda sn: ''.join([n for n in sn if n.isdigit()]),\n'rating': lambda r: r / 10,\n'playcount': lambda w: int(w) # pylint: disable=unnecessary-lambda\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/kodi/infolabels.py",
"new_path": "resources/lib/kodi/infolabels.py",
"diff": "@@ -123,10 +123,14 @@ def parse_info(videoid, item, raw_data):\ndef parse_atomic_infos(item):\n- \"\"\"Parse those infos into infolabels that are directly accesible from\n- the item dict\"\"\"\n- return {target: _get_and_transform(source, target, item)\n+ \"\"\"Parse those infos into infolabels that are directly accessible from the item dict\"\"\"\n+ infos = {target: _get_and_transform(source, target, item)\nfor target, source in iteritems(paths.INFO_MAPPINGS)}\n+ # When you browse the seasons list, season numbering is provided from a different property\n+ season_shortname = infos.pop('season_shortname')\n+ if season_shortname:\n+ infos.update({'season': season_shortname})\n+ return infos\ndef _get_and_transform(source, target, item):\n"
}
]
| Python | MIT License | castagnait/plugin.video.netflix | Add season number in infolabel to season items |
106,046 | 31.12.2019 18:16:06 | -3,600 | 09ac8d29f2b012c70120d7ece809b5ddda01a2aa | Handled not available metadata | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/api/exceptions.py",
"new_path": "resources/lib/api/exceptions.py",
"diff": "@@ -58,3 +58,7 @@ class APIError(Exception):\nclass NotConnected(Exception):\n\"\"\"Internet status not connected\"\"\"\n+\n+\n+class MetadataNotAvailable(Exception):\n+ \"\"\"Metadata not found\"\"\"\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/api/shakti.py",
"new_path": "resources/lib/api/shakti.py",
"diff": "@@ -22,7 +22,8 @@ from .paths import (VIDEO_LIST_PARTIAL_PATHS, VIDEO_LIST_BASIC_PARTIAL_PATHS,\nSEASONS_PARTIAL_PATHS, EPISODES_PARTIAL_PATHS, ART_PARTIAL_PATHS,\nGENRE_PARTIAL_PATHS, RANGE_SELECTOR, MAX_PATH_REQUEST_SIZE,\nTRAILER_PARTIAL_PATHS)\n-from .exceptions import (InvalidVideoListTypeError, APIError, MissingCredentialsError)\n+from .exceptions import (InvalidVideoListTypeError, APIError, MissingCredentialsError,\n+ MetadataNotAvailable)\ndef catch_api_errors(func):\n@@ -444,13 +445,20 @@ def _metadata(video_id):\nto a show by Netflix.\"\"\"\ncommon.debug('Requesting metadata for {}', video_id)\n# Always use params 'movieid' to all videoid identifier\n- return common.make_call(\n+ metadata_data = common.make_call(\n'get',\n{\n'component': 'metadata',\n'req_type': 'api',\n'params': {'movieid': video_id.value}\n- })['video']\n+ })\n+ if not metadata_data:\n+ # This return empty\n+ # - if the metadata is no longer available\n+ # - if it has been exported a tv show/movie from a specific language profile that is not\n+ # available using profiles with other languages\n+ raise MetadataNotAvailable\n+ return metadata_data['video']\n@common.time_execution(immediate=False)\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/common/misc_utils.py",
"new_path": "resources/lib/common/misc_utils.py",
"diff": "@@ -196,6 +196,8 @@ def execute_tasks(title, tasks, task_handler, **kwargs):\n# xbmc.sleep(25)\nif progress.iscanceled():\nbreak\n+ if not task:\n+ continue\ntry:\ntask_handler(task, **kwargs)\nexcept Exception as exc:\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/kodi/library_items.py",
"new_path": "resources/lib/kodi/library_items.py",
"diff": "@@ -19,6 +19,7 @@ import xbmcvfs\nimport resources.lib.api.shakti as api\nimport resources.lib.common as common\nimport resources.lib.kodi.ui as ui\n+from resources.lib.api.exceptions import MetadataNotAvailable\nfrom resources.lib.globals import g\nLIBRARY_HOME = 'library'\n@@ -118,6 +119,8 @@ def get_previously_exported_items():\n# and movies only contain one file\nresult.append(\n_get_root_videoid(filepath, videoid_pattern))\n+ except MetadataNotAvailable:\n+ common.warn('Metadata not available, item skipped')\nexcept (AttributeError, IndexError):\ncommon.warn('Item does not conform to old format')\nbreak\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/kodi/library_tasks.py",
"new_path": "resources/lib/kodi/library_tasks.py",
"diff": "@@ -16,6 +16,7 @@ import re\nimport resources.lib.api.shakti as api\nimport resources.lib.common as common\nimport resources.lib.kodi.nfo as nfo\n+from resources.lib.api.exceptions import MetadataNotAvailable\nfrom resources.lib.database.db_utils import (VidLibProp)\nfrom resources.lib.globals import g\nfrom resources.lib.kodi.library_items import (export_item, remove_item, export_new_item,\n@@ -27,7 +28,7 @@ def compile_tasks(videoid, task_handler, nfo_settings=None):\n\"\"\"Compile a list of tasks for items based on the videoid\"\"\"\ncommon.debug('Compiling library tasks for {}', videoid)\ntask = None\n-\n+ try:\nif task_handler == export_item:\nmetadata = api.metadata(videoid)\nif videoid.mediatype == common.VideoId.MOVIE:\n@@ -50,9 +51,12 @@ def compile_tasks(videoid, task_handler, nfo_settings=None):\ntask = _compile_remove_season_tasks(videoid)\nif videoid.mediatype == common.VideoId.EPISODE:\ntask = _create_remove_episode_task(videoid)\n-\n+ except MetadataNotAvailable:\n+ common.warn('compile_tasks: task_handler {} unavailable metadata for {} task skipped',\n+ task_handler, videoid)\n+ return [{}]\nif task is None:\n- common.debug('compile_tasks: task_handler {} did not match any task for {}',\n+ common.warn('compile_tasks: task_handler {} did not match any task for {}',\ntask_handler, videoid)\nreturn task\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/navigation/player.py",
"new_path": "resources/lib/navigation/player.py",
"diff": "@@ -13,6 +13,7 @@ import xbmc\nimport xbmcplugin\nimport xbmcgui\n+from resources.lib.api.exceptions import MetadataNotAvailable\nfrom resources.lib.globals import g\nimport resources.lib.common as common\nimport resources.lib.api.shakti as api\n@@ -51,8 +52,12 @@ class InputstreamError(Exception):\ndef play(videoid):\n\"\"\"Play an episode or movie as specified by the path\"\"\"\ncommon.info('Playing {}', videoid)\n+ metadata = [{}, {}]\n+ try:\nmetadata = api.metadata(videoid)\ncommon.debug('Metadata is {}', metadata)\n+ except MetadataNotAvailable:\n+ common.warn('Metadata not available for {}', videoid)\n# Parental control PIN\npin_result = _verify_pin(metadata[0].get('requiresPin', False))\n"
}
]
| Python | MIT License | castagnait/plugin.video.netflix | Handled not available metadata |
106,046 | 05.01.2020 12:51:34 | -3,600 | 580bb63c75270fc497f14a95f727d64ea5edab1b | Properties must not be shared with multiple kodi profiles | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/cache.py",
"new_path": "resources/lib/cache.py",
"diff": "@@ -153,14 +153,16 @@ class Cache(object):\ndef __init__(self, common, cache_path, ttl, metadata_ttl, plugin_handle):\n# pylint: disable=too-many-arguments\n# We have the self.common module injected as a dependency to work\n- # around circular dependencies with gloabl variable initialization\n+ # around circular dependencies with global variable initialization\nself.common = common\nself.plugin_handle = plugin_handle\nself.cache_path = cache_path\nself.ttl = ttl\nself.metadata_ttl = metadata_ttl\nself.buckets = {}\n- self.window = xbmcgui.Window(10000)\n+ self.window = xbmcgui.Window(10000) # Kodi home window\n+ # If you use multiple Kodi profiles you need to distinguish the cache of the current profile\n+ self.properties_prefix = common.get_current_kodi_profile_name()\nself.PY_IS_VER2 = sys.version_info.major == 2\ndef lock_marker(self):\n@@ -212,7 +214,7 @@ class Cache(object):\nif not bucket_names:\nbucket_names = BUCKET_NAMES\nfor bucket in bucket_names:\n- self.window.clearProperty(_window_property(bucket))\n+ self.window.clearProperty(self._window_property(bucket))\nif bucket in self.buckets:\ndel self.buckets[bucket]\n@@ -245,7 +247,7 @@ class Cache(object):\ndef _load_bucket(self, bucket):\n# Try 10 times to acquire a lock\nfor _ in range(1, 10):\n- wnd_property_data = self.window.getProperty(_window_property(bucket))\n+ wnd_property_data = self.window.getProperty(self._window_property(bucket))\nif wnd_property_data.startswith(str('LOCKED_BY_')):\nself.common.debug('Waiting for release of {}', bucket)\nxbmc.sleep(50)\n@@ -270,7 +272,7 @@ class Cache(object):\nreturn bucket_instance\ndef _lock(self, bucket):\n- self.window.setProperty(_window_property(bucket), self.lock_marker())\n+ self.window.setProperty(self._window_property(bucket), self.lock_marker())\ndef _get_from_disk(self, bucket, identifier):\n\"\"\"Load a cache entry from disk and add it to the in memory bucket\"\"\"\n@@ -314,25 +316,25 @@ class Cache(object):\nreturn\ntry:\nif self.PY_IS_VER2:\n- self.window.setProperty(_window_property(bucket), pickle.dumps(contents))\n+ self.window.setProperty(self._window_property(bucket), pickle.dumps(contents))\nelse:\n# Note: On python 3 pickle.dumps produces byte not str cannot be passed as is in\n# setProperty because cannot receive arbitrary byte sequences if they contain\n# null bytes \\x00, the stored value will be truncated by this null byte (Kodi bug).\n# To store pickled data in Python 3, you should use protocol 0 explicitly and decode\n# the resulted value with latin-1 encoding to str and then pass it to setPropety.\n- self.window.setProperty(_window_property(bucket),\n+ self.window.setProperty(self._window_property(bucket),\npickle.dumps(contents, protocol=0).decode('latin-1'))\nexcept Exception as exc: # pylint: disable=broad-except\nself.common.error('Failed to persist {} to wnd properties: {}', bucket, exc)\n- self.window.clearProperty(_window_property(bucket))\n+ self.window.clearProperty(self._window_property(bucket))\nfinally:\nself.common.debug('Released lock on {}', bucket)\ndef is_safe_to_persist(self, bucket):\n# Only persist if we acquired the original lock or if the lock is older\n# than 15 seconds (override stale locks)\n- lock_data = self.window.getProperty(_window_property(bucket))\n+ lock_data = self.window.getProperty(self._window_property(bucket))\nif lock_data.startswith(str('LOCKED_BY_')):\n# Eg. LOCKED_BY_0001_AT_1574951301\n# Check if is same add-on invocation: 'LOCKED_BY_0001'\n@@ -372,6 +374,5 @@ class Cache(object):\nif cache_exixts:\nos.remove(cache_filename)\n-\n-def _window_property(bucket):\n- return 'nfmemcache_{}'.format(bucket)\n+ def _window_property(self, bucket):\n+ return 'nfmemcache_{}_{}'.format(self.properties_prefix, bucket)\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/common/kodiops.py",
"new_path": "resources/lib/common/kodiops.py",
"diff": "@@ -137,6 +137,13 @@ def stop_playback():\nxbmc.executebuiltin('PlayerControl(Stop)')\n+def get_current_kodi_profile_name(no_spaces=True):\n+ \"\"\"Gets the name of the Kodi profile currently used\"\"\"\n+ name = json_rpc('Profiles.GetCurrentProfile',\n+ {'properties': ['thumbnail', 'lockmode']}).get('label', 'unknown')\n+ return name.replace(' ', '_') if no_spaces else name\n+\n+\ndef get_kodi_audio_language():\n\"\"\"\nReturn the audio language from Kodi settings\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/run_addon.py",
"new_path": "resources/lib/run_addon.py",
"diff": "@@ -15,7 +15,8 @@ from xbmcgui import Window\nfrom resources.lib.globals import g\nfrom resources.lib.common import (info, debug, warn, error, check_credentials, BackendNotReady,\n- log_time_trace, reset_log_level_global_var)\n+ log_time_trace, reset_log_level_global_var,\n+ get_current_kodi_profile_name)\nfrom resources.lib.upgrade_controller import check_addon_upgrade\n@@ -66,7 +67,7 @@ def route(pathitems):\nexecute(_get_nav_handler(root_handler), pathitems[1:], g.REQUEST_PARAMS)\n-def _skin_widget_call(window_cls):\n+def _skin_widget_call(window_cls, prop_nf_service_status):\n\"\"\"\nWorkaround to intercept calls made by the Skin Widgets currently in use.\nCurrently, the Skin widgets associated with add-ons are executed at Kodi startup immediately\n@@ -85,7 +86,7 @@ def _skin_widget_call(window_cls):\nif not getCondVisibility(\"Window.IsMedia\"):\nmonitor = Monitor()\nsec_elapsed = 0\n- while not window_cls.getProperty('nf_service_status') == 'running':\n+ while not window_cls.getProperty(prop_nf_service_status) == 'running':\nif sec_elapsed >= limit_sec or monitor.abortRequested() or monitor.waitForAbort(0.5):\nbreak\nsec_elapsed += 0.5\n@@ -145,10 +146,12 @@ def run(argv):\ninfo('URL is {}'.format(g.URL))\nsuccess = True\n- window_cls = Window(10000)\n- is_widget_skin_call = _skin_widget_call(window_cls)\n+ window_cls = Window(10000) # Kodi home window\n+ # If you use multiple Kodi profiles you need to distinguish the property of current profile\n+ prop_nf_service_status = 'nf_service_status_' + get_current_kodi_profile_name()\n+ is_widget_skin_call = _skin_widget_call(window_cls, prop_nf_service_status)\n- if window_cls.getProperty('nf_service_status') != 'running':\n+ if window_cls.getProperty(prop_nf_service_status) != 'running':\nif not is_widget_skin_call:\nfrom resources.lib.kodi.ui import show_backend_not_ready\nshow_backend_not_ready()\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/run_service.py",
"new_path": "resources/lib/run_service.py",
"diff": "@@ -10,13 +10,15 @@ from __future__ import absolute_import, division, unicode_literals\nimport threading\n+from xbmcgui import Window\n+\n# Global cache must not be used within these modules, because stale values may\n# be used and cause inconsistencies!\n+from resources.lib.common import (info, error, select_port, get_local_string,\n+ get_current_kodi_profile_name)\nfrom resources.lib.globals import g\n-from resources.lib.common import (info, error, select_port, get_local_string)\nfrom resources.lib.upgrade_controller import check_service_upgrade\n-\ntry: # Python 2\nunicode\nexcept NameError: # Python 3\n@@ -43,6 +45,9 @@ class NetflixService(object):\n]\ndef __init__(self):\n+ self.window_cls = Window(10000) # Kodi home window\n+ # If you use multiple Kodi profiles you need to distinguish the property of current profile\n+ self.prop_nf_service_status = 'nf_service_status_' + get_current_kodi_profile_name()\nfor server in self.SERVERS:\nself.init_server(server)\nself.controller = None\n@@ -72,9 +77,7 @@ class NetflixService(object):\nself.library_updater = LibraryUpdateService()\nself.settings_monitor = SettingsMonitor()\n# Mark the service as active\n- from xbmcgui import Window\n- window_cls = Window(10000)\n- window_cls.setProperty('nf_service_status', 'running')\n+ self.window_cls.setProperty(self.prop_nf_service_status, 'running')\nif not g.ADDON.getSettingBool('disable_startup_notification'):\nfrom resources.lib.kodi.ui import show_notification\nshow_notification(get_local_string(30110))\n@@ -83,9 +86,7 @@ class NetflixService(object):\n\"\"\"\nStop the background services\n\"\"\"\n- from xbmcgui import Window\n- window_cls = Window(10000)\n- window_cls.setProperty('nf_service_status', 'stopped')\n+ self.window_cls.setProperty(self.prop_nf_service_status, 'stopped')\nfor server in self.SERVERS:\nserver['instance'].server_close()\nserver['instance'].shutdown()\n@@ -100,9 +101,7 @@ class NetflixService(object):\ntry:\nself.start_services()\nexcept Exception as exc:\n- from xbmcgui import Window\n- window_cls = Window(10000)\n- window_cls.setProperty('nf_service_status', 'stopped')\n+ self.window_cls.setProperty(self.prop_nf_service_status, 'stopped')\nimport traceback\nfrom resources.lib.kodi.ui import show_addon_error_info\nerror(traceback.format_exc())\n"
}
]
| Python | MIT License | castagnait/plugin.video.netflix | Properties must not be shared with multiple kodi profiles |
106,046 | 06.01.2020 16:42:04 | -3,600 | b8cb733a4ca55f00505411be9a2773f87659a540 | Get list of profiles by api | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/api/exceptions.py",
"new_path": "resources/lib/api/exceptions.py",
"diff": "@@ -31,8 +31,8 @@ class InvalidAuthURLError(WebsiteParsingError):\n\"\"\"The authURL is invalid\"\"\"\n-class InvalidProfilesError(WebsiteParsingError):\n- \"\"\"Cannot extract profiles from Netflix webpage\"\"\"\n+class InvalidProfilesError(Exception):\n+ \"\"\"Cannot get profiles data from Netflix\"\"\"\nclass InvalidMembershipStatusError(WebsiteParsingError):\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/api/shakti.py",
"new_path": "resources/lib/api/shakti.py",
"diff": "@@ -24,6 +24,7 @@ from .paths import (VIDEO_LIST_PARTIAL_PATHS, VIDEO_LIST_BASIC_PARTIAL_PATHS,\nTRAILER_PARTIAL_PATHS)\nfrom .exceptions import (InvalidVideoListTypeError, APIError, MissingCredentialsError,\nMetadataNotAvailable)\n+from .website import parse_profiles\ndef catch_api_errors(func):\n@@ -62,8 +63,14 @@ def login(ask_credentials=True):\ndef update_profiles_data():\n- \"\"\"Fetch profiles data from website\"\"\"\n- return common.make_call('update_profiles_data')\n+ \"\"\"Update the profiles list data to the database\"\"\"\n+ profiles_data = common.make_call(\n+ 'path_request',\n+ [['profilesList', 'summary'], ['profilesList', 'current', 'summary'],\n+ ['profilesList', {'to': 5}, 'summary'], ['profilesList', {'to': 5},\n+ 'avatar', 'images', 'byWidth', 320],\n+ ['lolomo']])\n+ parse_profiles(profiles_data)\ndef activate_profile(profile_id):\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/api/website.py",
"new_path": "resources/lib/api/website.py",
"diff": "@@ -53,17 +53,20 @@ PAGE_ITEM_ERROR_CODE = 'models/flow/data/fields/errorCode/value'\nPAGE_ITEM_ERROR_CODE_LIST = 'models\\\\i18nStrings\\\\data\\\\login/login'\nJSON_REGEX = r'netflix\\.{}\\s*=\\s*(.*?);\\s*</script>'\n-AVATAR_SUBPATH = ['images', 'byWidth', '320', 'value']\n+AVATAR_SUBPATH = ['images', 'byWidth', '320']\n@common.time_execution(immediate=True)\n-def extract_session_data(content):\n+def extract_session_data(content, validate=False):\n\"\"\"\nCall all the parsers we need to extract all\nthe session relevant data from the HTML page\n\"\"\"\ncommon.debug('Extracting session data...')\nreact_context = extract_json(content, 'reactContext')\n+ if validate:\n+ validate_login(react_context)\n+\nuser_data = extract_userdata(react_context)\nif user_data.get('membershipStatus') != 'CURRENT_MEMBER':\n# When NEVER_MEMBER it is possible that the account has not been confirmed or renewed\n@@ -73,8 +76,8 @@ def extract_session_data(content):\napi_data = extract_api_data(react_context)\n# Note: falcor cache does not exist if membershipStatus is not CURRENT_MEMBER\n- falcor_cache = extract_json(content, 'falcorCache')\n- extract_profiles(falcor_cache)\n+ # falcor cache is not more used to extract profiles data\n+ # falcor_cache = extract_json(content, 'falcorCache')\n# Save only some info of the current profile from user data\ng.LOCAL_DB.set_value('build_identifier', user_data.get('BUILD_IDENTIFIER'), TABLE_SESSION)\n@@ -86,33 +89,21 @@ def extract_session_data(content):\ng.LOCAL_DB.set_value(key, path, TABLE_SESSION)\n-def validate_session_data(content):\n- \"\"\"\n- Try calling the parsers to extract the session data, to verify the login\n- \"\"\"\n- common.debug('Validating session data...')\n- extract_json(content, 'falcorCache')\n- react_context = extract_json(content, 'reactContext')\n- extract_userdata(react_context, False)\n- extract_api_data(react_context, False)\n-\n-\n@common.time_execution(immediate=True)\n-def extract_profiles(falkor_cache):\n- \"\"\"Extract profile information from Netflix website\"\"\"\n+def parse_profiles(profiles_list_data):\n+ \"\"\"Parse profile information from Netflix response\"\"\"\ntry:\n- profiles_list = OrderedDict(resolve_refs(falkor_cache['profilesList'], falkor_cache))\n+ profiles_list = OrderedDict(resolve_refs(profiles_list_data['profilesList'],\n+ profiles_list_data))\nif not profiles_list:\n- common.error('The profiles list from falkor cache is empty. '\n- 'The profiles were not parsed nor updated!')\n- else:\n+ raise InvalidProfilesError('It has not been possible to obtain the list of profiles.')\n_delete_non_existing_profiles(profiles_list)\nsort_order = 0\n+ debug_info = ['profileName', 'isAccountOwner', 'isActive', 'isKids', 'maturityLevel']\nfor guid, profile in list(profiles_list.items()):\ncommon.debug('Parsing profile {}', guid)\n- avatar_url = _get_avatar(falkor_cache, profile)\n- profile = profile['summary']['value']\n- debug_info = ['profileName', 'isAccountOwner', 'isActive', 'isKids', 'maturityLevel']\n+ avatar_url = _get_avatar(profiles_list_data, profile)\n+ profile = profile['summary']\nfor k_info in debug_info:\ncommon.debug('Profile info {}', {k_info: profile[k_info]})\nis_active = profile.pop('isActive')\n@@ -125,10 +116,42 @@ def extract_profiles(falkor_cache):\nexcept Exception:\nimport traceback\ncommon.error(traceback.format_exc())\n- common.error('Falkor cache: {}', falkor_cache)\n+ common.error('Profile list data: {}', profiles_list_data)\nraise InvalidProfilesError\n+# @common.time_execution(immediate=True)\n+# def extract_profiles(falkor_cache):\n+# \"\"\"Extract profile information from Netflix website\"\"\"\n+# try:\n+# profiles_list = OrderedDict(resolve_refs(falkor_cache['profilesList'], falkor_cache))\n+# if not profiles_list:\n+# common.error('The profiles list from falkor cache is empty. '\n+# 'The profiles were not parsed nor updated!')\n+# else:\n+# _delete_non_existing_profiles(profiles_list)\n+# sort_order = 0\n+# for guid, profile in list(profiles_list.items()):\n+# common.debug('Parsing profile {}', guid)\n+# avatar_url = _get_avatar(falkor_cache, profile)\n+# profile = profile['summary']['value']\n+# debug_info = ['profileName', 'isAccountOwner', 'isActive', 'isKids', 'maturityLevel']\n+# for k_info in debug_info:\n+# common.debug('Profile info {}', {k_info: profile[k_info]})\n+# is_active = profile.pop('isActive')\n+# g.LOCAL_DB.set_profile(guid, is_active, sort_order)\n+# g.SHARED_DB.set_profile(guid, sort_order)\n+# for key, value in list(profile.items()):\n+# g.LOCAL_DB.set_profile_config(key, value, guid)\n+# g.LOCAL_DB.set_profile_config('avatar', avatar_url, guid)\n+# sort_order += 1\n+# except Exception:\n+# import traceback\n+# common.error(traceback.format_exc())\n+# common.error('Falkor cache: {}', falkor_cache)\n+# raise\n+\n+\ndef _delete_non_existing_profiles(profiles_list):\nlist_guid = g.LOCAL_DB.get_guid_profiles()\nfor guid in list_guid:\n@@ -138,10 +161,10 @@ def _delete_non_existing_profiles(profiles_list):\ng.SHARED_DB.delete_profile(guid)\n-def _get_avatar(falkor_cache, profile):\n+def _get_avatar(profiles_list_data, profile):\ntry:\n- profile['avatar']['value'].extend(AVATAR_SUBPATH)\n- return common.get_path(profile['avatar']['value'], falkor_cache)\n+ profile['avatar'].extend(AVATAR_SUBPATH)\n+ return common.get_path(profile['avatar'], profiles_list_data)\nexcept KeyError:\ncommon.warn('Cannot find avatar for profile {guid}'\n.format(guid=profile['summary']['value']['guid']))\n@@ -188,8 +211,7 @@ def assert_valid_auth_url(user_data):\nreturn user_data\n-def validate_login(content):\n- react_context = extract_json(content, 'reactContext')\n+def validate_login(react_context):\npath_code_list = PAGE_ITEM_ERROR_CODE_LIST.split('\\\\')\npath_error_code = PAGE_ITEM_ERROR_CODE.split('/')\nif common.check_path_exists(path_error_code, react_context):\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/navigation/directory.py",
"new_path": "resources/lib/navigation/directory.py",
"diff": "@@ -59,9 +59,7 @@ class DirectoryBuilder(object):\n\"\"\"Show profiles listing\"\"\"\n# pylint: disable=unused-argument\ncommon.debug('Showing profiles listing')\n- if not api.update_profiles_data():\n- xbmcplugin.endOfDirectory(g.PLUGIN_HANDLE, succeeded=False)\n- return\n+ api.update_profiles_data()\nlistings.build_profiles_listing()\n_handle_endofdirectory(False, False)\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/nfsession/nfsession.py",
"new_path": "resources/lib/services/nfsession/nfsession.py",
"diff": "@@ -30,7 +30,6 @@ class NetflixSession(NFSessionAccess):\nself.slots = [\nself.login,\nself.logout,\n- self.update_profiles_data,\nself.activate_profile,\nself.parental_control_data,\nself.path_request,\n@@ -71,12 +70,6 @@ class NetflixSession(NFSessionAccess):\nextracted_content['pin'] = pin\nreturn extracted_content\n- @common.addonsignals_return_call\n- @needs_login\n- @common.time_execution(immediate=True)\n- def update_profiles_data(self):\n- return self.try_refresh_session_data(raise_exception=True)\n-\n@common.addonsignals_return_call\n@needs_login\n@common.time_execution(immediate=True)\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/nfsession/nfsession_access.py",
"new_path": "resources/lib/services/nfsession/nfsession_access.py",
"diff": "@@ -89,8 +89,7 @@ class NFSessionAccess(NFSessionRequests, NFSessionCookie):\n'login',\ndata=_login_payload(common.get_credentials(), auth_url))\ntry:\n- website.validate_login(login_response)\n- website.extract_session_data(login_response)\n+ website.extract_session_data(login_response, validate=True)\ncommon.info('Login successful')\nui.show_notification(common.get_local_string(30109))\nself.update_session_data(current_esn)\n"
}
]
| Python | MIT License | castagnait/plugin.video.netflix | Get list of profiles by api |
106,046 | 06.01.2020 17:10:57 | -3,600 | 95a347bb65ec27abe0258941b25d5502702ffb3d | Removed html parser from profile name | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/kodi/listings.py",
"new_path": "resources/lib/kodi/listings.py",
"diff": "@@ -64,27 +64,19 @@ def _activate_view(partial_setting_id):\n@common.time_execution(immediate=False)\ndef build_profiles_listing():\n\"\"\"Builds the profiles list Kodi screen\"\"\"\n- try:\n- from HTMLParser import HTMLParser\n- except ImportError:\n- from html.parser import HTMLParser\n- html_parser = HTMLParser()\ndirectory_items = []\nactive_guid_profile = g.LOCAL_DB.get_active_profile_guid()\nfor guid in g.LOCAL_DB.get_guid_profiles():\n- directory_items.append(_create_profile_item(guid,\n- (guid == active_guid_profile),\n- html_parser))\n+ directory_items.append(_create_profile_item(guid, (guid == active_guid_profile)))\n# The standard kodi theme does not allow to change view type if the content is \"files\" type,\n# so here we use \"images\" type, visually better to see\nfinalize_directory(directory_items, g.CONTENT_IMAGES)\n-def _create_profile_item(profile_guid, is_active, html_parser):\n+def _create_profile_item(profile_guid, is_active):\n\"\"\"Create a tuple that can be added to a Kodi directory that represents\na profile as listed in the profiles listing\"\"\"\nprofile_name = g.LOCAL_DB.get_profile_config('profileName', '', guid=profile_guid)\n- unescaped_profile_name = html_parser.unescape(profile_name)\nis_account_owner = g.LOCAL_DB.get_profile_config('isAccountOwner', False, guid=profile_guid)\nis_kids = g.LOCAL_DB.get_profile_config('isKids', False, guid=profile_guid)\ndescription = []\n@@ -92,15 +84,14 @@ def _create_profile_item(profile_guid, is_active, html_parser):\ndescription.append(common.get_local_string(30221))\nif is_kids:\ndescription.append(common.get_local_string(30222))\n- enc_profile_name = profile_name.encode('utf-8')\nlist_item = list_item_skeleton(\n- label=unescaped_profile_name,\n+ label=profile_name,\nicon=g.LOCAL_DB.get_profile_config('avatar', '', guid=profile_guid),\ndescription=', '.join(description))\nlist_item.select(is_active)\nautologin_url = common.build_url(\npathitems=['save_autologin', profile_guid],\n- params={'autologin_user': enc_profile_name},\n+ params={'autologin_user': profile_name.encode('utf-8')},\nmode=g.MODE_ACTION)\nlist_item.addContextMenuItems(\n[(common.get_local_string(30053),\n"
}
]
| Python | MIT License | castagnait/plugin.video.netflix | Removed html parser from profile name |
106,046 | 06.01.2020 18:06:04 | -3,600 | 2d19498ea6b8d7bc4ffa1bed6b7e47f37de82aa3 | Fixed missing profile on first login | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/nfsession/nfsession_base.py",
"new_path": "resources/lib/services/nfsession/nfsession_base.py",
"diff": "@@ -15,6 +15,7 @@ import requests\nimport resources.lib.common as common\nimport resources.lib.common.cookies as cookies\n+from resources.lib.database.db_exceptions import ProfilesMissing\nfrom resources.lib.globals import g\nfrom resources.lib.database.db_utils import (TABLE_SESSION)\nfrom resources.lib.api.exceptions import (NotLoggedInError, NotConnected)\n@@ -77,8 +78,12 @@ class NFSessionBase(object):\n_update_esn(old_esn)\ndef set_session_header_data(self):\n+ try:\n+ # When the addon is installed from scratch there is no profiles in the database\nself.session.headers.update(\n{'x-netflix.request.client.user.guid': g.LOCAL_DB.get_active_profile_guid()})\n+ except ProfilesMissing:\n+ pass\n@property\ndef account_hash(self):\n"
}
]
| Python | MIT License | castagnait/plugin.video.netflix | Fixed missing profile on first login |
106,046 | 06.01.2020 18:20:55 | -3,600 | 3e4481829436787726b26cc74c5bf23c31d854bc | is_logged_in must not be internal method | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/nfsession/nfsession_access.py",
"new_path": "resources/lib/services/nfsession/nfsession_access.py",
"diff": "@@ -39,7 +39,7 @@ class NFSessionAccess(NFSessionRequests, NFSessionCookie):\nIf so, do the login before the user requests it\"\"\"\ntry:\ncommon.get_credentials()\n- if not self._is_logged_in():\n+ if not self.is_logged_in():\nself._login()\nself.is_prefetch_login = True\nexcept requests.exceptions.RequestException as exc:\n@@ -55,7 +55,7 @@ class NFSessionAccess(NFSessionRequests, NFSessionCookie):\nui.show_notification(common.get_local_string(30180), time=10000)\n@common.time_execution(immediate=True)\n- def _is_logged_in(self):\n+ def is_logged_in(self):\n\"\"\"Check if the user is logged in and if so refresh session data\"\"\"\nvalid_login = self._load_cookies() and \\\nself._verify_session_cookies() and \\\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/nfsession/nfsession_base.py",
"new_path": "resources/lib/services/nfsession/nfsession_base.py",
"diff": "@@ -33,7 +33,7 @@ def needs_login(func):\nif not common.is_internet_connected():\nraise NotConnected('Internet connection not available')\n# ..this check verifies only if locally there are the data to correctly perform the login\n- if not session._is_logged_in():\n+ if not session.is_logged_in():\nraise NotLoggedInError\nreturn func(*args, **kwargs)\nreturn ensure_login\n"
}
]
| Python | MIT License | castagnait/plugin.video.netflix | is_logged_in must not be internal method |
106,046 | 06.01.2020 18:45:48 | -3,600 | e1ee5199594230cd7ae6eef7468ad879cf1e2859 | Hidden SSL setting - developers only | [
{
"change_type": "MODIFY",
"old_path": "resources/settings.xml",
"new_path": "resources/settings.xml",
"diff": "<setting id=\"enable_ipc_over_http\" type=\"bool\" label=\"30139\" default=\"false\"/>\n<setting id=\"enable_timing\" type=\"bool\" label=\"30134\" default=\"false\"/>\n<setting id=\"disable_modal_error_display\" type=\"bool\" label=\"30130\" default=\"false\"/>\n- <setting id=\"ssl_verification\" type=\"bool\" label=\"30024\" default=\"true\"/>\n+ <setting id=\"ssl_verification\" type=\"bool\" label=\"30024\" default=\"true\" visible=\"false\"/> <!-- just for developers -->\n<setting label=\"30117\" type=\"lsep\"/><!--Cache-->\n<setting id=\"cache_ttl\" type=\"slider\" option=\"int\" range=\"0,10,525600\" label=\"30084\" default=\"120\"/>\n<setting id=\"cache_metadata_ttl\" type=\"slider\" option=\"int\" range=\"0,1,365\" label=\"30085\" default=\"30\"/>\n"
}
]
| Python | MIT License | castagnait/plugin.video.netflix | Hidden SSL setting - developers only |
106,046 | 07.01.2020 20:21:02 | -3,600 | af943d174b1a39d6737502b926320ff5eecb4ea7 | A hack way to speed up requests made by requests module
This allows you to speed up the first request (made by requests module)
about halving the time it takes to get a response
With some devices/os you can see a significant improvement at the first start of the addon | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/nfsession/nfsession.py",
"new_path": "resources/lib/services/nfsession/nfsession.py",
"diff": "@@ -37,6 +37,7 @@ class NetflixSession(NFSessionAccess):\nself.perpetual_path_request_switch_profiles,\nself.get,\nself.post,\n+ self.startup_requests_module\n]\nfor slot in self.slots:\ncommon.register_slot(slot)\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/nfsession/nfsession_access.py",
"new_path": "resources/lib/services/nfsession/nfsession_access.py",
"diff": "@@ -19,7 +19,7 @@ import resources.lib.common.cookies as cookies\nimport resources.lib.api.website as website\nimport resources.lib.kodi.ui as ui\nfrom resources.lib.globals import g\n-from resources.lib.services.nfsession.nfsession_requests import NFSessionRequests\n+from resources.lib.services.nfsession.nfsession_requests import NFSessionRequests, BASE_URL\nfrom resources.lib.services.nfsession.nfsession_cookie import NFSessionCookie\nfrom resources.lib.api.exceptions import (LoginFailedError, LoginValidateError,\nMissingCredentialsError, InvalidMembershipStatusError)\n@@ -41,6 +41,9 @@ class NFSessionAccess(NFSessionRequests, NFSessionCookie):\ncommon.get_credentials()\nif not self.is_logged_in():\nself._login()\n+ else:\n+ # A hack way to full load requests module without blocking the service startup\n+ common.send_signal(signal='startup_requests_module')\nself.is_prefetch_login = True\nexcept requests.exceptions.RequestException as exc:\n# It was not possible to connect to the web service, no connection, network problem, etc\n@@ -70,6 +73,13 @@ class NFSessionAccess(NFSessionRequests, NFSessionCookie):\nreturn self.try_refresh_session_data()\nreturn True\n+ def startup_requests_module(self, data=None): # pylint: disable=unused-argument\n+ \"\"\"A hack way to full load requests module without blocking the service\"\"\"\n+ # The first call made with 'requests' module, takes more than one second longer then usual\n+ # to elaborate, i think it is better to do it when the service is started\n+ # to camouflage this delay and make the add-on frontend faster\n+ self.session.head(url=BASE_URL)\n+\n@common.addonsignals_return_call\ndef login(self):\n\"\"\"AddonSignals interface for login function\"\"\"\n"
}
]
| Python | MIT License | castagnait/plugin.video.netflix | A hack way to speed up requests made by requests module
This allows you to speed up the first request (made by requests module)
about halving the time it takes to get a response
With some devices/os you can see a significant improvement at the first start of the addon |
106,046 | 07.01.2020 20:39:52 | -3,600 | 06071c7d24ed97f534359b569c6db06b15d23734 | Version bump (0.16.2) | [
{
"change_type": "MODIFY",
"old_path": "addon.xml",
"new_path": "addon.xml",
"diff": "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n-<addon id=\"plugin.video.netflix\" name=\"Netflix\" version=\"0.16.1\" provider-name=\"libdev + jojo + asciidisco + caphm + castagnait\">\n+<addon id=\"plugin.video.netflix\" name=\"Netflix\" version=\"0.16.2\" provider-name=\"libdev + jojo + asciidisco + caphm + castagnait\">\n<requires>\n<import addon=\"xbmc.python\" version=\"2.26.0\"/>\n<import addon=\"script.module.addon.signals\" version=\"0.0.3\"/>\n<forum>https://forum.kodi.tv/showthread.php?tid=329767</forum>\n<source>https://github.com/CastagnaIT/plugin.video.netflix</source>\n<news>\n+v0.16.2 (2020-01-07)\n+-Improved add-on startup\n+-Improved loading of profiles list\n+-Added in expert setting a choice to speed up service or addon startup\n+-Fixed an issue that causing addon misbehaviour using multiple Kodi profiles\n+-Fixed an issue that causing addon breakage with sqlite connections\n+-Fixed some python 3 issues on Android\n+-Handled cases of metadata not available\n+-Permanently removed sharing Kodi videos settings between profiles\n+-Updated de, es, it translations\n+-Minor improvements\n+\nv0.16.1 (2019-12-14)\n-Allowed to export individual seasons to the library (manual mode)\n-Dolby atmos audio streams are now specified (Kodi 19)\n@@ -69,20 +81,6 @@ v0.16.1 (2019-12-14)\n-Added japanese language\n-Updated kr, hu, pt_br, fr\n-Many improvements to the code\n-\n-v0.16.0 (2019-11-29)\n--Added new parental control settings\n--Added new thumb rating to movies/tv shows\n--Started migrating to watched status marks by profile\n--Optimized startup code\n--Better handled no internet connection\n--Fixed an issue that breaks the service when there is no internet connection\n--Fixed an issue in some specific cases request at startup credentials even if already saved\n--Fixed an issue did not show any error to the user when the loading of profiles fails\n--Fixed an issue that did not allow the display of the skip button in the Kodi library\n--New Hungarian language\n--Updated de, hr, it, pl, pt_br translations\n--Other minor improvements/fixes\n</news>\n</extension>\n</addon>\n"
},
{
"change_type": "MODIFY",
"old_path": "changelog.txt",
"new_path": "changelog.txt",
"diff": "+v0.16.0 (2019-11-29)\n+-Added new parental control settings\n+-Added new thumb rating to movies/tv shows\n+-Started migrating to watched status marks by profile\n+-Optimized startup code\n+-Better handled no internet connection\n+-Fixed an issue that breaks the service when there is no internet connection\n+-Fixed an issue in some specific cases request at startup credentials even if already saved\n+-Fixed an issue did not show any error to the user when the loading of profiles fails\n+-Fixed an issue that did not allow the display of the skip button in the Kodi library\n+-New Hungarian language\n+-Updated de, hr, it, pl, pt_br translations\n+-Other minor improvements/fixes\n+\nv0.15.11 (2019-11-20)\n-Fixed a critical error on auto-update\n-Fixed some error on py3\n"
}
]
| Python | MIT License | castagnait/plugin.video.netflix | Version bump (0.16.2) |
106,046 | 10.01.2020 08:43:48 | -3,600 | faffa5731b659f9d7215e090b3258a37c5e6bcad | Cookie debug output | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/common/cookies.py",
"new_path": "resources/lib/common/cookies.py",
"diff": "@@ -88,6 +88,7 @@ def load(account_hash):\ndebug_output += '{} (expires {} - remaining TTL {})\\n'.format(cookie.name,\ncookie.expires,\nremaining_ttl)\n+ common.debug(debug_output)\n# if expired(cookie_jar):\n# raise CookiesExpiredError()\nreturn cookie_jar\n"
}
]
| Python | MIT License | castagnait/plugin.video.netflix | Cookie debug output |
106,046 | 10.01.2020 13:37:28 | -3,600 | 08a1f419bd6d8d802280dad182badb859558f691 | Forgot to update description | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/nfsession/nfsession_access.py",
"new_path": "resources/lib/services/nfsession/nfsession_access.py",
"diff": "@@ -74,10 +74,10 @@ class NFSessionAccess(NFSessionRequests, NFSessionCookie):\nreturn True\ndef startup_requests_module(self, data=None): # pylint: disable=unused-argument\n- \"\"\"A hack way to full load requests module without blocking the service\"\"\"\n- # The first call made with 'requests' module, takes more than one second longer then usual\n- # to elaborate, i think it is better to do it when the service is started\n- # to camouflage this delay and make the add-on frontend faster\n+ \"\"\"A hack way to full load requests module before making any other calls\"\"\"\n+ # The first call made with 'requests' module, can takes more than one second longer then\n+ # usual to elaborate (depend from device/os/connection), to camouflage this delay\n+ # and make the add-on frontend faster this request is made when the service is started\nself.session.head(url=BASE_URL)\n@common.addonsignals_return_call\n"
}
]
| Python | MIT License | castagnait/plugin.video.netflix | Forgot to update description |
106,046 | 11.01.2020 13:55:49 | -3,600 | 13584b58f901b3aa3513b16a3b8d42e60841b441 | Do not close output stream
This prevent the error:
ValueError: I/O operation on closed file
from the http server | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/msl/http_server.py",
"new_path": "resources/lib/services/msl/http_server.py",
"diff": "@@ -48,7 +48,6 @@ class MSLHttpRequestHandler(BaseHTTPRequestHandler):\nself.send_response(200)\nself.end_headers()\nself.wfile.write(base64.standard_b64decode(b64license))\n- self.finish()\nexcept Exception as exc:\nimport traceback\ncommon.error(traceback.format_exc())\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/nfsession/http_server.py",
"new_path": "resources/lib/services/nfsession/http_server.py",
"diff": "@@ -43,7 +43,6 @@ class NetflixHttpRequestHandler(BaseHTTPRequestHandler):\nelse 500)\nself.end_headers()\nself.wfile.write(json.dumps(result).encode('utf-8'))\n- self.finish()\ndef log_message(self, *args): # pylint: disable=arguments-differ\n\"\"\"Disable the BaseHTTPServer Log\"\"\"\n"
}
]
| Python | MIT License | castagnait/plugin.video.netflix | Do not close output stream
This prevent the error:
ValueError: I/O operation on closed file
from the http server |
106,046 | 11.01.2020 17:10:18 | -3,600 | 16fb4a43d107a31370571cd6337617467c1710c0 | Added sendSignal non-blocking workaround | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/common/ipc.py",
"new_path": "resources/lib/common/ipc.py",
"diff": "@@ -54,8 +54,24 @@ def unregister_slot(callback, signal=None):\ndebug('Unregistered AddonSignals slot {}'.format(name))\n-def send_signal(signal, data=None):\n+def send_signal(signal, data=None, non_blocking=False):\n\"\"\"Send a signal via AddonSignals\"\"\"\n+ if non_blocking:\n+ # Using sendSignal of AddonSignals you might think that it is not a blocking call instead is blocking because it\n+ # uses executeJSONRPC that is a blocking call, so the invoker will remain blocked until the function called by\n+ # executeJSONRPC has completed his operations, even if it does not return any data.\n+ # This workaround call sendSignal in a separate thread so immediately releases the invoker.\n+ # This is to be considered according to the functions to be called,\n+ # because it could keep the caller blocked for a certain amount of time unnecessarily.\n+ # To note that several consecutive calls, are made in sequence not at the same time.\n+ from threading import Thread\n+ thread = Thread(target=_send_signal, args=[signal, data])\n+ thread.start()\n+ else:\n+ _send_signal(signal, data)\n+\n+\n+def _send_signal(signal, data):\nAddonSignals.sendSignal(\nsource_id=g.ADDON_ID,\nsignal=signal,\n"
}
]
| Python | MIT License | castagnait/plugin.video.netflix | Added sendSignal non-blocking workaround |
106,046 | 11.01.2020 17:10:46 | -3,600 | 5ba3458bf5657f1026107aee0df3e13d3f9f853c | Using non-blocking send signal | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/navigation/player.py",
"new_path": "resources/lib/navigation/player.py",
"diff": "@@ -92,7 +92,8 @@ def play(videoid):\n'art': art,\n'timeline_markers': get_timeline_markers(metadata[0]),\n'upnext_info': get_upnext_info(videoid, (infos, art), metadata),\n- 'resume_position': resume_position})\n+ 'resume_position': resume_position},\n+ non_blocking=True)\nxbmcplugin.setResolvedUrl(\nhandle=g.PLUGIN_HANDLE,\nsucceeded=True,\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/nfsession/nfsession_access.py",
"new_path": "resources/lib/services/nfsession/nfsession_access.py",
"diff": "@@ -43,7 +43,7 @@ class NFSessionAccess(NFSessionRequests, NFSessionCookie):\nself._login()\nelse:\n# A hack way to full load requests module without blocking the service startup\n- common.send_signal(signal='startup_requests_module')\n+ common.send_signal(signal='startup_requests_module', non_blocking=True)\nself.is_prefetch_login = True\nexcept requests.exceptions.RequestException as exc:\n# It was not possible to connect to the web service, no connection, network problem, etc\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/playback/upnext.py",
"new_path": "resources/lib/services/playback/upnext.py",
"diff": "@@ -33,7 +33,7 @@ class UpNextNotifier(PlaybackActionManager):\ndef _on_playback_started(self, player_state):\n# pylint: disable=unused-argument\ncommon.debug('Sending initialization signal to Up Next')\n- common.send_signal('upnext_data', self.upnext_info)\n+ common.send_signal('upnext_data', self.upnext_info, non_blocking=True)\ndef _on_tick(self, player_state):\npass\n"
}
]
| Python | MIT License | castagnait/plugin.video.netflix | Using non-blocking send signal |
106,046 | 13.01.2020 10:06:33 | -3,600 | 8da3137fbcd6635c50dddc87f6c48cbfdc4cfd39 | Updated message request info | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/msl/msl_handler.py",
"new_path": "resources/lib/services/msl/msl_handler.py",
"diff": "@@ -121,10 +121,8 @@ class MSLHandler(object):\nresponse = _process_json_response(\nself._post(ENDPOINTS['manifest'],\nself.request_builder.handshake_request(esn)))\n- headerdata = json.loads(\n- base64.standard_b64decode(response['headerdata']))\n- self.request_builder.crypto.parse_key_response(\n- headerdata, not common.is_edge_esn(esn))\n+ header_data = self.request_builder.decrypt_header_data(response['headerdata'], False)\n+ self.request_builder.crypto.parse_key_response(header_data, not common.is_edge_esn(esn))\ncommon.debug('Key handshake successful')\nreturn True\n@@ -323,8 +321,14 @@ class MSLHandler(object):\n# if mt_renewable:\n# # Check if mastertoken is renewed\n# self.request_builder.crypto.compare_mastertoken(response['header']['mastertoken'])\n- decrypted_response = _decrypt_chunks(response['payloads'],\n- self.request_builder.crypto)\n+\n+ # header_data = self.request_builder.decrypt_header_data(\n+ # response['header'].get('headerdata'))\n+ # if 'keyresponsedata' in header_data:\n+ # common.debug('Found key handshake in response data')\n+ # # Update current mastertoken\n+ # self.request_builder.crypto.parse_key_response(header_data, True)\n+ decrypted_response = _decrypt_chunks(response['payloads'], self.request_builder.crypto)\nreturn _raise_if_error(decrypted_response)\n@@ -373,7 +377,7 @@ def _get_error_details(decoded_response):\n@common.time_execution(immediate=True)\ndef _parse_chunks(message):\n- header = message.split('}}')[0] + '}}'\n+ header = json.loads(message.split('}}')[0] + '}}')\npayloads = re.split(',\\\"signature\\\":\\\"[0-9A-Za-z=/+]+\\\"}',\nmessage.split('}}')[1])\npayloads = [x + '}' for x in payloads][:-1]\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/msl/request_builder.py",
"new_path": "resources/lib/services/msl/request_builder.py",
"diff": "@@ -13,7 +13,6 @@ import json\nimport base64\nimport random\nimport subprocess\n-import time\nfrom resources.lib.globals import g\nimport resources.lib.common as common\n@@ -48,69 +47,77 @@ class MSLRequestBuilder(object):\n@common.time_execution(immediate=True)\ndef handshake_request(self, esn):\n\"\"\"Create a key handshake request\"\"\"\n- return json.dumps({\n+ header = json.dumps({\n'entityauthdata': {\n'scheme': 'NONE',\n'authdata': {'identity': esn}},\n'headerdata':\nbase64.standard_b64encode(\n- self._headerdata(is_key_request=True, is_handshake=True,\n- compression=None, esn=esn).encode('utf-8')).decode('utf-8'),\n+ self._headerdata(is_handshake=True).encode('utf-8')).decode('utf-8'),\n'signature': ''\n}, sort_keys=True)\n+ payload = json.dumps(self._encrypted_chunk(envelope_payload=False))\n+ return header + payload\n@common.time_execution(immediate=True)\ndef _signed_header(self, esn):\n- encryption_envelope = self.crypto.encrypt(self._headerdata(esn=esn),\n- esn)\n+ encryption_envelope = self.crypto.encrypt(self._headerdata(esn=esn), esn)\nreturn {\n- 'headerdata': base64.standard_b64encode(encryption_envelope.encode('utf-8')).decode('utf-8'),\n+ 'headerdata': base64.standard_b64encode(\n+ encryption_envelope.encode('utf-8')).decode('utf-8'),\n'signature': self.crypto.sign(encryption_envelope),\n'mastertoken': self.crypto.mastertoken,\n}\n- def _headerdata(self, esn, is_handshake=False, is_key_request=False,\n- compression='GZIP'):\n+ def _headerdata(self, esn=None, compression=None, is_handshake=False):\n\"\"\"\nFunction that generates a MSL header dict\n:return: The base64 encoded JSON String of the header\n\"\"\"\nself.current_message_id = self.rndm.randint(0, pow(2, 52))\nheader_data = {\n- 'sender': esn,\n- 'handshake': is_handshake,\n+ 'messageid': self.current_message_id,\n+ 'renewable': True,\n'capabilities': {\n'languages': [g.LOCAL_DB.get_value('locale_id')],\n- 'compressionalgos': [compression] if compression else []\n- },\n- 'recipient': 'Netflix',\n- 'renewable': True,\n- 'messageid': self.current_message_id,\n- 'timestamp': int(time.time())\n+ 'compressionalgos': [compression] if compression else [] # GZIP, LZW, Empty\n+ }\n}\n- # If this is a keyrequest act different then other requests\n- if is_key_request:\n+ if is_handshake:\nheader_data['keyrequestdata'] = self.crypto.key_request_data()\nelse:\n+ header_data['sender'] = esn\n_add_auth_info(header_data, self.tokens)\nreturn json.dumps(header_data)\n@common.time_execution(immediate=True)\n- def _encrypted_chunk(self, data, esn):\n- payload = {\n+ def _encrypted_chunk(self, data='', esn=None, envelope_payload=True):\n+ if data:\n+ data = base64.standard_b64encode(json.dumps(data).encode('utf-8')).decode('utf-8')\n+ payload = json.dumps({\n'messageid': self.current_message_id,\n- 'data': base64.standard_b64encode(json.dumps(data).encode('utf-8')).decode('utf-8'),\n+ 'data': data,\n'sequencenumber': 1,\n'endofmsg': True\n- }\n- encryption_envelope = self.crypto.encrypt(json.dumps(payload), esn)\n+ })\n+ if envelope_payload:\n+ payload = self.crypto.encrypt(payload, esn)\nreturn {\n- 'payload': base64.standard_b64encode(encryption_envelope.encode('utf-8')).decode('utf-8'),\n- 'signature': self.crypto.sign(encryption_envelope),\n+ 'payload': base64.standard_b64encode(payload.encode('utf-8')).decode('utf-8'),\n+ 'signature': self.crypto.sign(payload) if envelope_payload else '',\n}\n+ def decrypt_header_data(self, data, enveloped=True):\n+ \"\"\"Decrypt a message header\"\"\"\n+ header_data = json.loads(base64.standard_b64decode(data))\n+ if enveloped:\n+ init_vector = base64.standard_b64decode(header_data['iv'])\n+ cipher_text = base64.standard_b64decode(header_data['ciphertext'])\n+ return json.loads(self.crypto.decrypt(init_vector, cipher_text))\n+ return header_data\n+\ndef _add_auth_info(header_data, tokens):\nif 'usertoken' not in tokens:\n"
}
]
| Python | MIT License | castagnait/plugin.video.netflix | Updated message request info |
106,046 | 10.01.2020 17:26:16 | -3,600 | 91dccffc0603dbe1e0c73dce75de792ab44dc061 | Added user ID token authentication | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/msl/msl_handler.py",
"new_path": "resources/lib/services/msl/msl_handler.py",
"diff": "@@ -322,8 +322,13 @@ class MSLHandler(object):\n# # Check if mastertoken is renewed\n# self.request_builder.crypto.compare_mastertoken(response['header']['mastertoken'])\n- # header_data = self.request_builder.decrypt_header_data(\n- # response['header'].get('headerdata'))\n+ header_data = self.request_builder.decrypt_header_data(\n+ response['header'].get('headerdata'))\n+\n+ if 'useridtoken' in header_data:\n+ # After the first call, it is possible get the 'user id token' that contains the\n+ # user identity to use instead of 'User Authentication Data' with user credentials\n+ self.request_builder.user_id_token = header_data['useridtoken']\n# if 'keyresponsedata' in header_data:\n# common.debug('Found key handshake in response data')\n# # Update current mastertoken\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/msl/request_builder.py",
"new_path": "resources/lib/services/msl/request_builder.py",
"diff": "@@ -34,7 +34,7 @@ class MSLRequestBuilder(object):\n\"\"\"Provides mechanisms to create MSL requests\"\"\"\ndef __init__(self, msl_data=None):\nself.current_message_id = None\n- self.tokens = []\n+ self.user_id_token = None\nself.rndm = random.SystemRandom()\nself.crypto = MSLCrypto(msl_data)\n@@ -88,7 +88,7 @@ class MSLRequestBuilder(object):\nheader_data['keyrequestdata'] = self.crypto.key_request_data()\nelse:\nheader_data['sender'] = esn\n- _add_auth_info(header_data, self.tokens)\n+ _add_auth_info(header_data, self.user_id_token)\nreturn json.dumps(header_data)\n@@ -119,10 +119,11 @@ class MSLRequestBuilder(object):\nreturn header_data\n-def _add_auth_info(header_data, tokens):\n- if 'usertoken' not in tokens:\n+def _add_auth_info(header_data, user_id_token):\n+ \"\"\"User authentication identifies the application user associated with a message\"\"\"\n+ if not user_id_token:\ncredentials = common.get_credentials()\n- # Auth via email and password\n+ # Authentication with the user credentials\nheader_data['userauthdata'] = {\n'scheme': 'EMAIL_PASSWORD',\n'authdata': {\n@@ -130,3 +131,6 @@ def _add_auth_info(header_data, tokens):\n'password': credentials['password']\n}\n}\n+ else:\n+ # Authentication with user ID token containing the user identity\n+ header_data['useridtoken'] = user_id_token\n"
}
]
| Python | MIT License | castagnait/plugin.video.netflix | Added user ID token authentication |
106,046 | 13.01.2020 11:38:08 | -3,600 | c67d3cf677dc0722334be3bd754e01e300423674 | Handle http 401 error | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/nfsession/nfsession_requests.py",
"new_path": "resources/lib/services/nfsession/nfsession_requests.py",
"diff": "@@ -95,12 +95,11 @@ class NFSessionRequests(NFSessionBase):\ndata=data)\ncommon.debug('Request took {}s', time.clock() - start)\ncommon.debug('Request returned statuscode {}', response.status_code)\n- if response.status_code == 404 and not session_refreshed:\n- # It may happen that netflix updates the build_identifier version\n- # when you are watching a video or browsing the menu,\n- # this causes the api address to change, and return 'url not found' error\n- # So let's try updating the session data (just once)\n- common.warn('Try refresh session data to update build_identifier version')\n+ if response.status_code in [404, 401] and not session_refreshed:\n+ # 404 - It may happen when Netflix update the build_identifier version and causes the api address to change\n+ # 401 - It may happen when authURL is not more valid (Unauthorized for url)\n+ # So let's try refreshing the session data (just once)\n+ common.warn('Try refresh session data due to {} http error', response.status_code)\nif self.try_refresh_session_data():\nreturn self._request(method, component, True, **kwargs)\nresponse.raise_for_status()\n"
}
]
| Python | MIT License | castagnait/plugin.video.netflix | Handle http 401 error |
106,046 | 13.01.2020 14:42:18 | -3,600 | 70357df84e2098b55d82f41ed4823e595d375d88 | Refresh session data at service startup to update authURL | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/nfsession/nfsession_access.py",
"new_path": "resources/lib/services/nfsession/nfsession_access.py",
"diff": "@@ -19,7 +19,7 @@ import resources.lib.common.cookies as cookies\nimport resources.lib.api.website as website\nimport resources.lib.kodi.ui as ui\nfrom resources.lib.globals import g\n-from resources.lib.services.nfsession.nfsession_requests import NFSessionRequests, BASE_URL\n+from resources.lib.services.nfsession.nfsession_requests import NFSessionRequests\nfrom resources.lib.services.nfsession.nfsession_cookie import NFSessionCookie\nfrom resources.lib.api.exceptions import (LoginFailedError, LoginValidateError,\nMissingCredentialsError, InvalidMembershipStatusError)\n@@ -77,8 +77,9 @@ class NFSessionAccess(NFSessionRequests, NFSessionCookie):\n\"\"\"A hack way to full load requests module before making any other calls\"\"\"\n# The first call made with 'requests' module, can takes more than one second longer then\n# usual to elaborate (depend from device/os/connection), to camouflage this delay\n- # and make the add-on frontend faster this request is made when the service is started\n- self.session.head(url=BASE_URL)\n+ # and make the add-on frontend faster this request is made when the service is started.\n+ # Side note: authURL probably has a expiration time not knowing which one we are obliged to refresh session data\n+ self.try_refresh_session_data()\n@common.addonsignals_return_call\ndef login(self):\n"
}
]
| Python | MIT License | castagnait/plugin.video.netflix | Refresh session data at service startup to update authURL |
106,046 | 13.01.2020 16:05:50 | -3,600 | 2ce086df8db567a0ab0f7bc30ce9a9800e8eee5d | Added OrderedDict in convert_to_string | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/common/data_conversion.py",
"new_path": "resources/lib/common/data_conversion.py",
"diff": "See LICENSES/MIT.md for more information.\n\"\"\"\nfrom __future__ import absolute_import, division, unicode_literals\n-import json\n+\nimport datetime\n+import json\nimport time\nfrom ast import literal_eval\n+from collections import OrderedDict\n# Workaround for http://bugs.python.org/issue8098 only to py2 caused by _conv_string_to_datetime()\n# Error: ImportError: Failed to import _strptime because the import lockis held by another thread.\nimport _strptime # pylint: disable=unused-import\n+\nfrom .logging import error\ntry: # Python 2\n@@ -41,7 +44,7 @@ def convert_to_string(value):\nconverter = None\nif data_type in (int, float, bool, tuple, datetime.datetime):\nconverter = _conv_standard_to_string\n- if data_type in (list, dict):\n+ if data_type in (list, dict, OrderedDict):\nconverter = _conv_json_to_string\nif not converter:\nerror('convert_to_string: Data type {} not mapped'.format(data_type))\n"
}
]
| Python | MIT License | castagnait/plugin.video.netflix | Added OrderedDict in convert_to_string |
106,046 | 13.01.2020 18:06:05 | -3,600 | 9dbc84473ae52547a65575467360cdc6798d2b13 | Fixed servers shutdown
shutdown() must be done before server_close() in order to stop serve_forever
this fix: [WinError 10038] An operation was attempted on something that is not a socket | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/run_service.py",
"new_path": "resources/lib/run_service.py",
"diff": "@@ -88,8 +88,8 @@ class NetflixService(object):\n\"\"\"\nself.window_cls.setProperty(self.prop_nf_service_status, 'stopped')\nfor server in self.SERVERS:\n- server['instance'].server_close()\nserver['instance'].shutdown()\n+ server['instance'].server_close()\nserver['instance'] = None\nserver['thread'].join()\nserver['thread'] = None\n"
}
]
| Python | MIT License | castagnait/plugin.video.netflix | Fixed servers shutdown
shutdown() must be done before server_close() in order to stop serve_forever
this fix: [WinError 10038] An operation was attempted on something that is not a socket |
106,046 | 10.12.2019 17:39:16 | -3,600 | f17b42717efcfa1dcd556d1ca7edb1e539c3bae0 | Delegate upnext to start the next video | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/common/ipc.py",
"new_path": "resources/lib/common/ipc.py",
"diff": "@@ -33,6 +33,7 @@ class Signals(object): # pylint: disable=no-init\nPLAYBACK_INITIATED = 'playback_initiated'\nESN_CHANGED = 'esn_changed'\nLIBRARY_UPDATE_REQUESTED = 'library_update_requested'\n+ UPNEXT_ADDON_INIT = 'upnext_data'\ndef register_slot(callback, signal=None, source_id=None):\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/navigation/player.py",
"new_path": "resources/lib/navigation/player.py",
"diff": "@@ -171,10 +171,12 @@ def get_upnext_info(videoid, current_episode, metadata):\nnext_episode_id.tvshowid,\nnext_episode_id.seasonid,\nnext_episode_id.episodeid)\n- next_info['play_info'] = {'play_path': g.py2_decode(xbmc.translatePath(filepath))}\n+ # next_info['play_info'] = {'play_path': g.py2_decode(xbmc.translatePath(filepath))}\n+ next_info['play_url'] = g.py2_decode(xbmc.translatePath(filepath))\nelse:\n- next_info['play_info'] = {'play_path': common.build_url(videoid=next_episode_id,\n- mode=g.MODE_PLAY)}\n+ # next_info['play_info'] = {'play_path': common.build_url(videoid=next_episode_id,\n+ # mode=g.MODE_PLAY)}\n+ next_info['play_url'] = common.build_url(videoid=next_episode_id, mode=g.MODE_PLAY)\nif 'creditsOffset' in metadata[0]:\nnext_info['notification_time'] = (metadata[0]['runtime'] -\nmetadata[0]['creditsOffset'])\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/nfsession/nfsession.py",
"new_path": "resources/lib/services/nfsession/nfsession.py",
"diff": "@@ -41,8 +41,9 @@ class NetflixSession(NFSessionAccess):\n]\nfor slot in self.slots:\ncommon.register_slot(slot)\n- common.register_slot(play_callback, signal=g.ADDON_ID + '_play_action',\n- source_id='upnextprovider')\n+ # UpNext Add-on - play call back method\n+ # common.register_slot(play_callback, signal=g.ADDON_ID + '_play_action',\n+ # source_id='upnextprovider')\nself.prefetch_login()\n@common.addonsignals_return_call\n@@ -235,8 +236,8 @@ def _set_range_selector(paths, range_start, range_end):\nreturn ranged_paths\n-def play_callback(data):\n- \"\"\"Callback function used for upnext integration\"\"\"\n- common.info('Received signal from Up Next. Playing next episode...')\n- common.stop_playback()\n- common.play_media(data['play_path'])\n+# def play_callback(data):\n+# \"\"\"Callback function used for upnext integration\"\"\"\n+# common.info('Received signal from Up Next. Playing next episode...')\n+# common.stop_playback()\n+# common.play_media(data['play_path'])\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/playback/upnext.py",
"new_path": "resources/lib/services/playback/upnext.py",
"diff": "@@ -33,7 +33,9 @@ class UpNextNotifier(PlaybackActionManager):\ndef _on_playback_started(self, player_state):\n# pylint: disable=unused-argument\ncommon.debug('Sending initialization signal to Up Next')\n- common.send_signal('upnext_data', self.upnext_info, non_blocking=True)\n+ common.send_signal(common.Signals.UPNEXT_ADDON_INIT,\n+ self.upnext_info,\n+ non_blocking=True)\ndef _on_tick(self, player_state):\npass\n"
}
]
| Python | MIT License | castagnait/plugin.video.netflix | Delegate upnext to start the next video |
106,046 | 14.01.2020 18:51:37 | -3,600 | 5e6c1ef9b7b694db3b7768a6bdec55bf52fb79ea | Removed ugly dependency workaround | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/cache.py",
"new_path": "resources/lib/cache.py",
"diff": "\"\"\"\n# Must not be used within these modules, because stale values may\n# be used and cause inconsistencies:\n-# resources.lib.self.common\n# resources.lib.services\n# resources.lib.kodi.ui\n# resources.lib.services.nfsession\n@@ -21,6 +20,8 @@ from time import time\nfrom functools import wraps\nfrom future.utils import iteritems\n+from resources.lib import common\n+\ntry:\nimport cPickle as pickle\nexcept ImportError:\n@@ -105,7 +106,6 @@ def cache_output(g, bucket, fixed_identifier=None,\ndef _get_identifier(fixed_identifier, identify_from_kwarg_name,\nidentify_append_from_kwarg_name, identify_fallback_arg_index, args, kwargs):\n\"\"\"Return the identifier to use with the caching_decorator\"\"\"\n- # import resources.lib.common as common\n# common.debug('Get_identifier args: {}', args)\n# common.debug('Get_identifier kwargs: {}', kwargs)\nif fixed_identifier:\n@@ -150,11 +150,8 @@ def _get_identifier(fixed_identifier, identify_from_kwarg_name,\nclass Cache(object):\n- def __init__(self, common, cache_path, ttl, metadata_ttl, plugin_handle):\n+ def __init__(self, cache_path, ttl, metadata_ttl, plugin_handle):\n# pylint: disable=too-many-arguments\n- # We have the self.common module injected as a dependency to work\n- # around circular dependencies with global variable initialization\n- self.common = common\nself.plugin_handle = plugin_handle\nself.cache_path = cache_path\nself.ttl = ttl\n@@ -206,7 +203,7 @@ class Cache(object):\n# same languageInvoker thread is being used so we MUST clear its\n# contents to allow cache consistency between instances\n# del self.buckets[bucket]\n- self.common.debug('Cache commit successful')\n+ common.debug('Cache commit successful')\ndef invalidate(self, on_disk=False, bucket_names=None):\n\"\"\"Clear all cache buckets\"\"\"\n@@ -220,20 +217,20 @@ class Cache(object):\nif on_disk:\nself._invalidate_on_disk(bucket_names)\n- self.common.info('Cache invalidated')\n+ common.info('Cache invalidated')\ndef _invalidate_on_disk(self, bucket_names):\nfor bucket in bucket_names:\n- self.common.delete_folder_contents(\n+ common.delete_folder_contents(\nos.path.join(self.cache_path, bucket))\ndef invalidate_entry(self, bucket, identifier, on_disk=False):\n\"\"\"Remove an item from a bucket\"\"\"\ntry:\nself._purge_entry(bucket, identifier, on_disk)\n- self.common.debug('Invalidated {} in {}', identifier, bucket)\n+ common.debug('Invalidated {} in {}', identifier, bucket)\nexcept KeyError:\n- self.common.debug('Nothing to invalidate, {} was not in {}', identifier, bucket)\n+ common.debug('Nothing to invalidate, {} was not in {}', identifier, bucket)\ndef _get_bucket(self, key):\n\"\"\"Get a cache bucket.\n@@ -249,11 +246,11 @@ class Cache(object):\nfor _ in range(1, 10):\nwnd_property_data = self.window.getProperty(self._window_property(bucket))\nif wnd_property_data.startswith(str('LOCKED_BY_')):\n- self.common.debug('Waiting for release of {}', bucket)\n+ common.debug('Waiting for release of {}', bucket)\nxbmc.sleep(50)\nelse:\nreturn self._load_bucket_from_wndprop(bucket, wnd_property_data)\n- self.common.warn('{} is locked. Working with an empty instance...', bucket)\n+ common.warn('{} is locked. Working with an empty instance...', bucket)\nreturn {}\ndef _load_bucket_from_wndprop(self, bucket, wnd_property_data):\n@@ -265,10 +262,10 @@ class Cache(object):\nbucket_instance = pickle.loads(wnd_property_data.encode('latin-1'))\nexcept Exception: # pylint: disable=broad-except\n# When window.getProperty does not have the property here happen an error\n- self.common.debug('No instance of {} found. Creating new instance.'.format(bucket))\n+ common.debug('No instance of {} found. Creating new instance.'.format(bucket))\nbucket_instance = {}\nself._lock(bucket)\n- self.common.debug('Acquired lock on {}', bucket)\n+ common.debug('Acquired lock on {}', bucket)\nreturn bucket_instance\ndef _lock(self, bucket):\n@@ -287,7 +284,7 @@ class Cache(object):\n# py3\nreturn pickle.loads(handle.readBytes())\nexcept Exception as exc:\n- self.common.error('Failed get cache from disk {}: {}', cache_filename, exc)\n+ common.error('Failed get cache from disk {}: {}', cache_filename, exc)\nraise CacheMiss()\nfinally:\nhandle.close()\n@@ -300,7 +297,7 @@ class Cache(object):\n# return pickle.dump(cache_entry, handle)\nhandle.write(bytearray(pickle.dumps(cache_entry)))\nexcept Exception as exc: # pylint: disable=broad-except\n- self.common.error('Failed to write cache entry to {}: {}', cache_filename, exc)\n+ common.error('Failed to write cache entry to {}: {}', cache_filename, exc)\nfinally:\nhandle.close()\n@@ -310,7 +307,7 @@ class Cache(object):\ndef _persist_bucket(self, bucket, contents):\nif not self.is_safe_to_persist(bucket):\n- self.common.warn(\n+ common.warn(\n'{} is locked by another instance. Discarding changes'\n.format(bucket))\nreturn\n@@ -326,10 +323,10 @@ class Cache(object):\nself.window.setProperty(self._window_property(bucket),\npickle.dumps(contents, protocol=0).decode('latin-1'))\nexcept Exception as exc: # pylint: disable=broad-except\n- self.common.error('Failed to persist {} to wnd properties: {}', bucket, exc)\n+ common.error('Failed to persist {} to wnd properties: {}', bucket, exc)\nself.window.clearProperty(self._window_property(bucket))\nfinally:\n- self.common.debug('Released lock on {}', bucket)\n+ common.debug('Released lock on {}', bucket)\ndef is_safe_to_persist(self, bucket):\n# Only persist if we acquired the original lock or if the lock is older\n@@ -345,7 +342,7 @@ class Cache(object):\nexcept ValueError:\nis_stale_lock = False\nif is_stale_lock:\n- self.common.info('Overriding stale cache lock {} on {}', lock_data, bucket)\n+ common.info('Overriding stale cache lock {} on {}', lock_data, bucket)\nreturn is_own_lock or is_stale_lock\nreturn True\n@@ -353,8 +350,7 @@ class Cache(object):\n\"\"\"Verify if cache_entry has reached its EOL.\nRemove from in-memory and disk cache if so and raise CacheMiss\"\"\"\nif cache_entry['eol'] < int(time()):\n- self.common.debug('Cache entry {} in {} has expired => cache miss',\n- identifier, bucket)\n+ common.debug('Cache entry {} in {} has expired => cache miss', identifier, bucket)\nself._purge_entry(bucket, identifier)\nraise CacheMiss()\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/globals.py",
"new_path": "resources/lib/globals.py",
"diff": "@@ -270,11 +270,8 @@ class GlobalVariables(object):\ndef _init_cache(self):\nif not os.path.exists(g.py2_decode(xbmc.translatePath(self.CACHE_PATH))):\nself._init_filesystem_cache()\n- # This is ugly: Pass the common module into Cache.__init__ to work\n- # around circular import dependencies.\n- import resources.lib.common as common\nfrom resources.lib.cache import Cache\n- self.CACHE = Cache(common, self.CACHE_PATH, self.CACHE_TTL,\n+ self.CACHE = Cache(self.CACHE_PATH, self.CACHE_TTL,\nself.CACHE_METADATA_TTL, self.PLUGIN_HANDLE)\ndef _init_filesystem_cache(self):\n"
}
]
| Python | MIT License | castagnait/plugin.video.netflix | Removed ugly dependency workaround |
106,046 | 14.01.2020 19:39:03 | -3,600 | d9a88160e2252e257e386c44389b67ccde5ed109 | Add carriage return to the supplemental message | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/kodi/infolabels.py",
"new_path": "resources/lib/kodi/infolabels.py",
"diff": "@@ -65,7 +65,7 @@ def add_info(videoid, list_item, item, raw_data, set_info=False):\nlist_item.addStreamInfo(stream_type, quality_infos)\nif item.get('dpSupplementalMessage'):\n# Short information about future release of tv show season or other\n- infos_copy['plot'] += ' [COLOR green]{}[/COLOR]'.format(item['dpSupplementalMessage'])\n+ infos_copy['plot'] += '[CR][COLOR green]{}[/COLOR]'.format(item['dpSupplementalMessage'])\nif set_info:\nlist_item.setInfo('video', infos_copy)\nreturn infos_copy\n"
}
]
| Python | MIT License | castagnait/plugin.video.netflix | Add carriage return to the supplemental message |
106,046 | 15.01.2020 14:19:29 | -3,600 | 7fac131bd8c190b64fd137ae67684248b741adac | Listing menu simplified a bit | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/api/data_types.py",
"new_path": "resources/lib/api/data_types.py",
"diff": "@@ -63,6 +63,14 @@ class LoLoMo(object):\nbreak\nreturn iteritems(lists)\n+ def find_by_context(self, context):\n+ \"\"\"Return the video list of a context\"\"\"\n+ for list_id, video_list in iteritems(self.lists):\n+ if not video_list['context'] == context:\n+ continue\n+ return list_id, VideoList(self.data, list_id)\n+ return None\n+\nclass VideoList:\n\"\"\"A video list\"\"\"\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/kodi/listings.py",
"new_path": "resources/lib/kodi/listings.py",
"diff": "@@ -109,30 +109,27 @@ def build_main_menu_listing(lolomo):\nBuilds the video lists (my list, continue watching, etc.) Kodi screen\n\"\"\"\ndirectory_items = []\n-\nfor menu_id, data in iteritems(g.MAIN_MENU_ITEMS):\n- show_in_menu = g.ADDON.getSettingBool('_'.join(('show_menu', menu_id)))\n- if show_in_menu:\n- menu_title = 'Missing menu title'\n+ if not g.ADDON.getSettingBool('_'.join(('show_menu', menu_id))):\n+ continue\nif data['lolomo_known']:\n- for list_id, user_list in lolomo.lists_by_context(data['lolomo_contexts'],\n- break_on_first=True):\n- videolist_item = _create_videolist_item(list_id, user_list, data,\n- static_lists=True)\n- videolist_item[1].addContextMenuItems(generate_context_menu_mainmenu(menu_id))\n- directory_items.append(videolist_item)\n- menu_title = user_list['displayName']\n+ context_data = lolomo.find_by_context(data['lolomo_contexts'][0])\n+ if not context_data:\n+ continue\n+ list_id, video_list = context_data\n+ menu_title = video_list['displayName']\n+ videolist_item = _create_videolist_item(list_id, video_list, data, static_lists=True)\nelse:\n- if data['label_id']:\n- menu_title = common.get_local_string(data['label_id'])\n+ menu_title = common.get_local_string(data['label_id']) if data.get('label_id') else 'Missing menu title'\nmenu_description = common.get_local_string(data['description_id']) \\\nif data['description_id'] is not None else ''\n- directory_items.append(\n- (common.build_url(data['path'], mode=g.MODE_DIRECTORY),\n+ videolist_item = (common.build_url(data['path'], mode=g.MODE_DIRECTORY),\nlist_item_skeleton(menu_title,\nicon=data['icon'],\ndescription=menu_description),\n- True))\n+ True)\n+ videolist_item[1].addContextMenuItems(generate_context_menu_mainmenu(menu_id))\n+ directory_items.append(videolist_item)\ng.LOCAL_DB.set_value(menu_id, {'title': menu_title}, TABLE_MENU_DATA)\nfinalize_directory(directory_items, g.CONTENT_FOLDER, title=common.get_local_string(30097))\n"
}
]
| Python | MIT License | castagnait/plugin.video.netflix | Listing menu simplified a bit |
106,046 | 15.01.2020 14:25:02 | -3,600 | 17ad8d67dad2852d33c13bfa0c6598837ad9434f | Added IS_ADDON_FIRSTRUN
Can be used to avoid to execute parts of code on subsequent addon
invocations and so optimize a bit the startup time.
The value will remain stored thanks to reuseLanguageInvoker,
but if the addon is updated or disabled and so reenabled, this value will
also be reset. | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/globals.py",
"new_path": "resources/lib/globals.py",
"diff": "@@ -182,6 +182,7 @@ class GlobalVariables(object):\ndef __init__(self):\n\"\"\"Do nothing on constructing the object\"\"\"\n# Define here any variables necessary for the correct loading of the modules\n+ self.IS_ADDON_FIRSTRUN = None\nself.ADDON = None\nself.ADDON_DATA_PATH = None\nself.DATA_PATH = None\n@@ -192,6 +193,8 @@ class GlobalVariables(object):\nNeeds to be called at start of each plugin instance!\nThis is an ugly hack because Kodi doesn't execute statements defined on\nmodule level if reusing a language invoker.\"\"\"\n+ # IS_ADDON_FIRSTRUN specifies when the addon is at its first run (reuselanguageinvoker is not yet used)\n+ self.IS_ADDON_FIRSTRUN = self.IS_ADDON_FIRSTRUN is None\nself.PY_IS_VER2 = sys.version_info.major == 2\nself.COOKIES = {}\nself.ADDON = xbmcaddon.Addon()\n"
}
]
| Python | MIT License | castagnait/plugin.video.netflix | Added IS_ADDON_FIRSTRUN
Can be used to avoid to execute parts of code on subsequent addon
invocations and so optimize a bit the startup time.
The value will remain stored thanks to reuseLanguageInvoker,
but if the addon is updated or disabled and so reenabled, this value will
also be reset. |
106,046 | 15.01.2020 14:58:57 | -3,600 | fa75655745afb3681115c66e5bf0c09b8b2655f6 | Show sceduling info only after setup | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/library_updater.py",
"new_path": "resources/lib/services/library_updater.py",
"diff": "@@ -134,6 +134,7 @@ def _compute_next_schedule():\nlast_run = last_run.replace(hour=int(time[0:2]), minute=int(time[3:5]))\nnext_run = last_run + timedelta(days=[1, 2, 5, 7][update_frequency])\n+ if next_run >= datetime.now():\ncommon.info('Next library auto update is scheduled for {}', next_run)\nreturn next_run\nexcept Exception: # pylint: disable=broad-except\n"
}
]
| Python | MIT License | castagnait/plugin.video.netflix | Show sceduling info only after setup |
106,046 | 15.01.2020 15:03:13 | -3,600 | ffd27fa58eb428b2289f967de0bdd9066a6f7c30 | Check addon upgrade only at first run | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/run_addon.py",
"new_path": "resources/lib/run_addon.py",
"diff": "@@ -160,6 +160,7 @@ def run(argv):\nif success:\ntry:\nif _check_valid_credentials():\n+ if g.IS_ADDON_FIRSTRUN:\ncheck_addon_upgrade()\ng.initial_addon_configuration()\nroute([part for part in g.PATH.split('/') if part])\n"
}
]
| Python | MIT License | castagnait/plugin.video.netflix | Check addon upgrade only at first run |
106,046 | 16.01.2020 11:38:11 | -3,600 | 16d9678066a9cbdb8960833a966e60111c04dec1 | Added folder exists method | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/common/fileops.py",
"new_path": "resources/lib/common/fileops.py",
"diff": "@@ -19,7 +19,7 @@ from resources.lib.globals import g\ndef check_folder_path(path):\n\"\"\"\n- Check if folderpath ends with path delimator\n+ Check if folder path ends with path delimiter\nIf not correct it (makes sure xbmcvfs.exists is working correct)\n\"\"\"\nend = ''\n@@ -30,6 +30,15 @@ def check_folder_path(path):\nreturn path + end\n+def folder_exists(path):\n+ \"\"\"\n+ Checks if a given path exists\n+ :param path: The path\n+ :return: True if exists\n+ \"\"\"\n+ return xbmcvfs.exists(check_folder_path(path))\n+\n+\ndef file_exists(filename, data_path=g.DATA_PATH):\n\"\"\"\nChecks if a given file exists\n"
}
]
| Python | MIT License | castagnait/plugin.video.netflix | Added folder exists method |
106,046 | 16.01.2020 12:50:36 | -3,600 | 3ef8d6198e870d9795271a23bc46bea88071c356 | Fixed edge case of getDirectory error
This fix the error of:
ERROR: XFILE::CDirectory::GetDirectory - Error getting ...
due to missing delimiter at the end of path | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/database/db_utils.py",
"new_path": "resources/lib/database/db_utils.py",
"diff": "@@ -14,6 +14,7 @@ import os\nimport xbmc\nimport xbmcvfs\n+from resources.lib.common import folder_exists\nfrom resources.lib.globals import g\n@@ -39,9 +40,9 @@ VidLibProp = {\ndef get_local_db_path(db_filename):\n# First ensure database folder exists\ndb_folder = xbmc.translatePath(os.path.join(g.DATA_PATH, 'database'))\n- if not xbmcvfs.exists(db_folder):\n+ if not folder_exists(db_folder):\nxbmcvfs.mkdirs(db_folder)\n- return xbmc.translatePath(os.path.join(g.DATA_PATH, 'database', db_filename))\n+ return os.path.join(db_folder, db_filename)\ndef sql_filtered_update(table, set_columns, where_columns, values):\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/kodi/library_items.py",
"new_path": "resources/lib/kodi/library_items.py",
"diff": "@@ -171,8 +171,7 @@ def export_item(item_task, library_home):\ndef _create_destination_folder(destination_folder):\n\"\"\"Create destination folder, ignore error if it already exists\"\"\"\n- destination_folder = xbmc.translatePath(destination_folder)\n- if not xbmcvfs.exists(destination_folder):\n+ if not common.folder_exists(destination_folder):\nxbmcvfs.mkdirs(destination_folder)\n"
}
]
| Python | MIT License | castagnait/plugin.video.netflix | Fixed edge case of getDirectory error
This fix the error of:
ERROR: XFILE::CDirectory::GetDirectory - Error getting ...
due to missing delimiter at the end of path |
106,046 | 16.01.2020 13:00:56 | -3,600 | ec1df2ef83ace630c6acf7191aa6f29f0c7f1c56 | Removed unused mkdir data path
It never worked because data_path is a "special" address,
so it always generated an exception,
and in case the folder is created by init cache | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/globals.py",
"new_path": "resources/lib/globals.py",
"diff": "@@ -242,11 +242,6 @@ class GlobalVariables(object):\nself.settings_monitor_suspend(False) # Reset the value in case of addon crash\n- try:\n- os.mkdir(self.DATA_PATH)\n- except OSError:\n- pass\n-\nself._init_cache()\ndef _init_database(self, initialize):\n"
}
]
| Python | MIT License | castagnait/plugin.video.netflix | Removed unused mkdir data path
It never worked because data_path is a "special" address,
so it always generated an exception,
and in case the folder is created by init cache |
106,046 | 16.01.2020 14:44:09 | -3,600 | 1e4bd9519380954f780a5c4cdb52e833e9d80cca | Saves the current kodi profile name as global
Avoid multiple rpc requests
Avoid problems with the use of the addon after rename the current kodi profile | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/common/kodiops.py",
"new_path": "resources/lib/common/kodiops.py",
"diff": "@@ -34,6 +34,8 @@ LIBRARY_PROPS = {\n'tag', 'art', 'userrating']\n}\n+__CURRENT_KODI_PROFILE_NAME__ = None\n+\ndef json_rpc(method, params=None):\n\"\"\"\n@@ -138,10 +140,13 @@ def stop_playback():\ndef get_current_kodi_profile_name(no_spaces=True):\n- \"\"\"Gets the name of the Kodi profile currently used\"\"\"\n- name = json_rpc('Profiles.GetCurrentProfile',\n- {'properties': ['thumbnail', 'lockmode']}).get('label', 'unknown')\n- return name.replace(' ', '_') if no_spaces else name\n+ \"\"\"Lazily gets the name of the Kodi profile currently used\"\"\"\n+ # pylint: disable=global-statement\n+ global __CURRENT_KODI_PROFILE_NAME__\n+ if not __CURRENT_KODI_PROFILE_NAME__:\n+ name = json_rpc('Profiles.GetCurrentProfile', {'properties': ['thumbnail', 'lockmode']}).get('label', 'unknown')\n+ __CURRENT_KODI_PROFILE_NAME__ = name.replace(' ', '_') if no_spaces else name\n+ return __CURRENT_KODI_PROFILE_NAME__\ndef get_kodi_audio_language():\n"
}
]
| Python | MIT License | castagnait/plugin.video.netflix | Saves the current kodi profile name as global
-Avoid multiple rpc requests
-Avoid problems with the use of the addon after rename the current kodi profile |
106,046 | 16.01.2020 16:18:11 | -3,600 | 44856573a606e0fd615ab2f673d3d100bf71a19f | Fixed unicodedecode error on py2 | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/cache.py",
"new_path": "resources/lib/cache.py",
"diff": "@@ -371,4 +371,6 @@ class Cache(object):\nos.remove(cache_filename)\ndef _window_property(self, bucket):\n+ if self.PY_IS_VER2:\n+ return ('nfmemcache_{}_{}'.format(self.properties_prefix, bucket)).encode('utf-8')\nreturn 'nfmemcache_{}_{}'.format(self.properties_prefix, bucket)\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/run_addon.py",
"new_path": "resources/lib/run_addon.py",
"diff": "@@ -148,7 +148,7 @@ def run(argv):\nwindow_cls = Window(10000) # Kodi home window\n# If you use multiple Kodi profiles you need to distinguish the property of current profile\n- prop_nf_service_status = 'nf_service_status_' + get_current_kodi_profile_name()\n+ prop_nf_service_status = g.py2_encode('nf_service_status_' + get_current_kodi_profile_name())\nis_widget_skin_call = _skin_widget_call(window_cls, prop_nf_service_status)\nif window_cls.getProperty(prop_nf_service_status) != 'running':\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/run_service.py",
"new_path": "resources/lib/run_service.py",
"diff": "@@ -47,7 +47,7 @@ class NetflixService(object):\ndef __init__(self):\nself.window_cls = Window(10000) # Kodi home window\n# If you use multiple Kodi profiles you need to distinguish the property of current profile\n- self.prop_nf_service_status = 'nf_service_status_' + get_current_kodi_profile_name()\n+ self.prop_nf_service_status = g.py2_encode('nf_service_status_' + get_current_kodi_profile_name())\nfor server in self.SERVERS:\nself.init_server(server)\nself.controller = None\n"
}
]
| Python | MIT License | castagnait/plugin.video.netflix | Fixed unicodedecode error on py2 |
106,046 | 16.01.2020 16:35:35 | -3,600 | 48b970bdd8c981d31b4bd2ef8efd5f333a1a97c9 | ndb file cache no more used | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/navigation/actions.py",
"new_path": "resources/lib/navigation/actions.py",
"diff": "@@ -119,8 +119,6 @@ class AddonActionExecutor(object):\n\"\"\"Clear the cache. If on_disk param is supplied, also clear cached\nitems from disk\"\"\"\ng.CACHE.invalidate(self.params.get('on_disk', False))\n- if self.params.get('on_disk', False):\n- common.delete_file('resources.lib.services.playback.stream_continuity.ndb')\nif not self.params.get('no_notification', False):\nui.show_notification(common.get_local_string(30135))\n"
}
]
| Python | MIT License | castagnait/plugin.video.netflix | ndb file cache no more used |
106,046 | 16.01.2020 17:34:25 | -3,600 | 78b7d55ab52adc760482d7ff58d43f11f0267535 | Cache class changes
Removed global hack
ttl read directly from global settings
General cleanup | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/api/shakti.py",
"new_path": "resources/lib/api/shakti.py",
"diff": "@@ -80,7 +80,7 @@ def activate_profile(profile_id):\n@common.time_execution(immediate=False)\n-@cache.cache_output(g, cache.CACHE_COMMON, fixed_identifier='root_lists')\n+@cache.cache_output(cache.CACHE_COMMON, fixed_identifier='root_lists')\ndef root_lists():\n\"\"\"Retrieve initial video lists to display on homepage\"\"\"\ncommon.debug('Requesting root lists from API')\n@@ -101,7 +101,7 @@ def root_lists():\nART_PARTIAL_PATHS)))\n-@cache.cache_output(g, cache.CACHE_COMMON, identify_from_kwarg_name='list_type')\n+@cache.cache_output(cache.CACHE_COMMON, identify_from_kwarg_name='list_type')\ndef list_id_for_type(list_type):\n\"\"\"Return the dynamic video list ID for a video list of known type\"\"\"\ntry:\n@@ -115,7 +115,7 @@ def list_id_for_type(list_type):\n@common.time_execution(immediate=False)\n-@cache.cache_output(g, cache.CACHE_COMMON, identify_from_kwarg_name='list_id')\n+@cache.cache_output(cache.CACHE_COMMON, identify_from_kwarg_name='list_id')\ndef video_list(list_id, perpetual_range_start=None):\n\"\"\"Retrieve a single video list\nsome of this type of request seems to have results fixed at ~40 from netflix\n@@ -133,7 +133,7 @@ def video_list(list_id, perpetual_range_start=None):\n@common.time_execution(immediate=False)\n-@cache.cache_output(g, cache.CACHE_COMMON, identify_from_kwarg_name='context_id',\n+@cache.cache_output(cache.CACHE_COMMON, identify_from_kwarg_name='context_id',\nidentify_append_from_kwarg_name='perpetual_range_start')\ndef video_list_sorted(context_name, context_id=None, perpetual_range_start=None, menu_data=None):\n\"\"\"Retrieve a single video list sorted\n@@ -175,7 +175,7 @@ def custom_video_list(video_ids, custom_paths=None):\n@common.time_execution(immediate=False)\n-@cache.cache_output(g, cache.CACHE_GENRES, identify_from_kwarg_name='genre_id')\n+@cache.cache_output(cache.CACHE_GENRES, identify_from_kwarg_name='genre_id')\ndef genre(genre_id):\n\"\"\"Retrieve LoLoMos for the given genre\"\"\"\ncommon.debug('Requesting LoLoMos for genre {}', genre_id)\n@@ -201,7 +201,7 @@ def subgenre(genre_id):\n@common.time_execution(immediate=False)\n-@cache.cache_output(g, cache.CACHE_COMMON)\n+@cache.cache_output(cache.CACHE_COMMON)\ndef seasons(videoid):\n\"\"\"Retrieve seasons of a TV show\"\"\"\nif videoid.mediatype != common.VideoId.SHOW:\n@@ -217,7 +217,7 @@ def seasons(videoid):\n@common.time_execution(immediate=False)\n-@cache.cache_output(g, cache.CACHE_COMMON, identify_from_kwarg_name='videoid_value',\n+@cache.cache_output(cache.CACHE_COMMON, identify_from_kwarg_name='videoid_value',\nidentify_append_from_kwarg_name='perpetual_range_start')\ndef episodes(videoid, videoid_value, perpetual_range_start=None): # pylint: disable=unused-argument\n\"\"\"Retrieve episodes of a season\"\"\"\n@@ -239,7 +239,7 @@ def episodes(videoid, videoid_value, perpetual_range_start=None): # pylint: dis\n@common.time_execution(immediate=False)\n-@cache.cache_output(g, cache.CACHE_SUPPLEMENTAL)\n+@cache.cache_output(cache.CACHE_SUPPLEMENTAL)\ndef supplemental_video_list(videoid, supplemental_type):\n\"\"\"Retrieve a supplemental video list\"\"\"\nif videoid.mediatype != common.VideoId.SHOW and videoid.mediatype != common.VideoId.MOVIE:\n@@ -254,7 +254,7 @@ def supplemental_video_list(videoid, supplemental_type):\n@common.time_execution(immediate=False)\n-@cache.cache_output(g, cache.CACHE_COMMON)\n+@cache.cache_output(cache.CACHE_COMMON)\ndef single_info(videoid):\n\"\"\"Retrieve info for a single episode\"\"\"\nif videoid.mediatype not in [common.VideoId.EPISODE, common.VideoId.MOVIE,\n@@ -294,7 +294,7 @@ def custom_video_list_basicinfo(context_name, switch_profiles=False):\n# We can not have the changes in real-time, if my-list is modified using other apps,\n# every 10 minutes will be updated with the new data\n# Never disable the cache to this function, it would cause plentiful requests to the service!\n-@cache.cache_output(g, cache.CACHE_COMMON, fixed_identifier='my_list_items', ttl=600)\n+@cache.cache_output(cache.CACHE_COMMON, fixed_identifier='my_list_items', ttl=600)\ndef mylist_items():\n\"\"\"Return a list of all the items currently contained in my list\"\"\"\ncommon.debug('Try to perform a request to get the id list of the videos in my list')\n@@ -444,7 +444,7 @@ def _episode_metadata(videoid):\n@common.time_execution(immediate=False)\n-@cache.cache_output(g, cache.CACHE_METADATA, identify_from_kwarg_name='video_id',\n+@cache.cache_output(cache.CACHE_METADATA, identify_from_kwarg_name='video_id',\nttl=g.CACHE_METADATA_TTL, to_disk=True)\ndef _metadata(video_id):\n\"\"\"Retrieve additional metadata for a video.This is a separate method from\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/cache.py",
"new_path": "resources/lib/cache.py",
"diff": "# resources.lib.kodi.ui\n# resources.lib.services.nfsession\nfrom __future__ import absolute_import, division, unicode_literals\n+\nimport os\n-import sys\n-from time import time\nfrom functools import wraps\n+from time import time\n+\nfrom future.utils import iteritems\n+import xbmc\n+import xbmcgui\n+import xbmcvfs\n+\nfrom resources.lib import common\n+from resources.lib.globals import g\ntry:\nimport cPickle as pickle\nexcept ImportError:\nimport pickle\n-import xbmc\n-import xbmcgui\n-import xbmcvfs\n-\ntry: # Python 2\nunicode\nexcept NameError: # Python 3\n@@ -72,7 +74,7 @@ class UnknownCacheBucketError(Exception):\n# get the value from the func arguments\n# fixed_identifier - note if specified all other params are ignored\n-def cache_output(g, bucket, fixed_identifier=None,\n+def cache_output(bucket, fixed_identifier=None,\nidentify_from_kwarg_name='videoid',\nidentify_append_from_kwarg_name=None,\nidentify_fallback_arg_index=0,\n@@ -150,17 +152,13 @@ def _get_identifier(fixed_identifier, identify_from_kwarg_name,\nclass Cache(object):\n- def __init__(self, cache_path, ttl, metadata_ttl, plugin_handle):\n- # pylint: disable=too-many-arguments\n+ def __init__(self, cache_path, plugin_handle):\nself.plugin_handle = plugin_handle\nself.cache_path = cache_path\n- self.ttl = ttl\n- self.metadata_ttl = metadata_ttl\nself.buckets = {}\nself.window = xbmcgui.Window(10000) # Kodi home window\n# If you use multiple Kodi profiles you need to distinguish the cache of the current profile\nself.properties_prefix = common.get_current_kodi_profile_name()\n- self.PY_IS_VER2 = sys.version_info.major == 2\ndef lock_marker(self):\n\"\"\"Return a lock marker for this instance and the current time\"\"\"\n@@ -185,7 +183,7 @@ class Cache(object):\n\"\"\"Add an item to a cache bucket\"\"\"\n# pylint: disable=too-many-arguments\nif not eol:\n- eol = int(time() + (ttl if ttl else self.ttl))\n+ eol = int(time() + (ttl if ttl else g.CACHE_TTL))\n# self.common.debug('Adding {} to {} (valid until {})',\n# identifier, bucket, eol)\ncache_entry = {'eol': eol, 'content': content}\n@@ -196,7 +194,6 @@ class Cache(object):\ndef commit(self):\n\"\"\"Persist cache contents in window properties\"\"\"\n- # pylint: disable=global-statement\nfor bucket, contents in iteritems(self.buckets):\nself._persist_bucket(bucket, contents)\n# The self.buckets dict survives across addon invocations if the\n@@ -207,7 +204,6 @@ class Cache(object):\ndef invalidate(self, on_disk=False, bucket_names=None):\n\"\"\"Clear all cache buckets\"\"\"\n- # pylint: disable=global-statement\nif not bucket_names:\nbucket_names = BUCKET_NAMES\nfor bucket in bucket_names:\n@@ -255,7 +251,7 @@ class Cache(object):\ndef _load_bucket_from_wndprop(self, bucket, wnd_property_data):\ntry:\n- if self.PY_IS_VER2:\n+ if g.PY_IS_VER2:\n# pickle.loads on py2 wants string\nbucket_instance = pickle.loads(wnd_property_data)\nelse:\n@@ -278,7 +274,7 @@ class Cache(object):\nraise CacheMiss()\nhandle = xbmcvfs.File(cache_filename, 'rb')\ntry:\n- if self.PY_IS_VER2:\n+ if g.PY_IS_VER2:\n# pickle.loads on py2 wants string\nreturn pickle.loads(handle.read())\n# py3\n@@ -312,7 +308,7 @@ class Cache(object):\n.format(bucket))\nreturn\ntry:\n- if self.PY_IS_VER2:\n+ if g.PY_IS_VER2:\nself.window.setProperty(self._window_property(bucket), pickle.dumps(contents))\nelse:\n# Note: On python 3 pickle.dumps produces byte not str cannot be passed as is in\n@@ -371,6 +367,4 @@ class Cache(object):\nos.remove(cache_filename)\ndef _window_property(self, bucket):\n- if self.PY_IS_VER2:\n- return ('nfmemcache_{}_{}'.format(self.properties_prefix, bucket)).encode('utf-8')\n- return 'nfmemcache_{}_{}'.format(self.properties_prefix, bucket)\n+ return g.py2_encode('nfmemcache_{}_{}'.format(self.properties_prefix, bucket))\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/globals.py",
"new_path": "resources/lib/globals.py",
"diff": "@@ -242,6 +242,7 @@ class GlobalVariables(object):\nself.settings_monitor_suspend(False) # Reset the value in case of addon crash\n+ if self.IS_ADDON_FIRSTRUN:\nself._init_cache()\ndef _init_database(self, initialize):\n@@ -271,8 +272,7 @@ class GlobalVariables(object):\nif not os.path.exists(g.py2_decode(xbmc.translatePath(self.CACHE_PATH))):\nself._init_filesystem_cache()\nfrom resources.lib.cache import Cache\n- self.CACHE = Cache(self.CACHE_PATH, self.CACHE_TTL,\n- self.CACHE_METADATA_TTL, self.PLUGIN_HANDLE)\n+ self.CACHE = Cache(self.CACHE_PATH, self.PLUGIN_HANDLE)\ndef _init_filesystem_cache(self):\nfrom xbmcvfs import mkdirs\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/settings_monitor.py",
"new_path": "resources/lib/services/settings_monitor.py",
"diff": "@@ -49,10 +49,10 @@ class SettingsMonitor(xbmc.Monitor):\nuse_mysql_old = g.LOCAL_DB.get_value('use_mysql', False, TABLE_SETTINGS_MONITOR)\nuse_mysql_turned_on = use_mysql and not use_mysql_old\n- common.debug('SettingsMonitor: Reinitialization of global settings')\n+ common.debug('SettingsMonitor: Reinitialization of service global settings')\ng.init_globals(sys.argv, use_mysql != use_mysql_old)\n- # Check the MySQL connection status after reinitialization of global settings\n+ # Check the MySQL connection status after reinitialization of service global settings\nuse_mysql_after = g.ADDON.getSettingBool('use_mysql')\nif use_mysql_turned_on and use_mysql_after:\ng.LOCAL_DB.set_value('use_mysql', True, TABLE_SETTINGS_MONITOR)\n"
}
]
| Python | MIT License | castagnait/plugin.video.netflix | Cache class changes
-Removed global hack
-ttl read directly from global settings
-General cleanup |
106,046 | 16.01.2020 18:40:14 | -3,600 | 5b748807173073e0313238e5fc19b7daa645953c | Fix settings monitor suspend | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/globals.py",
"new_path": "resources/lib/globals.py",
"diff": "@@ -381,7 +381,7 @@ class GlobalVariables(object):\nfor _ in range(0, 30):\nesn.append(random.choice(possible))\nedge_esn = ''.join(esn)\n- self.settings_monitor_suspend(True)\n+ self.settings_monitor_suspend(True, True)\nself.ADDON.setSetting('edge_esn', edge_esn)\nreturn edge_esn\n"
}
]
| Python | MIT License | castagnait/plugin.video.netflix | Fix settings monitor suspend |
106,046 | 18.01.2020 13:06:12 | -3,600 | 9b0f63bf59d9f30ad6dbdf5e10184816a8a1931c | Version bump (0.16.3) | [
{
"change_type": "MODIFY",
"old_path": "addon.xml",
"new_path": "addon.xml",
"diff": "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n-<addon id=\"plugin.video.netflix\" name=\"Netflix\" version=\"0.16.2\" provider-name=\"libdev + jojo + asciidisco + caphm + castagnait\">\n+<addon id=\"plugin.video.netflix\" name=\"Netflix\" version=\"0.16.3\" provider-name=\"libdev + jojo + asciidisco + caphm + castagnait\">\n<requires>\n<import addon=\"xbmc.python\" version=\"2.26.0\"/>\n<import addon=\"script.module.addon.signals\" version=\"0.0.3\"/>\n<forum>https://forum.kodi.tv/showthread.php?tid=329767</forum>\n<source>https://github.com/CastagnaIT/plugin.video.netflix</source>\n<news>\n+v0.16.3 (2020-01-18)\n+-Fixed an issue that causing addon freeze on export/update to library\n+-Fixed an regression issue that causing http error 401\n+-Fixed an issue that causing unicodedecode error at startup\n+-Fixed an issue that in some cases prevented the export of a tv show season\n+-Generally optimized addon speed\n+-Many improvements to the code\n+\nv0.16.2 (2020-01-07)\n-Improved add-on startup\n-Improved loading of profiles list\n@@ -63,24 +71,6 @@ v0.16.2 (2020-01-07)\n-Permanently removed sharing Kodi videos settings between profiles\n-Updated de, es, it translations\n-Minor improvements\n-\n-v0.16.1 (2019-12-14)\n--Allowed to export individual seasons to the library (manual mode)\n--Dolby atmos audio streams are now specified (Kodi 19)\n--Added workaround to fix skin widgets\n--Handled subtitle properties for next version of InputStream Adaptive\n--Introduced accurate handling of subtitles (Kodi 19)\n--Improved handling of subtitles (Kodi 18)\n--Improved return to main page from search dialog\n--Improved cancel login dialog after the logout\n--Improved timeout on IPC over HTTP\n--Fixed an issue that showed the wrong label while browsing movies\n--Fixed ParentalControl/Rating GUI on custom skins\n--Fixed an issue that cause unicodedecode error on some android devices\n--Fixed an issue that can cause unicodedecode error in user/password\n--Added japanese language\n--Updated kr, hu, pt_br, fr\n--Many improvements to the code\n</news>\n</extension>\n</addon>\n"
},
{
"change_type": "MODIFY",
"old_path": "changelog.txt",
"new_path": "changelog.txt",
"diff": "+v0.16.1 (2019-12-14)\n+-Allowed to export individual seasons to the library (manual mode)\n+-Dolby atmos audio streams are now specified (Kodi 19)\n+-Added workaround to fix skin widgets\n+-Handled subtitle properties for next version of InputStream Adaptive\n+-Introduced accurate handling of subtitles (Kodi 19)\n+-Improved handling of subtitles (Kodi 18)\n+-Improved return to main page from search dialog\n+-Improved cancel login dialog after the logout\n+-Improved timeout on IPC over HTTP\n+-Fixed an issue that showed the wrong label while browsing movies\n+-Fixed ParentalControl/Rating GUI on custom skins\n+-Fixed an issue that cause unicodedecode error on some android devices\n+-Fixed an issue that can cause unicodedecode error in user/password\n+-Added japanese language\n+-Updated kr, hu, pt_br, fr\n+-Many improvements to the code\n+\nv0.16.0 (2019-11-29)\n-Added new parental control settings\n-Added new thumb rating to movies/tv shows\n"
}
]
| Python | MIT License | castagnait/plugin.video.netflix | Version bump (0.16.3) |
106,046 | 20.01.2020 09:01:05 | -3,600 | 65050ab6ba8c886d06e60c582d5623e7c2417f85 | Added is_debug_verbose | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/common/logging.py",
"new_path": "resources/lib/common/logging.py",
"diff": "@@ -38,6 +38,10 @@ def get_log_level():\nreturn __LOG_LEVEL__\n+def is_debug_verbose():\n+ return get_log_level() == 'Verbose'\n+\n+\ndef reset_log_level_global_var():\n\"\"\"Reset log level global var, in order to update the value from settings\"\"\"\n# pylint: disable=global-statement\n"
}
]
| Python | MIT License | castagnait/plugin.video.netflix | Added is_debug_verbose |
106,046 | 20.01.2020 09:02:07 | -3,600 | 53f8dba120af5d1e19939842beaccc4517707de5 | Fixed wrong mpd seconds strings | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/msl/converter.py",
"new_path": "resources/lib/services/msl/converter.py",
"diff": "@@ -19,14 +19,16 @@ def convert_to_dash(manifest):\n\"\"\"Convert a Netflix style manifest to MPEGDASH manifest\"\"\"\nfrom xbmcaddon import Addon\nisa_version = Addon('inputstream.adaptive').getAddonInfo('version')\n- seconds = manifest['duration'] / 1000\n- init_length = seconds / 2 * 12 + 20 * 1000\n+\n+ has_drm_streams = manifest['hasDrmStreams']\n+ protection_info = _get_protection_info(manifest) if has_drm_streams else None\n+\n+ seconds = int(manifest['duration'] / 1000)\n+ init_length = int(seconds / 2 * 12 + 20 * 1000)\nduration = \"PT\" + str(seconds) + \".00S\"\nroot = _mpd_manifest_root(duration)\nperiod = ET.SubElement(root, 'Period', start='PT0S', duration=duration)\n- protection = _protection_info(manifest) if manifest['hasDrmStreams'] else None\n- drm_streams = manifest['hasDrmStreams']\nfor video_track in manifest['video_tracks']:\n_convert_video_track(\n"
}
]
| Python | MIT License | castagnait/plugin.video.netflix | Fixed wrong mpd seconds strings |
106,046 | 14.01.2020 10:08:53 | -3,600 | 5e4ac376593df00f6749a7f079441bca0ddefcd4 | Use notification_offset for upnext | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/navigation/player.py",
"new_path": "resources/lib/navigation/player.py",
"diff": "@@ -177,8 +177,7 @@ def get_upnext_info(videoid, current_episode, metadata):\n# mode=g.MODE_PLAY)}\nnext_info['play_url'] = common.build_url(videoid=next_episode_id, mode=g.MODE_PLAY)\nif 'creditsOffset' in metadata[0]:\n- next_info['notification_time'] = (metadata[0]['runtime'] -\n- metadata[0]['creditsOffset'])\n+ next_info['notification_offset'] = metadata[0]['creditsOffset']\nreturn next_info\n"
}
]
| Python | MIT License | castagnait/plugin.video.netflix | Use notification_offset for upnext |
106,046 | 13.01.2020 18:04:06 | -3,600 | 297d51f58379ab886dcbd78b105eab75583ad3e5 | Changed upnext default behaviour | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/navigation/player.py",
"new_path": "resources/lib/navigation/player.py",
"diff": "@@ -85,13 +85,21 @@ def play(videoid):\nif index_selected == 1:\nresume_position = None\n+ xbmcplugin.setResolvedUrl(\n+ handle=g.PLUGIN_HANDLE,\n+ succeeded=True,\n+ listitem=list_item)\n+\n+ upnext_info = get_upnext_info(videoid, (infos, art), metadata) \\\n+ if g.ADDON.getSettingBool('UpNextNotifier_enabled') else None\n+\ncommon.debug('Sending initialization signal')\ncommon.send_signal(common.Signals.PLAYBACK_INITIATED, {\n'videoid': videoid.to_dict(),\n'infos': infos,\n'art': art,\n'timeline_markers': get_timeline_markers(metadata[0]),\n- 'upnext_info': get_upnext_info(videoid, (infos, art), metadata),\n+ 'upnext_info': upnext_info,\n'resume_position': resume_position}, non_blocking=True)\nxbmcplugin.setResolvedUrl(\nhandle=g.PLUGIN_HANDLE,\n@@ -160,8 +168,8 @@ def get_upnext_info(videoid, current_episode, metadata):\nnext_episode = infolabels.add_info_for_playback(next_episode_id,\nxbmcgui.ListItem())\nnext_info = {\n- 'current_episode': upnext_info(videoid, *current_episode),\n- 'next_episode': upnext_info(next_episode_id, *next_episode)\n+ 'current_episode': _upnext_info(videoid, *current_episode),\n+ 'next_episode': _upnext_info(next_episode_id, *next_episode)\n}\nif (xbmc.getInfoLabel('Container.PluginName') != g.ADDON.getAddonInfo('id') and\n@@ -200,7 +208,7 @@ def _find_next_episode(videoid, metadata):\nepisodeid=episode['id'])\n-def upnext_info(videoid, infos, art):\n+def _upnext_info(videoid, infos, art):\n\"\"\"Create a data dict for upnext signal\"\"\"\n# Double check to 'rating' key, sometime can be an empty string, not accepted by UpNext Addon\nrating = infos.get('rating', None)\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/settings.xml",
"new_path": "resources/settings.xml",
"diff": "<setting id=\"SectionSkipper_enabled\" type=\"bool\" label=\"30075\" default=\"true\"/>\n<setting id=\"auto_skip_credits\" type=\"bool\" label=\"30079\" default=\"false\" visible=\"eq(-1,true)\" subsetting=\"true\"/>\n<setting id=\"pause_on_skip\" type=\"bool\" label=\"30080\" default=\"false\" visible=\"eq(-1,true)\" subsetting=\"true\"/>\n- <setting id=\"UpNextNotifier_enabled\" type=\"bool\" label=\"30129\" default=\"true\"/>\n+ <setting id=\"UpNextNotifier_enabled\" type=\"bool\" label=\"30129\" default=\"false\"/>\n<setting id=\"is_settings_upnext\" type=\"action\" label=\"30178\" action=\"Addon.OpenSettings(service.upnext)\" enable=\"System.HasAddon(service.upnext)\" option=\"close\" visible=\"eq(-1,true)\" subsetting=\"true\"/>\n<setting id=\"ResumeManager_enabled\" type=\"bool\" label=\"30176\" default=\"true\"/>\n<setting id=\"ResumeManager_dialog\" type=\"bool\" label=\"30177\" default=\"true\" visible=\"eq(-1,true)\" subsetting=\"true\"/>\n"
}
]
| Python | MIT License | castagnait/plugin.video.netflix | Changed upnext default behaviour |
106,046 | 20.01.2020 13:57:48 | -3,600 | 3d5317bc1cfa3ee8fdde97408e74277993c774f9 | Manage caches from the service individually
avoids possible cache locks due to improper use of cache buckets
makes it possible to use cache within the service even if it does not contain the data used by the frontend cache | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/cache.py",
"new_path": "resources/lib/cache.py",
"diff": "SPDX-License-Identifier: MIT\nSee LICENSES/MIT.md for more information.\n\"\"\"\n-# Must not be used within these modules, because stale values may\n-# be used and cause inconsistencies:\n-# resources.lib.services\n-# resources.lib.kodi.ui\n-# resources.lib.services.nfsession\n+# To avoid concurrency between multiple instances of the addon that write on the same Kodi properties (of each bucket),\n+# the first time that a bucket is read, will be blocked. When the addon instance ends, the properties\n+# (of each blocked bucket) are updated and then released.\n+# Then if another addon instance will try to access a blocked bucket, it will get an empty bucket content.\n+\n+# WARNING to using cache on the SERVICE SIDE:\n+# The contents of buckets will be handled temporarily in memory and not read or written in the Kodi properties,\n+# this is because sharing with the frontend is not possible and may cause a stale of values or inconsistencies.\n+# So take into account that if the cache will be used, it will NOT contain the cache data from the frontend!\nfrom __future__ import absolute_import, division, unicode_literals\nimport os\nfrom functools import wraps\nfrom time import time\n-from future.utils import iteritems\n-\nimport xbmc\nimport xbmcgui\nimport xbmcvfs\n@@ -159,6 +161,8 @@ class Cache(object):\nself.window = xbmcgui.Window(10000) # Kodi home window\n# If you use multiple Kodi profiles you need to distinguish the cache of the current profile\nself.properties_prefix = common.get_current_kodi_profile_name()\n+ if g.IS_SERVICE:\n+ common.register_slot(self.invalidate_callback, signal=common.Signals.INVALIDATE_SERVICE_CACHE)\ndef lock_marker(self):\n\"\"\"Return a lock marker for this instance and the current time\"\"\"\n@@ -184,8 +188,7 @@ class Cache(object):\n# pylint: disable=too-many-arguments\nif not eol:\neol = int(time() + (ttl if ttl else g.CACHE_TTL))\n- # self.common.debug('Adding {} to {} (valid until {})',\n- # identifier, bucket, eol)\n+ # common.debug('Adding {} to {} (valid until {})', identifier, bucket, eol)\ncache_entry = {'eol': eol, 'content': content}\nself._get_bucket(bucket).update(\n{identifier: cache_entry})\n@@ -194,16 +197,20 @@ class Cache(object):\ndef commit(self):\n\"\"\"Persist cache contents in window properties\"\"\"\n- for bucket, contents in iteritems(self.buckets):\n- self._persist_bucket(bucket, contents)\n+ for bucket in list(self.buckets.keys()):\n+ self._persist_bucket(bucket, self.buckets[bucket])\n# The self.buckets dict survives across addon invocations if the\n# same languageInvoker thread is being used so we MUST clear its\n# contents to allow cache consistency between instances\n- # del self.buckets[bucket]\n+ del self.buckets[bucket]\ncommon.debug('Cache commit successful')\n+ def invalidate_callback(self, data):\n+ \"\"\"Clear cache buckets - callback for frontend\"\"\"\n+ self.invalidate(data['on_disk'], data['bucket_names'])\n+\ndef invalidate(self, on_disk=False, bucket_names=None):\n- \"\"\"Clear all cache buckets\"\"\"\n+ \"\"\"Clear cache buckets\"\"\"\nif not bucket_names:\nbucket_names = BUCKET_NAMES\nfor bucket in bucket_names:\n@@ -238,6 +245,8 @@ class Cache(object):\nreturn self.buckets[key]\ndef _load_bucket(self, bucket):\n+ if g.IS_SERVICE:\n+ return {}\n# Try 10 times to acquire a lock\nfor _ in range(1, 10):\nwnd_property_data = self.window.getProperty(self._window_property(bucket))\n@@ -303,9 +312,7 @@ class Cache(object):\ndef _persist_bucket(self, bucket, contents):\nif not self.is_safe_to_persist(bucket):\n- common.warn(\n- '{} is locked by another instance. Discarding changes'\n- .format(bucket))\n+ common.warn('{} is locked by another instance. Discarding changes'.format(bucket))\nreturn\ntry:\nif g.PY_IS_VER2:\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/common/ipc.py",
"new_path": "resources/lib/common/ipc.py",
"diff": "@@ -34,6 +34,7 @@ class Signals(object): # pylint: disable=no-init\nESN_CHANGED = 'esn_changed'\nLIBRARY_UPDATE_REQUESTED = 'library_update_requested'\nUPNEXT_ADDON_INIT = 'upnext_data'\n+ INVALIDATE_SERVICE_CACHE = 'invalidate_service_cache'\ndef register_slot(callback, signal=None, source_id=None):\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/globals.py",
"new_path": "resources/lib/globals.py",
"diff": "@@ -224,8 +224,10 @@ class GlobalVariables(object):\nself.URL = urlparse(argv[0])\ntry:\nself.PLUGIN_HANDLE = int(argv[1])\n+ self.IS_SERVICE = False\nexcept IndexError:\nself.PLUGIN_HANDLE = 0\n+ self.IS_SERVICE = True\nself.BASE_URL = '{scheme}://{netloc}'.format(scheme=self.URL[0],\nnetloc=self.URL[1])\nself.PATH = g.py2_decode(unquote(self.URL[2][1:]))\n@@ -242,7 +244,7 @@ class GlobalVariables(object):\nself.settings_monitor_suspend(False) # Reset the value in case of addon crash\n- if self.IS_ADDON_FIRSTRUN:\n+ if self.IS_ADDON_FIRSTRUN or self.IS_SERVICE:\nself._init_cache()\ndef _init_database(self, initialize):\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/navigation/actions.py",
"new_path": "resources/lib/navigation/actions.py",
"diff": "@@ -116,9 +116,10 @@ class AddonActionExecutor(object):\n@common.time_execution(immediate=False)\ndef purge_cache(self, pathitems=None): # pylint: disable=unused-argument\n- \"\"\"Clear the cache. If on_disk param is supplied, also clear cached\n- items from disk\"\"\"\n+ \"\"\"Clear the cache. If on_disk param is supplied, also clear cached items from disk\"\"\"\ng.CACHE.invalidate(self.params.get('on_disk', False))\n+ common.send_signal(signal=common.Signals.INVALIDATE_SERVICE_CACHE,\n+ data={'on_disk': self.params.get('on_disk', False), 'bucket_names': None})\nif not self.params.get('no_notification', False):\nui.show_notification(common.get_local_string(30135))\n"
}
]
| Python | MIT License | castagnait/plugin.video.netflix | Manage caches from the service individually
-avoids possible cache locks due to improper use of cache buckets
-makes it possible to use cache within the service even if it does not contain the data used by the frontend cache |
106,046 | 20.01.2020 14:04:54 | -3,600 | bdce6f8e6e2a0a211f2db48a09b43a603ff8bdbf | Load the manifest from cache | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/playback/stream_continuity.py",
"new_path": "resources/lib/services/playback/stream_continuity.py",
"diff": "\"\"\"\nfrom __future__ import absolute_import, division, unicode_literals\n-import json\nimport xbmc\n-from resources.lib.globals import g\nimport resources.lib.common as common\n-\n+from resources.lib.cache import CACHE_MANIFESTS\n+from resources.lib.globals import g\nfrom .action_manager import PlaybackActionManager\nSTREAMS = {\n@@ -247,7 +246,8 @@ class StreamContinuityManager(PlaybackActionManager):\n# --- ONLY FOR KODI VERSION 18 ---\n# NOTE: With Kodi 18 it is not possible to read the properties of the streams\n# so the only possible way is to read the data from the manifest file\n- manifest_data = json.loads(common.load_file('manifest.json'))\n+ cache_identifier = g.get_esn() + '_' + self.current_videoid.value\n+ manifest_data = g.CACHE.get(CACHE_MANIFESTS, cache_identifier, False)\ncommon.fix_locale_languages(manifest_data['timedtexttracks'])\nif not any(text_track.get('isForcedNarrative', False) is True and\ntext_track['language'] == audio_language\n"
}
]
| Python | MIT License | castagnait/plugin.video.netflix | Load the manifest from cache |
106,046 | 21.01.2020 11:31:11 | -3,600 | e0350ad37f48581022aa1190d192779974597a7c | Add Up Next install option and fixed labels | [
{
"change_type": "MODIFY",
"old_path": "resources/language/resource.language.en_gb/strings.po",
"new_path": "resources/language/resource.language.en_gb/strings.po",
"diff": "@@ -737,7 +737,7 @@ msgid \"Ask to resume the video\"\nmsgstr \"\"\nmsgctxt \"#30178\"\n-msgid \"Open UpNext Addon settings\"\n+msgid \"Open Up Next add-on settings\"\nmsgstr \"\"\nmsgctxt \"#30179\"\n@@ -959,3 +959,7 @@ msgstr \"\"\nmsgctxt \"#30233\"\nmsgid \"Content for {} will require the PIN to start playback.\"\nmsgstr \"\"\n+\n+msgctxt \"#30234\"\n+msgid \"Install Up Next add-on\"\n+msgstr \"\"\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/language/resource.language.it_it/strings.po",
"new_path": "resources/language/resource.language.it_it/strings.po",
"diff": "@@ -737,8 +737,8 @@ msgid \"Ask to resume the video\"\nmsgstr \"Chiedi per riprendere un video\"\nmsgctxt \"#30178\"\n-msgid \"Open UpNext Addon settings\"\n-msgstr \"Apri impostazioni UpNext Addon\"\n+msgid \"Open Up Next add-on settings\"\n+msgstr \"Apri le impostazioni Up Next add-on\"\nmsgctxt \"#30179\"\nmsgid \"Show trailers & more\"\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/language/resource.language.nl_nl/strings.po",
"new_path": "resources/language/resource.language.nl_nl/strings.po",
"diff": "@@ -737,7 +737,7 @@ msgid \"Ask to resume the video\"\nmsgstr \"Vraag om het afspelen te hervatten\"\nmsgctxt \"#30178\"\n-msgid \"Open UpNext Addon settings\"\n+msgid \"Open Up Next add-on settings\"\nmsgstr \"Open de Up Next add-on instellingen\"\nmsgctxt \"#30179\"\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/settings.xml",
"new_path": "resources/settings.xml",
"diff": "<setting id=\"auto_skip_credits\" type=\"bool\" label=\"30079\" default=\"false\" visible=\"eq(-1,true)\" subsetting=\"true\"/>\n<setting id=\"pause_on_skip\" type=\"bool\" label=\"30080\" default=\"false\" visible=\"eq(-1,true)\" subsetting=\"true\"/>\n<setting id=\"UpNextNotifier_enabled\" type=\"bool\" label=\"30129\" default=\"false\"/>\n- <setting id=\"is_settings_upnext\" type=\"action\" label=\"30178\" action=\"Addon.OpenSettings(service.upnext)\" enable=\"System.HasAddon(service.upnext)\" option=\"close\" visible=\"eq(-1,true)\" subsetting=\"true\"/>\n+ <setting id=\"upnext_install\" type=\"action\" label=\"30234\" action=\"InstallAddon(service.upnext)\" enable=\"eq(-1,true)\" visible=\"!System.HasAddon(service.upnext)\" subsetting=\"true\" option=\"close\"/>\n+ <setting id=\"upnext_settings\" type=\"action\" label=\"30178\" action=\"Addon.OpenSettings(service.upnext)\" enable=\"eq(-2,true)\" visible=\"System.HasAddon(service.upnext)\" subsetting=\"true\" option=\"close\"/>\n<setting id=\"ResumeManager_enabled\" type=\"bool\" label=\"30176\" default=\"true\"/>\n<setting id=\"ResumeManager_dialog\" type=\"bool\" label=\"30177\" default=\"true\" visible=\"eq(-1,true)\" subsetting=\"true\"/>\n<setting id=\"forced_subtitle_workaround\" type=\"bool\" label=\"30181\" default=\"true\" />\n"
}
]
| Python | MIT License | castagnait/plugin.video.netflix | Add Up Next install option and fixed labels |
106,046 | 21.01.2020 14:22:15 | -3,600 | 761fef0714f44e1fa01ae78a96edb80f88b2dae1 | Check if the user id token is still valid | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/msl/request_builder.py",
"new_path": "resources/lib/services/msl/request_builder.py",
"diff": "@@ -13,6 +13,7 @@ import json\nimport base64\nimport random\nimport subprocess\n+import time\nfrom resources.lib.globals import g\nimport resources.lib.common as common\n@@ -121,9 +122,12 @@ class MSLRequestBuilder(object):\ndef _add_auth_info(header_data, user_id_token):\n\"\"\"User authentication identifies the application user associated with a message\"\"\"\n- if not user_id_token:\n- credentials = common.get_credentials()\n+ if user_id_token and _is_useridtoken_valid(user_id_token):\n+ # Authentication with user ID token containing the user identity\n+ header_data['useridtoken'] = user_id_token\n+ else:\n# Authentication with the user credentials\n+ credentials = common.get_credentials()\nheader_data['userauthdata'] = {\n'scheme': 'EMAIL_PASSWORD',\n'authdata': {\n@@ -131,6 +135,9 @@ def _add_auth_info(header_data, user_id_token):\n'password': credentials['password']\n}\n}\n- else:\n- # Authentication with user ID token containing the user identity\n- header_data['useridtoken'] = user_id_token\n+\n+\n+def _is_useridtoken_valid(user_id_token):\n+ \"\"\"Check if user id token is not expired\"\"\"\n+ token_data = json.loads(base64.standard_b64decode(user_id_token['tokendata']))\n+ return token_data['expiration'] > time.time()\n"
}
]
| Python | MIT License | castagnait/plugin.video.netflix | Check if the user id token is still valid |
106,046 | 21.01.2020 18:25:35 | -3,600 | 94a18f72623957c7e98a836f6f1b10a24bbae5e8 | Fixed error on py3 due to wrong decode | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/kodi/library_items.py",
"new_path": "resources/lib/kodi/library_items.py",
"diff": "@@ -75,8 +75,8 @@ def _get_library_entry(videoid):\ndef _get_item(mediatype, filename):\n# To ensure compatibility with previously exported items,\n# make the filename legal\n- fname = xbmc.makeLegalFilename(filename)\n- untranslated_path = os.path.dirname(fname).decode(\"utf-8\")\n+ fname = xbmc.makeLegalFilename(filename).decode(\"utf-8\")\n+ untranslated_path = os.path.dirname(fname)\ntranslated_path = os.path.dirname(xbmc.translatePath(fname).decode(\"utf-8\"))\nshortname = os.path.basename(xbmc.translatePath(fname).decode(\"utf-8\"))\n# We get the data from Kodi library using filters.\n"
}
]
| Python | MIT License | castagnait/plugin.video.netflix | Fixed error on py3 due to wrong decode |
106,046 | 22.01.2020 08:42:02 | -3,600 | e43a810790772fb7b430ab1695f63c13698b682c | Added get methods for infolabels info | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/common/kodiops.py",
"new_path": "resources/lib/common/kodiops.py",
"diff": "@@ -25,7 +25,7 @@ except NameError: # Python 3\nLIBRARY_PROPS = {\n'episode': ['title', 'plot', 'writer', 'playcount', 'director', 'season',\n'episode', 'originaltitle', 'showtitle', 'lastplayed', 'file',\n- 'resume', 'dateadded', 'art', 'userrating', 'firstaired'],\n+ 'resume', 'dateadded', 'art', 'userrating', 'firstaired', 'runtime'],\n'movie': ['title', 'genre', 'year', 'director', 'trailer',\n'tagline', 'plot', 'plotoutline', 'originaltitle', 'lastplayed',\n'playcount', 'writer', 'studio', 'mpaa', 'country',\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/kodi/infolabels.py",
"new_path": "resources/lib/kodi/infolabels.py",
"diff": "@@ -38,10 +38,8 @@ JSONRPC_MAPPINGS = {\n}\n-def add_info(videoid, list_item, item, raw_data, set_info=False):\n- \"\"\"Add infolabels to the list_item. The passed in list_item is modified\n- in place and the infolabels are returned.\"\"\"\n- # pylint: disable=too-many-locals\n+def get_info(videoid, item, raw_data):\n+ \"\"\"Get the infolabels data\"\"\"\ncache_identifier = unicode(videoid) + '_' + g.LOCAL_DB.get_profile_config('language', '')\ntry:\ncache_entry = g.CACHE.get(cache.CACHE_INFOLABELS, cache_identifier)\n@@ -52,6 +50,13 @@ def add_info(videoid, list_item, item, raw_data, set_info=False):\ng.CACHE.add(cache.CACHE_INFOLABELS, cache_identifier,\n{'infos': infos, 'quality_infos': quality_infos},\nttl=g.CACHE_METADATA_TTL, to_disk=True)\n+ return infos, quality_infos\n+\n+\n+def add_info(videoid, list_item, item, raw_data, handle_highlighted_title=False):\n+ \"\"\"Add infolabels to the list_item. The passed in list_item is modified\n+ in place and the infolabels are returned.\"\"\"\n+ infos, quality_infos = get_info(videoid, item, raw_data)\n# Use a deepcopy of dict to not reflect future changes to the dictionary also to the cache\ninfos_copy = copy.deepcopy(infos)\nif videoid.mediatype == common.VideoId.EPISODE or \\\n@@ -66,23 +71,40 @@ def add_info(videoid, list_item, item, raw_data, set_info=False):\nif item.get('dpSupplementalMessage'):\n# Short information about future release of tv show season or other\ninfos_copy['plot'] += '[CR][COLOR green]{}[/COLOR]'.format(item['dpSupplementalMessage'])\n- if set_info:\n+ if handle_highlighted_title:\n+ add_highlighted_title(list_item, videoid, infos)\nlist_item.setInfo('video', infos_copy)\nreturn infos_copy\n-def add_art(videoid, list_item, item, raw_data=None):\n- \"\"\"Add art infolabels to list_item\"\"\"\n+def get_art(videoid, item, raw_data=None):\n+ \"\"\"Get art infolabels\"\"\"\ntry:\nart = g.CACHE.get(cache.CACHE_ARTINFO, videoid)\nexcept cache.CacheMiss:\nart = parse_art(videoid, item, raw_data)\ng.CACHE.add(cache.CACHE_ARTINFO, videoid, art,\nttl=g.CACHE_METADATA_TTL, to_disk=True)\n+ return art\n+\n+\n+def add_art(videoid, list_item, item, raw_data=None):\n+ \"\"\"Add art infolabels to list_item\"\"\"\n+ art = get_art(videoid, item, raw_data)\nlist_item.setArt(art)\nreturn art\n+@common.time_execution(immediate=False)\n+def get_info_for_playback(videoid):\n+ \"\"\"Get infolabels and art info\"\"\"\n+ try:\n+ return get_info_from_library(videoid)\n+ except library.ItemNotFound:\n+ common.debug('Can not get infolabels from the library, submit a request to netflix')\n+ return get_info_from_netflix(videoid)\n+\n+\n@common.time_execution(immediate=False)\ndef add_info_for_playback(videoid, list_item):\n\"\"\"Retrieve infolabels and art info and add them to the list_item\"\"\"\n@@ -170,7 +192,6 @@ def get_quality_infos(item):\ndelivery.get('hasHD')), 2)]\nquality_infos['audio'] = {\n'channels': 2 + 4 * delivery.get('has51Audio', False)}\n-\nif g.ADDON.getSettingBool('enable_dolby_sound'):\nif delivery.get('hasDolbyAtmos', False):\nquality_infos['audio']['codec'] = 'truehd'\n@@ -223,39 +244,59 @@ def _best_art(arts):\nreturn next((art for art in arts if art), '')\n+def get_info_from_netflix(videoid):\n+ \"\"\"Get infolabels with info from Netflix API\"\"\"\n+ try:\n+ infos = get_info(videoid, None, None)[0]\n+ art = get_art(videoid, None)\n+ common.debug('Got infolabels and art from cache')\n+ except (AttributeError, TypeError):\n+ common.debug('Infolabels or art were not in cache, retrieving from API')\n+ api_data = api.single_info(videoid)\n+ infos = get_info(videoid, api_data['videos'][videoid.value], api_data)[0]\n+ art = get_art(videoid, api_data['videos'][videoid.value])\n+ return infos, art\n+\n+\ndef add_info_from_netflix(videoid, list_item):\n\"\"\"Apply infolabels with info from Netflix API\"\"\"\ntry:\n- infos = add_info(videoid, list_item, None, None, True)\n+ infos = add_info(videoid, list_item, None, None)\nart = add_art(videoid, list_item, None)\ncommon.debug('Got infolabels and art from cache')\nexcept (AttributeError, TypeError):\ncommon.debug('Infolabels or art were not in cache, retrieving from API')\napi_data = api.single_info(videoid)\n- infos = add_info(videoid, list_item, api_data['videos'][videoid.value], api_data, True)\n+ infos = add_info(videoid, list_item, api_data['videos'][videoid.value], api_data)\nart = add_art(videoid, list_item, api_data['videos'][videoid.value])\nreturn infos, art\n-def add_info_from_library(videoid, list_item):\n- \"\"\"Apply infolabels with info from Kodi library\"\"\"\n+def get_info_from_library(videoid):\n+ \"\"\"Get infolabels with info from Kodi library\"\"\"\ndetails = library.get_item(videoid)\ncommon.debug('Got file info from library: {}'.format(details))\nart = details.pop('art', {})\n+ infos = {\n+ 'DBID': details.pop('{}id'.format(videoid.mediatype)),\n+ 'mediatype': videoid.mediatype\n+ }\n+ infos.update(details)\n+ return infos, art\n+\n+\n+def add_info_from_library(videoid, list_item):\n+ \"\"\"Apply infolabels with info from Kodi library\"\"\"\n+ infos, art = get_info_from_library(videoid)\n# Resuming for strm files in library is currently broken in all kodi versions\n# keeping this for reference / in hopes this will get fixed\n- resume = details.pop('resume', {})\n+ resume = infos.pop('resume', {})\n# if resume:\n# start_percent = resume['position'] / resume['total'] * 100.0\n# list_item.setProperty('startPercent', str(start_percent))\n- infos = {\n- 'DBID': details.pop('{}id'.format(videoid.mediatype)),\n- 'mediatype': videoid.mediatype\n- }\n# WARNING!! Remove unsupported ListItem.setInfo keys from 'details' by using _sanitize_infos\n# reference to Kodi ListItem.cpp\n- _sanitize_infos(details)\n- infos.update(details)\n+ _sanitize_infos(infos)\nlist_item.setInfo('video', infos)\nlist_item.setArt(art)\n# Workaround for resuming strm files from library\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/kodi/listings.py",
"new_path": "resources/lib/kodi/listings.py",
"diff": "@@ -21,7 +21,7 @@ from resources.lib.database.db_utils import (TABLE_MENU_DATA)\nfrom resources.lib.globals import g\nimport resources.lib.common as common\n-from .infolabels import add_info, add_art, add_highlighted_title\n+from .infolabels import add_info, add_art\nfrom .context_menu import generate_context_menu_items, generate_context_menu_mainmenu\ntry: # Python 2\n@@ -200,10 +200,7 @@ def _create_videolist_item(video_list_id, video_list, menu_data, static_lists=Fa\npath = 'video_list_sorted'\npathitems = [path, menu_data['path'][1], video_list_id]\nlist_item = list_item_skeleton(video_list['displayName'])\n- infos = add_info(video_list.id, list_item, video_list, video_list.data)\n- if not static_lists:\n- add_highlighted_title(list_item, video_list.id, infos)\n- list_item.setInfo('video', infos)\n+ add_info(video_list.id, list_item, video_list, video_list.data, handle_highlighted_title=not static_lists)\nif video_list.artitem:\nadd_art(video_list.id, list_item, video_list.artitem)\nurl = common.build_url(pathitems,\n@@ -302,10 +299,7 @@ def _create_video_item(videoid_value, video, video_list, menu_data, params):\nvideoid = common.VideoId(\n**{('movieid' if is_movie else 'tvshowid'): videoid_value})\nlist_item = list_item_skeleton(video['title'])\n- infos = add_info(videoid, list_item, video, video_list.data)\n- if menu_data['path'][1] != 'myList':\n- add_highlighted_title(list_item, videoid, infos)\n- list_item.setInfo('video', infos)\n+ add_info(videoid, list_item, video, video_list.data, handle_highlighted_title=menu_data['path'][1] != 'myList')\nadd_art(videoid, list_item, video)\nurl = common.build_url(videoid=videoid,\nmode=(g.MODE_PLAY\n@@ -336,7 +330,7 @@ def _create_season_item(tvshowid, seasonid_value, season, season_list):\na season as listed in a season listing\"\"\"\nseasonid = tvshowid.derive_season(seasonid_value)\nlist_item = list_item_skeleton(season['summary']['name'])\n- add_info(seasonid, list_item, season, season_list.data, True)\n+ add_info(seasonid, list_item, season, season_list.data)\nadd_art(tvshowid, list_item, season_list.tvshow)\nlist_item.addContextMenuItems(generate_context_menu_items(seasonid))\nurl = common.build_url(videoid=seasonid, mode=g.MODE_DIRECTORY)\n@@ -365,7 +359,7 @@ def _create_episode_item(seasonid, episodeid_value, episode, episode_list, param\nan episode as listed in an episode listing\"\"\"\nepisodeid = seasonid.derive_episode(episodeid_value)\nlist_item = list_item_skeleton(episode['title'])\n- add_info(episodeid, list_item, episode, episode_list.data, True)\n+ add_info(episodeid, list_item, episode, episode_list.data)\nadd_art(episodeid, list_item, episode)\nlist_item.addContextMenuItems(generate_context_menu_items(episodeid))\nurl = common.build_url(videoid=episodeid, mode=g.MODE_PLAY, params=params)\n@@ -391,7 +385,7 @@ def _create_supplemental_item(videoid_value, video, video_list, params):\nvideoid = common.VideoId(\n**{'supplementalid': videoid_value})\nlist_item = list_item_skeleton(video['title'])\n- add_info(videoid, list_item, video, video_list.data, True)\n+ add_info(videoid, list_item, video, video_list.data)\nadd_art(videoid, list_item, video)\nurl = common.build_url(videoid=videoid,\nmode=g.MODE_PLAY,\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/navigation/player.py",
"new_path": "resources/lib/navigation/player.py",
"diff": "@@ -164,8 +164,7 @@ def get_upnext_info(videoid, current_episode, metadata):\nreturn {}\ncommon.debug('Next episode is {}', next_episode_id)\n- next_episode = infolabels.add_info_for_playback(next_episode_id,\n- xbmcgui.ListItem())\n+ next_episode = infolabels.get_info_for_playback(next_episode_id)\nnext_info = {\n'current_episode': _upnext_info(videoid, *current_episode),\n'next_episode': _upnext_info(next_episode_id, *next_episode)\n"
}
]
| Python | MIT License | castagnait/plugin.video.netflix | Added get methods for infolabels info |
106,046 | 22.01.2020 09:07:17 | -3,600 | c5035bddf97eff9358427713939f3dfe400de9df | Added runtime info to Up Next | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/kodi/infolabels.py",
"new_path": "resources/lib/kodi/infolabels.py",
"diff": "@@ -96,8 +96,11 @@ def add_art(videoid, list_item, item, raw_data=None):\n@common.time_execution(immediate=False)\n-def get_info_for_playback(videoid):\n+def get_info_for_playback(videoid, skip_add_from_library):\n\"\"\"Get infolabels and art info\"\"\"\n+ # By getting the info from the library you can not get the length of video required for Up Next addon\n+ # waiting for a suitable solution we avoid this method by using skip_add_from_library\n+ if not skip_add_from_library:\ntry:\nreturn get_info_from_library(videoid)\nexcept library.ItemNotFound:\n@@ -106,8 +109,11 @@ def get_info_for_playback(videoid):\n@common.time_execution(immediate=False)\n-def add_info_for_playback(videoid, list_item):\n+def add_info_for_playback(videoid, list_item, skip_add_from_library):\n\"\"\"Retrieve infolabels and art info and add them to the list_item\"\"\"\n+ # By getting the info from the library you can not get the length of video required for Up Next addon\n+ # waiting for a suitable solution we avoid this method by using skip_add_from_library\n+ if not skip_add_from_library:\ntry:\nreturn add_info_from_library(videoid, list_item)\nexcept library.ItemNotFound:\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/navigation/player.py",
"new_path": "resources/lib/navigation/player.py",
"diff": "@@ -52,6 +52,7 @@ class InputstreamError(Exception):\ndef play(videoid):\n\"\"\"Play an episode or movie as specified by the path\"\"\"\ncommon.info('Playing {}', videoid)\n+ is_up_next_enabled = g.ADDON.getSettingBool('UpNextNotifier_enabled')\nmetadata = [{}, {}]\ntry:\nmetadata = api.metadata(videoid)\n@@ -68,7 +69,7 @@ def play(videoid):\nreturn\nlist_item = get_inputstream_listitem(videoid)\n- infos, art = infolabels.add_info_for_playback(videoid, list_item)\n+ infos, art = infolabels.add_info_for_playback(videoid, list_item, is_up_next_enabled)\n# Workaround for resuming strm files from library\nresume_position = infos.get('resume', {}).get('position') \\\n@@ -89,8 +90,7 @@ def play(videoid):\nsucceeded=True,\nlistitem=list_item)\n- upnext_info = get_upnext_info(videoid, (infos, art), metadata) \\\n- if g.ADDON.getSettingBool('UpNextNotifier_enabled') else None\n+ upnext_info = get_upnext_info(videoid, (infos, art), metadata) if is_up_next_enabled else None\ncommon.debug('Sending initialization signal')\ncommon.send_signal(common.Signals.PLAYBACK_INITIATED, {\n@@ -164,7 +164,7 @@ def get_upnext_info(videoid, current_episode, metadata):\nreturn {}\ncommon.debug('Next episode is {}', next_episode_id)\n- next_episode = infolabels.get_info_for_playback(next_episode_id)\n+ next_episode = infolabels.get_info_for_playback(next_episode_id, True)\nnext_info = {\n'current_episode': _upnext_info(videoid, *current_episode),\n'next_episode': _upnext_info(next_episode_id, *next_episode)\n@@ -208,7 +208,7 @@ def _find_next_episode(videoid, metadata):\ndef _upnext_info(videoid, infos, art):\n\"\"\"Create a data dict for upnext signal\"\"\"\n- # Double check to 'rating' key, sometime can be an empty string, not accepted by UpNext Addon\n+ # Double check to 'rating' key, sometime can be an empty string, not accepted by Up Next add-on\nrating = infos.get('rating', None)\nreturn {\n'episodeid': videoid.episodeid,\n@@ -225,6 +225,7 @@ def _upnext_info(videoid, infos, art):\n'plot': infos['plot'],\n'showtitle': infos['tvshowtitle'],\n'playcount': infos.get('playcount', 0),\n+ 'runtime': infos['duration'],\n'season': infos['season'],\n'episode': infos['episode'],\n'rating': rating if rating else None,\n"
}
]
| Python | MIT License | castagnait/plugin.video.netflix | Added runtime info to Up Next |
106,046 | 22.01.2020 11:23:14 | -3,600 | e0fe3c4a7ba3d53a49c7381c709d0320d508d1fb | Reset user id token after an handshake | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/msl/msl_handler.py",
"new_path": "resources/lib/services/msl/msl_handler.py",
"diff": "@@ -123,6 +123,8 @@ class MSLHandler(object):\nself.request_builder.handshake_request(esn)))\nheader_data = self.request_builder.decrypt_header_data(response['headerdata'], False)\nself.request_builder.crypto.parse_key_response(header_data, not common.is_edge_esn(esn))\n+ # Reset the user id token\n+ self.request_builder.user_id_token = None\ncommon.debug('Key handshake successful')\nreturn True\n"
}
]
| Python | MIT License | castagnait/plugin.video.netflix | Reset user id token after an handshake |
106,046 | 22.01.2020 15:58:36 | -3,600 | 332e611ed42bc0c66939575436420a9ab2ad4472 | Added czech language to video content | [
{
"change_type": "MODIFY",
"old_path": "addon.xml",
"new_path": "addon.xml",
"diff": "<screenshot>resources/media/screenshot-04.jpg</screenshot>\n<screenshot>resources/media/screenshot-05.jpg</screenshot>\n</assets>\n- <language>en de es he hr hu it ja ko nl pl pt sk sv</language>\n+ <language>en cs de es he hr hu it ja ko nl pl pt sk sv</language>\n<platform>all</platform>\n<license>MIT</license>\n<website>https://www.netflix.com</website>\n"
}
]
| Python | MIT License | castagnait/plugin.video.netflix | Added czech language to video content |
106,046 | 22.01.2020 16:08:51 | -3,600 | 2a455da71485f3a8899872f6f1549ecf350ad29c | Dropped no longer maintained languages | [
{
"change_type": "MODIFY",
"old_path": "addon.xml",
"new_path": "addon.xml",
"diff": "<screenshot>resources/media/screenshot-04.jpg</screenshot>\n<screenshot>resources/media/screenshot-05.jpg</screenshot>\n</assets>\n- <language>en cs de es he hr hu it ja ko nl pl pt sk sv</language>\n+ <language>en cs de es hr hu it ja ko nl pl pt sv</language>\n<platform>all</platform>\n<license>MIT</license>\n<website>https://www.netflix.com</website>\n"
}
]
| Python | MIT License | castagnait/plugin.video.netflix | Dropped no longer maintained languages |
106,046 | 22.01.2020 17:40:21 | -3,600 | 9e9f1f39832dd4d2a70e13aff5cc1cbf01354891 | Fixed czech translation | [
{
"change_type": "RENAME",
"old_path": "resources/language/resource.language.cs_cs/strings.po",
"new_path": "resources/language/resource.language.cs_cz/strings.po",
"diff": "@@ -9,12 +9,12 @@ msgstr \"\"\n\"POT-Creation-Date: 2017-07-24 16:15+0000\\n\"\n\"PO-Revision-Date: 2020-01-21 15:40+0000\\n\"\n\"Last-Translator: otava5\\n\"\n-\"Language-Team: Czech\\n\"\n+\"Language-Team: Czech (Czech Republic)\\n\"\n\"MIME-Version: 1.0\\n\"\n\"Content-Type: text/plain; charset=UTF-8\\n\"\n\"Content-Transfer-Encoding: 8bit\\n\"\n-\"Language: cs\\n\"\n-\"Plural-Forms: nplurals=2; plural=(n != 1);\\n\"\n+\"Language: cs_CZ\\n\"\n+\"Plural-Forms: nplurals=3; plural=(n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2;\\n\"\nmsgctxt \"Addon Summary\"\nmsgid \"Netflix\"\n"
}
]
| Python | MIT License | castagnait/plugin.video.netflix | Fixed czech translation |
106,046 | 23.01.2020 10:32:47 | -3,600 | 67bb93ee96011717e94681a19ba1506d89c39554 | Moved debug settings to the right position | [
{
"change_type": "MODIFY",
"old_path": "resources/settings.xml",
"new_path": "resources/settings.xml",
"diff": "<setting id=\"reset_esn\" type=\"action\" label=\"30217\" action=\"RunPlugin(plugin://plugin.video.netflix/action/reset_esn/)\" option=\"close\"/>\n<setting label=\"30116\" type=\"lsep\"/><!--Advanced Addon Configuration-->\n<setting id=\"debug_log_level\" type=\"labelenum\" label=\"30066\" values=\"Disabled|Info|Verbose\" default=\"Disabled\"/>\n+ <setting id=\"enable_timing\" type=\"bool\" label=\"30134\" default=\"false\" visible=\"eq(-1,2)\" subsetting=\"true\"/>\n+ <setting id=\"show_codec_info\" type=\"bool\" label=\"30073\" default=\"false\" visible=\"eq(-2,2)\" subsetting=\"true\"/>\n<setting id=\"run_init_configuration\" type=\"bool\" label=\"30158\" default=\"true\"/>\n<setting id=\"enable_ipc_over_http\" type=\"bool\" label=\"30139\" default=\"false\"/>\n- <setting id=\"enable_timing\" type=\"bool\" label=\"30134\" default=\"false\"/>\n- <setting id=\"show_codec_info\" type=\"bool\" label=\"30073\" default=\"false\"/>\n<setting id=\"disable_modal_error_display\" type=\"bool\" label=\"30130\" default=\"false\"/>\n<setting id=\"ssl_verification\" type=\"bool\" label=\"30024\" default=\"true\" visible=\"false\"/> <!-- just for developers -->\n<setting label=\"30117\" type=\"lsep\"/><!--Cache-->\n"
}
]
| Python | MIT License | castagnait/plugin.video.netflix | Moved debug settings to the right position |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.