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.12.2020 11:49:49 | -3,600 | 1607fc7b819afbfdcd5c1633981472b77ff1e5f0 | Add CURRENT_DIRECTORY_MENU_ID | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/common/kodi_ops.py",
"new_path": "resources/lib/common/kodi_ops.py",
"diff": "@@ -149,6 +149,7 @@ class _WndProps: # pylint: disable=no-init\nIS_CONTAINER_REFRESHED = 'is_container_refreshed'\n\"\"\"Return 'True' when container_refresh in kodi_ops.py is used by context menus, etc.\"\"\"\nCURRENT_DIRECTORY = 'current_directory'\n+ CURRENT_DIRECTORY_MENU_ID = 'current_directory_menu_id'\n\"\"\"\nReturn the name of the currently loaded directory (so the method name of directory.py class), otherwise:\n[''] When the add-on is in his first run instance, so startup page\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/run_addon.py",
"new_path": "resources/lib/run_addon.py",
"diff": "@@ -154,8 +154,9 @@ def _execute(executor_type, pathitems, params, root_handler):\nLOG.debug('Invoking action: {}', executor.__name__)\nexecutor(pathitems=pathitems)\nif root_handler == G.MODE_DIRECTORY and not G.IS_ADDON_EXTERNAL_CALL:\n- # Save the method name of current loaded directory\n+ # Save the method name of current loaded directory and his menu item id\nWndHomeProps[WndHomeProps.CURRENT_DIRECTORY] = executor.__name__\n+ WndHomeProps[WndHomeProps.CURRENT_DIRECTORY_MENU_ID] = pathitems[1] if len(pathitems) > 1 else ''\nWndHomeProps[WndHomeProps.IS_CONTAINER_REFRESHED] = None\nexcept AttributeError as exc:\nraise InvalidPathError('Unknown action {}'.format('/'.join(pathitems))) from exc\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Add CURRENT_DIRECTORY_MENU_ID |
106,046 | 22.12.2020 11:52:38 | -3,600 | 9aa0c93e5dfdb44e2970714ab759b3c80bb4f2f0 | Avoids selection back to the top when remove item from my list | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/navigation/actions.py",
"new_path": "resources/lib/navigation/actions.py",
"diff": "@@ -107,6 +107,8 @@ class AddonActionExecutor:\noperation = pathitems[1]\napi.update_my_list(videoid, operation, self.params)\nsync_library(videoid, operation)\n+ if operation == 'remove' and common.WndHomeProps[common.WndHomeProps.CURRENT_DIRECTORY_MENU_ID] == 'myList':\n+ common.json_rpc('Input.Down') # Avoids selection back to the top\ncommon.container_refresh()\[email protected]_video_id(path_offset=1)\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Avoids selection back to the top when remove item from my list |
106,046 | 28.12.2020 15:49:30 | -3,600 | 6a66bd018b9a524d394ec336ad0bc433606d1997 | Do not catch AttributeError on 'executor' method | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/run_addon.py",
"new_path": "resources/lib/run_addon.py",
"diff": "@@ -151,6 +151,8 @@ def _execute(executor_type, pathitems, params, root_handler):\n\"\"\"Execute an action as specified by the path\"\"\"\ntry:\nexecutor = executor_type(params).__getattribute__(pathitems[0] if pathitems else 'root')\n+ except AttributeError as exc:\n+ raise InvalidPathError('Unknown action {}'.format('/'.join(pathitems))) from exc\nLOG.debug('Invoking action: {}', executor.__name__)\nexecutor(pathitems=pathitems)\nif root_handler == G.MODE_DIRECTORY and not G.IS_ADDON_EXTERNAL_CALL:\n@@ -158,8 +160,6 @@ def _execute(executor_type, pathitems, params, root_handler):\nWndHomeProps[WndHomeProps.CURRENT_DIRECTORY] = executor.__name__\nWndHomeProps[WndHomeProps.CURRENT_DIRECTORY_MENU_ID] = pathitems[1] if len(pathitems) > 1 else ''\nWndHomeProps[WndHomeProps.IS_CONTAINER_REFRESHED] = None\n- except AttributeError as exc:\n- raise InvalidPathError('Unknown action {}'.format('/'.join(pathitems))) from exc\ndef _get_service_status():\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Do not catch AttributeError on 'executor' method |
106,046 | 29.12.2020 12:45:25 | -3,600 | 265001113af135009adaf698cfeee67fccd558ed | Log need to be initialized before databases | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/globals.py",
"new_path": "resources/lib/globals.py",
"diff": "@@ -243,6 +243,12 @@ class GlobalVariables:\nnetloc=self.ADDON_ID)\nfrom resources.lib.common.kodi_ops import GetKodiVersion\nself.KODI_VERSION = GetKodiVersion()\n+ # Initialize the log\n+ from resources.lib.utils.logging import LOG\n+ LOG.initialize(self.ADDON_ID, self.PLUGIN_HANDLE,\n+ self.ADDON.getSettingString('debug_log_level'),\n+ self.ADDON.getSettingBool('enable_timing'))\n+ if self.IS_ADDON_FIRSTRUN:\nself.init_database()\n# Initialize the cache\nif self.IS_SERVICE:\n@@ -252,11 +258,6 @@ class GlobalVariables:\nself.SETTINGS_MONITOR = SettingsMonitor()\nfrom resources.lib.common.cache import Cache\nself.CACHE = Cache()\n- # Initialize the log\n- from resources.lib.utils.logging import LOG\n- LOG.initialize(self.ADDON_ID, self.PLUGIN_HANDLE,\n- self.ADDON.getSettingString('debug_log_level'),\n- self.ADDON.getSettingBool('enable_timing'))\nself.IPC_OVER_HTTP = self.ADDON.getSettingBool('enable_ipc_over_http')\ndef init_database(self):\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Log need to be initialized before databases |
106,046 | 29.12.2020 13:40:30 | -3,600 | 49e8a018d8811944d0bf449be378958a8c7af846 | Better managed side effect of playback STRM from a shared path | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/common/exceptions.py",
"new_path": "resources/lib/common/exceptions.py",
"diff": "@@ -134,6 +134,10 @@ class DBProfilesMissing(Exception):\n\"\"\"There are no stored profiles in database\"\"\"\n+class DBRecordNotExistError(Exception):\n+ \"\"\"The record do not exist in database\"\"\"\n+\n+\n# All other exceptions\nclass InvalidPathError(Exception):\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/common/kodi_library_ops.py",
"new_path": "resources/lib/common/kodi_library_ops.py",
"diff": "@@ -13,7 +13,7 @@ import xbmcvfs\nfrom resources.lib.globals import G\nfrom resources.lib.utils.logging import LOG\n-from .exceptions import ItemNotFound\n+from .exceptions import ItemNotFound, DBRecordNotExistError\nfrom .kodi_ops import json_rpc, get_local_string, json_rpc_multi\nfrom .videoid import VideoId\n@@ -88,7 +88,7 @@ def get_library_item_by_videoid(videoid):\nfile_path, media_type = _get_videoid_file_path(videoid)\n# Ask to Kodi to find this file path in Kodi library database, and get all item details\nreturn _get_item_details_from_kodi(media_type, file_path)\n- except (KeyError, IndexError, ItemNotFound) as exc:\n+ except (KeyError, IndexError, ItemNotFound, DBRecordNotExistError) as exc:\nraise ItemNotFound('The video with id {} is not present in the Kodi library'.format(videoid)) from exc\n@@ -112,8 +112,6 @@ def _get_videoid_file_path(videoid):\nelse:\n# Items of other mediatype are never in library\nraise ItemNotFound\n- if file_path is None:\n- raise ItemNotFound\nreturn file_path, media_type\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/database/db_shared.py",
"new_path": "resources/lib/database/db_shared.py",
"diff": "@@ -13,6 +13,7 @@ import resources.lib.common as common\nimport resources.lib.database.db_base_mysql as db_base_mysql\nimport resources.lib.database.db_base_sqlite as db_base_sqlite\nimport resources.lib.database.db_utils as db_utils\n+from resources.lib.common.exceptions import DBRecordNotExistError\ndef get_shareddb_class(use_mysql=False):\n@@ -67,16 +68,18 @@ def get_shareddb_class(use_mysql=False):\n@db_base_mysql.handle_connection\n@db_base_sqlite.handle_connection\n- def get_movie_filepath(self, movieid, default_value=None):\n+ def get_movie_filepath(self, movieid):\n\"\"\"Get movie filepath for given id\"\"\"\nquery = 'SELECT FilePath FROM video_lib_movies WHERE MovieID = ?'\ncur = self._execute_query(query, (movieid,))\nresult = cur.fetchone()\n- return result[0] if result else default_value\n+ if not result:\n+ raise DBRecordNotExistError\n+ return result[0]\n@db_base_mysql.handle_connection\n@db_base_sqlite.handle_connection\n- def get_episode_filepath(self, tvshowid, seasonid, episodeid, default_value=None):\n+ def get_episode_filepath(self, tvshowid, seasonid, episodeid):\n\"\"\"Get movie filepath for given id\"\"\"\nquery =\\\n('SELECT FilePath FROM video_lib_episodes '\n@@ -87,7 +90,9 @@ def get_shareddb_class(use_mysql=False):\n'video_lib_episodes.EpisodeID = ?')\ncur = self._execute_query(query, (tvshowid, seasonid, episodeid))\nresult = cur.fetchone()\n- return result[0] if result is not None else default_value\n+ if not result:\n+ raise DBRecordNotExistError\n+ return result[0]\n@db_base_mysql.handle_connection\n@db_base_sqlite.handle_connection\n@@ -102,7 +107,10 @@ def get_shareddb_class(use_mysql=False):\n'ON video_lib_episodes.SeasonID = video_lib_seasons.SeasonID '\n'WHERE video_lib_seasons.TvShowID = ?')\ncur = self._execute_query(query, (tvshowid,), cur)\n- return cur.fetchall()\n+ result = cur.fetchall()\n+ if not result:\n+ raise DBRecordNotExistError\n+ return result\n@db_base_mysql.handle_connection\n@db_base_sqlite.handle_connection\n@@ -118,11 +126,14 @@ def get_shareddb_class(use_mysql=False):\n'WHERE video_lib_seasons.TvShowID = ? AND '\n'video_lib_seasons.SeasonID = ?')\ncur = self._execute_query(query, (tvshowid, seasonid), cur)\n- return cur.fetchall()\n+ result = cur.fetchall()\n+ if not result:\n+ raise DBRecordNotExistError\n+ return result\n@db_base_mysql.handle_connection\n@db_base_sqlite.handle_connection\n- def get_random_episode_filepath_from_tvshow(self, tvshowid, default_value=None):\n+ def get_random_episode_filepath_from_tvshow(self, tvshowid):\n\"\"\"Get random episode filepath of a show of a given id\"\"\"\nrand_func_name = 'RAND()' if self.is_mysql_database else 'RANDOM()'\nquery =\\\n@@ -133,11 +144,13 @@ def get_shareddb_class(use_mysql=False):\n'ORDER BY {} LIMIT 1').format(rand_func_name)\ncur = self._execute_query(query, (tvshowid,))\nresult = cur.fetchone()\n- return result[0] if result is not None else default_value\n+ if not result:\n+ raise DBRecordNotExistError\n+ return result[0]\n@db_base_mysql.handle_connection\n@db_base_sqlite.handle_connection\n- def get_random_episode_filepath_from_season(self, tvshowid, seasonid, default_value=None):\n+ def get_random_episode_filepath_from_season(self, tvshowid, seasonid):\n\"\"\"Get random episode filepath of a show of a given id\"\"\"\nrand_func_name = 'RAND()' if self.is_mysql_database else 'RANDOM()'\nquery =\\\n@@ -148,7 +161,9 @@ def get_shareddb_class(use_mysql=False):\n'ORDER BY {} LIMIT 1').format(rand_func_name)\ncur = self._execute_query(query, (tvshowid, seasonid))\nresult = cur.fetchone()\n- return result[0] if result is not None else default_value\n+ if not result:\n+ raise DBRecordNotExistError\n+ return result[0]\n@db_base_mysql.handle_connection\n@db_base_sqlite.handle_connection\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/navigation/player.py",
"new_path": "resources/lib/navigation/player.py",
"diff": "@@ -210,6 +210,10 @@ def _strm_resume_workaroud(is_played_from_strm, videoid):\n\"\"\"Workaround for resuming STRM files from library\"\"\"\nif not is_played_from_strm or not G.ADDON.getSettingBool('ResumeManager_enabled'):\nreturn None\n+ # The resume workaround will fail when:\n+ # - The metadata have a new episode, but the STRM is not exported yet\n+ # - User try to play STRM files copied from another/previous add-on installation (without import them)\n+ # - User try to play STRM files from a shared path (like SMB) of another device (without use shared db)\nresume_position = infolabels.get_resume_info_from_library(videoid).get('position')\nif resume_position:\nindex_selected = (ui.ask_for_resume(resume_position)\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/playback/am_upnext_notifier.py",
"new_path": "resources/lib/services/playback/am_upnext_notifier.py",
"diff": "import xbmcvfs\nimport resources.lib.common as common\n+from resources.lib.common.exceptions import DBRecordNotExistError\nfrom resources.lib.globals import G\nfrom resources.lib.utils.logging import LOG\nfrom .action_manager import ActionManager\n@@ -33,9 +34,18 @@ class AMUpNextNotifier(ActionManager):\ndef initialize(self, data):\nif not self.videoid_next_episode or not data['info_data']:\nreturn\n+ try:\nself.upnext_info = self._get_upnext_info(data['info_data'], data['metadata'], data['is_played_from_strm'])\n+ except DBRecordNotExistError:\n+ # The videoid record of the STRM episode is missing in add-on database when:\n+ # - The metadata have a new episode, but the STRM is not exported yet\n+ # - User try to play STRM files copied from another/previous add-on installation (without import them)\n+ # - User try to play STRM files from a shared path (like SMB) of another device (without use shared db)\n+ LOG.warn('Up Next add-on signal skipped, the videoid for the next episode does not exist in the database')\n+ self.upnext_info = None\ndef on_playback_started(self, player_state): # pylint: disable=unused-argument\n+ if self.upnext_info:\nLOG.debug('Sending initialization signal to Up Next Add-on')\ncommon.send_signal(common.Signals.UPNEXT_ADDON_INIT, self.upnext_info, non_blocking=True)\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Better managed side effect of playback STRM from a shared path |
106,046 | 29.12.2020 15:05:50 | -3,600 | 48b7d3ecc2261e479cf123f0dda12bbf56bde525 | Changed addon signal min version to 0.0.6
i have encoutered some problems to intall the add-on
when the dependency is 0.0.5 do not know the reason | [
{
"change_type": "MODIFY",
"old_path": "addon.xml",
"new_path": "addon.xml",
"diff": "<addon id=\"plugin.video.netflix\" name=\"Netflix\" version=\"1.12.0+matrix.1\" provider-name=\"libdev + jojo + asciidisco + caphm + castagnait\">\n<requires>\n<import addon=\"xbmc.python\" version=\"3.0.0\"/>\n- <import addon=\"script.module.addon.signals\" version=\"0.0.5\"/>\n+ <import addon=\"script.module.addon.signals\" version=\"0.0.6\"/>\n<import addon=\"script.module.inputstreamhelper\" version=\"0.4.4\"/>\n<import addon=\"script.module.pycryptodome\" version=\"3.4.3\"/>\n<import addon=\"script.module.requests\" version=\"2.22.0\"/>\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Changed addon signal min version to 0.0.6
i have encoutered some problems to intall the add-on
when the dependency is 0.0.5 do not know the reason |
106,046 | 31.12.2020 11:20:55 | -3,600 | 846bc0b42c6067df2e5aaf810cb31794c406c0b9 | Changes to templates/readme | [
{
"change_type": "MODIFY",
"old_path": ".github/ISSUE_TEMPLATE/bug_report.md",
"new_path": ".github/ISSUE_TEMPLATE/bug_report.md",
"diff": "---\n-name: Problem report\n-about: If something doesn't work\n-\n+name: Bug report\n+about: To report errors or wrong behaviour - please use the Wiki pages, Kodi forum or Discussions tab to solve other questions\n---\n## Bug report\n@@ -19,8 +18,7 @@ Used Operating system:\n* [ ] Windows\n### Describe the bug\n-<!--- A bug report that is not clear will be closed -->\n-<!--- ALWAYS ATTACH THE LINK FOR KODI LOG FILE, HOW TO BELOW -->\n+<!--- A bug report that is not clear or not have a log will be closed -->\n<!--- Put your text below this line -->\n#### Expected behavior\n@@ -42,25 +40,17 @@ Used Operating system:\n<!--- Put your text below this line -->\n### Debug log\n-<!--- How to:\n+<!--- MANDATORY ATTACH/LINK A LOG:\n1) Go to add-on settings, in Expert page and change \"Debug logging level\" to \"Verbose\"\n2) Enable Kodi debug: go to Kodi Settings > System Settings > Logging, and enable \"Enable debug logging\"\n3) How to get the log file? Read Kodi wiki: https://kodi.wiki/view/Log_file/Easy\n-RESPECT THE RULES!\n-- A DEBUG LOG IS ALWAYS MANDATORY WHEN CREATING AN ISSUE. PROVIDE A LINK TO THE LOG!\n-- DO NOT PASTE THE CONTENT OF THE LOG HERE\n-- DO NOT CUT THE LOG\n-- If the log file is really huge (more 1Mb) in Kodi settings disable \"Component-specific logging\" then create a new log\n+4) You can attach the log file here or use http://paste.kodi.tv/\n-->\n-The debug log can be found from this link:\n-\n+The debug log can be found here:\n+<!--- PLEASE RESPECT THE RULES! DO NOT PASTE THE CONTENT OF THE LOG HERE AND DO NOT CUT THE LOG INFO -->\n### Additional context or screenshots (if appropriate)\n-#### Installation\n-* [ ] I'm using other Netflix Repo <!--- Specify which one is used -->\n-* [ ] I'm using a different source <!--- Specify which one is used -->\n-\n#### Other information\n<!--- E.g. related issues, suggestions, links for us to have context, etc... -->\n<!--- Put your text below this line -->\n"
},
{
"change_type": "DELETE",
"old_path": ".github/ISSUE_TEMPLATE/support_request.md",
"new_path": null,
"diff": "----\n-name: Help request\n-about: If you need help on how to use the addon\n-\n----\n-## Help request\n-\n-#### Your Environment\n-- Netflix add-on version: <!--- e.g. 14.1 -->\n-- Operating system version/name: <!--- e.g. Windows 10, LibreElec 9.0, etc... -->\n-- Device model: <!--- if appropriate -->\n-\n-Used Operating system:\n-* [ ] Android\n-* [ ] iOS\n-* [ ] Linux\n-* [ ] OSX\n-* [ ] Raspberry-Pi\n-* [ ] Windows\n-\n-### Describe your help request\n-<!--- Put your text below this line -->\n-\n-#### Screenshots\n-<!--- Add some screenshots if that helps understanding your problem -->\n-\n-\n-<!---\n-This addon respects the same rules used in the Kodi forum\n-https://kodi.wiki/view/Official:Forum_rules\n-therefore the single violation will eliminate your request\n--->\n"
},
{
"change_type": "MODIFY",
"old_path": "README.md",
"new_path": "README.md",
"diff": "@@ -107,27 +107,26 @@ If it happens often, there is the possibility to exclude the auto update from th\n## Something doesn't work\n-***Before open an issue please try read the Wiki pages or ask for help in the Kodi forum***\n+***Before open a new Issue and engage the developers, please try to find your answer on other channels like:\n+old closed Issues (on Issue tab), the Wiki pages or ask in the Kodi forum.***\n-If something doesn't work for you:\n-1. Open add-on settings, go to in Expert page and change `Debug logging level` to `Verbose`\n-2. Enable the Debug log in your Kodi settings\n-3. Perform the actions that cause the error, so they are written in the log\n-4. Open a new github issue (of type *Problem report*) by following the instructions in the report\n-\n-We can't help you if you don't provide detailed information (i.e. explanation and full debug log) on your issue.\n+If you have encountered an error or misbehaviour:\n+1. Open add-on settings, go to in `Expert` page and change `Debug logging level` to `Verbose`\n+2. Enable Kodi debug, go to Kodi `Settings` > `System Settings` > `Logging` and enable `Enable debug logging`\n+3. Perform the actions that cause the error, so they are written in the log file\n+4. Open a new GitHub Issue (of type *Bug report*) and fill in the page with detailed information\n+5. Attach/link in your Issue thread the log file is mandatory (follow rules below)\nRules for the log:\n-- Use a service like [Kodi paste](http://paste.kodi.tv) to copy the log content\n-- Do not paste the content of the log directly into a GH message\n+- You can attach the log file or use a service like [Kodi paste](http://paste.kodi.tv) to make a link\n+- Do not paste the content of the log directly into a Issue or message\n- Do not cut, edit or remove parts of the log (there are no sensitive data)\n-- If the log file is really huge (more 1Mb) in Kodi settings disable 'Component-specific logging'\nWhen the problem will be solved, remember to disable the debug logging, to avoid unnecessary slowing down in your device.\n**Why my Issue is labeled with  ?**\n-This happens when the guidelines for compiling the Issue post have not been followed. Therefore if the information will not be filled and or changed in the right way, the Issue post will be closed in the next days.\n+This happens when the guidelines for compiling the Issue thread have not been followed. Therefore if the information will not be filled and or changed in the right way, the Issue post will be closed in the next days.\n## Code of Conduct\n@@ -139,8 +138,6 @@ By participating in this project you agree to abide by its terms.\nLicensed under The MIT License.\n-## Contributions and collaborations\n+## Support the project\n[Info for contribute and donations](https://github.com/CastagnaIT/plugin.video.netflix/wiki/Contribute-and-donations)\n-\n-[Info for Business collaboration](https://github.com/CastagnaIT/plugin.video.netflix/wiki/Business-collaboration)\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Changes to templates/readme |
106,046 | 02.01.2021 16:51:12 | -3,600 | 379a4797c08210eee85ed88e2b837a8e220925d2 | Version bump (1.13.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=\"1.12.0+matrix.1\" provider-name=\"libdev + jojo + asciidisco + caphm + castagnait\">\n+<addon id=\"plugin.video.netflix\" name=\"Netflix\" version=\"1.13.0+matrix.1\" provider-name=\"libdev + jojo + asciidisco + caphm + castagnait\">\n<requires>\n<import addon=\"xbmc.python\" version=\"3.0.0\"/>\n<import addon=\"script.module.addon.signals\" version=\"0.0.6\"/>\n<forum>https://forum.kodi.tv/showthread.php?tid=329767</forum>\n<source>https://github.com/CastagnaIT/plugin.video.netflix</source>\n<news>\n-v1.12.0 (2020-12-13)\n-- >> END OF THE ADD-ON DEVELOPMENT ON KODI 18.x\n-- >> ON KODI 18.x THE ADD-ON WILL RECEIVE ONLY BUG FIX OR MINOR CHANGES\n-- Add more options to force Widevine L3 (android)\n-- Improved errors messages to resolve:\n- - This title is not available to watch instantly\n- - Request failed validation during key exchange\n-- Reverted \"reworked Audio/Subtitles language features\" on Kodi 18\n-- Fix missing default audio track for impaired (Kodi 19)\n-- Fixed \"Prefer audio/subtitles language with country code\" (Kodi 19)\n-- Parental control moved to profiles list context menu\n-- Fixed ESN generation with modelgroup\n-- Fixed build_media_tag exception due to video pause\n-- Blocked profile switching while playing, can cause issues\n-- Managed wrong password case on login that caused http error 500\n-- Updated translations it, de, gr, pt-br, hu, ro, es, jp, kr, fr\n+v1.13.0 (2021-01-02)\n+- Add new ESN/Widevine setting dialog\n+- MySQL Connector/Python library is now a Kodi dependency\n+- Removed all Python 2 code / Kodi 18 compatibility\n+- Fixed an issue that not allow to use same profile to play videos with UpNext\n+- Disabled UpNext when play STRM of a shared path (Wiki: Share STRM library with multiple devices - OPTION 2)\n+- Minor code fixes/improvements\n+- Add Taiwan transation\n+- Updated translations it, de, es, jp, kr, ro\n</news>\n</extension>\n</addon>\n"
},
{
"change_type": "MODIFY",
"old_path": "changelog.txt",
"new_path": "changelog.txt",
"diff": "+v1.13.0 (2021-01-02)\n+- Add new ESN/Widevine setting dialog\n+- MySQL Connector/Python library is now a Kodi dependency\n+- Removed all Python 2 code / Kodi 18 compatibility\n+- Fixed an issue that not allow to use same profile to play videos with UpNext\n+- Disabled UpNext when play STRM of a shared path (Wiki: Share STRM library with multiple devices - OPTION 2)\n+- Minor code fixes/improvements\n+- Add Taiwan transation\n+- Updated translations it, de, es, jp, kr, ro\n+\nv1.12.0 (2020-12-13)\n- >> END OF THE ADD-ON DEVELOPMENT ON KODI 18.x\n- >> ON KODI 18.x THE ADD-ON WILL RECEIVE ONLY BUG FIX OR MINOR CHANGES\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Version bump (1.13.0) (#1010) |
106,046 | 18.01.2021 10:43:35 | -3,600 | c499c087892579be6d5965ad0b0478dae61cedd4 | Various fixes mainly for audio/subtitle with country code selection | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/common/kodi_ops.py",
"new_path": "resources/lib/common/kodi_ops.py",
"diff": "@@ -179,18 +179,32 @@ def get_kodi_audio_language(iso_format=xbmc.ISO_639_1):\nReturn the audio language from Kodi settings\nWARNING: Based on Kodi player settings can also return values as: 'mediadefault', 'original'\n\"\"\"\n- audio_language = json_rpc('Settings.GetSettingValue', {'setting': 'locale.audiolanguage'})\n- if audio_language['value'] in ['mediadefault', 'original']:\n- return audio_language['value']\n- return convert_language_iso(audio_language['value'], iso_format)\n+ audio_language = json_rpc('Settings.GetSettingValue', {'setting': 'locale.audiolanguage'})['value']\n+ if audio_language in ['mediadefault', 'original']:\n+ return audio_language\n+ if audio_language == 'default': # \"User interface language\"\n+ return get_kodi_ui_language(iso_format)\n+ return convert_language_iso(audio_language, iso_format)\ndef get_kodi_subtitle_language(iso_format=xbmc.ISO_639_1):\n- \"\"\"Return the subtitle language from Kodi settings\"\"\"\n- subtitle_language = json_rpc('Settings.GetSettingValue', {'setting': 'locale.subtitlelanguage'})\n- if subtitle_language['value'] == 'forced_only':\n- return subtitle_language['value']\n- return convert_language_iso(subtitle_language['value'], iso_format)\n+ \"\"\"\n+ Return the subtitle language from Kodi settings\n+ WARNING: Based on Kodi player settings can also return values as: 'forced_only', 'original', or:\n+ 'default' when set as \"User interface language\"\n+ 'none' when set as \"None\"\n+ \"\"\"\n+ subtitle_language = json_rpc('Settings.GetSettingValue', {'setting': 'locale.subtitlelanguage'})['value']\n+ if subtitle_language in ['forced_only', 'original', 'default', 'none']:\n+ return subtitle_language\n+ return convert_language_iso(subtitle_language, iso_format)\n+\n+\n+def get_kodi_ui_language(iso_format=xbmc.ISO_639_1):\n+ \"\"\"Return the Kodi UI interface language\"\"\"\n+ setting = json_rpc('Settings.GetSettingValue', {'setting': 'locale.language'})\n+ # The value returned is as \"resource.language.en_gb\" we keep only the first two chars \"en\"\n+ return convert_language_iso(setting.split('.')[-1][:2], iso_format)\ndef convert_language_iso(from_value, iso_format=xbmc.ISO_639_1):\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/playback/am_stream_continuity.py",
"new_path": "resources/lib/services/playback/am_stream_continuity.py",
"diff": "@@ -58,6 +58,7 @@ class AMStreamContinuity(ActionManager):\nself.player_state = {}\nself.resume = {}\nself.is_kodi_forced_subtitles_only = None\n+ self.is_prefer_alternative_lang = None\nself.is_prefer_sub_impaired = None\nself.is_prefer_audio_impaired = None\n@@ -67,6 +68,7 @@ class AMStreamContinuity(ActionManager):\ndef initialize(self, data):\nself.is_kodi_forced_subtitles_only = common.get_kodi_subtitle_language() == 'forced_only'\n+ self.is_prefer_alternative_lang = G.ADDON.getSettingBool('prefer_alternative_lang')\nself.is_prefer_sub_impaired = common.json_rpc('Settings.GetSettingValue',\n{'setting': 'accessibility.subhearing'}).get('value')\nself.is_prefer_audio_impaired = common.json_rpc('Settings.GetSettingValue',\n@@ -98,7 +100,7 @@ class AMStreamContinuity(ActionManager):\n# Copy player state to restore it after, or the changes will affect the _restore_stream()\n_player_state_copy = copy.deepcopy(player_state)\n# Force selection of the audio/subtitles language with country code\n- if G.ADDON.getSettingBool('prefer_alternative_lang'):\n+ if self.is_prefer_alternative_lang:\nself._select_lang_with_country_code()\n# Ensures the display of forced subtitles only with the audio language set\nif G.ADDON.getSettingBool('show_forced_subtitles_only'):\n@@ -149,7 +151,6 @@ class AMStreamContinuity(ActionManager):\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@@ -238,80 +239,75 @@ class AMStreamContinuity(ActionManager):\ndef _select_lang_with_country_code(self):\n\"\"\"Force selection of the audio/subtitles language with country code\"\"\"\n- # If Kodi Player audio language is not set as \"mediadefault\" the language with country code for\n- # audio/subtitles, will never be selected automatically, then we try to do this manually.\n- audio_language = self._get_current_audio_language()\n- if '-' not in audio_language:\n- # There is no audio language with country code or different settings have been chosen\n- return\n- # Audio side\n- if common.get_kodi_audio_language() not in ['mediadefault', 'original']:\n+ # --- Audio side ---\n+ # NOTE: Kodi is able to auto-select the language with country code for audio/subtitles only\n+ # if audio track is set as default and the Kodi Player audio language is set as \"mediadefault\".\n+ pref_audio_language = self._get_preferred_audio_language()\n+ # Get current audio languages\naudio_list = self.player_state.get(STREAMS['audio']['list'])\n- stream = None\n+ lang_code = _find_lang_with_country_code(audio_list, pref_audio_language)\n+ if lang_code and common.get_kodi_audio_language() not in ['mediadefault', 'original']:\n+ stream_audio = None\nif self.is_prefer_audio_impaired:\n- stream = next((audio_track for audio_track in audio_list\n- if audio_track['language'] == audio_language\n+ stream_audio = next((audio_track for audio_track in audio_list\n+ if audio_track['language'] == lang_code\nand audio_track['isimpaired']\n- and audio_track['isdefault']), # The default track can change is user choose 2ch as def\n+ and audio_track['isdefault']), # The default track can change is user choose 2ch\nNone)\n- if not stream:\n- stream = next((audio_track for audio_track in audio_list\n- if audio_track['language'] == audio_language\n+ if not stream_audio:\n+ stream_audio = next((audio_track for audio_track in audio_list\n+ if audio_track['language'] == lang_code\nand not audio_track['isimpaired']\n- and audio_track['isdefault']), # The default track can change is user choose 2ch as def\n+ and audio_track['isdefault']), # The default track can change is user choose 2ch\nNone)\n- if stream:\n- self.sc_settings.update({'audio': stream})\n+ if stream_audio:\n+ self.sc_settings.update({'audio': stream_audio})\n# We update the current player state data to avoid wrong behaviour with features executed after\n- self.player_state[STREAMS['audio']['current']] = stream\n- # Subtitles side\n+ self.player_state[STREAMS['audio']['current']] = stream_audio\n+ # --- Subtitles side ---\n+ # Get the subtitles language set in Kodi Player setting\n+ pref_subtitle_language = self._get_preferred_subtitle_language()\n+ if not pref_subtitle_language:\n+ return\nsubtitle_list = self.player_state.get(STREAMS['subtitle']['list'])\n- if not any(subtitle_track for subtitle_track in subtitle_list\n- if subtitle_track['language'].startswith(audio_language[:2] + '-')):\n- self.sc_settings.update({'subtitleenabled': False})\n+ lang_code = _find_lang_with_country_code(subtitle_list, pref_subtitle_language)\n+ if not lang_code:\nreturn\n- if self.is_kodi_forced_subtitles_only:\n- subtitle_language = audio_language\n- else:\n- # Get the subtitles language set in Kodi Player setting\n- subtitle_language = common.get_kodi_subtitle_language()\n- # Get the alternative language code\n- # Here we have only the language code without country code, we do not know the country code to be used,\n- # usually there are only two tracks with the same language and different countries,\n- # then we try to find the language with the country code\n- _stream = next((subtitle_track for subtitle_track in subtitle_list\n- if subtitle_track['language'].startswith(subtitle_language + '-')), None)\n- if _stream:\n- subtitle_language = _stream['language']\n- stream_sub = self._find_subtitle_stream(subtitle_language, self.is_kodi_forced_subtitles_only)\n+ stream_sub = self._find_subtitle_stream(lang_code, self.is_kodi_forced_subtitles_only)\nif stream_sub:\nself.sc_settings.update({'subtitleenabled': True})\nself.sc_settings.update({'subtitle': stream_sub})\n# We update the current player state data to avoid wrong behaviour with features executed after\nself.player_state[STREAMS['subtitle']['current']] = stream_sub\n- else:\n- self.sc_settings.update({'subtitleenabled': False})\ndef _ensure_forced_subtitle_only(self):\n- \"\"\"Ensures the display of forced subtitles only with the audio language set\"\"\"\n+ \"\"\"Ensures the display of forced subtitles only with the preferred audio language set\"\"\"\n# When the audio language in Kodi player is set e.g. to 'Italian', and you try to play a video\n# without Italian audio language, Kodi choose another language available e.g. English,\n# this will also be reflected on the subtitles that which will be shown in English language,\n# but the subtitles may be available in Italian or the user may not want to view them in other languages.\n- # Get current subtitle stream\n- player_stream = self.player_state.get(STREAMS['subtitle']['current'])\n- if not player_stream:\n+ # Get current subtitle stream set (could be also changed by _select_lang_with_country_code)\n+ sub_stream = self.player_state.get(STREAMS['subtitle']['current'])\n+ if not sub_stream:\nreturn\n- # Get current audio language\n- audio_language = self._get_current_audio_language()\n- if player_stream['isforced'] and player_stream['language'] == audio_language:\n+ # Get the preferred audio language\n+ pref_audio_language = self._get_preferred_audio_language()\n+ # Get current audio languages\n+ audio_list = self.player_state.get(STREAMS['audio']['list'])\n+ if self.is_prefer_alternative_lang:\n+ lang_code = _find_lang_with_country_code(audio_list, pref_audio_language)\n+ if lang_code:\n+ pref_audio_language = lang_code\n+ if '-' not in pref_audio_language:\n+ pref_audio_language = common.convert_language_iso(pref_audio_language, xbmc.ISO_639_2)\n+ if sub_stream['isforced'] and sub_stream['language'] == pref_audio_language:\nreturn\nsubtitles_list = self.player_state.get(STREAMS['subtitle']['list'])\n- if not player_stream['language'] == audio_language:\n+ if not sub_stream['language'] == pref_audio_language:\n# The current subtitle is not forced or forced but not in the preferred audio language\n# Try find a forced subtitle in the preferred audio language\nstream = next((subtitle_track for subtitle_track in subtitles_list\n- if subtitle_track['language'] == audio_language\n+ if subtitle_track['language'] == pref_audio_language\nand subtitle_track['isforced']),\nNone)\nif stream:\n@@ -324,19 +320,29 @@ class AMStreamContinuity(ActionManager):\ndef _ensure_subtitles_no_audio_available(self):\n\"\"\"Ensure in any case to show the regular subtitles when the preferred audio language is not available\"\"\"\n- # Get current subtitle stream\n- player_stream = self.player_state.get(STREAMS['subtitle']['current'])\n- if not player_stream:\n+ # Check if there are subtitles\n+ subtitles_list = self.player_state.get(STREAMS['subtitle']['list'])\n+ if not subtitles_list:\nreturn\n- # Get current audio language\n- audio_language = self._get_current_audio_language()\n+ # Get the preferred audio language\n+ pref_audio_language = self._get_preferred_audio_language()\naudio_list = self.player_state.get(STREAMS['audio']['list'])\n+ # Check if there is an audio track available in the preferred audio language,\n+ # can also happen that in list there are languages with country code only\n+ accepted_lang_codes = [common.convert_language_iso(pref_audio_language, xbmc.ISO_639_2)]\n+ if self.is_prefer_alternative_lang:\n+ lang_code = _find_lang_with_country_code(audio_list, pref_audio_language)\n+ if lang_code:\n+ accepted_lang_codes.append(lang_code)\nstream = None\n- # Check if there is an audio track available in the preferred audio language\n- if not any(audio_track['language'] == audio_language for audio_track in audio_list):\n- # No audio available for the preferred audio language,\n+ if not any(audio_track['language'] in accepted_lang_codes for audio_track in audio_list):\n+ # No audio available in the preferred audio languages,\n# then try find a regular subtitle in the preferred audio language\n- stream = self._find_subtitle_stream(audio_language)\n+ if len(accepted_lang_codes) == 2:\n+ # Try find with country code\n+ stream = self._find_subtitle_stream(accepted_lang_codes[-1])\n+ if not stream:\n+ stream = self._find_subtitle_stream(accepted_lang_codes[0])\nif stream:\nself.sc_settings.update({'subtitleenabled': True})\nself.sc_settings.update({'subtitle': stream})\n@@ -361,31 +367,62 @@ class AMStreamContinuity(ActionManager):\nNone)\nreturn stream\n- def _get_current_audio_language(self):\n- # Get current audio language\n- audio_list = self.player_state.get(STREAMS['audio']['list'])\n- audio_language = common.get_kodi_audio_language(iso_format=xbmc.ISO_639_2)\n+ def _get_preferred_audio_language(self):\n+ \"\"\"\n+ Get the language code of the preferred audio as set in Kodi Player setting\n+ :return: The language code (as ISO with 2 letters)\n+ \"\"\"\n+ audio_language = common.get_kodi_audio_language()\nif audio_language == 'mediadefault':\n# Netflix do not have a \"Media default\" track then we rely on the language of current nf profile,\n# although due to current Kodi locale problems could be not always accurate.\nprofile_language_code = G.LOCAL_DB.get_profile_config('language')\n- audio_language = common.convert_language_iso(profile_language_code[0:2], xbmc.ISO_639_2)\n+ audio_language = profile_language_code[:2]\nif audio_language == 'original':\n+ # Get current audio languages\n+ audio_list = self.player_state.get(STREAMS['audio']['list'])\n# Find the language of the original audio track\nstream = next((audio_track for audio_track in audio_list if audio_track['isoriginal']), None)\n- audio_language = stream['language']\n- elif G.ADDON.getSettingBool('prefer_alternative_lang'):\n- # Get the alternative language code\n- # Here we have only the language code without country code, we do not know the country code to be used,\n- # usually there are only two tracks with the same language and different countries,\n- # then we try to find the language with the country code\n- two_letter_lang_code = common.convert_language_iso(audio_language)\n- stream = next((audio_track for audio_track in audio_list\n- if audio_track['language'].startswith(two_letter_lang_code + '-')), None)\n- if stream:\n- audio_language = stream['language']\n+ # stream['language'] can be ISO 3 letters or with country code (pt-BR) / converted with LOCALE_CONV_TABLE\n+ if stream is None: # Means some problem, let the code break\n+ audio_language = None\n+ else:\n+ if '-' in stream['language']:\n+ audio_language = stream['language'][:2]\n+ else:\n+ audio_language = common.convert_language_iso(stream['language'])\nreturn audio_language\n+ def _get_preferred_subtitle_language(self):\n+ \"\"\"\n+ Get the language code of the preferred subtitle as set in Kodi Player setting\n+ :return: The language code (as ISO with 2 letters) or 'None' if disabled\n+ \"\"\"\n+ subtitle_language = common.get_kodi_subtitle_language()\n+ if subtitle_language == 'forced_only':\n+ # Then match the audio language\n+ subtitle_language = self._get_preferred_audio_language()\n+ elif subtitle_language == 'original':\n+ # Get current audio languages\n+ audio_list = self.player_state.get(STREAMS['audio']['list'])\n+ # Find the language of the original audio track\n+ stream = next((audio_track for audio_track in audio_list if audio_track['isoriginal']), None)\n+ # stream['language'] can be ISO 3 letters or with country code (pt-BR) / converted with LOCALE_CONV_TABLE\n+ if stream is None:\n+ subtitle_language = None\n+ else:\n+ if '-' in stream['language']:\n+ subtitle_language = stream['language'][:2]\n+ else:\n+ subtitle_language = common.convert_language_iso(stream['language'])\n+ elif subtitle_language == 'default':\n+ # Get the Kodi UI language\n+ subtitle_language = common.get_kodi_ui_language()\n+ elif subtitle_language == 'none':\n+ # Subtitles are disabled\n+ subtitle_language = None\n+ return subtitle_language\n+\ndef _is_stream_value_equal(self, stream_a, stream_b):\nif isinstance(stream_a, dict):\nreturn common.compare_dict_keys(stream_a, stream_b,\n@@ -397,3 +434,20 @@ class AMStreamContinuity(ActionManager):\ndef _filter_streams(streams, filter_name, match_value):\nreturn [dict_stream for dict_stream in streams if\ndict_stream.get(filter_name, False) == match_value]\n+\n+\n+def _find_lang_with_country_code(tracks_list, lang_code):\n+ \"\"\"\n+ Try to find a language code with country code\n+ :param tracks_list: list of tracks where search the language code\n+ :param lang_code: the language code to find (2 letters - ISO_639_1)\n+ :return: the language code with country code or 'None' if it does not exist\n+ \"\"\"\n+ # The search checks whether a language exists with \"-\" char.\n+ # Usually for the same language there might be two different countries,\n+ # e.g. \"es\" and \"es-ES\" (that will be converted in \"es-Spain\" by LOCALE_CONV_TABLE)\n+ _stream = next((track for track in tracks_list\n+ if track['language'].startswith(lang_code + '-')), None)\n+ if _stream:\n+ return _stream['language']\n+ return None\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Various fixes mainly for audio/subtitle with country code selection |
106,046 | 18.01.2021 14:36:45 | -3,600 | 9edce205b659bc60b853eba3ab9d82c1d62b2b56 | Fixed/updated dependencies | [
{
"change_type": "MODIFY",
"old_path": "addon.xml",
"new_path": "addon.xml",
"diff": "<addon id=\"plugin.video.netflix\" name=\"Netflix\" version=\"1.13.0+matrix.1\" provider-name=\"libdev + jojo + asciidisco + caphm + castagnait\">\n<requires>\n<import addon=\"xbmc.python\" version=\"3.0.0\"/>\n- <import addon=\"script.module.addon.signals\" version=\"0.0.6\"/>\n- <import addon=\"script.module.inputstreamhelper\" version=\"0.4.4\"/>\n+ <import addon=\"script.module.addon.signals\" version=\"0.0.6+matrix.1\"/>\n+ <import addon=\"script.module.inputstreamhelper\" version=\"0.5.0+matrix.1\"/>\n<import addon=\"script.module.pycryptodome\" version=\"3.4.3\"/>\n- <import addon=\"script.module.requests\" version=\"2.22.0\"/>\n- <import addon=\"script.module.myconnpy\" version=\"8.0.18\"/> <!--MySQL Connector/Python-->\n+ <import addon=\"script.module.requests\" version=\"2.22.0+matrix.1\"/>\n+ <import addon=\"script.module.myconnpy\" version=\"8.0.18+matrix.1\"/> <!--MySQL Connector/Python-->\n</requires>\n<extension point=\"xbmc.python.pluginsource\" library=\"addon.py\">\n<provides>video</provides>\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Fixed/updated dependencies |
106,046 | 22.01.2021 13:40:05 | -3,600 | d232eac0d191ed5ce68e7cde5a421b221bf83b84 | Removed threaded send_signal
Slower devices are not always fast enough to send the signal in faster way while other operations are carried out,
this cause to ActionController to crash because receive the playback data after Kodi 'Player.OnPlay' event and will no longer manage events | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/navigation/player.py",
"new_path": "resources/lib/navigation/player.py",
"diff": "@@ -122,6 +122,7 @@ def _play(videoid, is_played_from_strm=False):\n# Start and initialize the action controller (see action_controller.py)\nLOG.debug('Sending initialization signal')\n+ # Do not use send_signal as threaded slow devices are not powerful to send in faster way and arrive late to service\ncommon.send_signal(common.Signals.PLAYBACK_INITIATED, {\n'videoid': videoid.to_dict(),\n'videoid_next_episode': videoid_next_episode.to_dict() if videoid_next_episode else None,\n@@ -129,7 +130,7 @@ def _play(videoid, is_played_from_strm=False):\n'info_data': info_data,\n'is_played_from_strm': is_played_from_strm,\n'resume_position': resume_position,\n- 'event_data': event_data}, non_blocking=True)\n+ 'event_data': event_data})\nxbmcplugin.setResolvedUrl(handle=G.PLUGIN_HANDLE, succeeded=True, listitem=list_item)\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Removed threaded send_signal
Slower devices are not always fast enough to send the signal in faster way while other operations are carried out,
this cause to ActionController to crash because receive the playback data after Kodi 'Player.OnPlay' event and will no longer manage events |
106,046 | 22.01.2021 14:15:11 | -3,600 | 181fb3825c492200ae5c79eaf4f7c73d2152fa3c | Avoid expose response object between functions and better managed chunks | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/msl/msl_requests.py",
"new_path": "resources/lib/services/msl/msl_requests.py",
"diff": "@@ -181,7 +181,7 @@ class MSLRequests(MSLRequestBuilder):\nLOG.debug('Request took {}s', time.perf_counter() - start)\nLOG.debug('Request returned response with status {}', response.status_code)\nresponse.raise_for_status()\n- return response\n+ return response.text\nexcept Exception as exc: # pylint: disable=broad-except\nLOG.error('HTTP request error: {}', exc)\nif not retry_all_exceptions and not isinstance(exc, exceptions.ReadTimeout):\n@@ -191,19 +191,13 @@ class MSLRequests(MSLRequestBuilder):\nretry_attempt += 1\nLOG.warn('Will be executed a new POST request (attempt {})'.format(retry_attempt))\n- # pylint: disable=unused-argument\n@measure_exec_time_decorator(is_immediate=True)\ndef _process_chunked_response(self, response, save_uid_token_to_owner=False):\n- \"\"\"Parse and decrypt an encrypted chunked response. Raise an error\n- if the response is plaintext json\"\"\"\n- try:\n- # if the json() does not fail we have an error because\n- # the expected response is a chunked json response\n- return _raise_if_error(response.json())\n- except ValueError:\n- # json() failed so parse and decrypt the chunked response\n+ \"\"\"Parse and decrypt an encrypted chunked response. Raise an error if the response is plaintext json\"\"\"\nLOG.debug('Received encrypted chunked response')\n- response = _parse_chunks(response.text)\n+ if not response:\n+ return {}\n+ response = _parse_chunks(response)\n# TODO: sending for the renewal request is not yet implemented\n# if self.crypto.get_current_mastertoken_validity()['is_renewable']:\n# # Check if mastertoken is renewed\n@@ -228,9 +222,9 @@ class MSLRequests(MSLRequestBuilder):\ndef _process_json_response(response):\n\"\"\"Execute a post request and expect a JSON response\"\"\"\ntry:\n- return _raise_if_error(response.json())\n+ return _raise_if_error(json.loads(response))\nexcept ValueError as exc:\n- raise MSLError('Expected JSON response, got {}'.format(response.text)) from exc\n+ raise MSLError('Expected JSON format type, got {}'.format(response)) from exc\ndef _raise_if_error(decoded_response):\n@@ -274,18 +268,27 @@ def _get_error_details(decoded_response):\n@measure_exec_time_decorator(is_immediate=True)\ndef _parse_chunks(message):\n- header = json.loads(message.split('}}')[0] + '}}')\n- payloads = re.split(',\\\"signature\\\":\\\"[0-9A-Za-z=/+]+\\\"}', message.split('}}')[1])\n- payloads = [x + '}' for x in payloads][:-1]\n+ try:\n+ msg_parts = json.loads('[' + message.replace('}{', '},{') + ']')\n+ header = None\n+ payloads = []\n+ for msg_part in msg_parts:\n+ if 'headerdata' in msg_part:\n+ header = msg_part\n+ elif 'payload' in msg_part:\n+ payloads.append(msg_part)\nreturn {'header': header, 'payloads': payloads}\n+ except Exception as exc: # pylint: disable=broad-except\n+ LOG.error('Unable to parse the chunks due to error: {}', exc)\n+ LOG.debug('Message data: {}', message)\n+ raise\n@measure_exec_time_decorator(is_immediate=True)\ndef _decrypt_chunks(chunks, crypto):\ndecrypted_payload = ''\nfor chunk in chunks:\n- payloadchunk = json.loads(chunk)\n- payload = payloadchunk.get('payload')\n+ payload = chunk.get('payload')\ndecoded_payload = base64.standard_b64decode(payload)\nencryption_envelope = json.loads(decoded_payload)\n# Decrypt the text\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Avoid expose response object between functions and better managed chunks |
106,046 | 22.01.2021 14:19:29 | -3,600 | cf81de1a56f7ab58ad17efe00211b2d15c6a9d71 | Partially reverted workaround of | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/common/exceptions.py",
"new_path": "resources/lib/common/exceptions.py",
"diff": "@@ -20,10 +20,6 @@ class HttpError401(Exception):\n\"\"\"The request has returned http error 401 unauthorized for url ...\"\"\"\n-class HttpErrorTimeout(Exception):\n- \"\"\"The request has raised timeout\"\"\"\n-\n-\nclass WebsiteParsingError(Exception):\n\"\"\"Parsing info from the Netflix Website failed\"\"\"\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/run_addon.py",
"new_path": "resources/lib/run_addon.py",
"diff": "@@ -12,7 +12,7 @@ from xbmc import getCondVisibility, Monitor, getInfoLabel\nfrom resources.lib.common.exceptions import (HttpError401, InputStreamHelperError, MbrStatusNeverMemberError,\nMbrStatusFormerMemberError, MissingCredentialsError, LoginError,\n- NotLoggedInError, InvalidPathError, BackendNotReady, HttpErrorTimeout)\n+ NotLoggedInError, InvalidPathError, BackendNotReady)\nfrom resources.lib.common import check_credentials, get_local_string, WndHomeProps\nfrom resources.lib.globals import G\nfrom resources.lib.upgrade_controller import check_addon_upgrade\n@@ -37,12 +37,11 @@ def catch_exceptions_decorator(func):\n('The operation has been cancelled.[CR]'\n'InputStream Helper has generated an internal error:[CR]{}[CR][CR]'\n'Please report it to InputStream Helper github.'.format(exc)))\n- except (HttpError401, HttpErrorTimeout) as exc:\n- # HttpError401: This is a generic error, can happen when the http request for some reason has failed.\n+ except HttpError401 as exc:\n+ # This is a generic error, can happen when the http request for some reason has failed.\n# Known causes:\n# - Possible change of data format or wrong data in the http request (also in headers/params)\n# - Some current nf session data are not more valid (authURL/cookies/...)\n- # HttpErrorTimeout: This error is raised by Requests ReadTimeout error, unknown causes\nfrom resources.lib.kodi.ui import show_ok_dialog\nshow_ok_dialog(get_local_string(30105),\n('There was a communication problem with Netflix.[CR]'\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/msl/events_handler.py",
"new_path": "resources/lib/services/msl/events_handler.py",
"diff": "@@ -105,7 +105,7 @@ class EventsHandler(threading.Thread):\n'events/{}'.format(event))\ntry:\nresponse = self.chunked_request(endpoint_url, event.request_data, get_esn(),\n- disable_msl_switch=False, retry_all_exceptions=True)\n+ disable_msl_switch=False)\n# Malformed/wrong content in requests are ignored without returning error feedback in the response\nevent.set_response(response)\nexcept Exception as exc: # pylint: disable=broad-except\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/msl/msl_requests.py",
"new_path": "resources/lib/services/msl/msl_requests.py",
"diff": "\"\"\"\nimport base64\nimport json\n-import re\nimport time\nimport zlib\n-from requests import exceptions\n-\nimport resources.lib.common as common\nfrom resources.lib.common.exceptions import MSLError\nfrom resources.lib.globals import G\n@@ -152,19 +149,18 @@ class MSLRequests(MSLRequestBuilder):\nreturn {'use_switch_profile': use_switch_profile, 'user_id_token': user_id_token}\n@measure_exec_time_decorator(is_immediate=True)\n- def chunked_request(self, endpoint, request_data, esn, disable_msl_switch=True, force_auth_credential=False,\n- retry_all_exceptions=False):\n+ def chunked_request(self, endpoint, request_data, esn, disable_msl_switch=True, force_auth_credential=False):\n\"\"\"Do a POST request and process the chunked response\"\"\"\nself._mastertoken_checks()\nauth_data = self._check_user_id_token(disable_msl_switch, force_auth_credential)\nLOG.debug('Chunked request will be executed with auth data: {}', auth_data)\nchunked_response = self._process_chunked_response(\n- self._post(endpoint, self.msl_request(request_data, esn, auth_data), retry_all_exceptions),\n+ self._post(endpoint, self.msl_request(request_data, esn, auth_data)),\nsave_uid_token_to_owner=auth_data['user_id_token'] is None)\nreturn chunked_response['result']\n- def _post(self, endpoint, request_data, retry_all_exceptions=False):\n+ def _post(self, endpoint, request_data):\n\"\"\"Execute a post request\"\"\"\nis_attemps_enabled = 'reqAttempt=' in endpoint\nmax_attempts = 3 if is_attemps_enabled else 1\n@@ -184,8 +180,6 @@ class MSLRequests(MSLRequestBuilder):\nreturn response.text\nexcept Exception as exc: # pylint: disable=broad-except\nLOG.error('HTTP request error: {}', exc)\n- if not retry_all_exceptions and not isinstance(exc, exceptions.ReadTimeout):\n- raise\nif retry_attempt >= max_attempts:\nraise\nretry_attempt += 1\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/nfsession/session/http_requests.py",
"new_path": "resources/lib/services/nfsession/session/http_requests.py",
"diff": "@@ -14,7 +14,7 @@ import time\nimport resources.lib.common as common\nimport resources.lib.utils.website as website\nfrom resources.lib.common.exceptions import (APIError, WebsiteParsingError, MbrStatusError, MbrStatusAnonymousError,\n- HttpError401, NotLoggedInError, HttpErrorTimeout)\n+ HttpError401, NotLoggedInError)\nfrom resources.lib.database.db_utils import TABLE_SESSION\nfrom resources.lib.globals import G\nfrom resources.lib.kodi import ui\n@@ -46,7 +46,6 @@ class SessionHTTPRequests(SessionBase):\nreturn self._request(method, endpoint, None, **kwargs)\ndef _request(self, method, endpoint, session_refreshed, **kwargs):\n- from requests import exceptions\nendpoint_conf = ENDPOINTS[endpoint]\nurl = (_api_url(endpoint_conf['address'])\nif endpoint_conf['is_api_call']\n@@ -55,7 +54,6 @@ class SessionHTTPRequests(SessionBase):\nverb='GET' if method == self.session.get else 'POST', url=url)\ndata, headers, params = self._prepare_request_properties(endpoint_conf, kwargs)\nstart = time.perf_counter()\n- try:\nresponse = method(\nurl=url,\nverify=self.verify_ssl,\n@@ -63,9 +61,6 @@ class SessionHTTPRequests(SessionBase):\nparams=params,\ndata=data,\ntimeout=8)\n- except exceptions.ReadTimeout as exc:\n- LOG.error('HTTP Request ReadTimeout error: {}', exc)\n- raise HttpErrorTimeout from exc\nLOG.debug('Request took {}s', time.perf_counter() - start)\nLOG.debug('Request returned status code {}', response.status_code)\n# for redirect in response.history:\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Partially reverted workaround of 918460443cb1818e3a000c520b42311a26d74b66 |
106,046 | 22.01.2021 19:39:33 | -3,600 | c8f68e7efc6c2420ffb150adecb6d2ef74a4fa2c | Try better handle HTTP ReadTimeout/ConnectionError errors | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/msl/msl_requests.py",
"new_path": "resources/lib/services/msl/msl_requests.py",
"diff": "@@ -13,6 +13,8 @@ import json\nimport time\nimport zlib\n+import requests.exceptions as req_exceptions\n+\nimport resources.lib.common as common\nfrom resources.lib.common.exceptions import MSLError\nfrom resources.lib.globals import G\n@@ -162,28 +164,29 @@ class MSLRequests(MSLRequestBuilder):\ndef _post(self, endpoint, request_data):\n\"\"\"Execute a post request\"\"\"\n- is_attemps_enabled = 'reqAttempt=' in endpoint\n- max_attempts = 3 if is_attemps_enabled else 1\n- retry_attempt = 1\n- while retry_attempt <= max_attempts:\n- if is_attemps_enabled:\n- _endpoint = endpoint.replace('reqAttempt=', 'reqAttempt=' + str(retry_attempt))\n+ is_attempts_enabled = 'reqAttempt=' in endpoint\n+ retry = 1\n+ while True:\n+ try:\n+ if is_attempts_enabled:\n+ _endpoint = endpoint.replace('reqAttempt=', 'reqAttempt=' + str(retry))\nelse:\n_endpoint = endpoint\nLOG.debug('Executing POST request to {}', _endpoint)\nstart = time.perf_counter()\n- try:\nresponse = self.session.post(_endpoint, request_data, timeout=4)\nLOG.debug('Request took {}s', time.perf_counter() - start)\nLOG.debug('Request returned response with status {}', response.status_code)\n- response.raise_for_status()\n- return response.text\n- except Exception as exc: # pylint: disable=broad-except\n+ break\n+ except (req_exceptions.ConnectionError, req_exceptions.ReadTimeout) as exc:\n+ # Info on PR: https://github.com/CastagnaIT/plugin.video.netflix/pull/1046\nLOG.error('HTTP request error: {}', exc)\n- if retry_attempt >= max_attempts:\n+ if retry == 3:\nraise\n- retry_attempt += 1\n- LOG.warn('Will be executed a new POST request (attempt {})'.format(retry_attempt))\n+ retry += 1\n+ LOG.warn('Another attempt will be performed ({})', retry)\n+ response.raise_for_status()\n+ return response.text\n@measure_exec_time_decorator(is_immediate=True)\ndef _process_chunked_response(self, response, save_uid_token_to_owner=False):\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/nfsession/session/http_requests.py",
"new_path": "resources/lib/services/nfsession/session/http_requests.py",
"diff": "import json\nimport time\n+import requests.exceptions as req_exceptions\n+\nimport resources.lib.common as common\nimport resources.lib.utils.website as website\nfrom resources.lib.common.exceptions import (APIError, WebsiteParsingError, MbrStatusError, MbrStatusAnonymousError,\n@@ -50,9 +52,12 @@ class SessionHTTPRequests(SessionBase):\nurl = (_api_url(endpoint_conf['address'])\nif endpoint_conf['is_api_call']\nelse _document_url(endpoint_conf['address'], kwargs))\n+ data, headers, params = self._prepare_request_properties(endpoint_conf, kwargs)\n+ retry = 1\n+ while True:\n+ try:\nLOG.debug('Executing {verb} request to {url}',\nverb='GET' if method == self.session.get else 'POST', url=url)\n- data, headers, params = self._prepare_request_properties(endpoint_conf, kwargs)\nstart = time.perf_counter()\nresponse = method(\nurl=url,\n@@ -63,6 +68,14 @@ class SessionHTTPRequests(SessionBase):\ntimeout=8)\nLOG.debug('Request took {}s', time.perf_counter() - start)\nLOG.debug('Request returned status code {}', response.status_code)\n+ break\n+ except (req_exceptions.ConnectionError, req_exceptions.ReadTimeout) as exc:\n+ # Info on PR: https://github.com/CastagnaIT/plugin.video.netflix/pull/1046\n+ LOG.error('HTTP request error: {}', exc)\n+ if retry == 3:\n+ raise\n+ retry += 1\n+ LOG.warn('Another attempt will be performed ({})', retry)\n# for redirect in response.history:\n# LOG.warn('Redirected to: [{}] {}', redirect.status_code, redirect.url)\nif not session_refreshed:\n@@ -84,7 +97,6 @@ class SessionHTTPRequests(SessionBase):\ndef try_refresh_session_data(self, raise_exception=False):\n\"\"\"Refresh session data from the Netflix website\"\"\"\n- from requests import exceptions\ntry:\nself.auth_url = website.extract_session_data(self.get('browse'))['auth_url']\ncookies.save(self.session.cookies)\n@@ -105,7 +117,7 @@ class SessionHTTPRequests(SessionBase):\ncommon.purge_credentials()\nui.show_notification(common.get_local_string(30008))\nraise NotLoggedInError from exc\n- except exceptions.RequestException:\n+ except req_exceptions.RequestException:\nimport traceback\nLOG.warn('Failed to refresh session data, request error (RequestException)')\nLOG.warn(traceback.format_exc())\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Try better handle HTTP ReadTimeout/ConnectionError errors |
106,046 | 24.01.2021 10:56:27 | -3,600 | e4854ec35070402596909b1a4d1896322eb3c40f | Removed leia CI | [
{
"change_type": "DELETE",
"old_path": ".github/workflows/addon-check-Leia.yml",
"new_path": null,
"diff": "-name: Kodi\n-on:\n- push:\n- branches:\n- - Leia\n- pull_request:\n- branches:\n- - Leia\n-jobs:\n- tests:\n- name: Addon checker\n- runs-on: ubuntu-latest\n- env:\n- PYTHONIOENCODING: utf-8\n- strategy:\n- fail-fast: false\n- matrix:\n- kodi-branch: [leia]\n- steps:\n- - uses: actions/checkout@v2\n- with:\n- path: ${{ github.repository }}\n- - name: Set up Python 3.8\n- uses: actions/setup-python@v1\n- with:\n- python-version: 3.8\n- - name: Install dependencies\n- run: |\n- sudo apt-get install gettext\n- python -m pip install --upgrade pip\n- pip install kodi-addon-checker\n- - name: Checking language translations\n- run: make check-translations\n- - name: Remove unwanted files\n- run: awk '/export-ignore/ { print $1 }' .gitattributes | xargs rm -rf --\n- working-directory: ${{ github.repository }}\n- - name: Run kodi-addon-checker\n- run: kodi-addon-checker --branch=${{ matrix.kodi-branch }} ${{ github.repository }}/\n"
},
{
"change_type": "DELETE",
"old_path": ".github/workflows/ci-Leia.yml",
"new_path": null,
"diff": "-name: CI\n-on:\n- push:\n- branches:\n- - Leia\n- pull_request:\n- branches:\n- - Leia\n-jobs:\n- tests:\n- name: Add-on testing\n- # ubuntu-latest has dropped Python 2, ubuntu-18.04 is the last one\n- runs-on: ubuntu-18.04\n- env:\n- PYTHONIOENCODING: utf-8\n- PYTHONPATH: ${{ github.workspace }}/resources/lib:${{ github.workspace }}/tests\n- strategy:\n- fail-fast: false\n- matrix:\n- python-version: [2.7]\n- steps:\n- - name: Check out ${{ github.sha }} from repository ${{ github.repository }}\n- uses: actions/checkout@v2\n- - name: Set up Python ${{ matrix.python-version }}\n- uses: actions/setup-python@v1\n- with:\n- python-version: ${{ matrix.python-version }}\n- - name: Install dependencies\n- run: |\n- python -m pip install --upgrade pip\n- pip install -r requirements.txt\n- - name: Run tox\n- run: python -m tox -q -e flake8,py\n- if: always()\n- - name: Run pylint\n- run: python -m pylint resources/lib/ tests/\n- if: always()\n- - name: Compare translations\n- run: make check-translations\n- if: always()\n- - name: Analyze with SonarCloud\n- uses: SonarSource/[email protected]\n- with:\n- args: >\n- -Dsonar.organization=add-ons\n- -Dsonar.projectKey=add-ons_plugin.video.netflix\n- env:\n- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}\n- SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}\n- continue-on-error: true\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Removed leia CI |
106,046 | 24.01.2021 11:08:54 | -3,600 | 6693782bfd9f73cdc10a09274b9e313aad3e87eb | Add seasons art | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/nfsession/directorybuilder/dir_builder_items.py",
"new_path": "resources/lib/services/nfsession/directorybuilder/dir_builder_items.py",
"diff": "@@ -148,7 +148,8 @@ def _create_season_item(tvshowid, seasonid_value, season, season_list, common_da\n'is_folder': True,\n'properties': {'nf_videoid': seasonid.to_string()}\n}\n- add_info_dict_item(dict_item, seasonid, season, season_list.data, False, common_data)\n+ add_info_dict_item(dict_item, seasonid, season, season_list.data, False, common_data,\n+ art_item=season_list.artitem)\ndict_item['url'] = common.build_url(videoid=seasonid, mode=G.MODE_DIRECTORY)\ndict_item['menu_items'] = generate_context_menu_items(seasonid, False, None)\nreturn dict_item\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/nfsession/directorybuilder/dir_path_requests.py",
"new_path": "resources/lib/services/nfsession/directorybuilder/dir_path_requests.py",
"diff": "@@ -106,7 +106,8 @@ class DirectoryPathRequests:\nraise InvalidVideoId('Cannot request season list for {}'.format(videoid))\nLOG.debug('Requesting the seasons list for show {}', videoid)\ncall_args = {\n- 'paths': build_paths(['videos', videoid.tvshowid], SEASONS_PARTIAL_PATHS),\n+ 'paths': (build_paths(['videos', videoid.tvshowid], SEASONS_PARTIAL_PATHS) +\n+ build_paths(['videos', videoid.tvshowid], ART_PARTIAL_PATHS)),\n'length_params': ['stdlist_wid', ['videos', videoid.tvshowid, 'seasonList']],\n'perpetual_range_start': perpetual_range_start\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/utils/data_types.py",
"new_path": "resources/lib/utils/data_types.py",
"diff": "@@ -224,6 +224,8 @@ class SeasonList:\nself.perpetual_range_selector = path_response.get('_perpetual_range_selector')\nself.data = path_response\nself.videoid = videoid\n+ # Get the art data of tv show (from first videoid)\n+ self.artitem = next(iter(self.data.get('videos', {}).values()), None)\nself.tvshow = self.data['videos'][self.videoid.tvshowid]\nself.seasons = OrderedDict(\nresolve_refs(self.tvshow['seasonList'], self.data))\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Add seasons art |
106,046 | 24.01.2021 11:31:33 | -3,600 | 838f5705e1e828ff9e8a58866930da5a93b95de2 | Little conditions improvement | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/common/data_conversion.py",
"new_path": "resources/lib/common/data_conversion.py",
"diff": "@@ -25,12 +25,11 @@ def convert_to_string(value):\ndata_type = type(value)\nif data_type == str:\nreturn value\n- converter = None\nif data_type in (int, float, bool, tuple, datetime.datetime):\nconverter = _conv_standard_to_string\n- if data_type in (list, dict, OrderedDict):\n+ elif data_type in (list, dict, OrderedDict):\nconverter = _conv_json_to_string\n- if not converter:\n+ else:\nLOG.error('convert_to_string: Data type {} not mapped'.format(data_type))\nraise DataTypeNotMapped\nreturn converter(value)\n@@ -43,12 +42,11 @@ def convert_from_string(value, to_data_type):\nreturn to_data_type(value)\nif to_data_type in (bool, list, tuple):\nreturn literal_eval(value)\n- converter = None\nif to_data_type == dict:\nconverter = _conv_string_to_json\n- if to_data_type == datetime.datetime:\n+ elif to_data_type == datetime.datetime:\nconverter = _conv_string_to_datetime\n- if not converter:\n+ else:\nLOG.error('convert_from_string: Data type {} not mapped'.format(to_data_type))\nraise DataTypeNotMapped\nreturn converter(value)\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Little conditions improvement |
106,046 | 25.01.2021 09:53:27 | -3,600 | 112f0595bf5e8e56129b919f01d8d98bc09c389f | Little condition improvement | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/run_addon.py",
"new_path": "resources/lib/run_addon.py",
"diff": "@@ -128,7 +128,6 @@ def route(pathitems):\ndef _get_nav_handler(root_handler, pathitems):\n- nav_handler = None\nif root_handler == G.MODE_DIRECTORY:\nfrom resources.lib.navigation.directory import Directory\nnav_handler = Directory\n@@ -141,7 +140,7 @@ def _get_nav_handler(root_handler, pathitems):\nelif root_handler == G.MODE_KEYMAPS:\nfrom resources.lib.navigation.keymaps import KeymapsActionExecutor\nnav_handler = KeymapsActionExecutor\n- if not nav_handler:\n+ else:\nraise InvalidPathError('No root handler for path {}'.format('/'.join(pathitems)))\nreturn nav_handler\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Little condition improvement |
106,046 | 25.01.2021 09:54:14 | -3,600 | 3c4787f89615c4632d4786015a6edd3e704b8d14 | Removed warning message of old upgrade | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/upgrade_controller.py",
"new_path": "resources/lib/upgrade_controller.py",
"diff": "@@ -57,11 +57,6 @@ def _perform_addon_changes(previous_ver, current_ver):\n\"\"\"Perform actions for an version bump\"\"\"\ncancel_playback = False\nLOG.debug('Initialize addon upgrade operations, from version {} to {})', previous_ver, current_ver)\n- if previous_ver and is_less_version(previous_ver, '0.15.9'):\n- import resources.lib.kodi.ui as ui\n- msg = ('This update resets the settings to auto-update library.\\r\\n'\n- 'Therefore only in case you are using auto-update must be reconfigured.')\n- ui.show_ok_dialog('Netflix upgrade', msg)\nif previous_ver and is_less_version(previous_ver, '1.7.0'):\nfrom resources.lib.upgrade_actions import migrate_library\nmigrate_library()\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Removed warning message of old upgrade |
106,046 | 25.01.2021 09:59:19 | -3,600 | 8f597480c1ca51e2c0bb0266b00500f9e3ed953e | Removed delete cache folder on old upgrade | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/upgrade_actions.py",
"new_path": "resources/lib/upgrade_actions.py",
"diff": "@@ -12,8 +12,7 @@ import os\nimport xbmc\nimport xbmcvfs\n-from resources.lib.common.fileops import (delete_folder_contents, list_dir, join_folders_paths, load_file, save_file,\n- copy_file, delete_file)\n+from resources.lib.common.fileops import (list_dir, join_folders_paths, load_file, save_file, copy_file, delete_file)\nfrom resources.lib.globals import G\nfrom resources.lib.kodi import ui\nfrom resources.lib.kodi.library_utils import get_library_subfolders, FOLDER_NAME_MOVIES, FOLDER_NAME_SHOWS\n@@ -31,21 +30,6 @@ def rename_cookie_file():\ndelete_file(filename)\n-def delete_cache_folder():\n- # Delete cache folder in the add-on userdata (no more needed with the new cache management)\n- cache_path = os.path.join(G.DATA_PATH, 'cache')\n- if not os.path.exists(xbmcvfs.translatePath(cache_path)):\n- return\n- LOG.debug('Deleting the cache folder from add-on userdata folder')\n- try:\n- delete_folder_contents(cache_path, True)\n- xbmc.sleep(80)\n- xbmcvfs.rmdir(cache_path)\n- except Exception: # pylint: disable=broad-except\n- import traceback\n- LOG.error(traceback.format_exc())\n-\n-\ndef migrate_library():\n# Migrate the Kodi library to the new format of STRM path\n# - Old STRM: '/play/show/xxxxxxxx/season/xxxxxxxx/episode/xxxxxxxx/' (used before ver 1.7.0)\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/upgrade_controller.py",
"new_path": "resources/lib/upgrade_controller.py",
"diff": "@@ -71,19 +71,6 @@ def _perform_service_changes(previous_ver, current_ver):\nLOG.debug('Initialize service upgrade operations, from version {} to {})', previous_ver, current_ver)\n# Clear cache (prevents problems when netflix change data structures)\nG.CACHE.clear()\n- if previous_ver and is_less_version(previous_ver, '1.2.0'):\n- # In the version 1.2.0 has been implemented a new cache management\n- from resources.lib.upgrade_actions import delete_cache_folder\n- delete_cache_folder()\n- # In the version 1.2.0 has been implemented in auto-update mode setting the option to disable the feature\n- try:\n- lib_auto_upd_mode = G.ADDON.getSettingInt('lib_auto_upd_mode')\n- with G.SETTINGS_MONITOR.ignore_events(1):\n- G.ADDON.setSettingInt('lib_auto_upd_mode', lib_auto_upd_mode + 1)\n- except TypeError:\n- # In case of a previous rollback this could fails\n- with G.SETTINGS_MONITOR.ignore_events(1):\n- G.ADDON.setSettingInt('lib_auto_upd_mode', 1)\nif previous_ver and is_less_version(previous_ver, '1.9.0'):\n# In the version 1.9.0 has been changed the COOKIE_ filename with a static filename\nfrom resources.lib.upgrade_actions import rename_cookie_file\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Removed delete cache folder on old upgrade |
106,046 | 04.02.2021 09:56:53 | -3,600 | c53abcc5776a3bbcd6a95ea87f02211046ead2f6 | Removed read setting from Kodi library settings | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/navigation/directory.py",
"new_path": "resources/lib/navigation/directory.py",
"diff": "@@ -122,10 +122,6 @@ class Directory:\n}\nlist_data, extra_data = common.make_call('get_seasons', call_args)\nif len(list_data) == 1:\n- # Check if Kodi setting \"Flatten TV show seasons\" is enabled\n- value = common.json_rpc('Settings.GetSettingValue',\n- {'setting': 'videolibrary.flattentvshows'}).get('value')\n- if value != 0: # Values: 0=never, 1=if one season, 2=always\n# If there is only one season, load and show the episodes now\npathitems = list_data[0]['url'].replace(G.BASE_URL, '').strip('/').split('/')[1:]\nvideoid = common.VideoId.from_path(pathitems)\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Removed read setting from Kodi library settings |
106,046 | 18.02.2021 14:26:45 | -3,600 | 2f3f3f7c9ff7fdb86c9fb9f3a2f918df7356fb2e | Enabled TCP Keep-Alive to Requests/urllib3 | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/msl/msl_requests.py",
"new_path": "resources/lib/services/msl/msl_requests.py",
"diff": "@@ -21,6 +21,7 @@ from resources.lib.globals import G\nfrom resources.lib.services.msl.msl_request_builder import MSLRequestBuilder\nfrom resources.lib.services.msl.msl_utils import (generate_logblobs_params, ENDPOINTS,\nMSL_DATA_FILENAME, create_req_params)\n+from resources.lib.services.tcp_keep_alive import enable_tcp_keep_alive\nfrom resources.lib.utils.esn import get_esn\nfrom resources.lib.utils.logging import LOG, measure_exec_time_decorator\n@@ -30,8 +31,9 @@ class MSLRequests(MSLRequestBuilder):\ndef __init__(self, msl_data=None):\nsuper().__init__()\n- from requests import session\n- self.session = session()\n+ from requests import Session\n+ self.session = Session()\n+ enable_tcp_keep_alive(self.session)\nself.session.headers.update({\n'User-Agent': common.get_user_agent(),\n'Content-Type': 'text/plain',\n@@ -178,8 +180,7 @@ class MSLRequests(MSLRequestBuilder):\nLOG.debug('Request took {}s', time.perf_counter() - start)\nLOG.debug('Request returned response with status {}', response.status_code)\nbreak\n- except (req_exceptions.ConnectionError, req_exceptions.ReadTimeout) as exc:\n- # Info on PR: https://github.com/CastagnaIT/plugin.video.netflix/pull/1046\n+ except req_exceptions.ConnectionError as exc:\nLOG.error('HTTP request error: {}', exc)\nif retry == 3:\nraise\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/nfsession/session/base.py",
"new_path": "resources/lib/services/nfsession/session/base.py",
"diff": "import resources.lib.common as common\nfrom resources.lib.database.db_utils import TABLE_SESSION\nfrom resources.lib.globals import G\n+from resources.lib.services.tcp_keep_alive import enable_tcp_keep_alive\nfrom resources.lib.utils.logging import LOG\n@@ -37,8 +38,9 @@ class SessionBase:\nLOG.info('Session closed')\nexcept AttributeError:\npass\n- from requests import session\n- self.session = session()\n+ from requests import Session\n+ self.session = Session()\n+ enable_tcp_keep_alive(self.session)\nself.session.max_redirects = 10 # Too much redirects should means some problem\nself.session.headers.update({\n'User-Agent': common.get_user_agent(enable_android_mediaflag_fix=True),\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/nfsession/session/http_requests.py",
"new_path": "resources/lib/services/nfsession/session/http_requests.py",
"diff": "@@ -69,8 +69,7 @@ class SessionHTTPRequests(SessionBase):\nLOG.debug('Request took {}s', time.perf_counter() - start)\nLOG.debug('Request returned status code {}', response.status_code)\nbreak\n- except (req_exceptions.ConnectionError, req_exceptions.ReadTimeout) as exc:\n- # Info on PR: https://github.com/CastagnaIT/plugin.video.netflix/pull/1046\n+ except req_exceptions.ConnectionError as exc:\nLOG.error('HTTP request error: {}', exc)\nif retry == 3:\nraise\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "resources/lib/services/tcp_keep_alive.py",
"diff": "+# -*- coding: utf-8 -*-\n+\"\"\"\n+ Copyright (C) 2017 Sebastian Golasch (plugin.video.netflix)\n+ Copyright (C) 2021 Stefano Gottardo - @CastagnaIT\n+ Helper to enable TCP Keep Alive\n+\n+ SPDX-License-Identifier: MIT\n+ See LICENSES/MIT.md for more information.\n+\"\"\"\n+import socket\n+import sys\n+\n+from requests.adapters import HTTPAdapter, DEFAULT_POOLBLOCK\n+from urllib3 import HTTPSConnectionPool, HTTPConnectionPool, PoolManager\n+from urllib3.connection import HTTPConnection\n+\n+TCP_KEEP_IDLE = 45\n+TCP_KEEPALIVE_INTERVAL = 10\n+TCP_KEEP_CNT = 6\n+\n+\n+class KeepAliveHTTPAdapter(HTTPAdapter):\n+ \"\"\"Transport adapter that allows us to use TCP Keep-Alive over HTTPS.\"\"\"\n+ def init_poolmanager(self, connections, maxsize, block=DEFAULT_POOLBLOCK, **pool_kwargs):\n+ self.poolmanager = KeepAlivePoolManager(num_pools=connections, maxsize=maxsize,\n+ block=block, strict=True, **pool_kwargs)\n+\n+\n+class KeepAlivePoolManager(PoolManager):\n+ \"\"\"\n+ This Pool Manager has only had the pool_classes_by_scheme variable changed.\n+ This now points at the TCPKeepAlive connection pools rather than the default connection pools.\n+ \"\"\"\n+ def __init__(self, num_pools=10, headers=None, **connection_pool_kw):\n+ super().__init__(num_pools=num_pools, headers=headers, **connection_pool_kw)\n+ self.pool_classes_by_scheme = {\n+ \"http\": HTTPConnectionPool,\n+ \"https\": TCPKeepAliveHTTPSConnectionPool\n+ }\n+\n+\n+class TCPKeepAliveHTTPSConnectionPool(HTTPSConnectionPool):\n+ \"\"\"This class overrides the _validate_conn method in the HTTPSConnectionPool class. This is the entry point to use\n+ for modifying the socket as it is called after the socket is created and before the request is made.\"\"\"\n+ def _validate_conn(self, conn):\n+ \"\"\"Called right before a request is made, after the socket is created.\"\"\"\n+ super()._validate_conn(conn)\n+ # NOTE: conn.sock can be of many types of classes, some classes like (WrappedSocket)\n+ # not inherit all socket methods and conn.sock.socket is not always available,\n+ # then the best way is to use default_socket_options, with the exception of Windows which requires ioctl\n+ # TCP Keep Alive Probes for Windows\n+ # pylint: disable=no-member\n+ conn.sock.ioctl(socket.SIO_KEEPALIVE_VALS, (1, TCP_KEEP_IDLE * 1000, TCP_KEEPALIVE_INTERVAL * 1000))\n+\n+\n+def enable_tcp_keep_alive(session):\n+ \"\"\"Enable TCP Keep-Alive (by default on urllib3 used by Requests is disabled)\"\"\"\n+ # More info on PR: https://github.com/CastagnaIT/plugin.video.netflix/pull/1065\n+ sock_options = [(socket.SOL_SOCKET, socket.SO_KEEPALIVE, 1)]\n+ if sys.platform == 'linux':\n+ # TCP Keep Alive Probes for Linux/Android\n+ if hasattr(socket, 'TCP_KEEPIDLE'):\n+ sock_options.append((socket.IPPROTO_TCP, socket.TCP_KEEPIDLE, TCP_KEEP_IDLE))\n+ if hasattr(socket, 'TCP_KEEPINTVL'):\n+ sock_options.append((socket.IPPROTO_TCP, socket.TCP_KEEPINTVL, TCP_KEEPALIVE_INTERVAL))\n+ if hasattr(socket, 'TCP_KEEPCNT'):\n+ sock_options.append((socket.IPPROTO_TCP, socket.TCP_KEEPCNT, TCP_KEEP_CNT))\n+ elif sys.platform == 'darwin':\n+ # TCP Keep Alive Probes for MacOS\n+ # NOTE: The socket constants from MacOS netinet/tcp.h are not exported by python's socket module\n+ # The MacOS TCP_KEEPALIVE(0x10) constant should be the same thing of the linux TCP_KEEPIDLE constant\n+ sock_options.append((socket.IPPROTO_TCP, getattr(socket, 'TCP_KEEPIDLE', 0x10), TCP_KEEP_IDLE))\n+ sock_options.append((socket.IPPROTO_TCP, getattr(socket, 'TCP_KEEPINTVL', 0x101), TCP_KEEPALIVE_INTERVAL))\n+ sock_options.append((socket.IPPROTO_TCP, getattr(socket, 'TCP_KEEPCNT', 0x102), TCP_KEEP_CNT))\n+ elif sys.platform == 'win32':\n+ # Windows use ioctl to enable and set Keep-Alive settings on single connection,\n+ # the only way to set it is create a new HTTP adapter\n+ session.mount('https://', KeepAliveHTTPAdapter())\n+ HTTPConnection.default_socket_options = HTTPConnection.default_socket_options + sock_options\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Enabled TCP Keep-Alive to Requests/urllib3 |
106,046 | 20.02.2021 14:05:32 | -3,600 | c147b49746bb52d341923083feab1b0ec5c4bf22 | Add clear "stream continuity" data | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/database/db_shared.py",
"new_path": "resources/lib/database/db_shared.py",
"diff": "@@ -460,6 +460,13 @@ def get_shareddb_class(use_mysql=False):\nself._execute_non_query(insert_query, (profile_guid, videoid,\nvalue, date_last_modified))\n+ @db_base_mysql.handle_connection\n+ @db_base_sqlite.handle_connection\n+ def clear_stream_continuity(self):\n+ \"\"\"Clear all stream continuity data\"\"\"\n+ query = 'DELETE FROM stream_continuity'\n+ self._execute_non_query(query)\n+\n@db_base_mysql.handle_connection\n@db_base_sqlite.handle_connection\ndef purge_library(self):\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/navigation/actions.py",
"new_path": "resources/lib/navigation/actions.py",
"diff": "@@ -137,7 +137,10 @@ class AddonActionExecutor:\n@measure_exec_time_decorator()\ndef purge_cache(self, pathitems=None): # pylint: disable=unused-argument\n\"\"\"Clear the cache. If on_disk param is supplied, also clear cached items from disk\"\"\"\n- G.CACHE.clear(clear_database=self.params.get('on_disk', False))\n+ _on_disk = self.params.get('on_disk', False)\n+ G.CACHE.clear(clear_database=_on_disk)\n+ if _on_disk:\n+ G.SHARED_DB.clear_stream_continuity()\nui.show_notification(common.get_local_string(30135))\ndef force_update_list(self, pathitems=None): # pylint: disable=unused-argument\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/upgrade_controller.py",
"new_path": "resources/lib/upgrade_controller.py",
"diff": "@@ -70,6 +70,12 @@ def _perform_service_changes(previous_ver, current_ver):\nLOG.debug('Initialize service upgrade operations, from version {} to {})', previous_ver, current_ver)\n# Clear cache (prevents problems when netflix change data structures)\nG.CACHE.clear()\n+ # Delete all stream continuity data - if user has upgraded from Kodi 18 to Kodi 19\n+ if is_less_version(previous_ver, '1.13'):\n+ # There is no way to determine if the user has migrated from Kodi 18 to Kodi 19,\n+ # then we assume that add-on versions prior to 1.13 was on Kodi 18\n+ # The am_stream_continuity.py on Kodi 18 works differently and the existing data can not be used on Kodi 19\n+ G.SHARED_DB.clear_stream_continuity()\nif previous_ver and is_less_version(previous_ver, '1.9.0'):\n# In the version 1.9.0 has been changed the COOKIE_ filename with a static filename\nfrom resources.lib.upgrade_actions import rename_cookie_file\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Add clear "stream continuity" data |
106,046 | 21.02.2021 11:32:21 | -3,600 | a72a3f2538f1f0e8b14c2dd6f841ecb95093b26a | Version bump (1.14.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=\"1.13.1+matrix.1\" provider-name=\"libdev + jojo + asciidisco + caphm + castagnait\">\n+<addon id=\"plugin.video.netflix\" name=\"Netflix\" version=\"1.14.0+matrix.1\" provider-name=\"libdev + jojo + asciidisco + caphm + castagnait\">\n<requires>\n<import addon=\"xbmc.python\" version=\"3.0.0\"/>\n<import addon=\"script.module.addon.signals\" version=\"0.0.6+matrix.1\"/>\n<forum>https://forum.kodi.tv/showthread.php?tid=329767</forum>\n<source>https://github.com/CastagnaIT/plugin.video.netflix</source>\n<news>\n-v1.13.1 (2021-01-25)\n-- Add images to seasons list items\n-- Implemented support to Kodi language setting case \"User interface language\"\n-- Fixed \"Prefer the audio/subtitle language with country code\" feature\n-- Fixed possible dependencies errors on new installations\n-- Fixed possible service crash on slower devices like RPI\n-- Better managed data chunks in some cases could cause errors on starting playback\n-- Tried to better handle HTTP ReadTimeout/ConnectionError errors\n-- Updated translations fr, hu, pt-br, zh-cn\n+v1.14.0 (2021-02-21)\n+- Converted settings xml to the new Kodi settings format type\n+- Debug logging setting is now an on/off switch\n+- Fixed stream continuity errors after Kodi migration (Kodi 18 to 19)\n+- Fixed HTTP ReadTimeout/ConnectionError errors\n+- Fixed incorrect handling of MSL errors\n+- Fixed AttributeError on playback when \"User interface language\" is set as preferred audio\n+- Updated translations de, it\n+- Minor fixes/changes\n</news>\n</extension>\n</addon>\n"
},
{
"change_type": "MODIFY",
"old_path": "changelog.txt",
"new_path": "changelog.txt",
"diff": "+v1.14.0 (2021-02-21)\n+- Converted settings xml to the new Kodi settings format type\n+- Debug logging setting is now an on/off switch\n+- Fixed stream continuity errors after Kodi migration (Kodi 18 to 19)\n+- Fixed HTTP ReadTimeout/ConnectionError errors\n+- Fixed incorrect handling of MSL errors\n+- Fixed AttributeError on playback when \"User interface language\" is set as preferred audio\n+- Updated translations de, it\n+- Minor fixes/changes\n+\nv1.13.1 (2021-01-25)\n- Add images to seasons list items\n- Implemented support to Kodi language setting case \"User interface language\"\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Version bump (1.14.0) (#1077) |
106,046 | 25.02.2021 08:34:37 | -3,600 | 017926280e6fc43be53d7aea523340e98998916e | Version bump (1.14.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=\"1.14.0+matrix.1\" provider-name=\"libdev + jojo + asciidisco + caphm + castagnait\">\n+<addon id=\"plugin.video.netflix\" name=\"Netflix\" version=\"1.14.1+matrix.1\" provider-name=\"libdev + jojo + asciidisco + caphm + castagnait\">\n<requires>\n<import addon=\"xbmc.python\" version=\"3.0.0\"/>\n<import addon=\"script.module.addon.signals\" version=\"0.0.6+matrix.1\"/>\n<forum>https://forum.kodi.tv/showthread.php?tid=329767</forum>\n<source>https://github.com/CastagnaIT/plugin.video.netflix</source>\n<news>\n-v1.14.0 (2021-02-21)\n-- Converted settings xml to the new Kodi settings format type\n-- Debug logging setting is now an on/off switch\n-- Fixed stream continuity errors after Kodi migration (Kodi 18 to 19)\n-- Fixed HTTP ReadTimeout/ConnectionError errors\n-- Fixed incorrect handling of MSL errors\n-- Fixed AttributeError on playback when \"User interface language\" is set as preferred audio\n-- Updated translations de, it\n-- Minor fixes/changes\n+v1.14.1 (2021-02-25)\n+- Fixed error caused by installation from scratch\n+- Update translations pt_br, zh,tw, ro, fr, zh_cn, jp, kr, gl_es, hu\n</news>\n</extension>\n</addon>\n"
},
{
"change_type": "MODIFY",
"old_path": "changelog.txt",
"new_path": "changelog.txt",
"diff": "+v1.14.1 (2021-02-25)\n+- Fixed error caused by installation from scratch\n+- Update translations pt_br, zh,tw, ro, fr, zh_cn, jp, kr, gl_es, hu\n+\nv1.14.0 (2021-02-21)\n- Converted settings xml to the new Kodi settings format type\n- Debug logging setting is now an on/off switch\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Version bump (1.14.1) (#1083) |
106,046 | 26.03.2021 11:09:49 | -3,600 | 1bd8af99fe2d80e24fbceff9ec974d674bf4b9b0 | Add lower h264 bitrate/resolution
could be useful in future for mobile purpose
when InputStreamAdaptive will integrate the resolution/bitstream toggle
based on network bandwidth | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/nfsession/msl/profiles.py",
"new_path": "resources/lib/services/nfsession/msl/profiles.py",
"diff": "@@ -42,8 +42,8 @@ PROFILES = {\n'dolbysound': ['ddplus-2.0-dash', 'ddplus-5.1-dash', 'ddplus-5.1hq-dash', 'ddplus-atmos-dash'],\n'h264': ['playready-h264mpl30-dash', 'playready-h264mpl31-dash',\n'playready-h264mpl40-dash',\n- 'playready-h264hpl30-dash', 'playready-h264hpl31-dash',\n- 'playready-h264hpl40-dash'],\n+ 'playready-h264hpl22-dash', 'playready-h264hpl30-dash',\n+ 'playready-h264hpl31-dash', 'playready-h264hpl40-dash'],\n'hevc':\n_profile_strings(base=HEVC,\ntails=[(BASE_LEVELS, CENC),\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Add lower h264 bitrate/resolution
could be useful in future for mobile purpose
when InputStreamAdaptive will integrate the resolution/bitstream toggle
based on network bandwidth |
106,046 | 26.03.2021 14:49:36 | -3,600 | 8712f273993cd613729d9b793816052ee295acec | Updated tests/AddonSignals | [
{
"change_type": "MODIFY",
"old_path": "tests/AddonSignals.py",
"new_path": "tests/AddonSignals.py",
"diff": "\"\"\"\nimport binascii\nimport json\n+import time\nxbmc = __import__('xbmc')\nxbmcaddon = __import__('xbmcaddon')\n@@ -14,6 +15,10 @@ xbmcaddon = __import__('xbmcaddon')\nRECEIVER = None\n+class WaitTimeoutError(Exception):\n+ pass\n+\n+\ndef _getReceiver():\nglobal RECEIVER # pylint: disable=global-statement\nif not RECEIVER:\n@@ -61,28 +66,34 @@ class SignalReceiver(xbmc.Monitor):\nclass CallHandler:\n- def __init__(self, signal, data, source_id, timeout=1000):\n+ def __init__(self, signal, data, source_id, timeout=1000, use_timeout_exception=False):\nself.signal = signal\nself.data = data\nself.timeout = timeout\nself.sourceID = source_id\nself._return = None\n+ self.is_callback_received = False\n+ self.use_timeout_exception = use_timeout_exception\nregisterSlot(self.sourceID, '_return.{0}'.format(self.signal), self.callback)\nsendSignal(signal, data, self.sourceID)\ndef callback(self, data):\nself._return = data\n+ self.is_callback_received = True\ndef waitForReturn(self):\n- waited = 0\n- while waited < self.timeout:\n- if self._return is not None:\n+ monitor = xbmc.Monitor()\n+ end_time = time.perf_counter() + (self.timeout / 1000)\n+ while not self.is_callback_received:\n+ if time.perf_counter() > end_time:\n+ if self.use_timeout_exception:\n+ unRegisterSlot(self.sourceID, self.signal)\n+ raise WaitTimeoutError\nbreak\n- xbmc.sleep(100)\n- waited += 100\n-\n+ if monitor.abortRequested():\n+ raise OSError\n+ xbmc.sleep(10)\nunRegisterSlot(self.sourceID, self.signal)\n-\nreturn self._return\n@@ -112,5 +123,5 @@ def returnCall(signal, data=None, source_id=None):\nsendSignal('_return.{0}'.format(signal), data, source_id)\n-def makeCall(signal, data=None, source_id=None, timeout_ms=1000):\n- return CallHandler(signal, data, source_id, timeout_ms).waitForReturn()\n+def makeCall(signal, data=None, source_id=None, timeout_ms=1000, use_timeout_exception=False):\n+ return CallHandler(signal, data, source_id, timeout_ms, use_timeout_exception).waitForReturn()\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Updated tests/AddonSignals |
106,046 | 26.03.2021 14:00:25 | -3,600 | 31d8ea82427ce679f731025731a2e362ae7f24f0 | Cleanup IPC methods and use pickle on AddonSignals return data | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/common/ipc.py",
"new_path": "resources/lib/common/ipc.py",
"diff": "SPDX-License-Identifier: MIT\nSee LICENSES/MIT.md for more information.\n\"\"\"\n-import json\nimport pickle\n+from base64 import b64encode, b64decode\nimport AddonSignals\n@@ -18,7 +18,6 @@ from resources.lib.utils.logging import LOG, measure_exec_time_decorator\nfrom .misc_utils import run_threaded\nIPC_TIMEOUT_SECS = 20\n-IPC_EXCEPTION_PLACEHOLDER = 'IPC_EXCEPTION_PLACEHOLDER'\n# IPC via HTTP endpoints\nIPC_ENDPOINT_CACHE = '/cache'\n@@ -92,14 +91,13 @@ def make_call(func_name, data=None, endpoint=IPC_ENDPOINT_NFSESSION):\nreturn make_addonsignals_call(func_name, data)\n-# pylint: disable=inconsistent-return-statements\ndef make_http_call(endpoint, func_name, data=None):\n\"\"\"\nMake an IPC call via HTTP and wait for it to return.\nThe contents of data will be expanded to kwargs and passed into the target function.\n\"\"\"\nfrom urllib.request import build_opener, install_opener, ProxyHandler, urlopen\n- from urllib.error import HTTPError, URLError\n+ from urllib.error import URLError\n# Note: Using 'localhost' as address slowdown the call (Windows OS is affected) not sure if it is an urllib issue\nurl = 'http://127.0.0.1:{}{}/{}'.format(G.LOCAL_DB.get_value('nf_server_service_port'), endpoint, func_name)\nLOG.debug('Handling HTTP IPC call to {}'.format(url))\n@@ -109,9 +107,14 @@ def make_http_call(endpoint, func_name, data=None):\ndata=pickle.dumps(data, protocol=pickle.HIGHEST_PROTOCOL),\ntimeout=IPC_TIMEOUT_SECS) as f:\nreceived_data = f.read()\n- return pickle.loads(received_data) if received_data else None\n- except HTTPError as exc:\n- _raise_exception(json.loads(exc.reason))\n+ if received_data:\n+ _data = pickle.loads(received_data)\n+ if isinstance(_data, Exception):\n+ raise _data\n+ return _data\n+ return None\n+ # except HTTPError as exc:\n+ # raise exc\nexcept URLError as exc:\nerr_msg = str(exc)\nif '10049' in err_msg:\n@@ -130,24 +133,16 @@ def make_addonsignals_call(callname, data):\nsource_id=G.ADDON_ID,\nsignal=callname,\ndata=data,\n- timeout_ms=IPC_TIMEOUT_SECS * 1000)\n- if isinstance(result, dict) and IPC_EXCEPTION_PLACEHOLDER in result:\n- _raise_exception(result)\n- if result is None:\n- raise Exception('Addon Signals call timeout')\n- return result\n-\n-\n-def _raise_exception(result):\n- \"\"\"Raises an exception by converting it from the json format (done by ipc_convert_exc_to_json)\"\"\"\n- result = result[IPC_EXCEPTION_PLACEHOLDER]\n- if result['class'] in exceptions.__dict__:\n- raise exceptions.__dict__[result['class']](result['message'])\n- raise Exception(result['class'] + '\\r\\nError details:\\r\\n' + result.get('message', '--'))\n+ timeout_ms=IPC_TIMEOUT_SECS * 1000,\n+ use_timeout_exception=True)\n+ _result = pickle.loads(b64decode(result))\n+ if isinstance(_result, Exception):\n+ raise _result\n+ return _result\nclass EnvelopeIPCReturnCall:\n- \"\"\"Makes a function callable through IPC and handles catching, conversion and forwarding of exceptions\"\"\"\n+ \"\"\"Makes a function callable through AddonSignals IPC, handles catching, conversion and forwarding of exceptions\"\"\"\n# Defines a type of in-memory reference to avoids define functions in the source code just to handle IPC return call\ndef __init__(self, func):\nself._func = func\n@@ -161,34 +156,9 @@ class EnvelopeIPCReturnCall:\nLOG.error('IPC callback raised exception: {exc}', exc=exc)\nimport traceback\nLOG.error(traceback.format_exc())\n- result = ipc_convert_exc_to_json(exc)\n- return _execute_addonsignals_return_call(result, self._func.__name__)\n-\n-\n-def ipc_convert_exc_to_json(exc=None, class_name=None, message=None):\n- \"\"\"\n- Convert an exception to a json data exception\n- :param exc: exception class\n-\n- or else, build a json data exception\n- :param class_name: custom class name\n- :param message: custom message\n- \"\"\"\n- return {IPC_EXCEPTION_PLACEHOLDER: {\n- 'class': class_name or exc.__class__.__name__,\n- 'message': message or str(exc),\n- }}\n-\n-\n-def _execute_addonsignals_return_call(result, func_name):\n- \"\"\"If enabled execute AddonSignals return callback\"\"\"\n- if G.IPC_OVER_HTTP:\n- return result\n- # Do not return None or AddonSignals will keep waiting till timeout\n- if result is None:\n- result = {}\n- AddonSignals.returnCall(signal=func_name, source_id=G.ADDON_ID, data=result)\n- return result\n+ result = exc\n+ _result = b64encode(pickle.dumps(result, pickle.HIGHEST_PROTOCOL)).decode('ascii')\n+ AddonSignals.returnCall(signal=self._func.__name__, source_id=G.ADDON_ID, data=_result)\ndef _call(func, data):\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/http_server.py",
"new_path": "resources/lib/services/http_server.py",
"diff": "SPDX-License-Identifier: MIT\nSee LICENSES/MIT.md for more information.\n\"\"\"\n-import json\nimport pickle\nfrom http.server import BaseHTTPRequestHandler\nfrom socketserver import TCPServer, ThreadingMixIn\nfrom urllib.parse import urlparse, parse_qs\n-from resources.lib import common\nfrom resources.lib.common import IPC_ENDPOINT_CACHE, IPC_ENDPOINT_NFSESSION, IPC_ENDPOINT_MSL\nfrom resources.lib.common.exceptions import InvalidPathError, CacheMiss, MetadataNotAvailable, SlotNotImplemented\nfrom resources.lib.globals import G\n@@ -88,37 +86,37 @@ def handle_msl_request(server, func_name, data, params=None):\ndef handle_request(server, handler, func_name, data):\n+ server.send_response(200)\n+ server.end_headers()\ntry:\ntry:\nfunc = handler.http_ipc_slots[func_name]\nexcept KeyError as exc:\nraise SlotNotImplemented('The specified IPC slot {} does not exist'.format(func_name)) from exc\nret_data = _call_func(func, pickle.loads(data))\n- server.send_response(200)\n- server.end_headers()\n- if ret_data:\n- server.wfile.write(pickle.dumps(ret_data, protocol=pickle.HIGHEST_PROTOCOL))\nexcept Exception as exc: # pylint: disable=broad-except\nif not isinstance(exc, (CacheMiss, MetadataNotAvailable)):\nLOG.error('IPC callback raised exception: {exc}', exc=exc)\nimport traceback\nLOG.error(traceback.format_exc())\n- server.send_error(500, json.dumps(common.ipc_convert_exc_to_json(exc)))\n+ ret_data = exc\n+ if ret_data:\n+ server.wfile.write(pickle.dumps(ret_data, protocol=pickle.HIGHEST_PROTOCOL))\ndef handle_cache_request(server, func_name, data):\n- try:\n- ret_data = _call_instance_func(G.CACHE_MANAGEMENT, func_name, pickle.loads(data))\nserver.send_response(200)\nserver.end_headers()\n- if ret_data:\n- server.wfile.write(ret_data)\n+ try:\n+ ret_data = _call_instance_func(G.CACHE_MANAGEMENT, func_name, pickle.loads(data))\nexcept Exception as exc: # pylint: disable=broad-except\nif not isinstance(exc, (CacheMiss, MetadataNotAvailable)):\nLOG.error('IPC callback raised exception: {exc}', exc=exc)\nimport traceback\nLOG.error(traceback.format_exc())\n- server.send_error(500, json.dumps(common.ipc_convert_exc_to_json(exc)))\n+ ret_data = pickle.dumps(exc, protocol=pickle.HIGHEST_PROTOCOL)\n+ if ret_data:\n+ server.wfile.write(ret_data)\ndef _call_instance_func(instance, func_name, data):\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Cleanup IPC methods and use pickle on AddonSignals return data |
106,046 | 26.03.2021 14:55:59 | -3,600 | af7f01c6f44235d48ddc82d29246fd1a8723183b | Enabled by default IPC over HTTP | [
{
"change_type": "MODIFY",
"old_path": "resources/settings.xml",
"new_path": "resources/settings.xml",
"diff": "</setting>\n<setting id=\"enable_ipc_over_http\" type=\"boolean\" label=\"30139\" help=\"\">\n<level>0</level>\n- <default>false</default>\n+ <default>true</default>\n<control type=\"toggle\"/>\n</setting>\n<setting id=\"page_results\" type=\"integer\" label=\"30247\" help=\"\">\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Enabled by default IPC over HTTP |
106,046 | 28.03.2021 18:19:31 | -7,200 | 9da53cf6d8e29e94781dff71b52dd321b5faa953 | Add missing IPC over AddonSignals to cache interface | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/common/cache.py",
"new_path": "resources/lib/common/cache.py",
"diff": "SPDX-License-Identifier: MIT\nSee LICENSES/MIT.md for more information.\n\"\"\"\n-from resources.lib.common import make_http_call, IPC_ENDPOINT_CACHE\n+from resources.lib.common import make_call, IPC_ENDPOINT_CACHE\nclass Cache:\n@@ -17,12 +17,9 @@ class Cache:\n\"\"\"Get a item from cache bucket\"\"\"\ncall_args = {\n'bucket': bucket,\n- 'identifier': identifier,\n- 'deserialize_data': False\n+ 'identifier': identifier\n}\n- # Todo: currently AddonSignals does not support serialization of objects\n- # return make_call('get', call_args, IPC_ENDPOINT_CACHE)\n- return make_http_call(IPC_ENDPOINT_CACHE, 'get', call_args)\n+ return make_call('get', call_args, IPC_ENDPOINT_CACHE)\ndef add(self, bucket, identifier, data, ttl=None, expires=None, delayed_db_op=False):\n\"\"\"\n@@ -45,8 +42,7 @@ class Cache:\n'expires': expires,\n'delayed_db_op': delayed_db_op\n}\n- # make_call('add', call_args, IPC_ENDPOINT_CACHE)\n- make_http_call(IPC_ENDPOINT_CACHE, 'add', call_args)\n+ make_call('add', call_args, IPC_ENDPOINT_CACHE)\ndef delete(self, bucket, identifier, including_suffixes=False):\n\"\"\"\n@@ -59,8 +55,7 @@ class Cache:\n'identifier': identifier,\n'including_suffixes': including_suffixes\n}\n- # make_call('delete', call_args, IPC_ENDPOINT_CACHE)\n- make_http_call(IPC_ENDPOINT_CACHE, 'delete', call_args)\n+ make_call('delete', call_args, IPC_ENDPOINT_CACHE)\ndef clear(self, buckets=None, clear_database=True):\n\"\"\"\n@@ -73,5 +68,4 @@ class Cache:\n'buckets': buckets,\n'clear_database': clear_database\n}\n- # make_call('clear', call_args, IPC_ENDPOINT_CACHE)\n- make_http_call(IPC_ENDPOINT_CACHE, 'clear', call_args)\n+ make_call('clear', call_args, IPC_ENDPOINT_CACHE)\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/cache_management.py",
"new_path": "resources/lib/services/cache_management.py",
"diff": "@@ -13,6 +13,7 @@ from datetime import datetime, timedelta\nfrom functools import wraps\nfrom time import time\n+from resources.lib import common\nfrom resources.lib.common import cache_utils\nfrom resources.lib.common.exceptions import (UnknownCacheBucketError, CacheMiss, DBSQLiteConnectionError,\nDBSQLiteError, DBProfilesMissing)\n@@ -70,18 +71,17 @@ class CacheManagement:\nself.ttl_values = {}\nself.load_ttl_values()\nself.pending_db_ops_add = []\n- # Todo: currently AddonSignals does not support serialization of objects\n- # # Slot allocation for IPC\n- # slots = [\n- # self.get,\n- # self.add,\n- # self.delete,\n- # self.clear\n- # ]\n- # for slot in slots:\n- # # For AddonSignals IPC\n- # enveloped_func = common.EnvelopeIPCReturnCall(slot).call\n- # common.register_slot(enveloped_func, slot.__name__)\n+ # Slot allocation for IPC\n+ slots = [\n+ self.get,\n+ self.add,\n+ self.delete,\n+ self.clear\n+ ]\n+ for slot in slots:\n+ # For AddonSignals IPC\n+ enveloped_func = common.EnvelopeIPCReturnCall(slot).call\n+ common.register_slot(enveloped_func, slot.__name__)\ndef load_ttl_values(self):\n\"\"\"Load the ttl values from add-on settings\"\"\"\n@@ -151,12 +151,11 @@ class CacheManagement:\nself.memory_cache[bucket_name] = {}\nreturn self.memory_cache[bucket_name]\n- def get(self, bucket, identifier, deserialize_data=True):\n+ def get(self, bucket, identifier):\n\"\"\"\nGet a item from cache bucket\n:param bucket: bucket where read the data\n:param identifier: key identifier of the data\n- :param deserialize_data: Must be False ONLY when this method is called by IPC (common/cache.py)\n:return: the data\n:raise CacheMiss: if cache entry does not exist\n\"\"\"\n@@ -166,12 +165,10 @@ class CacheManagement:\nif cache_entry['expires'] < int(time()):\n# Cache expired\nraise CacheMiss()\n- return cache_utils.deserialize_data(cache_entry['data']) if deserialize_data else cache_entry['data']\n+ return cache_utils.deserialize_data(cache_entry['data'])\nexcept KeyError as exc:\nif bucket['is_persistent']:\n- if deserialize_data:\nreturn cache_utils.deserialize_data(self._get_db(bucket['name'], identifier))\n- return self._get_db(bucket['name'], identifier)\nraise CacheMiss from exc\nexcept DBProfilesMissing as exc:\n# Raised by _add_prefix there is no active profile guid when add-on is installed from scratch\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/http_server.py",
"new_path": "resources/lib/services/http_server.py",
"diff": "@@ -114,9 +114,9 @@ def handle_cache_request(server, func_name, data):\nLOG.error('IPC callback raised exception: {exc}', exc=exc)\nimport traceback\nLOG.error(traceback.format_exc())\n- ret_data = pickle.dumps(exc, protocol=pickle.HIGHEST_PROTOCOL)\n+ ret_data = exc\nif ret_data:\n- server.wfile.write(ret_data)\n+ server.wfile.write(pickle.dumps(ret_data, protocol=pickle.HIGHEST_PROTOCOL))\ndef _call_instance_func(instance, func_name, data):\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Add missing IPC over AddonSignals to cache interface |
106,046 | 29.03.2021 09:35:55 | -7,200 | c098c8e82763a20b101885bdccc64a62874f9aea | Moved get_event_data to am_video_events | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/navigation/player.py",
"new_path": "resources/lib/navigation/player.py",
"diff": "@@ -17,7 +17,6 @@ import resources.lib.kodi.infolabels as infolabels\nimport resources.lib.kodi.ui as ui\nimport resources.lib.utils.api_requests as api\nfrom resources.lib.globals import G\n-from resources.lib.utils.api_paths import EVENT_PATHS\nfrom resources.lib.common.exceptions import MetadataNotAvailable, InputStreamHelperError\nfrom resources.lib.utils.logging import LOG, measure_exec_time_decorator\n@@ -61,8 +60,7 @@ def _play(videoid, is_played_from_strm=False):\n' [external call]' if G.IS_ADDON_EXTERNAL_CALL else '')\n# Profile switch when playing from a STRM file (library)\n- if is_played_from_strm:\n- if not _profile_switch():\n+ if is_played_from_strm and not _profile_switch():\nxbmcplugin.endOfDirectory(G.PLUGIN_HANDLE, succeeded=False)\nreturn\n@@ -92,7 +90,6 @@ def _play(videoid, is_played_from_strm=False):\nreturn\ninfo_data = None\n- event_data = {}\nvideoid_next_episode = None\n# Get Infolabels and Arts for the videoid to be played, and for the next video if it is an episode (for UpNext)\n@@ -107,14 +104,6 @@ def _play(videoid, is_played_from_strm=False):\nlist_item.setInfo('video', info)\nlist_item.setArt(arts)\n- # Get event data for videoid to be played (needed for sync of watched status with Netflix)\n- if (G.ADDON.getSettingBool('ProgressManager_enabled')\n- and videoid.mediatype in [common.VideoId.MOVIE, common.VideoId.EPISODE]):\n- if not is_played_from_strm or is_played_from_strm and G.ADDON.getSettingBool('sync_watched_status_library'):\n- event_data = _get_event_data(videoid)\n- event_data['videoid'] = videoid.to_dict()\n- event_data['is_played_by_library'] = is_played_from_strm\n-\n# Start and initialize the action controller (see action_controller.py)\nLOG.debug('Sending initialization signal')\n# Do not use send_signal as threaded slow devices are not powerful to send in faster way and arrive late to service\n@@ -124,8 +113,7 @@ def _play(videoid, is_played_from_strm=False):\n'metadata': metadata,\n'info_data': info_data,\n'is_played_from_strm': is_played_from_strm,\n- 'resume_position': resume_position,\n- 'event_data': event_data})\n+ 'resume_position': resume_position})\nxbmcplugin.setResolvedUrl(handle=G.PLUGIN_HANDLE, succeeded=True, listitem=list_item)\n@@ -220,39 +208,6 @@ def _strm_resume_workaroud(is_played_from_strm, videoid):\nreturn resume_position\n-def _get_event_data(videoid):\n- \"\"\"Get data needed to send event requests to Netflix and for resume from last position\"\"\"\n- is_episode = videoid.mediatype == common.VideoId.EPISODE\n- req_videoids = [videoid]\n- if is_episode:\n- # Get also the tvshow data\n- req_videoids.append(videoid.derive_parent(common.VideoId.SHOW))\n-\n- raw_data = api.get_video_raw_data(req_videoids, EVENT_PATHS)\n- if not raw_data:\n- return {}\n- LOG.debug('Event data: {}', raw_data)\n- videoid_data = raw_data['videos'][videoid.value]\n-\n- if is_episode:\n- # Get inQueue from tvshow data\n- is_in_mylist = raw_data['videos'][str(req_videoids[1].value)]['queue'].get('inQueue', False)\n- else:\n- is_in_mylist = videoid_data['queue'].get('inQueue', False)\n-\n- event_data = {'resume_position':\n- videoid_data['bookmarkPosition'] if videoid_data['bookmarkPosition'] > -1 else None,\n- 'runtime': videoid_data['runtime'],\n- 'request_id': videoid_data['requestId'],\n- 'watched': videoid_data['watched'],\n- 'is_in_mylist': is_in_mylist}\n- if videoid.mediatype == common.VideoId.EPISODE:\n- event_data['track_id'] = videoid_data['trackIds']['trackId_jawEpisode']\n- else:\n- event_data['track_id'] = videoid_data['trackIds']['trackId_jaw']\n- return event_data\n-\n-\ndef _upnext_get_next_episode_videoid(videoid, metadata):\n\"\"\"Determine the next episode and get the videoid\"\"\"\ntry:\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/playback/action_controller.py",
"new_path": "resources/lib/services/playback/action_controller.py",
"diff": "@@ -74,7 +74,7 @@ class ActionController(xbmc.Monitor):\nAMPlayback(),\nAMSectionSkipper(),\nAMStreamContinuity(),\n- AMVideoEvents(self.msl_handler, self.directory_builder),\n+ AMVideoEvents(self.nfsession, self.msl_handler, self.directory_builder),\nAMUpNextNotifier()\n]\nself.init_count += 1\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/playback/am_video_events.py",
"new_path": "resources/lib/services/playback/am_video_events.py",
"diff": "\"\"\"\nfrom typing import TYPE_CHECKING\n+from resources.lib import common\nfrom resources.lib.common.cache_utils import CACHE_BOOKMARKS, CACHE_COMMON\nfrom resources.lib.common.exceptions import InvalidVideoListTypeError\nfrom resources.lib.globals import G\nfrom resources.lib.services.nfsession.msl.msl_utils import EVENT_ENGAGE, EVENT_START, EVENT_STOP, EVENT_KEEP_ALIVE\n+from resources.lib.utils.api_paths import build_paths, EVENT_PATHS\nfrom resources.lib.utils.logging import LOG\nfrom .action_manager import ActionManager\nif TYPE_CHECKING: # This variable/imports are used only by the editor, so not at runtime\n+ from resources.lib.services.nfsession.nfsession_ops import NFSessionOperations\nfrom resources.lib.services.nfsession.directorybuilder.dir_builder import DirectoryBuilder\nfrom resources.lib.services.nfsession.msl.msl_handler import MSLHandler\n@@ -26,8 +29,9 @@ class AMVideoEvents(ActionManager):\nSETTING_ID = 'ProgressManager_enabled'\n- def __init__(self, msl_handler: 'MSLHandler', directory_builder: 'DirectoryBuilder'):\n+ def __init__(self, nfsession: 'NFSessionOperations' , msl_handler: 'MSLHandler', directory_builder: 'DirectoryBuilder'):\nsuper().__init__()\n+ self.nfsession = nfsession\nself.msl_handler = msl_handler\nself.directory_builder = directory_builder\nself.event_data = {}\n@@ -42,11 +46,17 @@ class AMVideoEvents(ActionManager):\nreturn 'enabled={}'.format(self.enabled)\ndef initialize(self, data):\n- if not data['event_data']:\n- LOG.warn('AMVideoEvents: disabled due to no event data')\n+ if not data['videoid'].mediatype in [common.VideoId.MOVIE, common.VideoId.EPISODE]:\n+ LOG.warn('AMVideoEvents: disabled due to no not supported videoid mediatype')\nself.enabled = False\nreturn\n- self.event_data = data['event_data']\n+ if (not data['is_played_from_strm'] or\n+ (data['is_played_from_strm'] and G.ADDON.getSettingBool('sync_watched_status_library'))):\n+ self.event_data = self._get_event_data(data['videoid'])\n+ self.event_data['videoid'] = data['videoid'].to_dict()\n+ self.event_data['is_played_by_library'] = data['is_played_from_strm']\n+ else:\n+ self.enabled = False\ndef on_playback_started(self, player_state):\n# Clear continue watching list data on the cache, to force loading of new data\n@@ -147,3 +157,41 @@ class AMVideoEvents(ActionManager):\nself.msl_handler.events_handler_thread.add_event_to_queue(event_type,\nevent_data,\nplayer_state)\n+\n+ def _get_event_data(self, videoid):\n+ \"\"\"Get data needed to send event requests to Netflix\"\"\"\n+ is_episode = videoid.mediatype == common.VideoId.EPISODE\n+ req_videoids = [videoid]\n+ if is_episode:\n+ # Get also the tvshow data\n+ req_videoids.append(videoid.derive_parent(common.VideoId.SHOW))\n+\n+ raw_data = self._get_video_raw_data(req_videoids)\n+ if not raw_data:\n+ return {}\n+ LOG.debug('Event data: {}', raw_data)\n+ videoid_data = raw_data['videos'][videoid.value]\n+\n+ if is_episode:\n+ # Get inQueue from tvshow data\n+ is_in_mylist = raw_data['videos'][str(req_videoids[1].value)]['queue'].get('inQueue', False)\n+ else:\n+ is_in_mylist = videoid_data['queue'].get('inQueue', False)\n+\n+ event_data = {'resume_position':\n+ videoid_data['bookmarkPosition'] if videoid_data['bookmarkPosition'] > -1 else None,\n+ 'runtime': videoid_data['runtime'],\n+ 'request_id': videoid_data['requestId'],\n+ 'watched': videoid_data['watched'],\n+ 'is_in_mylist': is_in_mylist}\n+ if videoid.mediatype == common.VideoId.EPISODE:\n+ event_data['track_id'] = videoid_data['trackIds']['trackId_jawEpisode']\n+ else:\n+ event_data['track_id'] = videoid_data['trackIds']['trackId_jaw']\n+ return event_data\n+\n+ def _get_video_raw_data(self, videoids):\n+ \"\"\"Retrieve raw data for specified video id's\"\"\"\n+ video_ids = [int(videoid.value) for videoid in videoids]\n+ LOG.debug('Requesting video raw data for {}', video_ids)\n+ return self.nfsession.path_request(build_paths(['videos', video_ids], EVENT_PATHS))\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Moved get_event_data to am_video_events |
106,046 | 29.03.2021 15:59:53 | -7,200 | 8410900f8bb8adbefedcdf2756343a061d6567f4 | Removed support of the deprecated Parental control PIN
plus related code cleaning | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/kodi/infolabels.py",
"new_path": "resources/lib/kodi/infolabels.py",
"diff": "import copy\nimport resources.lib.utils.api_paths as paths\n-import resources.lib.utils.api_requests as api\nimport resources.lib.common as common\nfrom resources.lib.common.exceptions import CacheMiss, ItemNotFound\nfrom resources.lib.common.cache_utils import CACHE_BOOKMARKS, CACHE_INFOLABELS, CACHE_ARTINFO\n@@ -71,7 +70,7 @@ def add_info_list_item(list_item: ListItemW, videoid, item, raw_data, is_in_myli\nlist_item.setLabel(_colorize_text(common_data['mylist_titles_color'], list_item.getLabel()))\ninfos_copy['title'] = list_item.getLabel()\nlist_item.setInfo('video', infos_copy)\n- list_item.setArt(get_art(videoid, art_item or item, common_data['profile_language_code'],\n+ list_item.setArt(get_art(videoid, art_item or item or {}, common_data['profile_language_code'],\ndelayed_db_op=True))\n@@ -103,13 +102,7 @@ def _add_supplemental_plot_info(infos_copy, item, common_data):\ndef get_art(videoid, item, profile_language_code='', delayed_db_op=False):\n- \"\"\"Get art infolabels\"\"\"\n- return _get_art(videoid, item or {}, profile_language_code,\n- delayed_db_op=delayed_db_op)\n-\n-\n-def _get_art(videoid, item, profile_language_code, delayed_db_op=False):\n- # If item is None this method raise TypeError\n+ \"\"\"Get art infolabels - NOTE: If 'item' arg is None this method can raise TypeError when there is not cache\"\"\"\ncache_identifier = videoid.value + '_' + profile_language_code\ntry:\nart = G.CACHE.get(CACHE_ARTINFO, cache_identifier)\n@@ -251,31 +244,6 @@ def _best_art(arts):\nreturn next((art for art in arts if art), '')\n-def get_info_from_netflix(videoids):\n- \"\"\"Get infolabels and arts from cache (if exist) or Netflix API, for multiple videoid\"\"\"\n- profile_language_code = G.LOCAL_DB.get_profile_config('language', '')\n- videoids_to_request = []\n- info_data = {}\n- for videoid in videoids:\n- try:\n- infos = get_info(videoid, None, None, profile_language_code)[0]\n- art = _get_art(videoid, None, profile_language_code)\n- info_data[videoid.value] = infos, art\n- LOG.debug('Got infolabels and art from cache for videoid {}', videoid)\n- except (AttributeError, TypeError):\n- videoids_to_request.append(videoid)\n-\n- if videoids_to_request:\n- # Retrieve missing data from API\n- LOG.debug('Retrieving infolabels and art from API for {} videoids', len(videoids_to_request))\n- raw_data = api.get_video_raw_data(videoids_to_request)\n- for videoid in videoids_to_request:\n- infos = get_info(videoid, raw_data['videos'][videoid.value], raw_data, profile_language_code)[0]\n- art = get_art(videoid, raw_data['videos'][videoid.value], profile_language_code)\n- info_data[videoid.value] = infos, art\n- return info_data\n-\n-\ndef get_info_from_library(videoid):\n\"\"\"Get infolabels with info from Kodi library\"\"\"\ndetails = common.get_library_item_by_videoid(videoid)\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/navigation/player.py",
"new_path": "resources/lib/navigation/player.py",
"diff": "SPDX-License-Identifier: MIT\nSee LICENSES/MIT.md for more information.\n\"\"\"\n-import json\n-\nimport xbmcgui\nimport xbmcplugin\nimport resources.lib.common as common\nimport resources.lib.kodi.infolabels as infolabels\nimport resources.lib.kodi.ui as ui\n-import resources.lib.utils.api_requests as api\nfrom resources.lib.globals import G\n-from resources.lib.common.exceptions import MetadataNotAvailable, InputStreamHelperError\n+from resources.lib.common.exceptions import InputStreamHelperError\nfrom resources.lib.utils.logging import LOG, measure_exec_time_decorator\nMANIFEST_PATH_FORMAT = common.IPC_ENDPOINT_MSL + '/get_manifest?videoid={}'\n@@ -64,22 +61,6 @@ def _play(videoid, is_played_from_strm=False):\nxbmcplugin.endOfDirectory(G.PLUGIN_HANDLE, succeeded=False)\nreturn\n- # Get metadata of videoid\n- try:\n- metadata = api.get_metadata(videoid)\n- LOG.debug('Metadata is {}', json.dumps(metadata))\n- except MetadataNotAvailable:\n- LOG.warn('Metadata not available for {}', videoid)\n- metadata = [{}, {}]\n-\n- # Check parental control PIN\n- pin_result = _verify_pin(metadata[0].get('requiresPin', False))\n- if not pin_result:\n- if pin_result is not None:\n- ui.show_notification(common.get_local_string(30106), time=8000)\n- xbmcplugin.endOfDirectory(G.PLUGIN_HANDLE, succeeded=False)\n- return\n-\n# Generate the xbmcgui.ListItem to be played\nlist_item = get_inputstream_listitem(videoid)\n@@ -89,18 +70,9 @@ def _play(videoid, is_played_from_strm=False):\nxbmcplugin.setResolvedUrl(handle=G.PLUGIN_HANDLE, succeeded=False, listitem=list_item)\nreturn\n- info_data = None\n- videoid_next_episode = None\n-\n- # Get Infolabels and Arts for the videoid to be played, and for the next video if it is an episode (for UpNext)\n+ # When a video is played from Kodi library or Up Next add-on is needed set infoLabels and art info to list_item\nif is_played_from_strm or is_upnext_enabled or G.IS_ADDON_EXTERNAL_CALL:\n- if is_upnext_enabled and videoid.mediatype == common.VideoId.EPISODE:\n- # When UpNext is enabled, get the next episode to play\n- videoid_next_episode = _upnext_get_next_episode_videoid(videoid, metadata)\n- info_data = infolabels.get_info_from_netflix(\n- [videoid, videoid_next_episode] if videoid_next_episode else [videoid])\n- info, arts = info_data[videoid.value]\n- # When a item is played from Kodi library or Up Next add-on is needed set info and art to list_item\n+ info, arts = common.make_call('get_videoid_info', {'videoid': videoid.to_path()})\nlist_item.setInfo('video', info)\nlist_item.setArt(arts)\n@@ -109,9 +81,6 @@ def _play(videoid, is_played_from_strm=False):\n# Do not use send_signal as threaded slow devices are not powerful to send in faster way and arrive late to service\ncommon.send_signal(common.Signals.PLAYBACK_INITIATED, {\n'videoid': videoid.to_dict(),\n- 'videoid_next_episode': videoid_next_episode.to_dict() if videoid_next_episode else None,\n- 'metadata': metadata,\n- 'info_data': info_data,\n'is_played_from_strm': is_played_from_strm,\n'resume_position': resume_position})\nxbmcplugin.setResolvedUrl(handle=G.PLUGIN_HANDLE, succeeded=True, listitem=list_item)\n@@ -129,33 +98,32 @@ def get_inputstream_listitem(videoid):\nimport inputstreamhelper\nis_helper = inputstreamhelper.Helper('mpd', drm='widevine')\ninputstream_ready = is_helper.check_inputstream()\n+ except Exception as exc: # pylint: disable=broad-except\n+ # Captures all types of ISH internal errors\n+ import traceback\n+ LOG.error(traceback.format_exc())\n+ raise InputStreamHelperError(str(exc)) from exc\nif not inputstream_ready:\nraise Exception(common.get_local_string(30046))\n-\nlist_item.setProperty(\n- key=is_helper.inputstream_addon + '.stream_headers',\n+ key='inputstream.adaptive.stream_headers',\nvalue='user-agent=' + common.get_user_agent())\nlist_item.setProperty(\n- key=is_helper.inputstream_addon + '.license_type',\n+ key='inputstream.adaptive.license_type',\nvalue='com.widevine.alpha')\nlist_item.setProperty(\n- key=is_helper.inputstream_addon + '.manifest_type',\n+ key='inputstream.adaptive.manifest_type',\nvalue='mpd')\nlist_item.setProperty(\n- key=is_helper.inputstream_addon + '.license_key',\n+ key='inputstream.adaptive.license_key',\nvalue=service_url + LICENSE_PATH_FORMAT.format(videoid.value) + '||b{SSM}!b{SID}|')\nlist_item.setProperty(\n- key=is_helper.inputstream_addon + '.server_certificate',\n+ key='inputstream.adaptive.server_certificate',\nvalue=INPUTSTREAM_SERVER_CERTIFICATE)\nlist_item.setProperty(\nkey='inputstream',\n- value=is_helper.inputstream_addon)\n+ value='inputstream.adaptive')\nreturn list_item\n- except Exception as exc: # pylint: disable=broad-except\n- # Captures all types of ISH internal errors\n- import traceback\n- LOG.error(traceback.format_exc())\n- raise InputStreamHelperError(str(exc)) from exc\ndef _profile_switch():\n@@ -181,13 +149,6 @@ def _profile_switch():\nreturn True\n-def _verify_pin(pin_required):\n- if not pin_required:\n- return True\n- pin = ui.show_dlg_input_numeric(common.get_local_string(30002))\n- return None if not pin else api.verify_pin(pin)\n-\n-\ndef _strm_resume_workaroud(is_played_from_strm, videoid):\n\"\"\"Workaround for resuming STRM files from library\"\"\"\nif not is_played_from_strm or not G.ADDON.getSettingBool('ResumeManager_enabled'):\n@@ -206,34 +167,3 @@ def _strm_resume_workaroud(is_played_from_strm, videoid):\nif index_selected == 1:\nresume_position = None\nreturn resume_position\n-\n-\n-def _upnext_get_next_episode_videoid(videoid, metadata):\n- \"\"\"Determine the next episode and get the videoid\"\"\"\n- try:\n- videoid_next_episode = _find_next_episode(videoid, metadata)\n- LOG.debug('Next episode is {}', videoid_next_episode)\n- return videoid_next_episode\n- except (TypeError, KeyError):\n- # import traceback\n- # LOG.debug(traceback.format_exc())\n- LOG.debug('There is no next episode, not setting up Up Next')\n- return None\n-\n-\n-def _find_next_episode(videoid, metadata):\n- try:\n- # Find next episode in current season\n- episode = common.find(metadata[0]['seq'] + 1, 'seq',\n- metadata[1]['episodes'])\n- return common.VideoId(tvshowid=videoid.tvshowid,\n- seasonid=videoid.seasonid,\n- episodeid=episode['id'])\n- except (IndexError, KeyError):\n- # Find first episode of next season\n- next_season = common.find(metadata[1]['seq'] + 1, 'seq',\n- metadata[2]['seasons'])\n- episode = common.find(1, 'seq', next_season['episodes'])\n- return common.VideoId(tvshowid=videoid.tvshowid,\n- seasonid=next_season['id'],\n- episodeid=episode['id'])\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/nfsession/nfsession_ops.py",
"new_path": "resources/lib/services/nfsession/nfsession_ops.py",
"diff": "@@ -22,6 +22,7 @@ from resources.lib.globals import G\nfrom resources.lib.kodi import ui\nfrom resources.lib.services.nfsession.session.path_requests import SessionPathRequests\nfrom resources.lib.utils import cookies\n+from resources.lib.utils.api_paths import EPISODES_PARTIAL_PATHS, ART_PARTIAL_PATHS, build_paths\nfrom resources.lib.utils.logging import LOG, measure_exec_time_decorator\n@@ -46,7 +47,8 @@ class NFSessionOperations(SessionPathRequests):\nself.parental_control_data,\nself.get_metadata,\nself.update_loco_context,\n- self.update_videoid_bookmark\n+ self.update_videoid_bookmark,\n+ self.get_videoid_info\n]\n# Share the activate profile function to SessionBase class\nself.external_func_activate_profile = self.activate_profile\n@@ -276,3 +278,21 @@ class NFSessionOperations(SessionPathRequests):\nui.show_notification(title=common.get_local_string(30105),\nmsg='An error prevented the update the status watched on Netflix',\ntime=10000)\n+\n+ def get_videoid_info(self, videoid):\n+ \"\"\"Get infolabels and arts from cache (if exist) otherwise will be requested\"\"\"\n+ if isinstance(videoid, list): # IPC call send the videoid as \"path\" list\n+ videoid = common.VideoId.from_path(videoid)\n+ from resources.lib.kodi.infolabels import get_info, get_art\n+ profile_language_code = G.LOCAL_DB.get_profile_config('language', '')\n+ try:\n+ infos = get_info(videoid, None, None, profile_language_code)[0]\n+ art = get_art(videoid, None, profile_language_code)\n+ except (AttributeError, TypeError):\n+ paths = build_paths(['videos', int(videoid.value)], EPISODES_PARTIAL_PATHS)\n+ if videoid.mediatype == common.VideoId.EPISODE:\n+ paths.extend(build_paths(['videos', int(videoid.tvshowid)], ART_PARTIAL_PATHS + [['title']]))\n+ raw_data = self.path_request(paths)\n+ infos = get_info(videoid, raw_data['videos'][videoid.value], raw_data, profile_language_code)[0]\n+ art = get_art(videoid, raw_data['videos'][videoid.value], profile_language_code)\n+ return infos, art\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/nfsession/session/endpoints.py",
"new_path": "resources/lib/services/nfsession/session/endpoints.py",
"diff": "@@ -117,18 +117,6 @@ ENDPOINTS = {\n'use_default_params': False,\n'add_auth_url': None,\n'accept': '*/*'},\n- 'pin_reset':\n- {'address': '/pin/reset',\n- 'is_api_call': True,\n- 'use_default_params': False,\n- 'add_auth_url': None},\n- 'pin_service':\n- {'address': '/pin/service',\n- 'is_api_call': True,\n- 'use_default_params': False,\n- 'add_auth_url': 'to_data',\n- 'content_type': 'application/json',\n- 'accept': 'application/json, text/javascript, */*'},\n'metadata':\n{'address': '/metadata',\n'is_api_call': True,\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/playback/action_controller.py",
"new_path": "resources/lib/services/playback/action_controller.py",
"diff": "@@ -59,8 +59,7 @@ class ActionController(xbmc.Monitor):\nvideoid = common.VideoId.from_dict(data['videoid'])\ndata['videoid'] = videoid\ndata['videoid_parent'] = videoid.derive_parent(common.VideoId.SHOW)\n- if data['videoid_next_episode']:\n- data['videoid_next_episode'] = common.VideoId.from_dict(data['videoid_next_episode'])\n+ data['metadata'] = self.nfsession.get_metadata(videoid)\nself._init_data = data\nself.active_player_id = None\nself.is_tracking_enabled = True\n@@ -75,7 +74,7 @@ class ActionController(xbmc.Monitor):\nAMSectionSkipper(),\nAMStreamContinuity(),\nAMVideoEvents(self.nfsession, self.msl_handler, self.directory_builder),\n- AMUpNextNotifier()\n+ AMUpNextNotifier(self.nfsession)\n]\nself.init_count += 1\nself._notify_all(ActionManager.call_initialize, self._init_data)\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/playback/action_manager.py",
"new_path": "resources/lib/services/playback/action_manager.py",
"diff": "@@ -23,7 +23,6 @@ class ActionManager:\nself.videoid = None\nself.videoid_parent = None\n\"\"\"If the 'videoid' variable is an episode, you get the parent videoid as tvshow or else return same videoid\"\"\"\n- self.videoid_next_episode = None\n@property\ndef name(self):\n@@ -52,7 +51,6 @@ class ActionManager:\n\"\"\"\nself.videoid = data['videoid']\nself.videoid_parent = data['videoid_parent']\n- self.videoid_next_episode = data['videoid_next_episode']\nself._call_if_enabled(self.initialize, data=data)\nLOG.debug('Initialized {}: {}', self.name, self)\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/playback/am_upnext_notifier.py",
"new_path": "resources/lib/services/playback/am_upnext_notifier.py",
"diff": "SPDX-License-Identifier: MIT\nSee LICENSES/MIT.md for more information.\n\"\"\"\n+from typing import TYPE_CHECKING\n+\nimport xbmc\nimport xbmcvfs\n@@ -16,6 +18,9 @@ from resources.lib.globals import G\nfrom resources.lib.utils.logging import LOG\nfrom .action_manager import ActionManager\n+if TYPE_CHECKING: # This variable/imports are used only by the editor, so not at runtime\n+ from resources.lib.services.nfsession.nfsession_ops import NFSessionOperations\n+\nclass AMUpNextNotifier(ActionManager):\n\"\"\"\n@@ -25,27 +30,32 @@ class AMUpNextNotifier(ActionManager):\nSETTING_ID = 'UpNextNotifier_enabled'\n- def __init__(self):\n+ def __init__(self, nfsession: 'NFSessionOperations'):\nsuper().__init__()\n+ self.nfsession = nfsession\nself.upnext_info = None\ndef __str__(self):\nreturn 'enabled={}'.format(self.enabled)\ndef initialize(self, data):\n- if (not self.videoid_next_episode or\n- not data['info_data'] or\n- not xbmc.getCondVisibility('System.AddonIsEnabled(service.upnext)')):\n+ if not xbmc.getCondVisibility('System.AddonIsEnabled(service.upnext)'):\n+ return\n+ videoid_next_ep = _upnext_get_next_episode_videoid(data['videoid'], data['metadata'])\n+ if not videoid_next_ep:\nreturn\n+ info_next_ep = self.nfsession.get_videoid_info(videoid_next_ep)\ntry:\n- self.upnext_info = self._get_upnext_info(data['info_data'], data['metadata'], data['is_played_from_strm'])\n+ self.upnext_info = self._get_upnext_info(videoid_next_ep,\n+ info_next_ep,\n+ data['metadata'],\n+ data['is_played_from_strm'])\nexcept DBRecordNotExistError:\n# The videoid record of the STRM episode is missing in add-on database when:\n# - The metadata have a new episode, but the STRM is not exported yet\n# - User try to play STRM files copied from another/previous add-on installation (without import them)\n# - User try to play STRM files from a shared path (like SMB) of another device (without use shared db)\nLOG.warn('Up Next add-on signal skipped, the videoid for the next episode does not exist in the database')\n- self.upnext_info = None\ndef on_playback_started(self, player_state): # pylint: disable=unused-argument\nif self.upnext_info:\n@@ -55,33 +65,37 @@ class AMUpNextNotifier(ActionManager):\ndef on_tick(self, player_state):\npass\n- def _get_upnext_info(self, info_data, metadata, is_played_from_strm):\n+ def _get_upnext_info(self, videoid_next_ep, info_next_ep, metadata, is_played_from_strm):\n\"\"\"Get the data to send to Up Next add-on\"\"\"\nupnext_info = {\n- 'current_episode': _upnext_info(self.videoid, *info_data[self.videoid.value]),\n- 'next_episode': _upnext_info(self.videoid_next_episode, *info_data[self.videoid_next_episode.value])\n+ 'current_episode': _upnext_curr_ep_info(self.videoid),\n+ 'next_episode': _upnext_next_ep_info(videoid_next_ep, *info_next_ep)\n}\n-\nif is_played_from_strm:\n# The current video played is a STRM, then generate the path of next STRM file\nfile_path = G.SHARED_DB.get_episode_filepath(\n- self.videoid_next_episode.tvshowid,\n- self.videoid_next_episode.seasonid,\n- self.videoid_next_episode.episodeid)\n+ videoid_next_ep.tvshowid, videoid_next_ep.seasonid, videoid_next_ep.episodeid)\nurl = xbmcvfs.translatePath(file_path)\nelse:\n- url = common.build_url(videoid=self.videoid_next_episode,\n+ url = common.build_url(videoid=videoid_next_ep,\nmode=G.MODE_PLAY,\nparams={'profile_guid': G.LOCAL_DB.get_active_profile_guid()})\nupnext_info['play_url'] = url\n-\nif 'creditsOffset' in metadata[0]:\nupnext_info['notification_offset'] = metadata[0]['creditsOffset']\nreturn upnext_info\n-def _upnext_info(videoid, infos, art):\n- \"\"\"Create a data dict for Up Next signal\"\"\"\n+def _upnext_curr_ep_info(videoid):\n+ \"\"\"Create the Up Next data for the current episode\"\"\"\n+ return {\n+ 'episodeid': videoid.episodeid,\n+ 'tvshowid': videoid.tvshowid,\n+ }\n+\n+\n+def _upnext_next_ep_info(videoid, infos, art):\n+ \"\"\"Create the Up Next data for the next episode\"\"\"\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@@ -105,3 +119,34 @@ def _upnext_info(videoid, infos, art):\n'rating': rating if rating else None,\n'firstaired': infos.get('Year', '')\n}\n+\n+\n+def _upnext_get_next_episode_videoid(videoid, metadata):\n+ \"\"\"Determine the next episode and get the videoid\"\"\"\n+ try:\n+ videoid_next_episode = _find_next_episode(videoid, metadata)\n+ LOG.debug('Next episode is {}', videoid_next_episode)\n+ return videoid_next_episode\n+ except (TypeError, KeyError):\n+ # import traceback\n+ # LOG.debug(traceback.format_exc())\n+ LOG.debug('There is no next episode, not setting up Up Next')\n+ return None\n+\n+\n+def _find_next_episode(videoid, metadata):\n+ try:\n+ # Find next episode in current season\n+ episode = common.find(metadata[0]['seq'] + 1, 'seq',\n+ metadata[1]['episodes'])\n+ return common.VideoId(tvshowid=videoid.tvshowid,\n+ seasonid=videoid.seasonid,\n+ episodeid=episode['id'])\n+ except (IndexError, KeyError):\n+ # Find first episode of next season\n+ next_season = common.find(metadata[1]['seq'] + 1, 'seq',\n+ metadata[2]['seasons'])\n+ episode = common.find(1, 'seq', next_season['episodes'])\n+ return common.VideoId(tvshowid=videoid.tvshowid,\n+ seasonid=next_season['id'],\n+ episodeid=episode['id'])\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/utils/api_requests.py",
"new_path": "resources/lib/utils/api_requests.py",
"diff": "@@ -185,21 +185,6 @@ def set_parental_control_data(data):\n)\n-@catch_api_errors_decorator\n-@measure_exec_time_decorator()\n-def verify_pin(pin):\n- \"\"\"Send adult PIN to Netflix and verify it.\"\"\"\n- try:\n- common.make_call(\n- 'post_safe',\n- {'endpoint': 'pin_service',\n- 'data': {'pin': pin}}\n- )\n- return True\n- except HttpError401: # Wrong PIN\n- return False\n-\n-\n@catch_api_errors_decorator\n@measure_exec_time_decorator()\ndef verify_profile_lock(guid, pin):\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Removed support of the deprecated Parental control PIN
plus related code cleaning |
106,046 | 31.03.2021 13:16:49 | -7,200 | 49011ba5b082cf076e954d4fe54bb1d310698772 | Add nfsession test endpoint to IPC over HTTP | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/common/ipc.py",
"new_path": "resources/lib/common/ipc.py",
"diff": "@@ -23,6 +23,7 @@ IPC_TIMEOUT_SECS = 20\nIPC_ENDPOINT_CACHE = '/cache'\nIPC_ENDPOINT_MSL = '/msl'\nIPC_ENDPOINT_NFSESSION = '/nfsession'\n+IPC_ENDPOINT_NFSESSION_TEST = '/nfsessiontest'\nclass Signals: # pylint: disable=no-init\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/http_server.py",
"new_path": "resources/lib/services/http_server.py",
"diff": "@@ -12,7 +12,7 @@ from http.server import BaseHTTPRequestHandler\nfrom socketserver import TCPServer, ThreadingMixIn\nfrom urllib.parse import urlparse, parse_qs\n-from resources.lib.common import IPC_ENDPOINT_CACHE, IPC_ENDPOINT_NFSESSION, IPC_ENDPOINT_MSL\n+from resources.lib.common import IPC_ENDPOINT_CACHE, IPC_ENDPOINT_NFSESSION, IPC_ENDPOINT_MSL, IPC_ENDPOINT_NFSESSION_TEST\nfrom resources.lib.common.exceptions import InvalidPathError, CacheMiss, MetadataNotAvailable, SlotNotImplemented\nfrom resources.lib.globals import G\nfrom resources.lib.services.nfsession.nfsession import NetflixSession\n@@ -49,6 +49,8 @@ class NetflixHttpRequestHandler(BaseHTTPRequestHandler):\nhandle_cache_request(self, func_name, data)\nelif endpoint == IPC_ENDPOINT_NFSESSION:\nhandle_request(self, self.server.netflix_session, func_name, data)\n+ elif endpoint == IPC_ENDPOINT_NFSESSION_TEST and LOG.is_enabled:\n+ handle_request_test(self, self.server.netflix_session, func_name, data)\nelse:\nself.send_error(404, 'Not found')\nself.end_headers()\n@@ -119,6 +121,22 @@ def handle_cache_request(server, func_name, data):\nserver.wfile.write(pickle.dumps(ret_data, protocol=pickle.HIGHEST_PROTOCOL))\n+def handle_request_test(server, handler, func_name, data):\n+ server.send_response(200)\n+ server.end_headers()\n+ import json\n+ try:\n+ try:\n+ func = handler.http_ipc_slots[func_name]\n+ except KeyError as exc:\n+ raise SlotNotImplemented('The specified IPC slot {} does not exist'.format(func_name)) from exc\n+ ret_data = _call_func(func, json.loads(data))\n+ except Exception as exc: # pylint: disable=broad-except\n+ ret_data = 'The request has failed, error: {}'.format(exc)\n+ if ret_data:\n+ server.wfile.write(json.dumps(ret_data).encode('utf-8'))\n+\n+\ndef _call_instance_func(instance, func_name, data):\ntry:\nfunc = getattr(instance, func_name)\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Add nfsession test endpoint to IPC over HTTP |
106,046 | 01.04.2021 20:10:34 | -7,200 | d4a95e01518f47af5b96dbcc2dac723a04f633cb | Adaptations to get current LoCo data from an HTTP request | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/nfsession/msl/events_handler.py",
"new_path": "resources/lib/services/nfsession/msl/events_handler.py",
"diff": "@@ -15,8 +15,6 @@ from typing import TYPE_CHECKING\nimport xbmc\n-from resources.lib import common\n-from resources.lib.common.cache_utils import CACHE_MANIFESTS\nfrom resources.lib.database.db_utils import TABLE_SESSION\nfrom resources.lib.globals import G\nfrom resources.lib.services.nfsession.msl import msl_utils\n@@ -29,42 +27,11 @@ if TYPE_CHECKING: # This variable/imports are used only by the editor, so not a\nfrom resources.lib.services.nfsession.nfsession_ops import NFSessionOperations\n-class Event:\n- \"\"\"Object representing an event request to be processed\"\"\"\n-\n- STATUS_REQUESTED = 'REQUESTED'\n- STATUS_INQUEUE = 'IN_QUEUE'\n- STATUS_ERROR = 'ERROR'\n- STATUS_SUCCESS = 'SUCCESS'\n-\n- def __init__(self, request_data, event_data):\n- self.event_type = request_data['params']['event']\n- self.status = self.STATUS_INQUEUE\n- self.event_data = event_data\n- self.request_data = request_data\n- self.response_data = None\n- LOG.debug('EVENT [{}] - Added to queue', self.event_type)\n-\n- def get_event_id(self):\n- return self.request_data['xid']\n-\n- def set_response(self, response):\n- self.response_data = response\n- LOG.debug('EVENT [{}] - Request response: {}', self.event_type, response)\n- if 'RequestError' in response:\n- self.status = self.STATUS_ERROR\n- else:\n- self.status = self.STATUS_SUCCESS\n-\n- def get_video_id(self):\n- return self.request_data['params']['sessionParams']['uiplaycontext']['video_id']\n-\n- def __str__(self):\n- return self.event_type\n-\n-\nclass EventsHandler(threading.Thread):\n\"\"\"Handle and build Netflix event requests\"\"\"\n+ # This threaded class has been designed to handle a queue of HTTP requests in a sort of async way\n+ # this to avoid to freeze the 'xbmc.Monitor' notifications in the action_controller.py,\n+ # and also to avoid ugly delay in Kodi GUI when stop event occurs\ndef __init__(self, chunked_request, nfsession: 'NFSessionOperations'):\nsuper().__init__()\n@@ -77,21 +44,18 @@ class EventsHandler(threading.Thread):\nself.cache_data_events = {}\nself.banned_events_ids = []\nself._stop_requested = False\n+ self.loco_data = None\ndef run(self):\n\"\"\"Monitor and process the event queue\"\"\"\nLOG.debug('[Event queue monitor] Thread started')\nmonitor = xbmc.Monitor()\n-\nwhile not monitor.abortRequested() and not self._stop_requested:\ntry:\n# Take the first queued item\n- event = self.queue_events.get_nowait()\n+ event_type, event_data, player_state = self.queue_events.get_nowait()\n# Process the request\n- continue_queue = self._process_event_request(event)\n- if not continue_queue:\n- # Ban future requests from this event id\n- self.banned_events_ids += [event.get_event_id()]\n+ self._process_event_request(event_type, event_data, player_state)\nexcept queue.Empty:\npass\nexcept Exception as exc: # pylint: disable=broad-except\n@@ -99,65 +63,64 @@ class EventsHandler(threading.Thread):\nimport traceback\nLOG.error(traceback.format_exc())\nself.clear_queue()\n- monitor.waitForAbort(1)\n-\n- def _process_event_request(self, event):\n- \"\"\"Do the event post request\"\"\"\n- event.status = Event.STATUS_REQUESTED\n+ monitor.waitForAbort(0.5)\n+\n+ def _process_event_request(self, event_type, event_data, player_state):\n+ \"\"\"Build and make the event post request\"\"\"\n+ if event_type == EVENT_START:\n+ # We get at every new video playback a fresh LoCo data\n+ self.loco_data = self.nfsession.get_loco_data()\n+ url = event_data['manifest']['links']['events']['href']\n+ from resources.lib.services.nfsession.msl.msl_request_builder import MSLRequestBuilder\n+ request_data = MSLRequestBuilder.build_request_data(url,\n+ self._build_event_params(event_type,\n+ event_data,\n+ player_state,\n+ event_data['manifest'],\n+ self.loco_data))\n# Request attempts can be made up to a maximum of 3 times per event\n- LOG.info('EVENT [{}] - Executing request', event)\n- endpoint_url = ENDPOINTS['events'] + create_req_params(20 if event.event_type == EVENT_START else 0,\n- 'events/{}'.format(event))\n+ LOG.info('EVENT [{}] - Executing request', event_type)\n+ endpoint_url = ENDPOINTS['events'] + create_req_params(20 if event_type == EVENT_START else 0,\n+ 'events/{}'.format(event_type))\ntry:\n- response = self.chunked_request(endpoint_url, event.request_data, get_esn(),\n+ response = self.chunked_request(endpoint_url, request_data, get_esn(),\ndisable_msl_switch=False)\n- # Malformed/wrong content in requests are ignored without returning error feedback in the response\n- event.set_response(response)\n+ # Malformed/wrong content in requests are ignored without returning any error in the response or exception\n+ LOG.debug('EVENT [{}] - Request response: {}', event_type, response)\n+ if event_type == EVENT_STOP:\n+ if event_data['allow_request_update_loco']:\n+ if 'list_context_name' in self.loco_data:\n+ self.nfsession.update_loco_context(\n+ self.loco_data['root_id'],\n+ self.loco_data['list_context_name'],\n+ self.loco_data['list_id'],\n+ self.loco_data['list_index'])\n+ else:\n+ LOG.warn('EventsHandler: LoCo list not updated due to missing list context data')\n+ video_id = request_data['params']['sessionParams']['uiplaycontext']['video_id']\n+ self.nfsession.update_videoid_bookmark(video_id)\n+ self.loco_data = None\nexcept Exception as exc: # pylint: disable=broad-except\n- LOG.error('EVENT [{}] - The request has failed: {}', event, exc)\n- event.set_response('RequestError')\n- if event.event_type == EVENT_STOP and event.status == Event.STATUS_SUCCESS:\n- self.clear_queue()\n- if event.event_data['allow_request_update_loco']:\n- self.nfsession.update_loco_context('continueWatching')\n- self.nfsession.update_videoid_bookmark(event.get_video_id())\n- return True\n+ LOG.error('EVENT [{}] - The request has failed: {}', event_type, exc)\n+ # Ban future event requests from this event xid\n+ # self.banned_events_xid.append(request_data['xid'])\n+ # Todo: this has been disabled because unstable Wi-Fi connections may cause consecutive errors\n+ # probably this should be handled in a different way\ndef stop_join(self):\nself._stop_requested = True\nself.join()\n- def callback_event_video_queue(self, data=None):\n- \"\"\"Callback to add a video event\"\"\"\n- try:\n- self.add_event_to_queue(data['event_type'], data['event_data'], data['player_state'])\n- except Exception as exc: # pylint: disable=broad-except\n- import traceback\n- from resources.lib.kodi.ui import show_addon_error_info\n- LOG.error(traceback.format_exc())\n- show_addon_error_info(exc)\n-\ndef add_event_to_queue(self, event_type, event_data, player_state):\n\"\"\"Adds an event in the queue of events to be processed\"\"\"\n- videoid = common.VideoId.from_dict(event_data['videoid'])\n- # pylint: disable=unused-variable\n- previous_data, previous_player_state = self.cache_data_events.get(videoid.value, ({}, None))\n- manifest = get_manifest(videoid)\n- url = manifest['links']['events']['href']\n-\n+ previous_data, _ = self.cache_data_events.get(event_data['videoid'].value, ({}, None))\nif previous_data.get('xid') in self.banned_events_ids:\nLOG.warn('EVENT [{}] - Not added to the queue. The xid {} is banned due to a previous failed request',\nevent_type, previous_data.get('xid'))\nreturn\n-\n- from resources.lib.services.nfsession.msl.msl_request_builder import MSLRequestBuilder\n- request_data = MSLRequestBuilder.build_request_data(url,\n- self._build_event_params(event_type,\n- event_data,\n- player_state,\n- manifest))\ntry:\n- self.queue_events.put_nowait(Event(request_data, event_data))\n+ self.queue_events.put_nowait((event_type, event_data, player_state))\n+ LOG.debug('EVENT [{}] - Added to queue', event_type)\nexcept queue.Full:\nLOG.warn('EVENT [{}] - Not added to the queue. The event queue is full.', event_type)\n@@ -168,12 +131,12 @@ class EventsHandler(threading.Thread):\nself.cache_data_events = {}\nself.banned_events_ids = []\n- def _build_event_params(self, event_type, event_data, player_state, manifest):\n+ def _build_event_params(self, event_type, event_data, player_state, manifest, loco_data):\n\"\"\"Build data params for an event request\"\"\"\n- videoid = common.VideoId.from_dict(event_data['videoid'])\n+ videoid_value = event_data['videoid'].value\n# Get previous elaborated data of the same video id\n# Some tags must remain unchanged between events\n- previous_data, previous_player_state = self.cache_data_events.get(videoid.value, ({}, None))\n+ previous_data, previous_player_state = self.cache_data_events.get(videoid_value, ({}, None))\ntimestamp = int(time.time() * 1000)\n# Context location values can be easily viewed from tag data-ui-tracking-context\n@@ -213,13 +176,13 @@ class EventsHandler(threading.Thread):\n'uiplaycontext': {\n# 'list_id': list_id, # not mandatory\n# lolomo_id: use loco root id value\n- 'lolomo_id': G.LOCAL_DB.get_value('loco_root_id', '', TABLE_SESSION),\n+ 'lolomo_id': loco_data['root_id'],\n'location': play_ctx_location,\n'rank': 0, # Perhaps this is a reference of cdn rank used in the manifest? (we use always 0)\n'request_id': event_data['request_id'],\n'row': 0, # Purpose not known\n'track_id': event_data['track_id'],\n- 'video_id': videoid.value\n+ 'video_id': videoid_value\n}\n})\n}\n@@ -227,11 +190,5 @@ class EventsHandler(threading.Thread):\nif event_type == EVENT_ENGAGE:\nparams['action'] = 'User_Interaction'\n- self.cache_data_events[videoid.value] = (params, player_state)\n+ self.cache_data_events[videoid_value] = (params, player_state)\nreturn params\n-\n-\n-def get_manifest(videoid):\n- \"\"\"Get the manifest from cache\"\"\"\n- cache_identifier = get_esn() + '_' + videoid.value\n- return G.CACHE.get(CACHE_MANIFESTS, cache_identifier)\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/nfsession/nfsession_ops.py",
"new_path": "resources/lib/services/nfsession/nfsession_ops.py",
"diff": "@@ -222,29 +222,17 @@ class NFSessionOperations(SessionPathRequests):\nraise MetadataNotAvailable\nreturn metadata_data['video']\n- def update_loco_context(self, context_name):\n+ def update_loco_context(self, loco_root_id, list_context_name, list_id, list_index):\n\"\"\"Update a loco list by context\"\"\"\n- # Call this api seem no more needed to update the continueWatching loco list\n- # Get current loco root data\n- loco_data = self.path_request([['loco', [context_name], ['context', 'id', 'index']]])\n- loco_root = loco_data['loco'][1]\n- if 'continueWatching' in loco_data['locos'][loco_root]:\n- context_index = loco_data['locos'][loco_root]['continueWatching'][2]\n- context_id = loco_data['locos'][loco_root][context_index][1]\n- else:\n- # In the new profiles, there is no 'continueWatching' list and no list is returned\n- LOG.warn('update_loco_context: Update skipped due to missing context {}', context_name)\n- return\n-\n- path = [['locos', loco_root, 'refreshListByContext']]\n+ path = [['locos', loco_root_id, 'refreshListByContext']]\n# After the introduction of LoCo, the following notes are to be reviewed (refers to old LoLoMo):\n# The fourth parameter is like a request-id, but it does not seem to match to\n# serverDefs/date/requestId of reactContext nor to request_id of the video event request,\n# seem to have some kind of relationship with renoMessageId suspect with the logblob but i am not sure.\n# I noticed also that this request can also be made with the fourth parameter empty.\n- params = [common.enclose_quotes(context_id),\n- context_index,\n- common.enclose_quotes(context_name),\n+ params = [common.enclose_quotes(list_id),\n+ list_index,\n+ common.enclose_quotes(list_context_name),\n'']\n# path_suffixs = [\n# [{'from': 0, 'to': 100}, 'itemSummary'],\n@@ -296,3 +284,22 @@ class NFSessionOperations(SessionPathRequests):\ninfos = get_info(videoid, raw_data['videos'][videoid.value], raw_data, profile_language_code)[0]\nart = get_art(videoid, raw_data['videos'][videoid.value], profile_language_code)\nreturn infos, art\n+\n+ def get_loco_data(self):\n+ \"\"\"\n+ Get the LoCo root id and the continueWatching list data references\n+ needed for events requests and update_loco_context\n+ \"\"\"\n+ # This data will be different for every profile,\n+ # while the loco root id should be a fixed value (expiry?), the 'continueWatching' context data\n+ # will change every time that nfsession update_loco_context is called\n+ context_name = 'continueWatching'\n+ loco_data = self.path_request([['loco', [context_name], ['context', 'id', 'index']]])\n+ loco_root = loco_data['loco'][1]\n+ _loco_data = {'root_id': loco_root}\n+ if context_name in loco_data['locos'][loco_root]:\n+ # NOTE: In the new profiles, there is no 'continueWatching' list and no data will be provided\n+ _loco_data['list_context_name'] = context_name\n+ _loco_data['list_index'] = loco_data['locos'][loco_root][context_name][2]\n+ _loco_data['list_id'] = loco_data['locos'][loco_root][_loco_data['list_index']][1]\n+ return _loco_data\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/playback/am_video_events.py",
"new_path": "resources/lib/services/playback/am_video_events.py",
"diff": "from typing import TYPE_CHECKING\nfrom resources.lib import common\n-from resources.lib.common.cache_utils import CACHE_BOOKMARKS, CACHE_COMMON\n+from resources.lib.common.cache_utils import CACHE_BOOKMARKS, CACHE_COMMON, CACHE_MANIFESTS\nfrom resources.lib.common.exceptions import InvalidVideoListTypeError\nfrom resources.lib.globals import G\nfrom resources.lib.services.nfsession.msl.msl_utils import EVENT_ENGAGE, EVENT_START, EVENT_STOP, EVENT_KEEP_ALIVE\nfrom resources.lib.utils.api_paths import build_paths, EVENT_PATHS\n+from resources.lib.utils.esn import get_esn\nfrom resources.lib.utils.logging import LOG\nfrom .action_manager import ActionManager\n@@ -29,7 +30,8 @@ class AMVideoEvents(ActionManager):\nSETTING_ID = 'ProgressManager_enabled'\n- def __init__(self, nfsession: 'NFSessionOperations' , msl_handler: 'MSLHandler', directory_builder: 'DirectoryBuilder'):\n+ def __init__(self, nfsession: 'NFSessionOperations', msl_handler: 'MSLHandler',\n+ directory_builder: 'DirectoryBuilder'):\nsuper().__init__()\nself.nfsession = nfsession\nself.msl_handler = msl_handler\n@@ -46,19 +48,20 @@ class AMVideoEvents(ActionManager):\nreturn 'enabled={}'.format(self.enabled)\ndef initialize(self, data):\n- if not data['videoid'].mediatype in [common.VideoId.MOVIE, common.VideoId.EPISODE]:\n+ if self.videoid.mediatype not in [common.VideoId.MOVIE, common.VideoId.EPISODE]:\nLOG.warn('AMVideoEvents: disabled due to no not supported videoid mediatype')\nself.enabled = False\nreturn\nif (not data['is_played_from_strm'] or\n(data['is_played_from_strm'] and G.ADDON.getSettingBool('sync_watched_status_library'))):\n- self.event_data = self._get_event_data(data['videoid'])\n- self.event_data['videoid'] = data['videoid'].to_dict()\n+ self.event_data = self._get_event_data(self.videoid)\n+ self.event_data['videoid'] = self.videoid\nself.event_data['is_played_by_library'] = data['is_played_from_strm']\nelse:\nself.enabled = False\ndef on_playback_started(self, player_state):\n+ self.event_data['manifest'] = _get_manifest(self.videoid)\n# Clear continue watching list data on the cache, to force loading of new data\n# but only when the videoid not exists in the continue watching list\ntry:\n@@ -132,7 +135,7 @@ class AMVideoEvents(ActionManager):\nself._reset_tick_count()\nself._send_event(EVENT_ENGAGE, self.event_data, player_state)\nself._send_event(EVENT_STOP, self.event_data, player_state)\n- # Update the resume here may not always work due to race conditions with refresh list/stop event\n+ # Update the resume here may not always work due to race conditions with GUI directory refresh and Stop event\nself._save_resume_time(player_state['elapsed_seconds'])\ndef _save_resume_time(self, resume_time):\n@@ -195,3 +198,9 @@ class AMVideoEvents(ActionManager):\nvideo_ids = [int(videoid.value) for videoid in videoids]\nLOG.debug('Requesting video raw data for {}', video_ids)\nreturn self.nfsession.path_request(build_paths(['videos', video_ids], EVENT_PATHS))\n+\n+\n+def _get_manifest(videoid):\n+ \"\"\"Get the manifest from cache\"\"\"\n+ cache_identifier = get_esn() + '_' + videoid.value\n+ return G.CACHE.get(CACHE_MANIFESTS, cache_identifier)\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/utils/website.py",
"new_path": "resources/lib/utils/website.py",
"diff": "@@ -78,15 +78,8 @@ def extract_session_data(content, validate=False, update_profiles=False):\napi_data = extract_api_data(react_context)\n# Note: Falcor cache does not exist if membershipStatus is not CURRENT_MEMBER\nfalcor_cache = extract_json(content, 'falcorCache')\n-\nif update_profiles:\nparse_profiles(falcor_cache)\n-\n- # 21/05/2020 - Netflix has introduced a new paging type called \"loco\" similar to the old \"lolomo\"\n- # Extract loco root id\n- loco_root = falcor_cache['loco']['value'][1]\n- G.LOCAL_DB.set_value('loco_root_id', loco_root, TABLE_SESSION)\n-\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)\nif not get_website_esn():\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Adaptations to get current LoCo data from an HTTP request |
106,046 | 01.04.2021 20:31:11 | -7,200 | f378774f2a60d4d63751573d941b4f8ac34154df | Fix for add/remove to My List | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/utils/api_requests.py",
"new_path": "resources/lib/utils/api_requests.py",
"diff": "@@ -129,7 +129,12 @@ def update_my_list(videoid, operation, params):\n'data': {\n'operation': operation,\n'videoId': videoid.value}})\n+ if G.IPC_OVER_HTTP:\n_update_mylist_cache(videoid, operation, params)\n+ else:\n+ # Todo: _update_mylist_cache cause error when execute G.CACHE.add\n+ # because the IPC over AddonSignals can receive objects but not send objects\n+ G.CACHE.clear([cache_utils.CACHE_MYLIST], clear_database=False)\ndef _update_mylist_cache(videoid, operation, params):\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Fix for add/remove to My List |
106,046 | 02.04.2021 09:12:07 | -7,200 | 50d67c8982c9a77104ec282ba055554ca5557a6f | Version bump (1.15.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=\"1.14.1+matrix.1\" provider-name=\"libdev + jojo + asciidisco + caphm + castagnait\">\n+<addon id=\"plugin.video.netflix\" name=\"Netflix\" version=\"1.15.0+matrix.1\" provider-name=\"libdev + jojo + asciidisco + caphm + castagnait\">\n<requires>\n<import addon=\"xbmc.python\" version=\"3.0.0\"/>\n<import addon=\"script.module.addon.signals\" version=\"0.0.6+matrix.1\"/>\n<forum>https://forum.kodi.tv/showthread.php?tid=329767</forum>\n<source>https://github.com/CastagnaIT/plugin.video.netflix</source>\n<news>\n-v1.14.1 (2021-02-25)\n-- Fixed error caused by installation from scratch\n-- Update translations pt_br, zh,tw, ro, fr, zh_cn, jp, kr, gl_es, hu\n+v1.15.0 (2021-04-02)\n+NOTICE TO PARENTAL CONTROL:\n+THE OLD PARENTAL CONTROL WITH PIN IS NO LONGER SUPPORTED,\n+HAS BEEN DEPRECATED BY NETFLIX SINCE LAST YEAR, IF YOU KEEP USING IT\n+YOU MUST UPDATE YOUR ACCOUNT PARENTAL CONTROL SETTINGS.\n+- Fixes due to website changes (fix KeyError loco)\n+- Removed the deprecated Parental Control (with PIN protection)\n+- Improved playback startup speed\n+- Enabled IPC over HTTP by default, IPC over AddonSignals lead to a memory leak (Kodi bug)\n+- IPC now use only Pickle\n+- Add missing support to IPC over AddonSignals for the cache\n+- Joined all HTTP servers to one multithreaded to save resources\n+- Used a single web session instead of two distinct (nfsession/MSL)\n+- Cleaned many part of source code (nfsession/MSL/directory/IPC/...)\n+- Update translations zh_tw, gr\n</news>\n</extension>\n</addon>\n"
},
{
"change_type": "MODIFY",
"old_path": "changelog.txt",
"new_path": "changelog.txt",
"diff": "+v1.15.0 (2021-04-02)\n+NOTICE TO PARENTAL CONTROL:\n+THE OLD PARENTAL CONTROL WITH PIN IS NO LONGER SUPPORTED,\n+HAS BEEN DEPRECATED BY NETFLIX SINCE LAST YEAR, IF YOU KEEP USING IT\n+YOU MUST UPDATE YOUR ACCOUNT PARENTAL CONTROL SETTINGS.\n+- Fixes due to website changes (fix KeyError loco)\n+- Removed the deprecated Parental Control (with PIN protection)\n+- Improved playback startup speed\n+- Enabled IPC over HTTP by default, IPC over AddonSignals lead to a memory leak (Kodi bug)\n+- IPC now use only Pickle\n+- Add missing support to IPC over AddonSignals for the cache\n+- Joined all HTTP servers to one multithreaded to save resources\n+- Used a single web session instead of two distinct (nfsession/MSL)\n+- Cleaned many part of source code (nfsession/MSL/directory/IPC/...)\n+- Update translations zh_tw, gr\n+\nv1.14.1 (2021-02-25)\n- Fixed error caused by installation from scratch\n- Update translations pt_br, zh,tw, ro, fr, zh_cn, jp, kr, gl_es, hu\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Version bump (1.15.0) |
106,046 | 05.04.2021 10:37:28 | -7,200 | d9908f3b234ec5a2b71f64b361b530ae640781f9 | Not needed json conversions | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/nfsession/session/path_requests.py",
"new_path": "resources/lib/services/nfsession/session/path_requests.py",
"diff": "@@ -23,7 +23,7 @@ class SessionPathRequests(SessionAccess):\n@measure_exec_time_decorator(is_immediate=True)\ndef path_request(self, paths, use_jsongraph=False):\n\"\"\"Perform a path request against the Shakti API\"\"\"\n- LOG.debug('Executing path request: {}', json.dumps(paths))\n+ LOG.debug('Executing path request: {}', paths)\ncustom_params = {}\nif use_jsongraph:\ncustom_params['falcor_server'] = '0.1.0'\n@@ -126,9 +126,7 @@ class SessionPathRequests(SessionAccess):\ndef callpath_request(self, callpaths, params=None, path_suffixs=None):\n\"\"\"Perform a callPath request against the Shakti API\"\"\"\nLOG.debug('Executing callPath request: {} params: {} path_suffixs: {}',\n- json.dumps(callpaths),\n- params,\n- json.dumps(path_suffixs))\n+ callpaths, params, path_suffixs)\ncustom_params = {\n'falcor_server': '0.1.0',\n'method': 'call',\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Not needed json conversions |
106,046 | 08.04.2021 11:42:39 | -7,200 | f420a0e8f6c4466261f5c56dddbb5cf77f67034c | Changes related to IPC over AddonSignals | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/common/ipc.py",
"new_path": "resources/lib/common/ipc.py",
"diff": "@@ -19,31 +19,31 @@ from .misc_utils import run_threaded\nIPC_TIMEOUT_SECS = 20\n-# IPC via HTTP endpoints\n+# IPC over HTTP endpoints\nIPC_ENDPOINT_CACHE = '/cache'\nIPC_ENDPOINT_MSL = '/msl'\nIPC_ENDPOINT_NFSESSION = '/nfsession'\nIPC_ENDPOINT_NFSESSION_TEST = '/nfsessiontest'\n-class Signals: # pylint: disable=no-init\n+class Signals: # pylint: disable=no-init,too-few-public-methods\n\"\"\"Signal names for use with AddonSignals\"\"\"\n- # pylint: disable=too-few-public-methods\nPLAYBACK_INITIATED = 'playback_initiated'\nREQUEST_KODI_LIBRARY_UPDATE = 'request_kodi_library_update'\n- UPNEXT_ADDON_INIT = 'upnext_data'\nCLEAR_USER_ID_TOKENS = 'clean_user_id_tokens'\nREINITIALIZE_MSL_HANDLER = 'reinitialize_msl_handler'\nSWITCH_EVENTS_HANDLER = 'switch_events_handler'\n-def register_slot(callback, signal=None, source_id=None):\n+def register_slot(callback, signal=None, source_id=None, is_signal=False):\n\"\"\"Register a callback with AddonSignals for return calls\"\"\"\nname = signal if signal else callback.__name__\n+ _callback = (EnvelopeAddonSignalsCallback(callback).call\n+ if is_signal else EnvelopeAddonSignalsCallback(callback).return_call)\nAddonSignals.registerSlot(\nsignaler_id=source_id or G.ADDON_ID,\nsignal=name,\n- callback=callback)\n+ callback=_callback)\nLOG.debug('Registered AddonSignals slot {} to {}'.format(name, callback))\n@@ -69,10 +69,11 @@ def send_signal(signal, data=None, non_blocking=False):\ndef _send_signal(signal, data):\n+ _data = b64encode(pickle.dumps(data, pickle.HIGHEST_PROTOCOL)).decode('ascii')\nAddonSignals.sendSignal(\nsource_id=G.ADDON_ID,\nsignal=signal,\n- data=data)\n+ data=_data)\n@measure_exec_time_decorator()\n@@ -85,8 +86,12 @@ def make_call(func_name, data=None, endpoint=IPC_ENDPOINT_NFSESSION):\n:return: the data if provided by the target function\n:raise: can raise exceptions raised from the target function\n\"\"\"\n- # Note: IPC over HTTP handle a FULL objects serialization (like classes),\n- # IPC over AddonSignals currently NOT HANDLE objects serialization\n+ # Note: IPC over HTTP - handle a FULL objects serialization (like classes)\n+ # IPC over AddonSignals - by default NOT HANDLE objects serialization,\n+ # but we have implemented a double data conversion to support a full objects serialization\n+ # (as predisposition for AddonConnector) the main problem is Kodi memory leak, see:\n+ # https://github.com/xbmc/xbmc/issues/19332\n+ # https://github.com/CastagnaIT/script.module.addon.connector\nif G.IPC_OVER_HTTP:\nreturn make_http_call(endpoint, func_name, data)\nreturn make_addonsignals_call(func_name, data)\n@@ -130,10 +135,11 @@ def make_addonsignals_call(callname, data):\nThe contents of data will be expanded to kwargs and passed into the target function.\n\"\"\"\nLOG.debug('Handling AddonSignals IPC call to {}'.format(callname))\n+ _data = b64encode(pickle.dumps(data, pickle.HIGHEST_PROTOCOL)).decode('ascii')\nresult = AddonSignals.makeCall(\nsource_id=G.ADDON_ID,\nsignal=callname,\n- data=data,\n+ data=_data,\ntimeout_ms=IPC_TIMEOUT_SECS * 1000,\nuse_timeout_exception=True)\n_result = pickle.loads(b64decode(result))\n@@ -142,16 +148,30 @@ def make_addonsignals_call(callname, data):\nreturn _result\n-class EnvelopeIPCReturnCall:\n- \"\"\"Makes a function callable through AddonSignals IPC, handles catching, conversion and forwarding of exceptions\"\"\"\n- # Defines a type of in-memory reference to avoids define functions in the source code just to handle IPC return call\n+class EnvelopeAddonSignalsCallback:\n+ \"\"\"\n+ Handle an AddonSignals function callback,\n+ allow to use funcs with multiple args/kwargs,\n+ allow an automatic AddonSignals.returnCall callback,\n+ can handle catching and forwarding of exceptions\n+ \"\"\"\ndef __init__(self, func):\nself._func = func\ndef call(self, data):\n- \"\"\"Routes the call to the function associated to the class\"\"\"\n+ \"\"\"In memory reference for the target func\"\"\"\n+ try:\n+ _data = pickle.loads(b64decode(data))\n+ _call(self._func, _data)\n+ except Exception: # pylint: disable=broad-except\n+ import traceback\n+ LOG.error(traceback.format_exc())\n+\n+ def return_call(self, data):\n+ \"\"\"In memory reference for the target func, with an automatic AddonSignals.returnCall callback\"\"\"\ntry:\n- result = _call(self._func, data)\n+ _data = pickle.loads(b64decode(data))\n+ result = _call(self._func, _data)\nexcept Exception as exc: # pylint: disable=broad-except\nif exc.__class__.__name__ not in ['CacheMiss', 'MetadataNotAvailable']:\nLOG.error('IPC callback raised exception: {exc}', exc=exc)\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/common/videoid.py",
"new_path": "resources/lib/common/videoid.py",
"diff": "@@ -266,6 +266,9 @@ class VideoId:\ndef __neq__(self, other):\nreturn not self.__eq__(other)\n+ def __repr__(self):\n+ return 'VideoId object [{}]'.format(self)\n+\ndef _get_unicode_kwargs(kwargs):\n# Example of return value: (None, None, '70084801', None, None, None) this is a movieid\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/navigation/player.py",
"new_path": "resources/lib/navigation/player.py",
"diff": "@@ -72,7 +72,7 @@ def _play(videoid, is_played_from_strm=False):\n# When a video is played from Kodi library or Up Next add-on is needed set infoLabels and art info to list_item\nif is_played_from_strm or is_upnext_enabled or G.IS_ADDON_EXTERNAL_CALL:\n- info, arts = common.make_call('get_videoid_info', {'videoid': videoid.to_path()})\n+ info, arts = common.make_call('get_videoid_info', videoid)\nlist_item.setInfo('video', info)\nlist_item.setArt(arts)\n@@ -80,7 +80,7 @@ def _play(videoid, is_played_from_strm=False):\nLOG.debug('Sending initialization signal')\n# Do not use send_signal as threaded slow devices are not powerful to send in faster way and arrive late to service\ncommon.send_signal(common.Signals.PLAYBACK_INITIATED, {\n- 'videoid': videoid.to_dict(),\n+ 'videoid': videoid,\n'is_played_from_strm': is_played_from_strm,\n'resume_position': resume_position})\nxbmcplugin.setResolvedUrl(handle=G.PLUGIN_HANDLE, succeeded=True, listitem=list_item)\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/cache_management.py",
"new_path": "resources/lib/services/cache_management.py",
"diff": "@@ -80,8 +80,7 @@ class CacheManagement:\n]\nfor slot in slots:\n# For AddonSignals IPC\n- enveloped_func = common.EnvelopeIPCReturnCall(slot).call\n- common.register_slot(enveloped_func, slot.__name__)\n+ common.register_slot(slot, slot.__name__)\ndef load_ttl_values(self):\n\"\"\"Load the ttl values from add-on settings\"\"\"\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/library_updater.py",
"new_path": "resources/lib/services/library_updater.py",
"diff": "@@ -109,16 +109,16 @@ class LibraryUpdateService(xbmc.Monitor):\nself.clean_in_progress = False\nself.check_awaiting_operations()\n- def request_kodi_library_update(self, data=None):\n+ def request_kodi_library_update(self, clean=False, scan=False):\n\"\"\"Make a request for scan/clean the Kodi library database\"\"\"\n# Kodi library scan/clean has some issues (Kodi 18/19), for example:\n# - If more than one scan calls will be performed, the last call cancel the previous scan\n# - If a clean is in progress, a new scan/clean call will be ignored\n# To manage these problems we monitor the events to check if a scan/clean is currently in progress\n# (from this or others add-ons) and delay the call until the current scan/clean will be finished.\n- if data.get('clean'):\n+ if clean:\nself.start_clean_kodi_library()\n- if data.get('scan'):\n+ if scan:\nself.start_update_kodi_library()\ndef check_awaiting_operations(self):\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/nfsession/msl/msl_handler.py",
"new_path": "resources/lib/services/nfsession/msl/msl_handler.py",
"diff": "@@ -73,13 +73,16 @@ class MSLHandler:\nself._init_msl_handler()\ncommon.register_slot(\nsignal=common.Signals.CLEAR_USER_ID_TOKENS,\n- callback=self.clear_user_id_tokens)\n+ callback=self.clear_user_id_tokens,\n+ is_signal=True)\ncommon.register_slot(\nsignal=common.Signals.REINITIALIZE_MSL_HANDLER,\n- callback=self.reinitialize_msl_handler)\n+ callback=self.reinitialize_msl_handler,\n+ is_signal=True)\ncommon.register_slot(\nsignal=common.Signals.SWITCH_EVENTS_HANDLER,\n- callback=self.switch_events_handler)\n+ callback=self.switch_events_handler,\n+ is_signal=True)\n# Slot allocation for IPC\nself.slots = [self.msl_requests.perform_key_handshake]\n@@ -93,22 +96,22 @@ class MSLHandler:\nself.msl_requests = MSLRequests(msl_data, self.nfsession)\nself.switch_events_handler()\n- def reinitialize_msl_handler(self, data=None): # pylint: disable=unused-argument\n+ def reinitialize_msl_handler(self, delete_msl_file=False):\n\"\"\"\nReinitialize the MSL handler\n- :param data: set True for delete the msl file data, and then reset all\n+ :param delete_msl_file: if True delete the msl file data\n\"\"\"\nLOG.debug('Reinitializing MSL handler')\n- if data is True:\n+ if delete_msl_file:\ncommon.delete_file(MSL_DATA_FILENAME)\nself._init_msl_handler()\n- def switch_events_handler(self, data=None):\n+ def switch_events_handler(self, override_enable=False):\n\"\"\"Switch to enable or disable the Events handler\"\"\"\nif self.events_handler_thread:\nself.events_handler_thread.stop_join()\nself.events_handler_thread = None\n- if G.ADDON.getSettingBool('ProgressManager_enabled') or data:\n+ if G.ADDON.getSettingBool('ProgressManager_enabled') or override_enable:\nself.events_handler_thread = EventsHandler(self.msl_requests.chunked_request, self.nfsession)\nself.events_handler_thread.start()\n@@ -324,7 +327,7 @@ class MSLHandler:\n# Example the supplemental media type have no license\nLOG.debug('No license to release')\n- def clear_user_id_tokens(self, data=None): # pylint: disable=unused-argument\n+ def clear_user_id_tokens(self):\n\"\"\"Clear all user id tokens\"\"\"\nself.msl_requests.crypto.clear_user_id_tokens()\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/nfsession/nfsession.py",
"new_path": "resources/lib/services/nfsession/nfsession.py",
"diff": "@@ -37,8 +37,7 @@ class NetflixSession:\n# For HTTP IPC (http_server.py)\nself.http_ipc_slots[func_name] = slot\n# For AddonSignals IPC\n- enveloped_func = common.EnvelopeIPCReturnCall(slot).call\n- common.register_slot(enveloped_func, func_name)\n+ common.register_slot(slot, func_name)\ndef library_auto_update(self):\n\"\"\"Run the library auto update\"\"\"\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/nfsession/nfsession_ops.py",
"new_path": "resources/lib/services/nfsession/nfsession_ops.py",
"diff": "@@ -174,8 +174,6 @@ class NFSessionOperations(SessionPathRequests):\n@measure_exec_time_decorator(is_immediate=True)\ndef get_metadata(self, videoid, refresh=False):\n\"\"\"Retrieve additional metadata for the given VideoId\"\"\"\n- if isinstance(videoid, list): # IPC call send the videoid as \"path\" list\n- videoid = common.VideoId.from_path(videoid)\n# Get the parent VideoId (when the 'videoid' is a type of EPISODE/SEASON)\nparent_videoid = videoid.derive_parent(common.VideoId.SHOW)\n# Delete the cache if we need to refresh the all metadata\n@@ -269,8 +267,6 @@ class NFSessionOperations(SessionPathRequests):\ndef get_videoid_info(self, videoid):\n\"\"\"Get infolabels and arts from cache (if exist) otherwise will be requested\"\"\"\n- if isinstance(videoid, list): # IPC call send the videoid as \"path\" list\n- videoid = common.VideoId.from_path(videoid)\nfrom resources.lib.kodi.infolabels import get_info, get_art\nprofile_language_code = G.LOCAL_DB.get_profile_config('language', '')\ntry:\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/nfsession/session/access.py",
"new_path": "resources/lib/services/nfsession/session/access.py",
"diff": "@@ -178,7 +178,7 @@ class SessionAccess(SessionCookie, SessionHTTPRequests):\ncommon.purge_credentials()\n# Reinitialize the MSL handler (delete msl data file, then reset everything)\n- common.send_signal(signal=common.Signals.REINITIALIZE_MSL_HANDLER, data=True)\n+ common.send_signal(common.Signals.REINITIALIZE_MSL_HANDLER, {'delete_msl_file': True})\nG.CACHE.clear(clear_database=True)\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/playback/action_controller.py",
"new_path": "resources/lib/services/playback/action_controller.py",
"diff": "@@ -49,18 +49,15 @@ class ActionController(xbmc.Monitor):\nself.action_managers = None\nself._last_player_state = {}\nself._is_pause_called = False\n- common.register_slot(self.initialize_playback, common.Signals.PLAYBACK_INITIATED)\n+ common.register_slot(self.initialize_playback, common.Signals.PLAYBACK_INITIATED, is_signal=True)\n- def initialize_playback(self, data):\n+ def initialize_playback(self, **kwargs):\n\"\"\"\nCallback for AddonSignal when this add-on has initiated a playback\n\"\"\"\n- # We convert the videoid only once for all action managers\n- videoid = common.VideoId.from_dict(data['videoid'])\n- data['videoid'] = videoid\n- data['videoid_parent'] = videoid.derive_parent(common.VideoId.SHOW)\n- data['metadata'] = self.nfsession.get_metadata(videoid)\n- self._init_data = data\n+ self._init_data = kwargs\n+ self._init_data['videoid_parent'] = kwargs['videoid'].derive_parent(common.VideoId.SHOW)\n+ self._init_data['metadata'] = self.nfsession.get_metadata(kwargs['videoid'])\nself.active_player_id = None\nself.is_tracking_enabled = True\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/playback/am_upnext_notifier.py",
"new_path": "resources/lib/services/playback/am_upnext_notifier.py",
"diff": "@@ -60,7 +60,11 @@ class AMUpNextNotifier(ActionManager):\ndef on_playback_started(self, player_state): # pylint: disable=unused-argument\nif self.upnext_info:\nLOG.debug('Sending initialization signal to Up Next Add-on')\n- common.send_signal(common.Signals.UPNEXT_ADDON_INIT, self.upnext_info, non_blocking=True)\n+ import AddonSignals\n+ AddonSignals.sendSignal(\n+ source_id=G.ADDON_ID,\n+ signal='upnext_data',\n+ data=self.upnext_info)\ndef on_tick(self, player_state):\npass\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/settings_monitor.py",
"new_path": "resources/lib/services/settings_monitor.py",
"diff": "@@ -146,4 +146,4 @@ def _check_watched_status_sync():\nprogress_manager_enabled_old = G.LOCAL_DB.get_value('progress_manager_enabled', False, TABLE_SETTINGS_MONITOR)\nif progress_manager_enabled != progress_manager_enabled_old:\nG.LOCAL_DB.set_value('progress_manager_enabled', progress_manager_enabled, TABLE_SETTINGS_MONITOR)\n- common.send_signal(signal=common.Signals.SWITCH_EVENTS_HANDLER, data=progress_manager_enabled)\n+ common.send_signal(common.Signals.SWITCH_EVENTS_HANDLER, progress_manager_enabled)\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/utils/api_requests.py",
"new_path": "resources/lib/utils/api_requests.py",
"diff": "@@ -256,7 +256,7 @@ def remove_watched_status(videoid):\ndef get_metadata(videoid, refresh=False):\n- return common.make_call('get_metadata', {'videoid': videoid.to_path(),\n+ return common.make_call('get_metadata', {'videoid': videoid,\n'refresh': refresh})\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Changes related to IPC over AddonSignals |
106,046 | 09.04.2021 09:02:18 | -7,200 | 0644cf68e0c1b396105a58bc600500e0b588d1dc | Implemented new version number comparer | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/common/kodi_ops.py",
"new_path": "resources/lib/common/kodi_ops.py",
"diff": "@@ -14,7 +14,7 @@ import xbmc\nfrom resources.lib.globals import G\nfrom resources.lib.utils.logging import LOG\n-from .misc_utils import is_less_version\n+from .misc_utils import CmpVersion\n__CURRENT_KODI_PROFILE_NAME__ = None\n@@ -237,8 +237,8 @@ def fix_locale_languages(data_list):\nLOG.error('fix_locale_languages: missing mapping conversion for locale \"{}\"'.format(item['language']))\n-class GetKodiVersion:\n- \"\"\"Get the kodi version, git date, stage name\"\"\"\n+class KodiVersion(CmpVersion):\n+ \"\"\"Comparator for Kodi version numbers\"\"\"\n# Examples of some types of supported strings:\n# 10.1 Git:Unknown PRE-11.0 Git:Unknown 11.0-BETA1 Git:20111222-22ad8e4\n# 18.1-RC1 Git:20190211-379f5f9903 19.0-ALPHA1 Git:20190419-c963b64487\n@@ -247,9 +247,8 @@ class GetKodiVersion:\nself.build_version = xbmc.getInfoLabel('System.BuildVersion')\n# Parse the version number\nresult = re.search(r'\\d+\\.\\d+', self.build_version)\n- self.version = result.group(0) if result else ''\n- # Parse the major version number\n- self.major_version = self.version.split('.')[0] if self.version else ''\n+ version = result.group(0) if result else ''\n+ super().__init__(version)\n# Parse the date of GIT build\nresult = re.search(r'(Git:)(\\d+?(?=(-|$)))', self.build_version)\nself.date = int(result.group(2)) if result and len(result.groups()) >= 2 else None\n@@ -260,12 +259,3 @@ class GetKodiVersion:\nself.stage = result.group(1) if result else ''\nelse:\nself.stage = result.group(2) if result else ''\n-\n- def is_major_ver(self, major_ver):\n- return bool(major_ver in self.major_version)\n-\n- def is_less_version(self, ver):\n- return is_less_version(self.version, ver)\n-\n- def __str__(self):\n- return self.build_version\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/common/misc_utils.py",
"new_path": "resources/lib/common/misc_utils.py",
"diff": "SPDX-License-Identifier: MIT\nSee LICENSES/MIT.md for more information.\n\"\"\"\n+import operator\nfrom urllib.parse import quote, urlencode\nfrom resources.lib.globals import G\n@@ -154,16 +155,6 @@ def enclose_quotes(content):\nreturn '\"' + content + '\"'\n-def is_minimum_version(version, min_version):\n- \"\"\"Return True if version is equal or greater to min_version\"\"\"\n- return list(map(int, version.split('.'))) >= list(map(int, min_version.split('.')))\n-\n-\n-def is_less_version(version, max_version):\n- \"\"\"Return True if version is less to max_version\"\"\"\n- return list(map(int, version.split('.'))) < list(map(int, max_version.split('.')))\n-\n-\ndef make_list(arg):\n\"\"\"Return a list with arg as its member or arg if arg is already a list. Returns an empty list if arg is None\"\"\"\nreturn (arg\n@@ -201,3 +192,51 @@ def run_threaded(non_blocking, target_func, *args, **kwargs):\nfrom threading import Thread\nThread(target=target_func, args=args, kwargs=kwargs).start()\nreturn None\n+\n+\n+class CmpVersion:\n+ \"\"\"Comparator for version numbers\"\"\"\n+ def __init__(self, version):\n+ self.version = version\n+\n+ def __str__(self):\n+ return self.version\n+\n+ def __repr__(self):\n+ return self.version\n+\n+ def __lt__(self, other):\n+ \"\"\"Operator <\"\"\"\n+ return operator.lt(*zip(*map(lambda x, y: (x or 0, y or 0),\n+ map(int, self.version.split('.')),\n+ map(int, other.split('.')))))\n+\n+ def __le__(self, other):\n+ \"\"\"Operator <=\"\"\"\n+ return operator.le(*zip(*map(lambda x, y: (x or 0, y or 0),\n+ map(int, self.version.split('.')),\n+ map(int, other.split('.')))))\n+\n+ def __gt__(self, other):\n+ \"\"\"Operator >\"\"\"\n+ return operator.gt(*zip(*map(lambda x, y: (x or 0, y or 0),\n+ map(int, self.version.split('.')),\n+ map(int, other.split('.')))))\n+\n+ def __ge__(self, other):\n+ \"\"\"Operator >=\"\"\"\n+ return operator.ge(*zip(*map(lambda x, y: (x or 0, y or 0),\n+ map(int, self.version.split('.')),\n+ map(int, other.split('.')))))\n+\n+ def __eq__(self, other):\n+ \"\"\"Operator ==\"\"\"\n+ return operator.eq(*zip(*map(lambda x, y: (x or 0, y or 0),\n+ map(int, self.version.split('.')),\n+ map(int, other.split('.')))))\n+\n+ def __ne__(self, other):\n+ \"\"\"Operator !=\"\"\"\n+ return operator.ne(*zip(*map(lambda x, y: (x or 0, y or 0),\n+ map(int, self.version.split('.')),\n+ map(int, other.split('.')))))\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/database/db_base_sqlite.py",
"new_path": "resources/lib/database/db_base_sqlite.py",
"diff": "@@ -236,7 +236,7 @@ class SQLiteDatabase(db_base.BaseDatabase):\ntable_columns = table[1]\n# Doing many sqlite operations at the same makes the performance much worse (especially on Kodi 18)\n# The use of 'executemany' and 'transaction' can improve performance up to about 75% !!\n- if common.is_less_version(sql.sqlite_version, '3.24.0'):\n+ if common.CmpVersion(sql.sqlite_version) < '3.24.0':\nquery = 'INSERT OR REPLACE INTO {} ({}, {}) VALUES (?, ?)'.format(table_name,\ntable_columns[0],\ntable_columns[1])\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/database/db_update.py",
"new_path": "resources/lib/database/db_update.py",
"diff": "SPDX-License-Identifier: MIT\nSee LICENSES/MIT.md for more information.\n\"\"\"\n-import resources.lib.common as common\n+from resources.lib.common import CmpVersion\nfrom resources.lib.globals import G\ndef run_local_db_updates(current_version, upgrade_to_version): # pylint: disable=unused-argument\n\"\"\"Perform database actions for a db version change\"\"\"\n# The changes must be left in sequence to allow cascade operations on non-updated databases\n- if common.is_less_version(current_version, '0.2'):\n+ if CmpVersion(current_version) < '0.2':\n# Changes: added table 'search'\nimport sqlite3 as sql\nfrom resources.lib.database.db_base_sqlite import CONN_ISOLATION_LEVEL\n@@ -34,7 +34,7 @@ def run_local_db_updates(current_version, upgrade_to_version): # pylint: disabl\ncur.execute(table)\nshared_db_conn.close()\n- if common.is_less_version(current_version, '0.3'):\n+ if CmpVersion(current_version) < '0.3':\npass\n@@ -42,7 +42,7 @@ def run_shared_db_updates(current_version, upgrade_to_version): # pylint: disab\n\"\"\"Perform database actions for a db version change\"\"\"\n# The changes must be left in sequence to allow cascade operations on non-updated databases\n- if common.is_less_version(current_version, '0.2'):\n+ if CmpVersion(current_version) < '0.2':\n# Changes: added table 'watched_status_override'\n# SQLite\n@@ -91,5 +91,5 @@ def run_shared_db_updates(current_version, upgrade_to_version): # pylint: disab\ncur.execute(alter_tbl)\nshared_db_conn.conn.close()\n- if common.is_less_version(current_version, '0.3'):\n+ if CmpVersion(current_version) < '0.3':\npass\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/globals.py",
"new_path": "resources/lib/globals.py",
"diff": "@@ -240,8 +240,9 @@ class GlobalVariables:\nself.IS_SERVICE = True\nself.BASE_URL = '{scheme}://{netloc}'.format(scheme='plugin',\nnetloc=self.ADDON_ID)\n- from resources.lib.common.kodi_ops import GetKodiVersion\n- self.KODI_VERSION = GetKodiVersion()\n+ # Disabled currently unused\n+ # from resources.lib.common.kodi_ops import KodiVersion\n+ # self.KODI_VERSION = KodiVersion()\n# Initialize the log\nfrom resources.lib.utils.logging import LOG\nLOG.initialize(self.ADDON_ID, self.PLUGIN_HANDLE,\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/upgrade_controller.py",
"new_path": "resources/lib/upgrade_controller.py",
"diff": "SPDX-License-Identifier: MIT\nSee LICENSES/MIT.md for more information.\n\"\"\"\n-from resources.lib.common.misc_utils import is_less_version\n+from resources.lib.common.misc_utils import CmpVersion\nfrom resources.lib.database.db_update import run_local_db_updates, run_shared_db_updates\nfrom resources.lib.globals import G\nfrom resources.lib.utils.logging import LOG\n@@ -25,7 +25,7 @@ def check_addon_upgrade():\ncancel_playback = False\naddon_previous_ver = G.LOCAL_DB.get_value('addon_previous_version', None)\naddon_current_ver = G.VERSION\n- if addon_previous_ver is None or is_less_version(addon_previous_ver, addon_current_ver):\n+ if addon_previous_ver is None or CmpVersion(addon_current_ver) > addon_previous_ver:\ncancel_playback = _perform_addon_changes(addon_previous_ver, addon_current_ver)\nreturn addon_previous_ver is None, cancel_playback\n@@ -48,7 +48,7 @@ def check_service_upgrade():\n# Perform service changes\nservice_previous_ver = G.LOCAL_DB.get_value('service_previous_version', None)\nservice_current_ver = G.VERSION\n- if service_previous_ver is None or is_less_version(service_previous_ver, service_current_ver):\n+ if service_previous_ver is None or CmpVersion(service_current_ver) > service_previous_ver:\n_perform_service_changes(service_previous_ver, service_current_ver)\n@@ -56,7 +56,7 @@ def _perform_addon_changes(previous_ver, current_ver):\n\"\"\"Perform actions for an version bump\"\"\"\ncancel_playback = False\nLOG.debug('Initialize addon upgrade operations, from version {} to {})', previous_ver, current_ver)\n- if previous_ver and is_less_version(previous_ver, '1.7.0'):\n+ if previous_ver and CmpVersion(previous_ver) < '1.7.0':\nfrom resources.lib.upgrade_actions import migrate_library\nmigrate_library()\ncancel_playback = True\n@@ -71,16 +71,16 @@ def _perform_service_changes(previous_ver, current_ver):\n# Clear cache (prevents problems when netflix change data structures)\nG.CACHE.clear()\n# Delete all stream continuity data - if user has upgraded from Kodi 18 to Kodi 19\n- if previous_ver and is_less_version(previous_ver, '1.13'):\n+ if previous_ver and CmpVersion(previous_ver) < '1.13':\n# There is no way to determine if the user has migrated from Kodi 18 to Kodi 19,\n# then we assume that add-on versions prior to 1.13 was on Kodi 18\n# The am_stream_continuity.py on Kodi 18 works differently and the existing data can not be used on Kodi 19\nG.SHARED_DB.clear_stream_continuity()\n- if previous_ver and is_less_version(previous_ver, '1.9.0'):\n+ if previous_ver and CmpVersion(previous_ver) < '1.9.0':\n# In the version 1.9.0 has been changed the COOKIE_ filename with a static filename\nfrom resources.lib.upgrade_actions import rename_cookie_file\nrename_cookie_file()\n- if previous_ver and is_less_version(previous_ver, '1.12.0'):\n+ if previous_ver and CmpVersion(previous_ver) < '1.12.0':\n# In the version 1.13.0:\n# - 'force_widevine' on setting.xml has been moved\n# as 'widevine_force_seclev' in TABLE_SESSION with different values:\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Implemented new version number comparer |
106,046 | 13.04.2021 08:59:30 | -7,200 | 2d8d23d7a29ca333d8bda89e33ea8321d2510977 | Fix wrong path due to last changes | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/http_server.py",
"new_path": "resources/lib/services/http_server.py",
"diff": "@@ -84,7 +84,7 @@ def handle_msl_request(server, func_name, data, params=None):\nserver.end_headers()\nserver.wfile.write(manifest_data)\nelse:\n- handle_request(server, server.server.netflix_session.msl_handler, func_name, data)\n+ handle_request(server, server.server.netflix_session, func_name, data)\ndef handle_request(server, handler, func_name, data):\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Fix wrong path due to last changes |
106,046 | 14.04.2021 08:09:09 | -7,200 | 5d42d691d95b6425cc8b8e40b8d9999299284afd | Moved get impaired Kodi settings to common | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/common/kodi_ops.py",
"new_path": "resources/lib/common/kodi_ops.py",
"diff": "@@ -207,6 +207,16 @@ def get_kodi_ui_language(iso_format=xbmc.ISO_639_1):\nreturn convert_language_iso(setting.split('.')[-1][:2], iso_format)\n+def get_kodi_is_prefer_sub_impaired():\n+ \"\"\"Return True if subtitles for impaired are enabled in Kodi settings\"\"\"\n+ return json_rpc('Settings.GetSettingValue', {'setting': 'accessibility.subhearing'})['value']\n+\n+\n+def get_kodi_is_prefer_audio_impaired():\n+ \"\"\"Return True if audio for impaired is enabled in Kodi settings\"\"\"\n+ return json_rpc('Settings.GetSettingValue', {'setting': 'accessibility.audiovisual'})['value']\n+\n+\ndef convert_language_iso(from_value, iso_format=xbmc.ISO_639_1):\n\"\"\"\nConvert given value (English name or two/three letter code) to the specified format\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/playback/am_stream_continuity.py",
"new_path": "resources/lib/services/playback/am_stream_continuity.py",
"diff": "@@ -59,8 +59,6 @@ class AMStreamContinuity(ActionManager):\nself.resume = {}\nself.is_kodi_forced_subtitles_only = None\nself.is_prefer_alternative_lang = None\n- self.is_prefer_sub_impaired = None\n- self.is_prefer_audio_impaired = None\ndef __str__(self):\nreturn ('enabled={}, videoid_parent={}'\n@@ -69,10 +67,6 @@ class AMStreamContinuity(ActionManager):\ndef initialize(self, data):\nself.is_kodi_forced_subtitles_only = common.get_kodi_subtitle_language() == 'forced_only'\nself.is_prefer_alternative_lang = G.ADDON.getSettingBool('prefer_alternative_lang')\n- self.is_prefer_sub_impaired = common.json_rpc('Settings.GetSettingValue',\n- {'setting': 'accessibility.subhearing'}).get('value')\n- self.is_prefer_audio_impaired = common.json_rpc('Settings.GetSettingValue',\n- {'setting': 'accessibility.audiovisual'}).get('value')\ndef on_playback_started(self, player_state):\nis_enabled = G.ADDON.getSettingBool('StreamContinuityManager_enabled')\n@@ -248,7 +242,7 @@ class AMStreamContinuity(ActionManager):\nlang_code = _find_lang_with_country_code(audio_list, pref_audio_language)\nif lang_code and common.get_kodi_audio_language() not in ['mediadefault', 'original']:\nstream_audio = None\n- if self.is_prefer_audio_impaired:\n+ if common.get_kodi_is_prefer_audio_impaired():\nstream_audio = next((audio_track for audio_track in audio_list\nif audio_track['language'] == lang_code\nand audio_track['isimpaired']\n@@ -350,7 +344,7 @@ class AMStreamContinuity(ActionManager):\ndef _find_subtitle_stream(self, language, is_forced=False):\n# Take in account if a user have enabled Kodi impaired subtitles preference\n# but only without forced setting (same Kodi player behaviour)\n- is_prefer_impaired = self.is_prefer_sub_impaired and not is_forced\n+ is_prefer_impaired = common.get_kodi_is_prefer_sub_impaired() and not is_forced\nsubtitles_list = self.player_state.get(STREAMS['subtitle']['list'])\nstream = None\nif is_prefer_impaired:\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Moved get impaired Kodi settings to common |
106,046 | 14.04.2021 08:19:57 | -7,200 | 2a50371f616b81a5c0954ec2ba591660f512698f | Fixed wrong selection of impaired audio track
When Kodi preferred audio setting was set as 'media default'
and the video had two default audio tracks the choice fell on the wrong track | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/nfsession/msl/converter.py",
"new_path": "resources/lib/services/nfsession/msl/converter.py",
"diff": "@@ -44,7 +44,7 @@ def convert_to_dash(manifest):\nid_default_audio_tracks = _get_id_default_audio_tracks(manifest)\nfor audio_track in manifest['audio_tracks']:\n- is_default = audio_track['id'] in id_default_audio_tracks\n+ is_default = audio_track['id'] == id_default_audio_tracks\n_convert_audio_track(audio_track, period, init_length, is_default, has_audio_drm_streams, cdn_index)\nfor text_track in manifest['timedtexttracks']:\n@@ -309,13 +309,14 @@ def _get_id_default_audio_tracks(manifest):\naudio_stream = _find_audio_stream(manifest, 'isNative', True, channels_multi)\nif not audio_stream:\naudio_stream = _find_audio_stream(manifest, 'isNative', True, channels_stereo)\n- # Try find the default track for impaired\nimp_audio_stream = {}\n+ if common.get_kodi_is_prefer_audio_impaired():\n+ # Try to find the default track for impaired\nif not is_prefer_stereo:\nimp_audio_stream = _find_audio_stream(manifest, 'language', audio_language, channels_multi, True)\nif not imp_audio_stream:\nimp_audio_stream = _find_audio_stream(manifest, 'language', audio_language, channels_stereo, True)\n- return audio_stream.get('id'), imp_audio_stream.get('id')\n+ return imp_audio_stream.get('id') or audio_stream.get('id')\ndef _find_audio_stream(manifest, property_name, property_value, channels_list, is_impaired=False):\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Fixed wrong selection of impaired audio track
When Kodi preferred audio setting was set as 'media default'
and the video had two default audio tracks the choice fell on the wrong track |
106,046 | 21.04.2021 14:29:06 | -7,200 | 150f8531ad642e2abd22f2834780c52d696edc74 | Version bump (1.15.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=\"1.15.0+matrix.1\" provider-name=\"libdev + jojo + asciidisco + caphm + castagnait\">\n+<addon id=\"plugin.video.netflix\" name=\"Netflix\" version=\"1.15.1+matrix.1\" provider-name=\"libdev + jojo + asciidisco + caphm + castagnait\">\n<requires>\n<import addon=\"xbmc.python\" version=\"3.0.0\"/>\n<import addon=\"script.module.addon.signals\" version=\"0.0.6+matrix.1\"/>\n<forum>https://forum.kodi.tv/showthread.php?tid=329767</forum>\n<source>https://github.com/CastagnaIT/plugin.video.netflix</source>\n<news>\n-v1.15.0 (2021-04-02)\n-NOTICE TO PARENTAL CONTROL:\n-THE OLD PARENTAL CONTROL WITH PIN IS NO LONGER SUPPORTED,\n-HAS BEEN DEPRECATED BY NETFLIX SINCE LAST YEAR, IF YOU KEEP USING IT\n-YOU MUST UPDATE YOUR ACCOUNT PARENTAL CONTROL SETTINGS.\n-- Fixes due to website changes (fix KeyError loco)\n-- Removed the deprecated Parental Control (with PIN protection)\n-- Improved playback startup speed\n-- Enabled IPC over HTTP by default, IPC over AddonSignals lead to a memory leak (Kodi bug)\n-- IPC now use only Pickle\n-- Add missing support to IPC over AddonSignals for the cache\n-- Joined all HTTP servers to one multithreaded to save resources\n-- Used a single web session instead of two distinct (nfsession/MSL)\n-- Cleaned many part of source code (nfsession/MSL/directory/IPC/...)\n-- Update translations zh_tw, gr\n+v1.15.1 (2021-04-21)\n+- Fixed regression to ESN/Widevine window\n+- Fixed wrong selection of audio track for impaired\n+- Add latest changes to IPC\n+- Minor changes\n</news>\n</extension>\n</addon>\n"
},
{
"change_type": "MODIFY",
"old_path": "changelog.txt",
"new_path": "changelog.txt",
"diff": "+v1.15.1 (2021-04-21)\n+- Fixed regression to ESN/Widevine window\n+- Fixed wrong selection of audio track for impaired\n+- Add latest changes to IPC\n+- Minor changes\n+\nv1.15.0 (2021-04-02)\nNOTICE TO PARENTAL CONTROL:\nTHE OLD PARENTAL CONTROL WITH PIN IS NO LONGER SUPPORTED,\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Version bump (1.15.1) (#1132) |
106,046 | 23.04.2021 14:15:33 | -7,200 | b759160abac1c98506b8bc86ddf3fd32777700a8 | Fixed uppercase problem in property
caused Kodi to play unplayable listitems | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/nfsession/directorybuilder/dir_builder_items.py",
"new_path": "resources/lib/services/nfsession/directorybuilder/dir_builder_items.py",
"diff": "@@ -165,7 +165,7 @@ def _create_episode_item(seasonid, episodeid_value, episode, episodes_list, comm\nepisodeid = seasonid.derive_episode(episodeid_value)\nlist_item = ListItemW(label=episode['title'])\nlist_item.setProperties({\n- 'isPlayable': 'true' if is_playable else 'false',\n+ 'isPlayable': str(is_playable).lower(),\n'nf_videoid': episodeid.to_string()\n})\nadd_info_list_item(list_item, episodeid, episode, episodes_list.data, False, common_data)\n@@ -289,14 +289,14 @@ def build_video_listing(video_list, menu_data, sub_genre_id=None, pathitems=None\ndef _create_video_item(videoid_value, video, video_list, perpetual_range_start, common_data): # pylint: disable=unused-argument\n- is_playable = video['availability']['isPlayable']\nvideoid = common.VideoId.from_videolist_item(video)\nis_folder = videoid.mediatype == common.VideoId.SHOW\n+ is_playable = video['availability']['isPlayable']\n+ is_video_playable = not is_folder and is_playable\nis_in_mylist = videoid in common_data['mylist_items']\n-\nlist_item = ListItemW(label=video['title'])\nlist_item.setProperties({\n- 'isPlayable': str(not is_folder and is_playable),\n+ 'isPlayable': str(is_video_playable).lower(),\n'nf_videoid': videoid.to_string(),\n'nf_is_in_mylist': str(is_in_mylist),\n'nf_perpetual_range_start': str(perpetual_range_start)\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Fixed uppercase problem in property
caused Kodi to play unplayable listitems |
106,046 | 27.04.2021 08:47:06 | -7,200 | dc3c00b70855c98efb5d511de92169492cc529d3 | Fix again playback on unplayable items | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/nfsession/directorybuilder/dir_builder_items.py",
"new_path": "resources/lib/services/nfsession/directorybuilder/dir_builder_items.py",
"diff": "@@ -314,7 +314,7 @@ def _create_video_item(videoid_value, video, video_list, perpetual_range_start,\n# The video is not playable, try check if there is a date\nlist_item.setProperty('nf_availability_message', get_availability_message(video))\nurl = common.build_url(['show_availability_message'], mode=G.MODE_ACTION)\n- return url, list_item, is_folder\n+ return url, list_item, is_folder and is_playable\n@measure_exec_time_decorator(is_immediate=True)\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Fix again playback on unplayable items |
106,046 | 23.04.2021 14:17:38 | -7,200 | a89d86d29f3f033eff621fad51a46c464da13210 | Add support to append kwarg to fixed cache identifier | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/common/cache_utils.py",
"new_path": "resources/lib/common/cache_utils.py",
"diff": "@@ -86,6 +86,8 @@ def _get_identifier(fixed_identifier, identify_from_kwarg_name,\narg_value = None\nif fixed_identifier:\nidentifier = fixed_identifier\n+ if identify_append_from_kwarg_name and kwargs.get(identify_append_from_kwarg_name):\n+ identifier += '_' + str(kwargs.get(identify_append_from_kwarg_name))\nelse:\nidentifier = str(kwargs.get(identify_from_kwarg_name) or '')\nif not identifier and args:\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Add support to append kwarg to fixed cache identifier |
106,046 | 06.05.2021 10:01:00 | -7,200 | 71a55acf527e03ee984c9429dff38a3321c8d928 | Enable Kodi version comparer | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/globals.py",
"new_path": "resources/lib/globals.py",
"diff": "@@ -246,9 +246,8 @@ class GlobalVariables:\nself.IS_SERVICE = True\nself.BASE_URL = '{scheme}://{netloc}'.format(scheme='plugin',\nnetloc=self.ADDON_ID)\n- # Disabled currently unused\n- # from resources.lib.common.kodi_ops import KodiVersion\n- # self.KODI_VERSION = KodiVersion()\n+ from resources.lib.common.kodi_ops import KodiVersion\n+ self.KODI_VERSION = KodiVersion()\n# Initialize the log\nfrom resources.lib.utils.logging import LOG\nLOG.initialize(self.ADDON_ID, self.PLUGIN_HANDLE,\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Enable Kodi version comparer |
106,046 | 06.05.2021 10:03:45 | -7,200 | f6c562cad6cf956e87c63761c979bdcf476f304f | Add default button to yesno dialog | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/kodi/ui/dialogs.py",
"new_path": "resources/lib/kodi/ui/dialogs.py",
"diff": "@@ -100,8 +100,13 @@ def show_ok_dialog(title, message):\nreturn xbmcgui.Dialog().ok(title, message)\n-def show_yesno_dialog(title, message, yeslabel=None, nolabel=None):\n+def show_yesno_dialog(title, message, yeslabel=None, nolabel=None, default_yes_button=False):\n+ if G.KODI_VERSION < '20':\nreturn xbmcgui.Dialog().yesno(title, message, yeslabel=yeslabel, nolabel=nolabel)\n+ # pylint: disable=no-member,unexpected-keyword-arg\n+ default_button = xbmcgui.DLG_YESNO_YES_BTN if default_yes_button else xbmcgui.DLG_YESNO_NO_BTN\n+ return xbmcgui.Dialog().yesno(title, message,\n+ yeslabel=yeslabel, nolabel=nolabel, defaultbutton=default_button)\ndef show_error_info(title, message, unknown_error=False, netflix_error=False):\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Add default button to yesno dialog |
106,046 | 12.05.2021 08:51:33 | -7,200 | 6ea86a54aec7afa9bdaa94fba342e2c401c789e0 | Removed "Top 10" we use the generated one from "New and Popular" | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/globals.py",
"new_path": "resources/lib/globals.py",
"diff": "@@ -101,10 +101,6 @@ class GlobalVariables:\n('currentTitles', {'path': ['video_list', 'currentTitles'],\n'loco_contexts': ['trendingNow'],\n'loco_known': True}),\n- ('mostWatched', {'path': ['video_list', 'mostWatched'], # Top 10 menu\n- 'loco_contexts': ['mostWatched'],\n- 'loco_known': True,\n- 'no_use_cache': True}),\n('mostViewed', {'path': ['video_list', 'mostViewed'],\n'loco_contexts': ['popularTitles'],\n'loco_known': True}),\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/nfsession/directorybuilder/dir_builder_items.py",
"new_path": "resources/lib/services/nfsession/directorybuilder/dir_builder_items.py",
"diff": "@@ -368,9 +368,6 @@ def build_lolomo_category_listing(lolomo_cat_list, menu_data):\ndirectory_items = []\nfor list_id, summary_data, video_list in lolomo_cat_list.lists():\nmenu_parameters = common.MenuIdParameters(list_id)\n- # Skip \"Top 10\" list, currently we have it in the main menu\n- if menu_parameters.type_id == '101':\n- continue\n# Create dynamic sub-menu info in MAIN_MENU_ITEMS\nsub_menu_data = menu_data.copy()\nsub_menu_data['path'] = [menu_data['path'][0], list_id, list_id]\n@@ -379,7 +376,7 @@ def build_lolomo_category_listing(lolomo_cat_list, menu_data):\nsub_menu_data['content_type'] = menu_data.get('content_type', G.CONTENT_SHOW)\nsub_menu_data['title'] = summary_data['displayName']\nsub_menu_data['initial_menu_id'] = menu_data.get('initial_menu_id', menu_data['path'][1])\n- # sub_menu_data['no_use_cache'] = menu_parameters.type_id == '101'\n+ sub_menu_data['no_use_cache'] = menu_parameters.type_id == '101'\nG.LOCAL_DB.set_value(list_id, sub_menu_data, TABLE_MENU_DATA)\ndirectory_item = _create_category_item(list_id, video_list, sub_menu_data, common_data, summary_data)\ndirectory_items.append(directory_item)\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/settings.xml",
"new_path": "resources/settings.xml",
"diff": "<default>true</default>\n<control type=\"toggle\"/>\n</setting>\n- <setting id=\"show_menu_mostwatched\" type=\"boolean\" label=\"30242\" help=\"\">\n- <level>0</level>\n- <default>true</default>\n- <control type=\"toggle\"/>\n- </setting>\n<setting id=\"show_menu_mostviewed\" type=\"boolean\" label=\"30172\" help=\"\">\n<level>0</level>\n<default>true</default>\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Removed "Top 10" we use the generated one from "New and Popular" |
106,046 | 12.05.2021 10:01:46 | -7,200 | 5a375619c0f0681df7d75bab3d48bed4b8df708f | Do not show empty lists | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/nfsession/directorybuilder/dir_builder_items.py",
"new_path": "resources/lib/services/nfsession/directorybuilder/dir_builder_items.py",
"diff": "@@ -367,6 +367,8 @@ def build_lolomo_category_listing(lolomo_cat_list, menu_data):\n}\ndirectory_items = []\nfor list_id, summary_data, video_list in lolomo_cat_list.lists():\n+ if summary_data['length'] == 0: # Do not show empty lists\n+ continue\nmenu_parameters = common.MenuIdParameters(list_id)\n# Create dynamic sub-menu info in MAIN_MENU_ITEMS\nsub_menu_data = menu_data.copy()\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Do not show empty lists |
106,046 | 12.05.2021 11:08:52 | -7,200 | 0402bf1bf03aa386591a7a8a9f97d048e2f50b22 | Fix lost selection of the current directory listitem
Kodi become crazy when more listitems share the same url | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/navigation/actions.py",
"new_path": "resources/lib/navigation/actions.py",
"diff": "@@ -209,7 +209,8 @@ class AddonActionExecutor:\npass\ncommon.container_refresh()\n- def show_availability_message(self, pathitems=None): # pylint: disable=unused-argument\n+ @common.inject_video_id(path_offset=1)\n+ def show_availability_message(self, videoid): # pylint: disable=unused-argument\n\"\"\"Show a message to the user to show the date of availability of a video\"\"\"\n# Try get the promo trailer path\ntrailer_path = xbmc.getInfoLabel('ListItem.Trailer')\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/nfsession/directorybuilder/dir_builder_items.py",
"new_path": "resources/lib/services/nfsession/directorybuilder/dir_builder_items.py",
"diff": "@@ -328,7 +328,7 @@ def _create_video_item(videoid_value, video, video_list, perpetual_range_start,\nis_in_remind_me = video['inRemindMeList'] or video['queue']['inQueue']\ntrackid = video['trackIds']['trackId']\nlist_item.addContextMenuItems(generate_context_menu_remind_me(videoid, is_in_remind_me, trackid))\n- url = common.build_url(['show_availability_message'], mode=G.MODE_ACTION)\n+ url = common.build_url(['show_availability_message'], videoid=videoid, mode=G.MODE_ACTION)\nreturn url, list_item, is_folder and is_playable\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Fix lost selection of the current directory listitem
Kodi become crazy when more listitems share the same url |
106,046 | 12.05.2021 17:21:00 | -7,200 | 1b422424e720bc3f482bdecb56990863edef4975 | Use trackid_jaw value | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/nfsession/directorybuilder/dir_builder_items.py",
"new_path": "resources/lib/services/nfsession/directorybuilder/dir_builder_items.py",
"diff": "@@ -326,7 +326,7 @@ def _create_video_item(videoid_value, video, video_list, perpetual_range_start,\nexcept CacheMiss:\n# The website check the \"Remind Me\" value on key \"inRemindMeList\" and also \"queue\"/\"inQueue\"\nis_in_remind_me = video['inRemindMeList'] or video['queue']['inQueue']\n- trackid = video['trackIds']['trackId']\n+ trackid = video['trackIds']['trackId_jaw']\nlist_item.addContextMenuItems(generate_context_menu_remind_me(videoid, is_in_remind_me, trackid))\nurl = common.build_url(['show_availability_message'], videoid=videoid, mode=G.MODE_ACTION)\nreturn url, list_item, is_folder and is_playable\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Use trackid_jaw value |
106,046 | 14.05.2021 11:34:28 | -7,200 | 439f96c5cfc565e8df7eb4b3c5e5749865606707 | Changes to DASH robustness_level
refer to | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/nfsession/msl/converter.py",
"new_path": "resources/lib/services/nfsession/msl/converter.py",
"diff": "@@ -111,16 +111,12 @@ def _add_protection_info(adaptation_set, pssh, keyid):\ntable=TABLE_SESSION)\nif (G.LOCAL_DB.get_value('drm_security_level', '', table=TABLE_SESSION) == 'L1'\nand wv_force_sec_lev == WidevineForceSecLev.DISABLED):\n- # The flag HW_SECURE_CODECS_REQUIRED is mandatory for L1 devices,\n- # if it is set on L3 devices ISA already remove it automatically.\n- # But some L1 devices with non regular Widevine library cause issues then need to be handled\n- robustness_level = 'HW_SECURE_CODECS_REQUIRED'\n- else:\n- robustness_level = ''\n+ # NOTE: This is needed only when on ISA is enabled the Expert setting \"Don't use secure decoder if possible\"\n+ # The flag HW_SECURE_CODECS_REQUIRED is mandatory for L1 devices (if set on L3 devices is ignored)\nET.SubElement(\nprotection, # Parent\n'widevine:license', # Tag\n- robustness_level=robustness_level)\n+ robustness_level='HW_SECURE_CODECS_REQUIRED')\nif pssh:\nET.SubElement(protection, 'cenc:pssh').text = pssh\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Changes to DASH robustness_level
refer to https://github.com/xbmc/inputstream.adaptive/pull/662 |
106,046 | 14.05.2021 13:30:53 | -7,200 | cf12c4700ff5e4161ce1ff7f764a676c0fdf9f0a | Enabled watched status sync by default | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/kodi/context_menu.py",
"new_path": "resources/lib/kodi/context_menu.py",
"diff": "@@ -81,7 +81,7 @@ def generate_context_menu_items(videoid, is_in_mylist, perpetual_range_start=Non\nif videoid.mediatype in [common.VideoId.MOVIE, common.VideoId.EPISODE]:\n# Add menu to allow change manually the watched status when progress manager is enabled\n- if G.ADDON.getSettingBool('ProgressManager_enabled'):\n+ if G.ADDON.getSettingBool('sync_watched_status'):\nitems.insert(0, _ctx_item('change_watched_status', videoid))\nreturn items\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/navigation/directory_utils.py",
"new_path": "resources/lib/navigation/directory_utils.py",
"diff": "@@ -106,7 +106,7 @@ def auto_scroll(dir_items):\nworks only with Sync of watched status with netflix\n\"\"\"\n# A sad implementation to a Kodi feature available only for the Kodi library\n- if G.ADDON.getSettingBool('ProgressManager_enabled') and G.ADDON.getSettingBool('select_first_unwatched'):\n+ if G.ADDON.getSettingBool('sync_watched_status') and G.ADDON.getSettingBool('select_first_unwatched'):\ntotal_items = len(dir_items)\nif total_items:\n# Delay a bit to wait for the completion of the screen update\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/navigation/keymaps.py",
"new_path": "resources/lib/navigation/keymaps.py",
"diff": "@@ -74,7 +74,7 @@ class KeymapsActionExecutor:\n\"\"\"Change the watched status of a video, only when sync of watched status with NF is enabled\"\"\"\nif videoid.mediatype not in [common.VideoId.MOVIE, common.VideoId.EPISODE]:\nreturn\n- if G.ADDON.getSettingBool('ProgressManager_enabled'):\n+ if G.ADDON.getSettingBool('sync_watched_status'):\nchange_watched_status_locally(videoid)\n@allow_execution_decorator(inject_videoid=True)\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/nfsession/directorybuilder/dir_builder_items.py",
"new_path": "resources/lib/services/nfsession/directorybuilder/dir_builder_items.py",
"diff": "@@ -149,7 +149,7 @@ def build_episode_listing(episodes_list, seasonid, pathitems=None):\n\"\"\"Build a episodes listing of a season\"\"\"\ncommon_data = {\n'params': get_param_watched_status_by_profile(),\n- 'set_watched_status': G.ADDON.getSettingBool('ProgressManager_enabled'),\n+ 'set_watched_status': G.ADDON.getSettingBool('sync_watched_status'),\n'supplemental_info_color': get_color_name(G.ADDON.getSettingInt('supplemental_info_color')),\n'profile_language_code': G.LOCAL_DB.get_profile_config('language', ''),\n'active_profile_guid': G.LOCAL_DB.get_active_profile_guid()\n@@ -254,7 +254,7 @@ def build_video_listing(video_list, menu_data, sub_genre_id=None, pathitems=None\ncommon_data = {\n'params': get_param_watched_status_by_profile(),\n'mylist_items': mylist_items,\n- 'set_watched_status': G.ADDON.getSettingBool('ProgressManager_enabled'),\n+ 'set_watched_status': G.ADDON.getSettingBool('sync_watched_status'),\n'supplemental_info_color': get_color_name(G.ADDON.getSettingInt('supplemental_info_color')),\n'mylist_titles_color': (get_color_name(G.ADDON.getSettingInt('mylist_titles_color'))\nif menu_data['path'][1] != 'myList'\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/nfsession/msl/msl_handler.py",
"new_path": "resources/lib/services/nfsession/msl/msl_handler.py",
"diff": "@@ -111,7 +111,7 @@ class MSLHandler:\nif self.events_handler_thread:\nself.events_handler_thread.stop_join()\nself.events_handler_thread = None\n- if G.ADDON.getSettingBool('ProgressManager_enabled') or override_enable:\n+ if G.ADDON.getSettingBool('sync_watched_status') or override_enable:\nself.events_handler_thread = EventsHandler(self.msl_requests.chunked_request, self.nfsession)\nself.events_handler_thread.start()\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/playback/am_playback.py",
"new_path": "resources/lib/services/playback/am_playback.py",
"diff": "@@ -79,7 +79,7 @@ class AMPlayback(ActionManager):\nreturn\nif not self.watched_threshold or not player_state['elapsed_seconds'] > self.watched_threshold:\nreturn\n- if G.ADDON.getSettingBool('ProgressManager_enabled') and not self.is_played_from_strm:\n+ if G.ADDON.getSettingBool('sync_watched_status') and not self.is_played_from_strm:\n# This have not to be applied with our custom watched status of Netflix sync, within the addon\nreturn\nif self.is_played_from_strm:\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/playback/am_video_events.py",
"new_path": "resources/lib/services/playback/am_video_events.py",
"diff": "@@ -28,7 +28,7 @@ if TYPE_CHECKING: # This variable/imports are used only by the editor, so not a\nclass AMVideoEvents(ActionManager):\n\"\"\"Detect the progress of the played video and send the data to the netflix service\"\"\"\n- SETTING_ID = 'ProgressManager_enabled'\n+ SETTING_ID = 'sync_watched_status'\ndef __init__(self, nfsession: 'NFSessionOperations', msl_handler: 'MSLHandler',\ndirectory_builder: 'DirectoryBuilder'):\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/settings_monitor.py",
"new_path": "resources/lib/services/settings_monitor.py",
"diff": "@@ -142,8 +142,8 @@ def _check_msl_profiles(clean_buckets):\ndef _check_watched_status_sync():\n\"\"\"Check if NF watched status sync setting is changed\"\"\"\n- progress_manager_enabled = G.ADDON.getSettingBool('ProgressManager_enabled')\n- progress_manager_enabled_old = G.LOCAL_DB.get_value('progress_manager_enabled', False, TABLE_SETTINGS_MONITOR)\n+ progress_manager_enabled = G.ADDON.getSettingBool('sync_watched_status')\n+ progress_manager_enabled_old = G.LOCAL_DB.get_value('sync_watched_status', True, TABLE_SETTINGS_MONITOR)\nif progress_manager_enabled != progress_manager_enabled_old:\n- G.LOCAL_DB.set_value('progress_manager_enabled', progress_manager_enabled, TABLE_SETTINGS_MONITOR)\n+ G.LOCAL_DB.set_value('sync_watched_status', progress_manager_enabled, TABLE_SETTINGS_MONITOR)\ncommon.send_signal(common.Signals.SWITCH_EVENTS_HANDLER, progress_manager_enabled)\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/upgrade_controller.py",
"new_path": "resources/lib/upgrade_controller.py",
"diff": "@@ -104,6 +104,12 @@ def _perform_service_changes(previous_ver, current_ver):\nui.show_ok_dialog('Netflix add-on upgrade',\n'This add-on upgrade has reset your ESN code, if you had set an ESN code manually '\n'you must re-enter it again in the Expert settings, otherwise simply ignore this message.')\n+ if previous_ver and CmpVersion(previous_ver) < '1.16.0':\n+ # In the version 1.16.0 the watched status sync setting has been enabled by default,\n+ # therefore to be able to keep the user's setting even when it has never been changed,\n+ # we have done a new setting (ProgressManager_enabled >> to >> sync_watched_status)\n+ with G.SETTINGS_MONITOR.ignore_events(1):\n+ G.ADDON.setSettingBool('sync_watched_status', G.ADDON.getSettingBool('ProgressManager_enabled'))\n# Always leave this to last - After the operations set current version\nG.LOCAL_DB.set_value('service_previous_version', current_ver)\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/settings.xml",
"new_path": "resources/settings.xml",
"diff": "</group>\n<!--GROUP: Other options-->\n<group id=\"3\" label=\"30015\">\n- <setting id=\"ProgressManager_enabled\" type=\"boolean\" label=\"30235\" help=\"\">\n+ <setting id=\"ProgressManager_enabled\" type=\"boolean\" label=\"30235\" help=\"\"><!--DEPRECATED: kept only for add-on upgrade purpose-->\n<level>0</level>\n<default>false</default>\n+ <visible>false</visible>\n<control type=\"toggle\"/>\n</setting>\n- <setting id=\"sync_watched_status_library\" type=\"boolean\" label=\"30301\" help=\"\" parent=\"ProgressManager_enabled\">\n+ <setting id=\"sync_watched_status\" type=\"boolean\" label=\"30235\" help=\"\">\n+ <level>0</level>\n+ <default>true</default>\n+ <control type=\"toggle\"/>\n+ </setting>\n+ <setting id=\"sync_watched_status_library\" type=\"boolean\" label=\"30301\" help=\"\" parent=\"sync_watched_status\">\n<level>0</level>\n<default>false</default>\n<control type=\"toggle\"/>\n<dependencies>\n- <dependency type=\"visible\" setting=\"ProgressManager_enabled\">true</dependency>\n+ <dependency type=\"visible\" setting=\"sync_watched_status\">true</dependency>\n</dependencies>\n</setting>\n- <setting id=\"select_first_unwatched\" type=\"boolean\" label=\"30243\" help=\"\" parent=\"ProgressManager_enabled\">\n+ <setting id=\"select_first_unwatched\" type=\"boolean\" label=\"30243\" help=\"\" parent=\"sync_watched_status\">\n<level>0</level>\n<default>false</default>\n<control type=\"toggle\"/>\n<dependencies>\n- <dependency type=\"visible\" setting=\"ProgressManager_enabled\">true</dependency>\n+ <dependency type=\"visible\" setting=\"sync_watched_status\">true</dependency>\n</dependencies>\n</setting>\n<setting id=\"mylist_titles_color\" type=\"integer\" label=\"30215\" help=\"\">\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Enabled watched status sync by default |
106,046 | 15.05.2021 10:50:52 | -7,200 | b3e6c043c62b14c962f60924a66e0dc54c3b45d0 | Disabled HEVC profile setting on non-android device
HEVC works only on android | [
{
"change_type": "MODIFY",
"old_path": "resources/settings.xml",
"new_path": "resources/settings.xml",
"diff": "<control type=\"toggle\"/>\n</setting>\n<setting id=\"enable_hevc_profiles\" type=\"boolean\" label=\"30060\" help=\"\">\n+ <requirement>HAS_MEDIACODEC</requirement><!--Visible only for Android-->\n<level>0</level>\n<default>false</default>\n<control type=\"toggle\"/>\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Disabled HEVC profile setting on non-android device
HEVC works only on android |
106,046 | 17.05.2021 13:58:23 | -7,200 | 4b8f619c9dd7f070e18874487e4dd14c7c46e4a9 | Fix wrong parsed VP9 codec string
The VP9 profile number was wrong | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/nfsession/msl/converter.py",
"new_path": "resources/lib/services/nfsession/msl/converter.py",
"diff": "@@ -189,7 +189,7 @@ def _determine_video_codec(content_profile):\nreturn 'dvhe'\nreturn 'hevc'\nif content_profile.startswith('vp9'):\n- return 'vp9.0.' + content_profile[14:16]\n+ return 'vp9.' + content_profile[11:12]\nreturn 'h264'\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Fix wrong parsed VP9 codec string
The VP9 profile number was wrong |
106,046 | 17.05.2021 14:00:35 | -7,200 | 69da87ed267230ef1ac86f1a48452d790a5b9faf | Enabled VP9 by default to all systems except android
With Kodi 19 there should be no more problems
Android is excluded because depends on device capability | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/config_wizard.py",
"new_path": "resources/lib/config_wizard.py",
"diff": "@@ -66,21 +66,13 @@ def _set_isa_addon_settings(is_4k_capable, hdcp_override):\ndef _set_profiles(system, is_4k_capable):\n\"\"\"Method for self-configuring of netflix manifest profiles\"\"\"\n- enable_vp9_profiles = False\n- enable_hevc_profiles = False\n- if system in ['osx', 'ios']:\n- enable_hevc_profiles = True\n- elif system in ['windows', 'uwp']:\nenable_vp9_profiles = True\n- elif system == 'android':\n+ enable_hevc_profiles = False\n+ if system == 'android':\n# By default we do not enable VP9 because on some devices do not fully support it\n+ enable_vp9_profiles = False\n# By default we do not enable HEVC because not all device support it, then enable it only on 4K capable devices\nenable_hevc_profiles = is_4k_capable\n- elif system == 'linux':\n- # Too many different linux systems, we can not predict all the behaviors\n- # some linux distributions have encountered problems with VP9,\n- # some OSMC users reported that HEVC does not work well\n- pass\nG.ADDON.setSettingBool('enable_vp9_profiles', enable_vp9_profiles)\nG.ADDON.setSettingBool('enable_hevc_profiles', enable_hevc_profiles)\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Enabled VP9 by default to all systems except android
With Kodi 19 there should be no more problems
Android is excluded because depends on device capability |
106,046 | 19.05.2021 10:00:42 | -7,200 | c9ec8bacecc97e3a5b9ed0d19c72de9b07733b07 | Disabled HEVC profile setting on non-android device | [
{
"change_type": "MODIFY",
"old_path": "resources/settings.xml",
"new_path": "resources/settings.xml",
"diff": "<control type=\"toggle\"/>\n</setting>\n<setting id=\"enable_hevc_profiles\" type=\"boolean\" label=\"30060\" help=\"\">\n+ <dependencies>\n+ <dependency type=\"visible\">\n+ <condition on=\"property\" name=\"InfoBool\">system.platform.android</condition>\n+ </dependency>\n+ </dependencies>\n<level>0</level>\n<default>false</default>\n<control type=\"toggle\"/>\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Disabled HEVC profile setting on non-android device |
106,046 | 22.05.2021 14:37:42 | -7,200 | b1bb021415ba8f5e6aa007642a922736a73f88d6 | Convert macrolanguage codes | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/nfsession/msl/converter.py",
"new_path": "resources/lib/services/nfsession/msl/converter.py",
"diff": "@@ -37,8 +37,8 @@ def convert_to_dash(manifest):\nfor video_track in manifest['video_tracks']:\n_convert_video_track(video_track, period, init_length, video_protection_info, has_video_drm_streams, cdn_index)\n- common.fix_locale_languages(manifest['audio_tracks'])\n- common.fix_locale_languages(manifest['timedtexttracks'])\n+ common.apply_lang_code_changes(manifest['audio_tracks'])\n+ common.apply_lang_code_changes(manifest['timedtexttracks'])\nhas_audio_drm_streams = manifest['audio_tracks'][0].get('hasDrmStreams', False)\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/nfsession/msl/msl_utils.py",
"new_path": "resources/lib/services/nfsession/msl/msl_utils.py",
"diff": "@@ -83,7 +83,7 @@ def update_play_times_duration(play_times, player_state):\ndef build_media_tag(player_state, manifest):\n\"\"\"Build the playTimes and the mediaId data by parsing manifest and the current player streams used\"\"\"\n- common.fix_locale_languages(manifest['audio_tracks'])\n+ common.apply_lang_code_changes(manifest['audio_tracks'])\nduration = player_state['elapsed_seconds'] * 1000\naudio_downloadable_id, audio_track_id = _find_audio_data(player_state, manifest)\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Convert macrolanguage codes |
106,004 | 29.05.2021 19:24:01 | -32,400 | 923850f0a100f1514e766daae662ed9702f2116b | refactor: if-statement easier to read | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/utils/website.py",
"new_path": "resources/lib/utils/website.py",
"diff": "@@ -246,12 +246,12 @@ def validate_login(react_context):\nerror_code = common.get_path(path_error_code, react_context)\nLOG.error('Login not valid, error code {}', error_code)\nerror_description = common.get_local_string(30102) + error_code\n- if error_code in error_code_list:\n- error_description = error_code_list[error_code]\n- if 'email_' + error_code in error_code_list:\n- error_description = error_code_list['email_' + error_code]\nif 'login_' + error_code in error_code_list:\nerror_description = error_code_list['login_' + error_code]\n+ elif 'email_' + error_code in error_code_list:\n+ error_description = error_code_list['email_' + error_code]\n+ elif error_code in error_code_list:\n+ error_description = error_code_list[error_code]\nraise LoginValidateError(common.remove_html_tags(error_description))\nexcept (AttributeError, KeyError) as exc:\nimport traceback\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | refactor: if-statement easier to read |
106,046 | 03.06.2021 09:30:57 | -7,200 | 92d6d89930a9e9f22ed9c4fe5b7ce15224f82291 | Increased waiting time
sometimes happen that the list takes longer to complete the refresh | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/navigation/directory_utils.py",
"new_path": "resources/lib/navigation/directory_utils.py",
"diff": "@@ -110,7 +110,7 @@ def auto_scroll(dir_items):\ntotal_items = len(dir_items)\nif total_items:\n# Delay a bit to wait for the completion of the screen update\n- xbmc.sleep(100)\n+ xbmc.sleep(200)\nif not _auto_scroll_init_checks():\nreturn\n# Check if all items are already watched\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Increased waiting time
sometimes happen that the list takes longer to complete the refresh |
106,046 | 03.06.2021 09:43:52 | -7,200 | 8a6f865289bc83a2fa4f00095831a1825e3a6cbe | Version bump (1.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=\"1.15.1+matrix.1\" provider-name=\"libdev + jojo + asciidisco + caphm + castagnait\">\n+<addon id=\"plugin.video.netflix\" name=\"Netflix\" version=\"1.16.0+matrix.1\" provider-name=\"libdev + jojo + asciidisco + caphm + castagnait\">\n<requires>\n<import addon=\"xbmc.python\" version=\"3.0.0\"/>\n<import addon=\"script.module.addon.signals\" version=\"0.0.6+matrix.1\"/>\n<forum>https://forum.kodi.tv/showthread.php?tid=329767</forum>\n<source>https://github.com/CastagnaIT/plugin.video.netflix</source>\n<news>\n-v1.15.1 (2021-04-21)\n-- Fixed regression to ESN/Widevine window\n-- Fixed wrong selection of audio track for impaired\n-- Add latest changes to IPC\n+v1.16.0 (2021-06-03)\n+- Add new menu \"New and Popular\"\n+- Add feature to play promo trailer on unavailable videos\n+- Add \"Remind me\" feature on unavailable videos\n+- Norwegian macrolanguages are now played/selected as the main Norwegian language\n+- Watched status sync is now enabled by default (on new installs)\n+- VP9 codec profile is now enabled by default (on new installs for non-android devices)\n+- \"Top 10\" menu is now under \"New and Popular\" menu\n+- Re-added Up Next add-on install menu\n+- Unplayable videos no longer cause playback error\n- Minor changes\n+- Update translations cs_cz, it, hu, de, cz, fr, ro, jp, kr, pt-br, zh_tw\n</news>\n</extension>\n</addon>\n"
},
{
"change_type": "MODIFY",
"old_path": "changelog.txt",
"new_path": "changelog.txt",
"diff": "+v1.16.0 (2021-06-03)\n+- Add new menu \"New and Popular\"\n+- Add feature to play promo trailer on unavailable videos\n+- Add \"Remind me\" feature on unavailable videos\n+- Norwegian macrolanguages are now played/selected as the main Norwegian language\n+- Watched status sync is now enabled by default (on new installs)\n+- VP9 codec profile is now enabled by default (on new installs for non-android devices)\n+- \"Top 10\" menu is now under \"New and Popular\" menu\n+- Re-added Up Next add-on install menu\n+- Unplayable videos no longer cause playback error\n+- Minor changes\n+- Update translations cs_cz, it, hu, de, cz, fr, ro, jp, kr, pt-br, zh_tw\n+\nv1.15.1 (2021-04-21)\n- Fixed regression to ESN/Widevine window\n- Fixed wrong selection of audio track for impaired\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Version bump (1.16.0) (#1165) |
106,046 | 12.06.2021 17:07:22 | -7,200 | c71b92614f75ac6869c6eb1e3f8c4d836602a254 | Updated video profiles | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/nfsession/msl/profiles.py",
"new_path": "resources/lib/services/nfsession/msl/profiles.py",
"diff": "from resources.lib.globals import G\nimport resources.lib.common as common\n-HEVC = 'hevc-main-'\nHEVC_M10 = 'hevc-main10-'\nCENC_PRK = 'dash-cenc-prk'\n+CENC_PRK_DO = 'dash-cenc-prk-do'\nCENC = 'dash-cenc'\nCENC_TL = 'dash-cenc-tl'\nHDR = 'hevc-hdr-main10-'\nDV5 = 'hevc-dv5-main10-'\nVP9_PROFILE0 = 'vp9-profile0-'\n-VP9_PROFILE2 = 'vp9-profile2-'\n+# VP9 Profile 2 (HDR) test only, the website does not list it but some videos still have this profile available\n+# VP9_PROFILE2 = 'vp9-profile2-'\nBASE_LEVELS = ['L30-', 'L31-', 'L40-', 'L41-', 'L50-', 'L51-']\n-CENC_TL_LEVELS = ['L30-L31-', 'L31-L40-', 'L40-L41-', 'L50-L51-']\nVP9_PROFILE0_LEVELS = ['L21-', 'L30-', 'L31-', 'L40-']\n-VP9_PROFILE2_LEVELS = ['L30-', 'L31-', 'L40-', 'L50-', 'L51-']\n+# VP9_PROFILE2_LEVELS = ['L30-', 'L31-', 'L40-', 'L50-', 'L51-']\ndef _profile_strings(base, tails):\n@@ -45,26 +45,25 @@ PROFILES = {\n'playready-h264hpl22-dash', 'playready-h264hpl30-dash',\n'playready-h264hpl31-dash', 'playready-h264hpl40-dash'],\n'hevc':\n- _profile_strings(base=HEVC,\n- tails=[(BASE_LEVELS, CENC),\n- (CENC_TL_LEVELS, CENC_TL)]) +\n_profile_strings(base=HEVC_M10,\ntails=[(BASE_LEVELS, CENC),\n(BASE_LEVELS[:4], CENC_PRK),\n- (CENC_TL_LEVELS, CENC_TL)]),\n+ (BASE_LEVELS, CENC_PRK_DO)]),\n'hdr':\n_profile_strings(base=HDR,\ntails=[(BASE_LEVELS, CENC),\n- (BASE_LEVELS, CENC_PRK)]),\n+ (BASE_LEVELS, CENC_PRK),\n+ (BASE_LEVELS, CENC_PRK_DO)]),\n'dolbyvision':\n_profile_strings(base=DV5,\n- tails=[(BASE_LEVELS, CENC_PRK)]),\n+ tails=[(BASE_LEVELS, CENC_PRK),\n+ (BASE_LEVELS, CENC_PRK_DO)]),\n'vp9profile0':\n_profile_strings(base=VP9_PROFILE0,\n- tails=[(VP9_PROFILE0_LEVELS, CENC)]),\n- 'vp9profile2':\n- _profile_strings(base=VP9_PROFILE2,\n- tails=[(VP9_PROFILE2_LEVELS, CENC_PRK)])\n+ tails=[(VP9_PROFILE0_LEVELS, CENC)])\n+ # 'vp9profile2':\n+ # _profile_strings(base=VP9_PROFILE2,\n+ # tails=[(VP9_PROFILE2_LEVELS, CENC_PRK)])\n}\n@@ -74,7 +73,7 @@ def enabled_profiles():\nPROFILES['h264'] +\n_subtitle_profiles() +\n_additional_profiles('vp9profile0', 'enable_vp9_profiles') +\n- _additional_profiles('vp9profile2', 'enable_vp9_profiles') +\n+ # _additional_profiles('vp9profile2', 'enable_vp9_profiles') +\n_additional_profiles('dolbysound', 'enable_dolby_sound') +\n_additional_profiles('hevc', 'enable_hevc_profiles') +\n_additional_profiles('hdr',\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Updated video profiles |
106,046 | 12.06.2021 17:11:31 | -7,200 | 4c8359bfd846a493d32891245129f23c995ccc6f | Allow browse network paths | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/kodi/ui/dialogs.py",
"new_path": "resources/lib/kodi/ui/dialogs.py",
"diff": "@@ -140,7 +140,7 @@ def show_browse_dialog(title, browse_type=0, default_path=None, multi_selection=\n:param extensions: extensions allowed e.g. '.jpg|.png'\n:return: The selected path as string (or tuple of selected items) if user pressed 'Ok', else None\n\"\"\"\n- ret = xbmcgui.Dialog().browse(browse_type, title, shares='local', useThumbs=False, treatAsFolder=False,\n+ ret = xbmcgui.Dialog().browse(browse_type, title, shares='', useThumbs=False, treatAsFolder=False,\ndefaultt=default_path, enableMultiple=multi_selection, mask=extensions)\n# Note: when defaultt is set and the user cancel the action (when enableMultiple is False),\n# will be returned the defaultt value again, so we avoid this strange behavior...\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Allow browse network paths |
106,046 | 14.06.2021 09:39:24 | -7,200 | e844371efa1cc679202840f1afae81a133b35a40 | Allow to always have play callbacks also with playlists
Fix broken addon action_controller services | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/navigation/player.py",
"new_path": "resources/lib/navigation/player.py",
"diff": "@@ -94,6 +94,8 @@ def get_inputstream_listitem(videoid):\nlist_item.setContentLookup(False)\nlist_item.setMimeType('application/xml+dash')\nlist_item.setProperty('IsPlayable', 'true')\n+ # Allows the add-on to always have play callbacks also when using the playlist (Kodi versions >= 20)\n+ list_item.setProperty('ForceResolvePlugin', 'true')\ntry:\nimport inputstreamhelper\nis_helper = inputstreamhelper.Helper('mpd', drm='widevine')\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Allow to always have play callbacks also with playlists
Fix broken addon action_controller services |
106,046 | 15.06.2021 14:30:11 | -7,200 | 7411f36e645830e28779bd4bca70b6c30abb2711 | Fix db query error introduced by | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/database/db_utils.py",
"new_path": "resources/lib/database/db_utils.py",
"diff": "@@ -74,8 +74,8 @@ def sql_filtered_insert(table, set_columns, values):\ndel values[index]\nvalues_fields = ['?'] * len(set_columns)\nquery_columns = ', '.join(set_columns)\n- values = ', '.join(values_fields)\n- query = f'INSERT INTO {table} ({query_columns}) VALUES ({values})'\n+ values_fields = ', '.join(values_fields)\n+ query = f'INSERT INTO {table} ({query_columns}) VALUES ({values_fields})'\nreturn query, values\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Fix db query error introduced by #1177 |
106,046 | 15.06.2021 15:33:08 | -7,200 | 3ee67548812ff35821ab6fed6628f6342bec9dd8 | Removed wrong argument | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/utils/website.py",
"new_path": "resources/lib/utils/website.py",
"diff": "@@ -149,7 +149,7 @@ def parse_profiles(data):\n_delete_non_existing_profiles(current_guids)\nexcept Exception as exc: # pylint: disable=broad-except\nimport traceback\n- LOG.error(traceback.format_exc(), 'latin-1')\n+ LOG.error(traceback.format_exc())\nLOG.error('Profile list data: {}', profiles_list)\nraise InvalidProfilesError from exc\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Removed wrong argument |
106,046 | 18.06.2021 13:39:14 | -7,200 | 6844f1af0737064c2402090ff3e6cb1120fc632d | Removed workaround for "1 more item" problem
netflix has fixed the API bug | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/nfsession/session/path_requests.py",
"new_path": "resources/lib/services/nfsession/session/path_requests.py",
"diff": "@@ -53,17 +53,9 @@ class SessionPathRequests(SessionAccess):\n# multiple path requests will be executed with forward shifting range selectors\n# and the results will be combined into one path response.\nresponse_type, length_args = length_params\n- context_name = length_args[0]\n+ # context_name = length_args[0]\nresponse_length = apipaths.LENGTH_ATTRIBUTES[response_type]\n-\n- # Note: when the request is made with 'genres' or 'seasons' context,\n- # the response strangely does not respect the number of objects\n- # requested, returning 1 more item, i couldn't understand why\n- if context_name in ['genres', 'seasons']:\n- request_size -= 1\nresponse_size = request_size + 1\n- if context_name in ['genres', 'seasons']:\n- response_size += 1\nnumber_of_requests = 100 if no_limit_req else int(G.ADDON.getSettingInt('page_results') / 45)\nperpetual_range_start = int(perpetual_range_start) if perpetual_range_start else 0\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Removed workaround for "1 more item" problem
netflix has fixed the API bug |
106,046 | 20.06.2021 10:14:22 | -7,200 | d0be74cc8c0d51c19c606751bd212ff09254e5d1 | Version bump (1.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=\"1.16.0+matrix.1\" provider-name=\"libdev + jojo + asciidisco + caphm + castagnait\">\n+<addon id=\"plugin.video.netflix\" name=\"Netflix\" version=\"1.16.1+matrix.1\" provider-name=\"libdev + jojo + asciidisco + caphm + castagnait\">\n<requires>\n<import addon=\"xbmc.python\" version=\"3.0.0\"/>\n<import addon=\"script.module.addon.signals\" version=\"0.0.6+matrix.1\"/>\n<forum>https://forum.kodi.tv/showthread.php?tid=329767</forum>\n<source>https://github.com/CastagnaIT/plugin.video.netflix</source>\n<news>\n-v1.16.0 (2021-06-03)\n-- Add new menu \"New and Popular\"\n-- Add feature to play promo trailer on unavailable videos\n-- Add \"Remind me\" feature on unavailable videos\n-- Norwegian macrolanguages are now played/selected as the main Norwegian language\n-- Watched status sync is now enabled by default (on new installs)\n-- VP9 codec profile is now enabled by default (on new installs for non-android devices)\n-- \"Top 10\" menu is now under \"New and Popular\" menu\n-- Re-added Up Next add-on install menu\n-- Unplayable videos no longer cause playback error\n+v1.16.1 (2021-06-20)\n+- Updated video profiles for HEVC/HEVC HDR\n+- Add support to browse network paths with open file/folder dialog\n+- Fixed missing items in episodes lists and others submenus\n+- Fixed broken add-on services when play videos from playlist (only Kodi 20)\n+- Update translations gl_es\n- Minor changes\n-- Update translations cs_cz, it, hu, de, cz, fr, ro, jp, kr, pt-br, zh_tw\n</news>\n</extension>\n</addon>\n"
},
{
"change_type": "MODIFY",
"old_path": "changelog.txt",
"new_path": "changelog.txt",
"diff": "+v1.16.1 (2021-06-20)\n+- Updated video profiles for HEVC/HEVC HDR\n+- Add support to browse network paths with open file/folder dialog\n+- Fixed missing items in episodes lists and others submenus\n+- Fixed broken add-on services when play videos from playlist (only Kodi 20)\n+- Update translations gl_es\n+- Minor changes\n+\nv1.16.0 (2021-06-03)\n- Add new menu \"New and Popular\"\n- Add feature to play promo trailer on unavailable videos\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Version bump (1.16.1) (#1193) |
106,046 | 27.06.2021 19:21:47 | -7,200 | 09e19bf608cffd5d2d119fdef5d19b884fce0fa8 | Fix some ARM devices recognized in wrong way
To some ARM devices platform.machine return e.g. "aarch64" instead "arm"
and was recognized as standard linux instead of ChromeOS
and generated incorrect user agent, this had ripercussion to the ESN
that when play a video caused error "This title is not available to watch instantly" | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/common/device_utils.py",
"new_path": "resources/lib/common/device_utils.py",
"diff": "@@ -126,7 +126,8 @@ def get_user_agent(enable_android_mediaflag_fix=False):\nif system in ['windows', 'uwp']:\nreturn base.replace('%PL%', '(Windows NT 10.0; Win64; x64)')\n# ARM based Linux\n- if get_machine().startswith('arm'):\n+ machine_arch = get_machine()\n+ if machine_arch.startswith('arm') or machine_arch.startswith('aarch'):\n# Last number is the platform version of Chrome OS\nreturn base.replace('%PL%', '(X11; CrOS armv7l 13099.110.0)')\n# x86 Linux\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/nfsession/msl/msl_handler.py",
"new_path": "resources/lib/services/nfsession/msl/msl_handler.py",
"diff": "@@ -214,7 +214,9 @@ class MSLHandler:\n'preferAssistiveAudio': False\n}\n- if 'linux' in common.get_system_platform() and 'arm' in common.get_machine():\n+ if 'linux' in common.get_system_platform():\n+ machine_arch = common.get_machine()\n+ if machine_arch.startswith('arm') or machine_arch.startswith('aarch'):\n# 24/06/2020 To get until to 1080P resolutions under arm devices (ChromeOS), android excluded,\n# is mandatory to add the widevine challenge data (key request) to the manifest request.\n# Is not possible get the key request from the default_crypto, is needed to implement\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Fix some ARM devices recognized in wrong way
To some ARM devices platform.machine return e.g. "aarch64" instead "arm"
and was recognized as standard linux instead of ChromeOS
and generated incorrect user agent, this had ripercussion to the ESN
that when play a video caused error "This title is not available to watch instantly" |
106,046 | 13.07.2021 16:20:29 | -7,200 | 3306711b061ce7a0046edbb1b187f418d8ea10b4 | Implemented licensed manifest request | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/navigation/player.py",
"new_path": "resources/lib/navigation/player.py",
"diff": "@@ -36,6 +36,8 @@ INPUTSTREAM_SERVER_CERTIFICATE = (\n'ovtl/ogZgjMeEdFyd/9YMYjOS4krYmwp3yJ7m9ZzYCQ6I8RQN4x/yLlHG5RH/+WNLNUs6JAZ'\n'0fFdCmw=')\n+PSSH_KID = 'AAAANHBzc2gAAAAA7e+LqXnWSs6jyCfc1R0h7QAAABQIARIQAAAAAAPSZ0kAAAAAAAAAAA==|AAAAAAPSZ0kAAAAAAAAAAA=='\n+\[email protected]_video_id(path_offset=0, pathitems_arg='videoid', inject_full_pathitems=True)\ndef play_strm(videoid):\n@@ -125,6 +127,10 @@ def get_inputstream_listitem(videoid):\nlist_item.setProperty(\nkey='inputstream',\nvalue='inputstream.adaptive')\n+ # Set PSSH/KID to pre-initialize the DRM to get challenge/session ID data in the ISA manifest proxy callback\n+ list_item.setProperty(\n+ key='inputstream.adaptive.pre_init_data',\n+ value=PSSH_KID)\nreturn list_item\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/http_server.py",
"new_path": "resources/lib/services/http_server.py",
"diff": "import pickle\nfrom http.server import BaseHTTPRequestHandler\nfrom socketserver import TCPServer, ThreadingMixIn\n-from urllib.parse import urlparse, parse_qs\n+from urllib.parse import urlparse, parse_qs, unquote\nfrom resources.lib.common import IPC_ENDPOINT_CACHE, IPC_ENDPOINT_NFSESSION, IPC_ENDPOINT_MSL, IPC_ENDPOINT_NFSESSION_TEST\nfrom resources.lib.common.exceptions import InvalidPathError, CacheMiss, MetadataNotAvailable, SlotNotImplemented\n@@ -78,7 +78,11 @@ def handle_msl_request(server, func_name, data, params=None):\nelif func_name == 'get_manifest':\n# Proxy for InputStream Adaptive to get the XML manifest for the requested video\nvideoid = int(params['videoid'][0])\n- manifest_data = server.server.netflix_session.msl_handler.get_manifest(videoid)\n+ challenge = server.headers['challengeB64']\n+ sid = server.headers['sessionId']\n+ if not challenge or not sid:\n+ raise Exception(f'Widevine session data not valid\\r\\nSession ID: {sid} Challenge: {challenge}')\n+ manifest_data = server.server.netflix_session.msl_handler.get_manifest(videoid, unquote(challenge), sid)\nserver.send_response(200)\nserver.send_header('Content-type', 'application/xml')\nserver.end_headers()\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/nfsession/msl/android_crypto.py",
"new_path": "resources/lib/services/nfsession/msl/android_crypto.py",
"diff": "@@ -75,7 +75,7 @@ class AndroidMSLCrypto(MSLBaseCrypto):\ndef load_crypto_session(self, msl_data=None):\nif not msl_data:\nreturn\n- self.keyset_id = base64.standard_b64decode(msl_data['key_set_id'])\n+ self.keyset_id = base64.standard_b64decode(msl_data['key_set_id']).decode('utf-8')\nself.key_id = base64.standard_b64decode(msl_data['key_id'])\nself.hmac_key_id = base64.standard_b64decode(msl_data['hmac_key_id'])\nself.crypto_session.RestoreKeys(self.keyset_id)\n@@ -87,23 +87,16 @@ class AndroidMSLCrypto(MSLBaseCrypto):\n\"\"\"Return a key request dict\"\"\"\n# No key update supported -> remove existing keys\nself.crypto_session.RemoveKeys()\n- key_request = self.crypto_session.GetKeyRequest( # pylint: disable=assignment-from-none\n+ _key_request = self.crypto_session.GetKeyRequest( # pylint: disable=assignment-from-none\nbytes([10, 122, 0, 108, 56, 43]), 'application/xml', True, dict())\n-\n- if not key_request:\n+ if not _key_request:\nraise MSLError('Widevine CryptoSession getKeyRequest failed!')\n-\n- LOG.debug('Widevine CryptoSession getKeyRequest successful. Size: {}', len(key_request))\n-\n- # Save the key request (challenge data) required for manifest requests\n- # Todo: to be implemented if/when it becomes mandatory\n- key_request = base64.standard_b64encode(key_request).decode('utf-8')\n- # G.LOCAL_DB.set_value('drm_session_challenge', key_request, TABLE_SESSION)\n-\n+ LOG.debug('Widevine CryptoSession getKeyRequest successful. Size: {}', len(_key_request))\n+ _key_request = base64.standard_b64encode(_key_request).decode('utf-8')\nreturn [{\n'scheme': 'WIDEVINE',\n'keydata': {\n- 'keyrequest': key_request\n+ 'keyrequest': _key_request\n}\n}]\n@@ -115,7 +108,6 @@ class AndroidMSLCrypto(MSLBaseCrypto):\nraise MSLError('Widevine CryptoSession provideKeyResponse failed')\nLOG.debug('Widevine CryptoSession provideKeyResponse successful')\nLOG.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@@ -176,7 +168,7 @@ class AndroidMSLCrypto(MSLBaseCrypto):\ndef _export_keys(self):\nreturn {\n- 'key_set_id': base64.standard_b64encode(self.keyset_id).decode('utf-8'),\n+ 'key_set_id': base64.standard_b64encode(self.keyset_id.encode('utf-8')).decode('utf-8'),\n'key_id': base64.standard_b64encode(self.key_id).decode('utf-8'),\n'hmac_key_id': base64.standard_b64encode(self.hmac_key_id).decode('utf-8')\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/nfsession/msl/msl_handler.py",
"new_path": "resources/lib/services/nfsession/msl/msl_handler.py",
"diff": "@@ -38,34 +38,6 @@ class MSLHandler:\nlicenses_session_id = []\nlicenses_xid = []\nlicenses_release_url = []\n- manifest_challenge = ('CAESwQsKhgsIARLsCQqvAggCEhGN3Th6q2GhvXw9bD+X9aW2ChjQ8PLmBSKOAjCCAQoCggEBANsVUL5yI9K'\n- 'UG1TPpb1A0bzk6df3YwbpDEkh+IOj52RfnKyspASRN1JQvCRrKwiq433M9BV+8ZkzkheYEPZ9X5rl5Ydkwp'\n- 'qedzdZRAiuaVp/mMA5zUM3I3fZogVxGnVzh4mB2URg+g7TFwbPWz2x1uzPumO+2ImOPIUyR7auoOKrZml30'\n- '8w8Edwdd1HwFyrJEZHLDN2P51PJhVrUBWUlxebY05NhfIUvWQ/pyXAa6AahTf7PTVow/uu1d0vc6gHSxmj0'\n- 'hodvaxrkDcBY9NoOH2XCW7LNJnKC487CVwCHOJC9+6fakaHnjHepayeGEp2JL2AaCrGGqAOZdG8F11Pa0H8'\n- 'CAwEAASirbxKAAmFqOFvUp7caxO5/q2QK5yQ8/AA5E1KOQJxZrqwREPbGUX3670XGw9bamA0bxc37DUi6Dw'\n- 'rOyWKWSaW/qVNie86mW/7KdVSpZPGcF/TxO+kd4iXMIjH0REZst/mMJhv5UMMO9dDFGR3RBqkPbDTdzvX1u'\n- 'E/loVPDH8QEfDACzDkeCA1P0zAcjWKGPzaeUrogsnBEQN4wCVRQqufDXkgImhDUCUkmyQDJXQkhgMMWtbbC'\n- 'HMa/DMGEZAhu4I8G32m8XxU3NoK1kDsb+s5VUgOdkX3ZnFw1uf3niQ9FCTYlzv4SIBJGEokJjkHagT6kVWf'\n- 'hsvSHMHzayKb00OwIn/6NsNEatAUKrgIIARIQiX9ghrmqxsdcq/w8cprG8Bj46/LmBSKOAjCCAQoCggEBAL'\n- 'udF8e+FexCGnOsPQCNtaIvTRW8XsqiTxdo5vElAnGMoOZn6Roy2jwDkc1Gy2ucybY926xk0ZP2Xt5Uy/atI'\n- '5yAvn7WZGWzbR5BbMbXIxaCyDysm7L+X6Fid55YbJ8GLl2/ToOY2CVYT+EciaTj56OjcyBJLDW/0Zqp25gn'\n- 'da61HwomZOVLoFmLbeZtC5DjvEv8c2NIDXXketqd/vj0I1nWKtEy8nKIPw/2nhitR6QFUnfEb8hJgPgdTAp'\n- 'TkxWm4hSpWsM0j8CQOYNzDL2/kfP1cYw0Fh7oJMSEt2H6AUjC4lIkp54rPHAhLYE+tmwKSYfrmjEoTVErcI'\n- 'jl6jEvwtsCAwEAASirbxKAA0OHZIfwXbTghTVi4awHyXje/8D5fdtggtTa0Edec0KmZbHwBbLJ9OCBc9RrR'\n- 'L8O4WgQPG/5RVLc9IsR9x/Gw1vg/X+MmWEBnY62XNdVAUjbYGwRQuHQFMkwEQdzxfcH9oWoJtOZdLEN2X/p'\n- 'Ws7MeM4KZc8gTUqcDHekq1QqKNs+Voc8Q5hIX7fims9llY/RUHNatDPFVuEyJ0Vqx5l+Rrrdqk+b1fXuVR6'\n- 'yxP1h4S/C/UtedUyZxZgc/1OJ0mLr5x1tkRbFVyzA8Z/qfZeYq3HV4pAGg7nLg0JRBTbjiZH8eUhr1JtwLi'\n- 'udU9vLvDnv1Y6bsfaT62vfLOttozSZVIeWo7acZHICduOL/tH1Kx7f6e7ierwQYAOng1LGs/PLofQ874C1A'\n- 'tNkN0tVe6cSSAvN+Vl33GbICXpX6Rq8LBPqqhzGMGBMiybnmXqOaXz8ngSQCiXqp/ImaOKfx8OE6qH92rUV'\n- 'Wgw68qBy9ExEOl95SSEx9A/B4vEYFHaHwzqh2BoYChFhcmNoaXRlY3R1cmVfbmFtZRIDYXJtGhYKDGNvbXB'\n- 'hbnlfbmFtZRIGR29vZ2xlGhcKCm1vZGVsX25hbWUSCUNocm9tZUNETRoZCg1wbGF0Zm9ybV9uYW1lEghDaH'\n- 'JvbWVPUxojChR3aWRldmluZV9jZG1fdmVyc2lvbhILNC4xMC4xNjEwLjYyCAgBEAAYACABEiwKKgoUCAESE'\n- 'AAAAAAD0mdJAAAAAAAAAAAQARoQA5cwqbEo4TSV6p1qQZy26BgBIOSrw/cFMBUagAIp7zGUC9p3XZ9sp0w+'\n- 'yd6/wyRa1V22NyPF4BsNivSEkMtcEaQiUOW+LrGhHO+RrukWeJlzVbtpai5/vjOAbsaouQ0yMp8yfpquZcV'\n- 'kpPugSOPKu1A0W5w5Ou9NOGsMaJi6+LicGxhS+7xAp/lv/9LATCcQJXS2elBCz6f6VUQyMOPyjQYBrH3h27'\n- 'tVRcsnTRQATcogwCytXohKroBGvODIYcpVFsy2saOCyh4HTezzXJvgogx2f15ViyF5rDqho4YsW0z4it9TF'\n- 'BT0OOLkk0fQ6a1LSqA49eN3RufKYq4LT+G+ffdgoDmKpIWS3bp7xQ6GeYtDAUh0D8Ipwc8aKzP2')\ndef __init__(self, nfsession: 'NFSessionOperations'):\nself.nfsession = nfsession\n@@ -116,7 +88,7 @@ class MSLHandler:\nself.events_handler_thread.start()\n@display_error_info\n- def get_manifest(self, viewable_id):\n+ def get_manifest(self, viewable_id, challenge, sid):\n\"\"\"\nGet the manifests for the given viewable_id and returns a mpd-XML-Manifest\n@@ -128,7 +100,7 @@ class MSLHandler:\n# When the add-on is installed from scratch or you logout the account the ESN will be empty\nif not esn:\nesn = set_esn()\n- manifest = self._get_manifest(viewable_id, esn)\n+ manifest = self._get_manifest(viewable_id, esn, challenge, sid)\nexcept MSLError as exc:\nif 'Email or password is incorrect' in str(exc):\n# Known cases when MSL error \"Email or password is incorrect.\" can happen:\n@@ -141,7 +113,7 @@ class MSLHandler:\nreturn self.__tranform_to_dash(manifest)\n@measure_exec_time_decorator(is_immediate=True)\n- def _get_manifest(self, viewable_id, esn):\n+ def _get_manifest(self, viewable_id, esn, challenge, sid):\ncache_identifier = f'{esn}_{viewable_id}'\ntry:\n# The manifest must be requested once and maintained for its entire duration\n@@ -170,7 +142,7 @@ class MSLHandler:\nif hdcp_4k_capable and hdcp_override:\nhdcp_version = ['2.2']\n- LOG.info('Requesting manifest for {} with ESN {} and HDCP {}',\n+ LOG.info('Requesting licensed manifest for {} with ESN {} and HDCP {}',\nviewable_id,\ncommon.censure(esn) if len(esn) > 50 else esn,\nhdcp_version)\n@@ -211,24 +183,25 @@ class MSLHandler:\n'supportedHdcpVersions': hdcp_version,\n'isHdcpEngaged': hdcp_override\n}],\n- 'preferAssistiveAudio': False\n+ 'preferAssistiveAudio': False,\n+ 'profileGroups': [{\n+ 'name': 'default',\n+ 'profiles': profiles\n+ }],\n+ 'licenseType': 'standard',\n+ 'challenge': challenge,\n+ 'challenges': {\n+ 'default': [{\n+ 'drmSessionId': sid,\n+ 'clientTime': int(time.time()),\n+ 'challengeBase64': challenge\n+ }]\n+ }\n}\n- if 'linux' in common.get_system_platform():\n- machine_arch = common.get_machine()\n- if machine_arch.startswith('arm') or machine_arch.startswith('aarch'):\n- # 24/06/2020 To get until to 1080P resolutions under arm devices (ChromeOS), android excluded,\n- # is mandatory to add the widevine challenge data (key request) to the manifest request.\n- # Is not possible get the key request from the default_crypto, is needed to implement\n- # the wv crypto (used for android) but currently InputStreamAdaptive support this interface only\n- # under android OS.\n- # As workaround: Initially we pass an hardcoded challenge data needed to play the first video,\n- # then when ISA perform the license callback we replace it with the fresh license challenge data.\n- params['challenge'] = self.manifest_challenge\n-\n- endpoint_url = ENDPOINTS['manifest'] + create_req_params(0, 'prefetch/manifest')\n+ endpoint_url = ENDPOINTS['manifest'] + create_req_params(0, 'licensedManifest')\nmanifest = self.msl_requests.chunked_request(endpoint_url,\n- self.msl_requests.build_request_data('/manifest', params),\n+ self.msl_requests.build_request_data('licensedManifest', params),\nesn,\ndisable_msl_switch=False)\nif LOG.is_enabled:\n@@ -259,7 +232,6 @@ class MSLHandler:\n'challengeBase64': challenge,\n'xid': xid\n}]\n- self.manifest_challenge = challenge\nendpoint_url = ENDPOINTS['license'] + create_req_params(0, 'prefetch/license')\ntry:\nresponse = self.msl_requests.chunked_request(endpoint_url,\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Implemented licensed manifest request |
106,046 | 13.07.2021 17:15:08 | -7,200 | f2947e4c3be7db4a98439b143c21934a829258d7 | Temporary allow request manifest without DRM data
ATM is possible make the manifest request also without DRM data,
then we take advantage to allow a soft transition | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/http_server.py",
"new_path": "resources/lib/services/http_server.py",
"diff": "@@ -12,9 +12,10 @@ from http.server import BaseHTTPRequestHandler\nfrom socketserver import TCPServer, ThreadingMixIn\nfrom urllib.parse import urlparse, parse_qs, unquote\n+from resources.lib import common\nfrom resources.lib.common import IPC_ENDPOINT_CACHE, IPC_ENDPOINT_NFSESSION, IPC_ENDPOINT_MSL, IPC_ENDPOINT_NFSESSION_TEST\nfrom resources.lib.common.exceptions import InvalidPathError, CacheMiss, MetadataNotAvailable, SlotNotImplemented\n-from resources.lib.globals import G\n+from resources.lib.globals import G, remove_ver_suffix\nfrom resources.lib.services.nfsession.nfsession import NetflixSession\nfrom resources.lib.utils.logging import LOG\n@@ -78,10 +79,18 @@ def handle_msl_request(server, func_name, data, params=None):\nelif func_name == 'get_manifest':\n# Proxy for InputStream Adaptive to get the XML manifest for the requested video\nvideoid = int(params['videoid'][0])\n- challenge = server.headers['challengeB64']\n- sid = server.headers['sessionId']\n+ challenge = server.headers.get('challengeB64')\n+ sid = server.headers.get('sessionId')\nif not challenge or not sid:\n+ from xbmcaddon import Addon\n+ isa_version = remove_ver_suffix(Addon('inputstream.adaptive').getAddonInfo('version'))\n+ if common.CmpVersion(isa_version) >= '2.6.18':\nraise Exception(f'Widevine session data not valid\\r\\nSession ID: {sid} Challenge: {challenge}')\n+ # TODO: We temporary allow the use of older versions of InputStream Adaptive (but SD video content)\n+ # to allow a soft transition, this must be removed in future.\n+ LOG.error('Detected older version of InputStream Adaptive add-on, HD video contents are not supported.')\n+ challenge = ''\n+ sid = ''\nmanifest_data = server.server.netflix_session.msl_handler.get_manifest(videoid, unquote(challenge), sid)\nserver.send_response(200)\nserver.send_header('Content-type', 'application/xml')\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/nfsession/msl/msl_handler.py",
"new_path": "resources/lib/services/nfsession/msl/msl_handler.py",
"diff": "@@ -188,16 +188,17 @@ class MSLHandler:\n'name': 'default',\n'profiles': profiles\n}],\n- 'licenseType': 'standard',\n- 'challenge': challenge,\n- 'challenges': {\n+ 'licenseType': 'standard'\n+ }\n+ if challenge and sid:\n+ params['challenge'] = challenge\n+ params['challenges'] = {\n'default': [{\n'drmSessionId': sid,\n'clientTime': int(time.time()),\n'challengeBase64': challenge\n}]\n}\n- }\nendpoint_url = ENDPOINTS['manifest'] + create_req_params(0, 'licensedManifest')\nmanifest = self.msl_requests.chunked_request(endpoint_url,\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Temporary allow request manifest without DRM data
ATM is possible make the manifest request also without DRM data,
then we take advantage to allow a soft transition |
106,046 | 13.07.2021 17:22:11 | -7,200 | 1d61f42e768904b7cf7ebce9e20135874cdac190 | Warning message for ISA old version installed | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/upgrade_controller.py",
"new_path": "resources/lib/upgrade_controller.py",
"diff": "\"\"\"\nfrom resources.lib.common.misc_utils import CmpVersion\nfrom resources.lib.database.db_update import run_local_db_updates, run_shared_db_updates\n-from resources.lib.globals import G\n+from resources.lib.globals import G, remove_ver_suffix\nfrom resources.lib.utils.logging import LOG\n@@ -60,6 +60,14 @@ def _perform_addon_changes(previous_ver, current_ver):\nfrom resources.lib.upgrade_actions import migrate_library\nmigrate_library()\ncancel_playback = True\n+ if previous_ver and CmpVersion(previous_ver) < '1.16.2':\n+ from xbmcaddon import Addon\n+ isa_version = remove_ver_suffix(Addon('inputstream.adaptive').getAddonInfo('version'))\n+ if CmpVersion(isa_version) < '2.6.18':\n+ from resources.lib.kodi import ui\n+ ui.show_ok_dialog('Netflix add-on upgrade',\n+ 'The currently installed [B]InputStream Adaptive add-on[/B] version not support Netflix HD videos.'\n+ '[CR]To get HD video contents, please update it to the last version.')\n# Always leave this to last - After the operations set current version\nG.LOCAL_DB.set_value('addon_previous_version', current_ver)\nreturn cancel_playback\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Warning message for ISA old version installed |
106,046 | 13.07.2021 18:10:33 | -7,200 | a3abbd97d688fe95b0ac03fdcfab0c2fc90ed0f6 | Removed some old stuff and cleanup | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/run_addon.py",
"new_path": "resources/lib/run_addon.py",
"diff": "@@ -235,20 +235,12 @@ def run(argv):\nshow_backend_not_ready()\nsuccess = False\nif success:\n- cancel_playback = False\npathitems = [part for part in G.REQUEST_PATH.split('/') if part]\nif G.IS_ADDON_FIRSTRUN:\n- is_first_run_install, cancel_playback = check_addon_upgrade()\n+ is_first_run_install = check_addon_upgrade()\nif is_first_run_install:\nfrom resources.lib.config_wizard import run_addon_configuration\nrun_addon_configuration()\n- if cancel_playback and G.MODE_PLAY in pathitems[:1]:\n- # Temporary for migration library STRM to new format. todo: to be removed in future releases\n- # When a user do the add-on upgrade, the first time that the add-on will be opened will be executed\n- # the library migration. But if a user instead to open the add-on, try to play a video from Kodi\n- # library, Kodi will open the old STRM file because the migration is executed after.\n- success = False\n- else:\nsuccess = route(pathitems)\nif not success:\nfrom xbmcplugin import endOfDirectory\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/upgrade_controller.py",
"new_path": "resources/lib/upgrade_controller.py",
"diff": "@@ -17,17 +17,15 @@ def check_addon_upgrade():\n\"\"\"\nCheck addon upgrade and perform necessary update operations\n- :return tuple boolean 1: True if this is the first run of the add-on after an installation from scratch\n- boolean 2: True to cancel a playback after upgrade\n- (if user was trying to playback from kodi library so without open the add-on interface)\n+ :return True if this is the first run of the add-on after an installation from scratch\n\"\"\"\n# Upgrades that require user interaction or to be performed outside of the service\n- cancel_playback = False\naddon_previous_ver = G.LOCAL_DB.get_value('addon_previous_version', None)\naddon_current_ver = G.VERSION\nif addon_previous_ver is None or CmpVersion(addon_current_ver) > addon_previous_ver:\n- cancel_playback = _perform_addon_changes(addon_previous_ver, addon_current_ver)\n- return addon_previous_ver is None, cancel_playback\n+ _perform_addon_changes(addon_previous_ver, addon_current_ver)\n+ G.LOCAL_DB.set_value('addon_previous_version', addon_current_ver)\n+ return addon_previous_ver is None\ndef check_service_upgrade():\n@@ -38,29 +36,29 @@ def check_service_upgrade():\nupgrade_to_local_db_version = '0.2'\nif current_local_db_version != upgrade_to_local_db_version:\n_perform_local_db_changes(current_local_db_version, upgrade_to_local_db_version)\n+ G.LOCAL_DB.set_value('local_db_version', upgrade_to_local_db_version)\n# Upgrade the shared databases\ncurrent_shared_db_version = G.LOCAL_DB.get_value('shared_db_version', None)\nupgrade_to_shared_db_version = '0.2'\nif current_shared_db_version != upgrade_to_shared_db_version:\n_perform_shared_db_changes(current_shared_db_version, upgrade_to_shared_db_version)\n+ G.LOCAL_DB.set_value('shared_db_version', upgrade_to_shared_db_version)\n# Perform service changes\nservice_previous_ver = G.LOCAL_DB.get_value('service_previous_version', None)\nservice_current_ver = G.VERSION\nif service_previous_ver is None or CmpVersion(service_current_ver) > service_previous_ver:\n_perform_service_changes(service_previous_ver, service_current_ver)\n+ G.LOCAL_DB.set_value('service_previous_version', service_current_ver)\ndef _perform_addon_changes(previous_ver, current_ver):\n\"\"\"Perform actions for an version bump\"\"\"\n- cancel_playback = False\n- LOG.debug('Initialize addon upgrade operations, from version {} to {})', previous_ver, current_ver)\n- if previous_ver and CmpVersion(previous_ver) < '1.7.0':\n- from resources.lib.upgrade_actions import migrate_library\n- migrate_library()\n- cancel_playback = True\n- if previous_ver and CmpVersion(previous_ver) < '1.16.2':\n+ LOG.debug('Initialize add-on upgrade operations, from version {} to {}', previous_ver, current_ver)\n+ if not previous_ver:\n+ return\n+ if CmpVersion(previous_ver) < '1.16.2':\nfrom xbmcaddon import Addon\nisa_version = remove_ver_suffix(Addon('inputstream.adaptive').getAddonInfo('version'))\nif CmpVersion(isa_version) < '2.6.18':\n@@ -68,27 +66,26 @@ def _perform_addon_changes(previous_ver, current_ver):\nui.show_ok_dialog('Netflix add-on upgrade',\n'The currently installed [B]InputStream Adaptive add-on[/B] version not support Netflix HD videos.'\n'[CR]To get HD video contents, please update it to the last version.')\n- # Always leave this to last - After the operations set current version\n- G.LOCAL_DB.set_value('addon_previous_version', current_ver)\n- return cancel_playback\ndef _perform_service_changes(previous_ver, current_ver):\n\"\"\"Perform actions for an version bump\"\"\"\n- LOG.debug('Initialize service upgrade operations, from version {} to {})', previous_ver, current_ver)\n+ LOG.debug('Initialize add-on service upgrade operations, from version {} to {}', previous_ver, current_ver)\n# Clear cache (prevents problems when netflix change data structures)\nG.CACHE.clear()\n+ if not previous_ver:\n+ return\n# Delete all stream continuity data - if user has upgraded from Kodi 18 to Kodi 19\n- if previous_ver and CmpVersion(previous_ver) < '1.13':\n+ if CmpVersion(previous_ver) < '1.13':\n# There is no way to determine if the user has migrated from Kodi 18 to Kodi 19,\n# then we assume that add-on versions prior to 1.13 was on Kodi 18\n# The am_stream_continuity.py on Kodi 18 works differently and the existing data can not be used on Kodi 19\nG.SHARED_DB.clear_stream_continuity()\n- if previous_ver and CmpVersion(previous_ver) < '1.9.0':\n+ if CmpVersion(previous_ver) < '1.9.0':\n# In the version 1.9.0 has been changed the COOKIE_ filename with a static filename\nfrom resources.lib.upgrade_actions import rename_cookie_file\nrename_cookie_file()\n- if previous_ver and CmpVersion(previous_ver) < '1.12.0':\n+ if CmpVersion(previous_ver) < '1.12.0':\n# In the version 1.13.0:\n# - 'force_widevine' on setting.xml has been moved\n# as 'widevine_force_seclev' in TABLE_SESSION with different values:\n@@ -112,29 +109,25 @@ def _perform_service_changes(previous_ver, current_ver):\nui.show_ok_dialog('Netflix add-on upgrade',\n'This add-on upgrade has reset your ESN code, if you had set an ESN code manually '\n'you must re-enter it again in the Expert settings, otherwise simply ignore this message.')\n- if previous_ver and CmpVersion(previous_ver) < '1.16.0':\n+ if CmpVersion(previous_ver) < '1.16.0':\n# In the version 1.16.0 the watched status sync setting has been enabled by default,\n# therefore to be able to keep the user's setting even when it has never been changed,\n# we have done a new setting (ProgressManager_enabled >> to >> sync_watched_status)\nwith G.SETTINGS_MONITOR.ignore_events(1):\nG.ADDON.setSettingBool('sync_watched_status', G.ADDON.getSettingBool('ProgressManager_enabled'))\n- # Always leave this to last - After the operations set current version\n- G.LOCAL_DB.set_value('service_previous_version', current_ver)\ndef _perform_local_db_changes(current_version, upgrade_to_version):\n\"\"\"Perform database actions for a db version change\"\"\"\nif current_version is not None:\n- LOG.debug('Initialization of local database updates from version {} to {})',\n+ LOG.debug('Initialize local database updates, from version {} to {}',\ncurrent_version, upgrade_to_version)\nrun_local_db_updates(current_version, upgrade_to_version)\n- G.LOCAL_DB.set_value('local_db_version', upgrade_to_version)\ndef _perform_shared_db_changes(current_version, upgrade_to_version):\n\"\"\"Perform database actions for a db version change\"\"\"\nif current_version is not None:\n- LOG.debug('Initialization of shared databases updates from version {} to {})',\n+ LOG.debug('Initialize shared databases updates, from version {} to {}',\ncurrent_version, upgrade_to_version)\nrun_shared_db_updates(current_version, upgrade_to_version)\n- G.LOCAL_DB.set_value('shared_db_version', upgrade_to_version)\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Removed some old stuff and cleanup |
106,046 | 15.07.2021 10:00:02 | -7,200 | 301db926a1d4bb4fbf06fc4842aa56a4503147bd | Removed some IPC signals | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/common/ipc.py",
"new_path": "resources/lib/common/ipc.py",
"diff": "@@ -30,8 +30,6 @@ class Signals: # pylint: disable=no-init,too-few-public-methods\n\"\"\"Signal names for use with AddonSignals\"\"\"\nPLAYBACK_INITIATED = 'playback_initiated'\nREQUEST_KODI_LIBRARY_UPDATE = 'request_kodi_library_update'\n- CLEAR_USER_ID_TOKENS = 'clean_user_id_tokens'\n- REINITIALIZE_MSL_HANDLER = 'reinitialize_msl_handler'\nSWITCH_EVENTS_HANDLER = 'switch_events_handler'\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/nfsession/msl/msl_handler.py",
"new_path": "resources/lib/services/nfsession/msl/msl_handler.py",
"diff": "@@ -43,14 +43,6 @@ class MSLHandler:\nself.nfsession = nfsession\nself.events_handler_thread = None\nself._init_msl_handler()\n- common.register_slot(\n- signal=common.Signals.CLEAR_USER_ID_TOKENS,\n- callback=self.clear_user_id_tokens,\n- is_signal=True)\n- common.register_slot(\n- signal=common.Signals.REINITIALIZE_MSL_HANDLER,\n- callback=self.reinitialize_msl_handler,\n- is_signal=True)\ncommon.register_slot(\nsignal=common.Signals.SWITCH_EVENTS_HANDLER,\ncallback=self.switch_events_handler,\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/nfsession/nfsession.py",
"new_path": "resources/lib/services/nfsession/nfsession.py",
"diff": "@@ -26,6 +26,8 @@ class NetflixSession:\nself.nfsession = NFSessionOperations()\n# Create MSL handler\nself.msl_handler = MSLHandler(self.nfsession)\n+ # Set to the nfsession the reference to the current MSL Handler object\n+ self.nfsession.msl_handler = self.msl_handler\n# Initialize correlated features\nself.directory_builder = DirectoryBuilder(self.nfsession)\nself.action_controller = ActionController(self.nfsession, self.msl_handler, self.directory_builder)\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/nfsession/nfsession_ops.py",
"new_path": "resources/lib/services/nfsession/nfsession_ops.py",
"diff": "@@ -168,7 +168,8 @@ class NFSessionOperations(SessionPathRequests):\nLOG.warn('The session data is not more valid ({})', type(exc).__name__)\ncommon.purge_credentials()\nself.session.cookies.clear()\n- common.send_signal(signal=common.Signals.CLEAR_USER_ID_TOKENS)\n+ # Clear the user ID tokens are tied to the credentials\n+ self.msl_handler.clear_user_id_tokens()\nraise NotLoggedInError from exc\n@measure_exec_time_decorator(is_immediate=True)\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/nfsession/session/access.py",
"new_path": "resources/lib/services/nfsession/session/access.py",
"diff": "@@ -178,7 +178,7 @@ class SessionAccess(SessionCookie, SessionHTTPRequests):\ncommon.purge_credentials()\n# Reinitialize the MSL handler (delete msl data file, then reset everything)\n- common.send_signal(common.Signals.REINITIALIZE_MSL_HANDLER, {'delete_msl_file': True})\n+ self.msl_handler.reinitialize_msl_handler(delete_msl_file=True)\nG.CACHE.clear(clear_database=True)\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/nfsession/session/base.py",
"new_path": "resources/lib/services/nfsession/session/base.py",
"diff": "SPDX-License-Identifier: MIT\nSee LICENSES/MIT.md for more information.\n\"\"\"\n+from typing import TYPE_CHECKING\n+\nimport resources.lib.common as common\nfrom resources.lib.database.db_utils import TABLE_SESSION\nfrom resources.lib.globals import G\nfrom resources.lib.services.tcp_keep_alive import enable_tcp_keep_alive\nfrom resources.lib.utils.logging import LOG\n+if TYPE_CHECKING: # This variable/imports are used only by the editor, so not at runtime\n+ from resources.lib.services.nfsession.msl.msl_handler import MSLHandler\n+\nclass SessionBase:\n\"\"\"Initialize the netflix session\"\"\"\n@@ -27,6 +32,9 @@ class SessionBase:\n# Functions from derived classes to allow perform particular operations in parent classes\nexternal_func_activate_profile = None # (set by nfsession_op.py)\n+ msl_handler: 'MSLHandler' = None\n+ \"\"\"A reference to the MSL Handler object\"\"\"\n+\ndef __init__(self):\nself._init_session()\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/nfsession/session/http_requests.py",
"new_path": "resources/lib/services/nfsession/session/http_requests.py",
"diff": "@@ -111,7 +111,7 @@ class SessionHTTPRequests(SessionBase):\nself.session.cookies.clear()\nif isinstance(exc, MbrStatusAnonymousError):\n# This prevent the MSL error: No entity association record found for the user\n- common.send_signal(signal=common.Signals.CLEAR_USER_ID_TOKENS)\n+ self.msl_handler.clear_user_id_tokens()\n# Needed to do a new login\ncommon.purge_credentials()\nui.show_notification(common.get_local_string(30008))\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Removed some IPC signals |
106,046 | 15.07.2021 11:25:40 | -7,200 | 3420284cd34de2740d5c05faf43488de3677e0c8 | Video sorted lists query changes | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/globals.py",
"new_path": "resources/lib/globals.py",
"diff": "@@ -72,7 +72,8 @@ class GlobalVariables:\n'loco_known': True,\n'request_context_name': 'mylist',\n'view': VIEW_MYLIST,\n- 'has_sort_setting': True}),\n+ 'has_sort_setting': True,\n+ 'query_without_reference': True}),\n('continueWatching', {'path': ['video_list', 'continueWatching'],\n'loco_contexts': ['continueWatching'],\n'loco_known': True}),\n@@ -97,7 +98,8 @@ class GlobalVariables:\n'loco_contexts': ['newRelease'],\n'loco_known': True,\n'request_context_name': 'newrelease',\n- 'has_sort_setting': True}),\n+ 'has_sort_setting': True,\n+ 'query_without_reference': True}),\n('currentTitles', {'path': ['video_list', 'currentTitles'],\n'loco_contexts': ['trendingNow'],\n'loco_known': True}),\n@@ -116,7 +118,8 @@ class GlobalVariables:\n'label_id': 30163,\n'description_id': 30164,\n'icon': 'DefaultTVShows.png',\n- 'has_sort_setting': True}),\n+ 'has_sort_setting': True,\n+ 'query_without_reference': True}),\n('recommendations', {'path': ['recommendations', 'recommendations'],\n'loco_contexts': ['similars', 'becauseYouAdded', 'becauseYouLiked', 'watchAgain',\n'bigRow'],\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/nfsession/directorybuilder/dir_path_requests.py",
"new_path": "resources/lib/services/nfsession/directorybuilder/dir_path_requests.py",
"diff": "@@ -174,7 +174,11 @@ class DirectoryPathRequests:\nint(G.ADDON.getSettingInt('menu_sortorder_' + menu_data.get('initial_menu_id', menu_data['path'][1])))\n]\nbase_path.append(req_sort_order_type)\n- paths = build_paths(base_path + [RANGE_PLACEHOLDER], VIDEO_LIST_PARTIAL_PATHS)\n+ _base_path = list(base_path)\n+ _base_path.append(RANGE_PLACEHOLDER)\n+ if not menu_data.get('query_without_reference', False):\n+ _base_path.append('reference')\n+ paths = build_paths(_base_path, VIDEO_LIST_PARTIAL_PATHS)\npath_response = self.nfsession.perpetual_path_request(paths, [response_type, base_path], perpetual_range_start)\nreturn VideoListSorted(path_response, context_name, context_id, req_sort_order_type)\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Video sorted lists query changes |
106,046 | 15.07.2021 13:57:43 | -7,200 | 1eb757a532e60315737d957597aa1c2ac1c7a38a | Use regular pip install | [
{
"change_type": "MODIFY",
"old_path": ".github/workflows/addon-check.yml",
"new_path": ".github/workflows/addon-check.yml",
"diff": "@@ -25,12 +25,10 @@ jobs:\nwith:\npython-version: 3.8\n- name: Install dependencies\n- # TODO: Revert addon checker git install when the new version will be released\n- # pip install kodi-addon-checker\nrun: |\nsudo apt-get install gettext\npython -m pip install --upgrade pip\n- pip install git+git://github.com/xbmc/addon-check.git@master\n+ pip install kodi-addon-checker\n- name: Checking language translations\nrun: make check-translations\nworking-directory: ${{ github.repository }}\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Use regular pip install |
106,046 | 15.07.2021 14:33:30 | -7,200 | fbe6c8a0fb22057ebf19a99a53ae93c02b2f1c9b | Changes on workflow | [
{
"change_type": "MODIFY",
"old_path": ".github/workflows/addon-check.yml",
"new_path": ".github/workflows/addon-check.yml",
"diff": "-name: Kodi\n+name: Kodi Addon-Check\non:\npush:\nbranches:\n@@ -7,33 +7,15 @@ on:\nbranches:\n- master\njobs:\n- tests:\n- name: Addon checker\n+ kodi-addon-checker:\nruns-on: ubuntu-latest\n- env:\n- PYTHONIOENCODING: utf-8\n- strategy:\n- fail-fast: false\n- matrix:\n- kodi-branch: [matrix]\n+ name: Kodi addon checker\nsteps:\n- - uses: actions/checkout@v2\n+ - name: Checkout\n+ uses: actions/checkout@v2\n+ - name: Kodi addon checker validation\n+ id: kodi-addon-checker\n+ uses: xbmc/action-kodi-addon-checker@master\nwith:\n- path: ${{ github.repository }}\n- - name: Set up Python 3.8\n- uses: actions/setup-python@v1\n- with:\n- python-version: 3.8\n- - name: Install dependencies\n- run: |\n- sudo apt-get install gettext\n- python -m pip install --upgrade pip\n- pip install kodi-addon-checker\n- - name: Checking language translations\n- run: make check-translations\n- working-directory: ${{ github.repository }}\n- - name: Remove unwanted files\n- run: awk '/export-ignore/ { print $1 }' .gitattributes | xargs rm -rf --\n- working-directory: ${{ github.repository }}\n- - name: Run kodi-addon-checker\n- run: kodi-addon-checker --branch=${{ matrix.kodi-branch }} ${{ github.repository }}/\n+ kodi-version: matrix\n+ addon-id: ${{ github.event.repository.name }}\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": ".github/workflows/translations.yml",
"diff": "+name: Translations\n+on:\n+ push:\n+ branches:\n+ - master\n+ pull_request:\n+ branches:\n+ - master\n+jobs:\n+ tests:\n+ name: Check translations\n+ runs-on: ubuntu-latest\n+ env:\n+ PYTHONIOENCODING: utf-8\n+ strategy:\n+ fail-fast: false\n+ matrix:\n+ kodi-branch: [matrix]\n+ steps:\n+ - uses: actions/checkout@v2\n+ with:\n+ path: ${{ github.repository }}\n+ - name: Set up Python 3.8\n+ uses: actions/setup-python@v1\n+ with:\n+ python-version: 3.8\n+ - name: Install dependencies\n+ run: |\n+ sudo apt-get install gettext\n+ - name: Checking language translations\n+ run: make check-translations\n+ working-directory: ${{ github.repository }}\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Changes on workflow |
106,046 | 16.07.2021 09:15:16 | -7,200 | 62259a710f969bfad3144b62bdab30af5839bed8 | Version bump (1.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=\"1.16.1+matrix.1\" provider-name=\"libdev + jojo + asciidisco + caphm + castagnait\">\n+<addon id=\"plugin.video.netflix\" name=\"Netflix\" version=\"1.16.2+matrix.1\" provider-name=\"libdev + jojo + asciidisco + caphm + castagnait\">\n<requires>\n<import addon=\"xbmc.python\" version=\"3.0.0\"/>\n<import addon=\"script.module.addon.signals\" version=\"0.0.6+matrix.1\"/>\n<forum>https://forum.kodi.tv/showthread.php?tid=329767</forum>\n<source>https://github.com/CastagnaIT/plugin.video.netflix</source>\n<news>\n-v1.16.1 (2021-06-20)\n-- Updated video profiles for HEVC/HEVC HDR\n-- Add support to browse network paths with open file/folder dialog\n-- Fixed missing items in episodes lists and others submenus\n-- Fixed broken add-on services when play videos from playlist (only Kodi 20)\n-- Update translations gl_es\n+v1.16.2 (2021-07-16)\n+- Implemented new licensed manifest request (to have HD is mandatory to update InputStream Adaptive to last version)\n+- Fixed \"This title is not available to watch instantly\" error on some ARM devices incorrectly identified\n+- Fixed empty lists on menu/submenus due to website changes\n+- Update translation zh_cn\n- Minor changes\n</news>\n</extension>\n"
},
{
"change_type": "MODIFY",
"old_path": "changelog.txt",
"new_path": "changelog.txt",
"diff": "+v1.16.2 (2021-07-16)\n+- Implemented new licensed manifest request (to have HD is mandatory to update InputStream Adaptive to last version)\n+- Fixed \"This title is not available to watch instantly\" error on some ARM devices incorrectly identified\n+- Fixed empty lists on menu/submenus due to website changes\n+- Update translation zh_cn\n+- Minor changes\n+\nv1.16.1 (2021-06-20)\n- Updated video profiles for HEVC/HEVC HDR\n- Add support to browse network paths with open file/folder dialog\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Version bump (1.16.2) (#1201) |
106,046 | 14.06.2021 09:26:39 | -7,200 | 86e15b610f5bd6c30742f59cb876d58d5ea71d1a | Enabled TCP Keep Alive on httpcore (httpx)
Currently there is no way to enable TCP KeepAlive directly on httpx
module | [
{
"change_type": "MODIFY",
"old_path": "packages/httpcore/_backends/sync.py",
"new_path": "packages/httpcore/_backends/sync.py",
"diff": "@@ -14,6 +14,7 @@ from .._exceptions import (\nWriteTimeout,\nmap_exceptions,\n)\n+from .tcp_keep_alive import enable_tcp_keep_alive\nfrom .._types import TimeoutDict\nfrom .._utils import is_socket_readable\n@@ -137,6 +138,9 @@ class SyncBackend:\nsock = socket.create_connection(\naddress, connect_timeout, source_address=source_address # type: ignore\n)\n+ # Enable TCP Keep-Alive\n+ enable_tcp_keep_alive(sock)\n+\nif ssl_context is not None:\nsock = ssl_context.wrap_socket(\nsock, server_hostname=hostname.decode(\"ascii\")\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "packages/httpcore/_backends/tcp_keep_alive.py",
"diff": "+# -*- coding: utf-8 -*-\n+\"\"\"\n+ Copyright (C) 2021 Stefano Gottardo - @CastagnaIT\n+ Helper to enable TCP Keep Alive\n+\n+ SPDX-License-Identifier: MIT\n+ See LICENSES/MIT.md for more information.\n+\"\"\"\n+import socket\n+import sys\n+\n+TCP_KEEP_IDLE = 45\n+TCP_KEEPALIVE_INTERVAL = 10\n+TCP_KEEP_CNT = 6\n+\n+\n+def enable_tcp_keep_alive(sock):\n+ \"\"\"Enable TCP Keep-Alive (by default disabled)\"\"\"\n+ # More info on PR: https://github.com/CastagnaIT/plugin.video.netflix/pull/1065\n+ sock.setsockopt(socket.SOL_SOCKET, socket.SO_KEEPALIVE, 1)\n+ if sys.platform == 'linux':\n+ # TCP Keep Alive Probes for Linux/Android\n+ if hasattr(socket, 'TCP_KEEPIDLE'):\n+ sock.setsockopt(socket.IPPROTO_TCP, socket.TCP_KEEPIDLE, TCP_KEEP_IDLE)\n+ if hasattr(socket, 'TCP_KEEPINTVL'):\n+ sock.setsockopt(socket.IPPROTO_TCP, socket.TCP_KEEPINTVL, TCP_KEEPALIVE_INTERVAL)\n+ if hasattr(socket, 'TCP_KEEPCNT'):\n+ sock.setsockopt(socket.IPPROTO_TCP, socket.TCP_KEEPCNT, TCP_KEEP_CNT)\n+ elif sys.platform == 'darwin':\n+ # TCP Keep Alive Probes for MacOS\n+ # NOTE: The socket constants from MacOS netinet/tcp.h are not exported by python's socket module\n+ # The MacOS TCP_KEEPALIVE(0x10) constant should be the same thing of the linux TCP_KEEPIDLE constant\n+ sock.setsockopt(socket.IPPROTO_TCP, getattr(socket, 'TCP_KEEPIDLE', 0x10), TCP_KEEP_IDLE)\n+ sock.setsockopt(socket.IPPROTO_TCP, getattr(socket, 'TCP_KEEPINTVL', 0x101), TCP_KEEPALIVE_INTERVAL)\n+ sock.setsockopt(socket.IPPROTO_TCP, getattr(socket, 'TCP_KEEPCNT', 0x102), TCP_KEEP_CNT)\n+ elif sys.platform == 'win32':\n+ # TCP Keep Alive Probes for Windows\n+ sock.ioctl(socket.SIO_KEEPALIVE_VALS, (1, TCP_KEEP_IDLE * 1000, TCP_KEEPALIVE_INTERVAL * 1000))\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Enabled TCP Keep Alive on httpcore (httpx)
Currently there is no way to enable TCP KeepAlive directly on httpx
module |
106,046 | 11.08.2021 16:31:06 | -7,200 | 4cfbddb4b864faab9a57c0b82216de905242b379 | Changes for httpx | [
{
"change_type": "MODIFY",
"old_path": ".codeclimate.yml",
"new_path": ".codeclimate.yml",
"diff": "@@ -27,6 +27,7 @@ exclude_paths:\n- \"resources/skins/\"\n- \"resources/settings.xml\"\n- \"tests/\"\n+ - \"packages/\"\n- \"addon.xml\"\n- \"changelog.txt\"\n- \"Contributing.md\"\n"
},
{
"change_type": "MODIFY",
"old_path": "codecov.yml",
"new_path": "codecov.yml",
"diff": "@@ -10,3 +10,4 @@ coverage:\ncomment: false\nignore:\n- tests/\n+- packages/\n"
},
{
"change_type": "MODIFY",
"old_path": "requirements.txt",
"new_path": "requirements.txt",
"diff": "@@ -9,3 +9,4 @@ setuptools\ntox\nxmlschema\nKodistubs==19.0.3\n+httpx[http2]\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/globals.py",
"new_path": "resources/lib/globals.py",
"diff": "# All other modules (imports) are initialized only on the first invocation of the add-on.\nimport collections\nimport os\n+import sys\nfrom urllib.parse import parse_qsl, unquote, urlparse\nimport xbmcaddon\n@@ -233,6 +234,7 @@ class GlobalVariables:\nself.DEFAULT_FANART = self.ADDON.getAddonInfo('fanart')\nself.ADDON_DATA_PATH = self.ADDON.getAddonInfo('path') # Add-on folder\nself.DATA_PATH = self.ADDON.getAddonInfo('profile') # Add-on user data folder\n+ self.ADDON_PACKAGES_PATH = os.path.join(self.ADDON_DATA_PATH, 'packages')\nself.CACHE_PATH = os.path.join(self.DATA_PATH, 'cache')\nself.COOKIES_PATH = os.path.join(self.DATA_PATH, 'COOKIES')\ntry:\n@@ -250,6 +252,9 @@ class GlobalVariables:\nLOG.initialize(self.ADDON_ID, self.PLUGIN_HANDLE,\nself.ADDON.getSettingBool('enable_debug'),\nself.ADDON.getSettingBool('enable_timing'))\n+ # Add path of embedded packages (not supplied by Kodi) to python system directory\n+ if self.ADDON_PACKAGES_PATH not in sys.path:\n+ sys.path.insert(0, self.ADDON_PACKAGES_PATH)\nif self.IS_ADDON_FIRSTRUN:\nself.init_database()\n# Initialize the cache\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/run_addon.py",
"new_path": "resources/lib/run_addon.py",
"diff": "@@ -86,7 +86,8 @@ def lazy_login(func):\ntry:\nreturn func(*args, **kwargs)\nexcept NotLoggedInError:\n- # Exception raised by nfsession: \"login\" / \"assert_logged_in\" / \"website_extract_session_data\"\n+ # Exception raised by nfsession:\n+ # \"login\" / \"assert_logged_in\" / \"website_extract_session_data\" / _request from http_requests.py\nLOG.debug('Tried to perform an action without being logged in')\ntry:\nfrom resources.lib.utils.api_requests import login\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/http_server.py",
"new_path": "resources/lib/services/http_server.py",
"diff": "@@ -68,6 +68,11 @@ class NFThreadedTCPServer(ThreadingMixIn, TCPServer):\n# Define shared members\nself.netflix_session = NetflixSession()\n+ def __del__(self):\n+ if self.netflix_session.nfsession.session:\n+ # Close the connection pool of the session\n+ self.netflix_session.nfsession.session.close()\n+\ndef handle_msl_request(server, func_name, data, params=None):\nif func_name == 'get_license':\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/nfsession/msl/msl_requests.py",
"new_path": "resources/lib/services/nfsession/msl/msl_requests.py",
"diff": "@@ -14,7 +14,7 @@ import time\nimport zlib\nfrom typing import TYPE_CHECKING\n-import requests.exceptions as req_exceptions\n+import httpx\nimport resources.lib.common as common\nfrom resources.lib.common.exceptions import MSLError\n@@ -179,13 +179,14 @@ class MSLRequests(MSLRequestBuilder):\n_endpoint = endpoint\nLOG.debug('Executing POST request to {}', _endpoint)\nstart = time.perf_counter()\n- response = self.nfsession.session.post(_endpoint, request_data,\n+ response = self.nfsession.session.post(url=_endpoint,\n+ data=request_data,\nheaders=self.HTTP_HEADERS,\ntimeout=4)\nLOG.debug('Request took {}s', time.perf_counter() - start)\nLOG.debug('Request returned response with status {}', response.status_code)\nbreak\n- except req_exceptions.ConnectionError as exc:\n+ except httpx.ConnectError as exc:\nLOG.error('HTTP request error: {}', exc)\nif retry == 3:\nraise\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/nfsession/nfsession_ops.py",
"new_path": "resources/lib/services/nfsession/nfsession_ops.py",
"diff": "import time\nfrom datetime import datetime, timedelta\n+import httpx\nimport xbmc\nimport resources.lib.common as common\n@@ -78,10 +79,9 @@ class NFSessionOperations(SessionPathRequests):\nself.dt_initial_page_prefetch = None\nreturn\nLOG.debug('Fetch initial page')\n- from requests import exceptions\ntry:\nself.refresh_session_data(True)\n- except exceptions.TooManyRedirects:\n+ except httpx.TooManyRedirects:\n# This error can happen when the profile used in nf session actually no longer exists,\n# something wrong happen in the session then the server try redirect to the login page without success.\n# (CastagnaIT: i don't know the best way to handle this borderline case, but login again works)\n@@ -128,11 +128,10 @@ class NFSessionOperations(SessionPathRequests):\nG.LOCAL_DB.switch_active_profile(guid)\nG.CACHE_MANAGEMENT.identifier_prefix = guid\n- cookies.save(self.session.cookies)\n+ cookies.save(self.session.cookies.jar)\ndef parental_control_data(self, guid, password):\n# Ask to the service if password is right and get the PIN status\n- from requests import exceptions\ntry:\nresponse = self.post_safe('profile_hub',\ndata={'destination': 'contentRestrictions',\n@@ -142,7 +141,7 @@ class NFSessionOperations(SessionPathRequests):\nif response.get('status') != 'ok':\nLOG.warn('Parental control status issue: {}', response)\nraise MissingCredentialsError\n- except exceptions.HTTPError as exc:\n+ except httpx.HTTPStatusError as exc:\nif exc.response.status_code == 500:\n# This endpoint raise HTTP error 500 when the password is wrong\nraise MissingCredentialsError from exc\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/nfsession/session/access.py",
"new_path": "resources/lib/services/nfsession/session/access.py",
"diff": "See LICENSES/MIT.md for more information.\n\"\"\"\nimport re\n+from http.cookiejar import Cookie\n+\n+import httpx\nimport resources.lib.utils.website as website\nimport resources.lib.common as common\n@@ -30,7 +33,6 @@ class SessionAccess(SessionCookie, SessionHTTPRequests):\ndef prefetch_login(self):\n\"\"\"Check if we have stored credentials.\nIf so, do the login before the user requests it\"\"\"\n- from requests import exceptions\ntry:\ncommon.get_credentials()\nif not self.is_logged_in():\n@@ -38,7 +40,7 @@ class SessionAccess(SessionCookie, SessionHTTPRequests):\nreturn True\nexcept MissingCredentialsError:\npass\n- except exceptions.RequestException as exc:\n+ except httpx.RequestError as exc:\n# It was not possible to connect to the web service, no connection, network problem, etc\nimport traceback\nLOG.error('Login prefetch: request exception {}', exc)\n@@ -77,13 +79,33 @@ class SessionAccess(SessionCookie, SessionHTTPRequests):\n@measure_exec_time_decorator(is_immediate=True)\ndef login_auth_data(self, data=None, password=None):\n\"\"\"Perform account login with authentication data\"\"\"\n- from requests import exceptions\nLOG.debug('Logging in with authentication data')\n# Add the cookies to the session\nself.session.cookies.clear()\nfor cookie in data['cookies']:\n- self.session.cookies.set(cookie[0], cookie[1], **cookie[2])\n- cookies.log_cookie(self.session.cookies)\n+ # The code below has been adapted from httpx.Cookies.set() method\n+ kwargs = {\n+ 'version': 0,\n+ 'name': cookie['name'],\n+ 'value': cookie['value'],\n+ 'port': None,\n+ 'port_specified': False,\n+ 'domain': cookie['domain'],\n+ 'domain_specified': bool(cookie['domain']),\n+ 'domain_initial_dot': cookie['domain'].startswith('.'),\n+ 'path': cookie['path'],\n+ 'path_specified': bool(cookie['path']),\n+ 'secure': cookie['secure'],\n+ 'expires': cookie['expires'],\n+ 'discard': True,\n+ 'comment': None,\n+ 'comment_url': None,\n+ 'rest': cookie['rest'],\n+ 'rfc2109': False,\n+ }\n+ cookie = Cookie(**kwargs)\n+ self.session.cookies.jar.set_cookie(cookie)\n+ cookies.log_cookie(self.session.cookies.jar)\n# Try access to website\ntry:\nwebsite.extract_session_data(self.get('browse'), validate=True, update_profiles=True)\n@@ -105,7 +127,7 @@ class SessionAccess(SessionCookie, SessionHTTPRequests):\n'task': 'auth'})\nif response.get('status') != 'ok':\nraise LoginError(common.get_local_string(12344)) # 12344=Passwords entered did not match.\n- except exceptions.HTTPError as exc:\n+ except httpx.HTTPStatusError as exc:\nif exc.response.status_code == 500:\n# This endpoint raise HTTP error 500 when the password is wrong\nraise LoginError(common.get_local_string(12344)) from exc\n@@ -113,7 +135,7 @@ class SessionAccess(SessionCookie, SessionHTTPRequests):\ncommon.set_credentials({'email': email, 'password': password})\nLOG.info('Login successful')\nui.show_notification(common.get_local_string(30109))\n- cookies.save(self.session.cookies)\n+ cookies.save(self.session.cookies.jar)\nreturn True\n@measure_exec_time_decorator(is_immediate=True)\n@@ -136,7 +158,7 @@ class SessionAccess(SessionCookie, SessionHTTPRequests):\ncommon.set_credentials(credentials)\nLOG.info('Login successful')\nui.show_notification(common.get_local_string(30109))\n- cookies.save(self.session.cookies)\n+ cookies.save(self.session.cookies.jar)\nreturn True\nexcept LoginValidateError as exc:\nself.session.cookies.clear()\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/nfsession/session/base.py",
"new_path": "resources/lib/services/nfsession/session/base.py",
"diff": "@@ -13,7 +13,6 @@ from typing import TYPE_CHECKING\nimport resources.lib.common as common\nfrom resources.lib.database.db_utils import TABLE_SESSION\nfrom resources.lib.globals import G\n-from resources.lib.services.tcp_keep_alive import enable_tcp_keep_alive\nfrom resources.lib.utils.logging import LOG\nif TYPE_CHECKING: # This variable/imports are used only by the editor, so not at runtime\n@@ -26,9 +25,6 @@ class SessionBase:\nsession = None\n\"\"\"The requests.session object to handle communication to Netflix\"\"\"\n- verify_ssl = True\n- \"\"\"Use SSL verification when performing requests\"\"\"\n-\n# Functions from derived classes to allow perform particular operations in parent classes\nexternal_func_activate_profile = None # (set by nfsession_op.py)\n@@ -45,9 +41,10 @@ class SessionBase:\nLOG.info('Session closed')\nexcept AttributeError:\npass\n- from requests import Session\n- self.session = Session()\n- enable_tcp_keep_alive(self.session)\n+ import httpx\n+ # (http1=False, http2=True) means that the client know that server support HTTP/2 and avoid to do negotiations,\n+ # prior knowledge: https://python-hyper.org/projects/hyper-h2/en/v2.3.1/negotiating-http2.html#prior-knowledge\n+ self.session = httpx.Client(http1=False, http2=True)\nself.session.max_redirects = 10 # Too much redirects should means some problem\nself.session.headers.update({\n'User-Agent': common.get_user_agent(enable_android_mediaflag_fix=True),\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/nfsession/session/cookie.py",
"new_path": "resources/lib/services/nfsession/session/cookie.py",
"diff": "@@ -46,7 +46,7 @@ class SessionCookie(SessionBase):\nLOG.error('The cookie \"{}\" do not exist, it is not possible to check the expiration',\ncookie_name)\nreturn False\n- for cookie in list(self.session.cookies):\n+ for cookie in self.session.cookies.jar:\nif cookie.name != cookie_name:\ncontinue\nif cookie.expires <= int(time.time()):\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/nfsession/session/http_requests.py",
"new_path": "resources/lib/services/nfsession/session/http_requests.py",
"diff": "import json\nimport time\n-import requests.exceptions as req_exceptions\n+import httpx\nimport resources.lib.common as common\nimport resources.lib.utils.website as website\n@@ -32,14 +32,14 @@ class SessionHTTPRequests(SessionBase):\ndef get(self, endpoint, **kwargs):\n\"\"\"Execute a GET request to the designated endpoint.\"\"\"\nreturn self._request_call(\n- method=self.session.get,\n+ method='GET',\nendpoint=endpoint,\n**kwargs)\ndef post(self, endpoint, **kwargs):\n\"\"\"Execute a POST request to the designated endpoint.\"\"\"\nreturn self._request_call(\n- method=self.session.post,\n+ method='POST',\nendpoint=endpoint,\n**kwargs)\n@@ -56,12 +56,17 @@ class SessionHTTPRequests(SessionBase):\nretry = 1\nwhile True:\ntry:\n- LOG.debug('Executing {verb} request to {url}',\n- verb='GET' if method == self.session.get else 'POST', url=url)\n+ LOG.debug('Executing {verb} request to {url}', verb=method, url=url)\nstart = time.perf_counter()\n- response = method(\n+ if method == 'GET':\n+ response = self.session.get(\n+ url=url,\n+ headers=headers,\n+ params=params,\n+ timeout=8)\n+ else:\n+ response = self.session.post(\nurl=url,\n- verify=self.verify_ssl,\nheaders=headers,\nparams=params,\ndata=data,\n@@ -69,7 +74,16 @@ class SessionHTTPRequests(SessionBase):\nLOG.debug('Request took {}s', time.perf_counter() - start)\nLOG.debug('Request returned status code {}', response.status_code)\nbreak\n- except req_exceptions.ConnectionError as exc:\n+ except httpx.RemoteProtocolError as exc:\n+ if 'Server disconnected' in str(exc):\n+ # Known reasons:\n+ # - The server has revoked cookies validity\n+ # - The user has executed \"Sign out of all devices\" from account settings\n+ # Clear the user ID tokens are tied to the credentials\n+ self.msl_handler.clear_user_id_tokens()\n+ raise NotLoggedInError from exc\n+ raise\n+ except httpx.ConnectError as exc:\nLOG.error('HTTP request error: {}', exc)\nif retry == 3:\nraise\n@@ -98,7 +112,7 @@ class SessionHTTPRequests(SessionBase):\n\"\"\"Refresh session data from the Netflix website\"\"\"\ntry:\nself.auth_url = website.extract_session_data(self.get('browse'))['auth_url']\n- cookies.save(self.session.cookies)\n+ cookies.save(self.session.cookies.jar)\nLOG.debug('Successfully refreshed session data')\nreturn True\nexcept MbrStatusError:\n@@ -116,9 +130,9 @@ class SessionHTTPRequests(SessionBase):\ncommon.purge_credentials()\nui.show_notification(common.get_local_string(30008))\nraise NotLoggedInError from exc\n- except req_exceptions.RequestException:\n+ except httpx.RequestError:\nimport traceback\n- LOG.warn('Failed to refresh session data, request error (RequestException)')\n+ LOG.warn('Failed to refresh session data, request error (RequestError)')\nLOG.warn(traceback.format_exc())\nif raise_exception:\nraise\n@@ -171,7 +185,7 @@ class SessionHTTPRequests(SessionBase):\nif endpoint_conf['add_auth_url'] == 'to_data':\ndata['authURL'] = self.auth_url\nif endpoint_conf.get('content_type') == 'application/x-www-form-urlencoded':\n- data_converted = data # In this case Requests module convert the data automatically\n+ data_converted = data # In this case the data is converted automatically\nelse:\ndata_converted = json.dumps(data, separators=(',', ':')) # Netflix rejects spaces\nelse:\n@@ -193,6 +207,7 @@ def _api_url(endpoint_address):\nbaseurl = G.LOCAL_DB.get_value('api_endpoint_url', table=TABLE_SESSION)\nreturn f'{baseurl}{endpoint_address}'\n+\ndef _raise_api_error(decoded_response):\nif decoded_response.get('status', 'success') == 'error':\nraise APIError(decoded_response.get('message'))\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/utils/cookies.py",
"new_path": "resources/lib/utils/cookies.py",
"diff": "See LICENSES/MIT.md for more information.\n\"\"\"\nimport pickle\n+from http.cookiejar import CookieJar\n+from threading import RLock\nfrom time import time\nimport xbmcvfs\n@@ -17,14 +19,38 @@ from resources.lib.globals import G\nfrom resources.lib.utils.logging import LOG\n+class PickleableCookieJar(CookieJar):\n+ \"\"\"A pickleable CookieJar class\"\"\"\n+ # This code has been adapted from RequestsCookieJar of \"Requests\" module\n+ @classmethod\n+ def cast(cls, cookie_jar: CookieJar):\n+ \"\"\"Make a kind of cast to convert the class from CookieJar to PickleableCookieJar\"\"\"\n+ assert isinstance(cookie_jar, CookieJar)\n+ cookie_jar.__class__ = cls\n+ assert isinstance(cookie_jar, PickleableCookieJar)\n+ return cookie_jar\n+\n+ def __getstate__(self):\n+ \"\"\"Unlike a normal CookieJar, this class is pickleable.\"\"\"\n+ state = self.__dict__.copy()\n+ # remove the unpickleable RLock object\n+ state.pop('_cookies_lock')\n+ return state\n+\n+ def __setstate__(self, state):\n+ \"\"\"Unlike a normal CookieJar, this class is pickleable.\"\"\"\n+ self.__dict__.update(state)\n+ if '_cookies_lock' not in self.__dict__:\n+ self._cookies_lock = RLock()\n+\n+\ndef save(cookie_jar, log_output=True):\n\"\"\"Save a cookie jar to file and in-memory storage\"\"\"\nif log_output:\nlog_cookie(cookie_jar)\ncookie_file = xbmcvfs.File(cookie_file_path(), 'wb')\ntry:\n- # pickle.dump(cookie_jar, cookie_file)\n- cookie_file.write(bytearray(pickle.dumps(cookie_jar)))\n+ cookie_file.write(bytearray(pickle.dumps(PickleableCookieJar.cast(cookie_jar))))\nexcept Exception as exc: # pylint: disable=broad-except\nLOG.error('Failed to save cookies to file: {exc}', exc=exc)\nfinally:\n@@ -81,11 +107,12 @@ def cookie_file_path():\ndef convert_chrome_cookie(cookie):\n\"\"\"Convert a cookie from Chrome to a CookieJar format type\"\"\"\n- kwargs = {'domain': cookie['domain']}\n- if cookie['expires'] != -1:\n- kwargs['expires'] = int(cookie['expires'])\n- kwargs['path'] = cookie['path']\n- kwargs['secure'] = cookie['secure']\n- if cookie['httpOnly']:\n- kwargs['rest'] = {'HttpOnly': True}\n- return cookie['name'], cookie['value'], kwargs\n+ return {\n+ 'name': cookie['name'],\n+ 'value': cookie['value'],\n+ 'domain': cookie['domain'],\n+ 'path': cookie['path'],\n+ 'secure': cookie['secure'],\n+ 'expires': int(cookie['expires']) if cookie['expires'] != -1 else None,\n+ 'rest': {'HttpOnly': True if cookie['httpOnly'] else None}\n+ }\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Changes for httpx |
106,046 | 21.07.2021 17:50:36 | -7,200 | ac127878c612a14df5f43399993f0b8cce209ae1 | Removed "Requests" dependency | [
{
"change_type": "MODIFY",
"old_path": "addon.xml",
"new_path": "addon.xml",
"diff": "<import addon=\"script.module.addon.signals\" version=\"0.0.6+matrix.1\"/>\n<import addon=\"script.module.inputstreamhelper\" version=\"0.5.0+matrix.1\"/>\n<import addon=\"script.module.pycryptodome\" version=\"3.4.3\"/>\n- <import addon=\"script.module.requests\" version=\"2.22.0+matrix.1\"/>\n<import addon=\"script.module.myconnpy\" version=\"8.0.18+matrix.1\"/> <!--MySQL Connector/Python-->\n</requires>\n<extension point=\"xbmc.python.pluginsource\" library=\"addon.py\">\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Removed "Requests" dependency |
106,046 | 13.08.2021 10:02:21 | -7,200 | e2515a7c27d3c96635fb707e1936f3cd4e395661 | Version bump (1.17.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=\"1.16.2+matrix.1\" provider-name=\"libdev + jojo + asciidisco + caphm + castagnait\">\n+<addon id=\"plugin.video.netflix\" name=\"Netflix\" version=\"1.17.0+matrix.1\" provider-name=\"libdev + jojo + asciidisco + caphm + castagnait\">\n<requires>\n<import addon=\"xbmc.python\" version=\"3.0.0\"/>\n<import addon=\"script.module.addon.signals\" version=\"0.0.6+matrix.1\"/>\n<forum>https://forum.kodi.tv/showthread.php?tid=329767</forum>\n<source>https://github.com/CastagnaIT/plugin.video.netflix</source>\n<news>\n-v1.16.2 (2021-07-16)\n-- Implemented new licensed manifest request (to have HD is mandatory to update InputStream Adaptive to last version)\n-- Fixed \"This title is not available to watch instantly\" error on some ARM devices incorrectly identified\n-- Fixed empty lists on menu/submenus due to website changes\n-- Update translation zh_cn\n-- Minor changes\n+v1.17.0 (2021-08-13)\n+- Migration to HTTP2 protocol\n+- Fixed login with username/password for more than 90% of cases\n</news>\n</extension>\n</addon>\n"
},
{
"change_type": "MODIFY",
"old_path": "changelog.txt",
"new_path": "changelog.txt",
"diff": "+v1.17.0 (2021-08-13)\n+- Migration to HTTP2 protocol\n+- Fixed login with username/password for more than 90% of cases\n+\nv1.16.2 (2021-07-16)\n- Implemented new licensed manifest request (to have HD is mandatory to update InputStream Adaptive to last version)\n- Fixed \"This title is not available to watch instantly\" error on some ARM devices incorrectly identified\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Version bump (1.17.0) (#1211) |
106,046 | 20.08.2021 18:07:00 | -7,200 | ac5b049ee3bf968eb02fa131bfeaba3a51481fc8 | Removed python 3.6 from CI
EOL end of this year and HTTP2 deps need at least 3.7 | [
{
"change_type": "MODIFY",
"old_path": ".github/workflows/ci.yml",
"new_path": ".github/workflows/ci.yml",
"diff": "@@ -10,7 +10,7 @@ jobs:\nstrategy:\nfail-fast: false\nmatrix:\n- python-version: [3.6, 3.7, 3.8, 3.9]\n+ python-version: [3.7, 3.8, 3.9]\nsteps:\n- name: Check out ${{ github.sha }} from repository ${{ github.repository }}\nuses: actions/checkout@v2\n"
},
{
"change_type": "MODIFY",
"old_path": "tox.ini",
"new_path": "tox.ini",
"diff": "[tox]\n-envlist = py36,py37,py38,py39,flake8\n+envlist = py37,py38,py39,flake8\nskipsdist = True\nskip_missing_interpreters = True\n@@ -16,7 +16,7 @@ builtins = func\nmax-line-length = 160\nignore = E129,E402,F401,F403,FI13,FI50,FI51,FI53,FI54,W503,W504\nrequire-code = True\n-min-version = 3.6\n+min-version = 3.7\nexclude = .tox\n[pytest]\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Removed python 3.6 from CI
EOL end of this year and HTTP2 deps need at least 3.7 |
106,046 | 10.09.2021 10:53:03 | -7,200 | 181e9015f31a18a3a232f74c6e2c4505415f79df | Fix pylint use-dict-literal | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/nfsession/msl/android_crypto.py",
"new_path": "resources/lib/services/nfsession/msl/android_crypto.py",
"diff": "@@ -88,7 +88,7 @@ class AndroidMSLCrypto(MSLBaseCrypto):\n# No key update supported -> remove existing keys\nself.crypto_session.RemoveKeys()\n_key_request = self.crypto_session.GetKeyRequest( # pylint: disable=assignment-from-none\n- bytes([10, 122, 0, 108, 56, 43]), 'application/xml', True, dict())\n+ bytes([10, 122, 0, 108, 56, 43]), 'application/xml', True, {})\nif not _key_request:\nraise MSLError('Widevine CryptoSession getKeyRequest failed!')\nLOG.debug('Widevine CryptoSession getKeyRequest successful. Size: {}', len(_key_request))\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Fix pylint use-dict-literal |
106,046 | 10.09.2021 15:06:18 | -7,200 | bbeacea7b2676816f14736909384b99d5cb373ce | Add support to make search by text from json-rpc | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/navigation/directory_search.py",
"new_path": "resources/lib/navigation/directory_search.py",
"diff": "@@ -34,6 +34,9 @@ SEARCH_TYPES_DESC = {\ndef route_search_nav(pathitems, perpetual_range_start, dir_update_listing, params):\n+ if 'query' in params:\n+ path = 'query'\n+ else:\npath = pathitems[2] if len(pathitems) > 2 else 'list'\nLOG.debug('Routing \"search\" navigation to: {}', path)\nret = True\n@@ -47,6 +50,12 @@ def route_search_nav(pathitems, perpetual_range_start, dir_update_listing, param\nsearch_remove(params['row_id'])\nelif path == 'clear':\nret = search_clear()\n+ elif path == 'query':\n+ # Used to make a search by text from a JSON-RPC request\n+ # without save the item to the add-on database\n+ # Endpoint: plugin://plugin.video.netflix/directory/search/search/?query=something\n+ ret = exec_query(None, 'text', None, params['query'], perpetual_range_start, dir_update_listing,\n+ {'query': params['query']})\nelse:\nret = search_query(path, perpetual_range_start, dir_update_listing)\nif not ret:\n@@ -169,14 +178,19 @@ def search_query(row_id, perpetual_range_start, dir_update_listing):\n# Update the last access data (move on top last used items)\nif not perpetual_range_start:\nG.LOCAL_DB.update_search_item_last_access(row_id)\n- # Perform the path call\n+ return exec_query(row_id, search_item['Type'], search_item['Parameters'], search_item['Value'],\n+ perpetual_range_start, dir_update_listing)\n+\n+\n+def exec_query(row_id, search_type, search_params, search_value, perpetual_range_start, dir_update_listing,\n+ path_params=None):\nmenu_data = G.MAIN_MENU_ITEMS['search']\n- search_type = search_item['Type']\nif search_type == 'text':\ncall_args = {\n'menu_data': menu_data,\n- 'search_term': search_item['Value'],\n- 'pathitems': ['search', 'search', row_id],\n+ 'search_term': search_value,\n+ 'pathitems': ['search', 'search', row_id] if row_id else ['search', 'search'],\n+ 'path_params': path_params,\n'perpetual_range_start': perpetual_range_start\n}\ndir_items, extra_data = common.make_call('get_video_list_search', call_args)\n@@ -186,7 +200,7 @@ def search_query(row_id, perpetual_range_start, dir_update_listing):\n'pathitems': ['search', 'search', row_id],\n'perpetual_range_start': perpetual_range_start,\n'context_name': 'spokenAudio',\n- 'context_id': common.convert_from_string(search_item['Parameters'], dict)['lang_code']\n+ 'context_id': common.convert_from_string(search_params, dict)['lang_code']\n}\ndir_items, extra_data = common.make_call('get_video_list_sorted_sp', call_args)\nelif search_type == 'subtitles_lang':\n@@ -195,7 +209,7 @@ def search_query(row_id, perpetual_range_start, dir_update_listing):\n'pathitems': ['search', 'search', row_id],\n'perpetual_range_start': perpetual_range_start,\n'context_name': 'subtitles',\n- 'context_id': common.convert_from_string(search_item['Parameters'], dict)['lang_code']\n+ 'context_id': common.convert_from_string(search_params, dict)['lang_code']\n}\ndir_items, extra_data = common.make_call('get_video_list_sorted_sp', call_args)\nelif search_type == 'genre_id':\n@@ -204,7 +218,7 @@ def search_query(row_id, perpetual_range_start, dir_update_listing):\n'pathitems': ['search', 'search', row_id],\n'perpetual_range_start': perpetual_range_start,\n'context_name': 'genres',\n- 'context_id': common.convert_from_string(search_item['Parameters'], dict)['genre_id']\n+ 'context_id': common.convert_from_string(search_params, dict)['genre_id']\n}\ndir_items, extra_data = common.make_call('get_video_list_sorted_sp', call_args)\nelse:\n@@ -213,7 +227,7 @@ def search_query(row_id, perpetual_range_start, dir_update_listing):\nif not dir_items:\nui.show_notification(common.get_local_string(30407))\nreturn False\n- _search_results_directory(search_item['Value'], menu_data, dir_items, extra_data, dir_update_listing)\n+ _search_results_directory(search_value, menu_data, dir_items, extra_data, dir_update_listing)\nreturn True\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/nfsession/directorybuilder/dir_builder.py",
"new_path": "resources/lib/services/nfsession/directorybuilder/dir_builder.py",
"diff": "@@ -129,9 +129,10 @@ class DirectoryBuilder(DirectoryPathRequests):\nreturn build_video_listing(video_list, menu_data, pathitems=pathitems, mylist_items=self.req_mylist_items())\n@measure_exec_time_decorator(is_immediate=True)\n- def get_video_list_search(self, pathitems, menu_data, search_term, perpetual_range_start):\n+ def get_video_list_search(self, pathitems, menu_data, search_term, perpetual_range_start, path_params=None):\nvideo_list = self.req_video_list_search(search_term, perpetual_range_start=perpetual_range_start)\n- return build_video_listing(video_list, menu_data, pathitems=pathitems, mylist_items=self.req_mylist_items())\n+ return build_video_listing(video_list, menu_data,\n+ pathitems=pathitems, mylist_items=self.req_mylist_items(), path_params=path_params)\n@measure_exec_time_decorator(is_immediate=True)\ndef get_genres(self, menu_data, genre_id, force_use_videolist_id):\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/nfsession/directorybuilder/dir_builder_items.py",
"new_path": "resources/lib/services/nfsession/directorybuilder/dir_builder_items.py",
"diff": "@@ -249,7 +249,7 @@ def _create_videolist_item(list_id, video_list, menu_data, common_data, static_l\n@measure_exec_time_decorator(is_immediate=True)\ndef build_video_listing(video_list, menu_data, sub_genre_id=None, pathitems=None, perpetual_range_start=None,\n- mylist_items=None):\n+ mylist_items=None, path_params=None):\n\"\"\"Build a video listing\"\"\"\ncommon_data = {\n'params': get_param_watched_status_by_profile(),\n@@ -286,7 +286,8 @@ def build_video_listing(video_list, menu_data, sub_genre_id=None, pathitems=None\nfolder_list_item,\nTrue))\n# add_items_previous_next_page use the new value of perpetual_range_selector\n- add_items_previous_next_page(directory_items, pathitems, video_list.perpetual_range_selector, sub_genre_id)\n+ add_items_previous_next_page(directory_items, pathitems, video_list.perpetual_range_selector, sub_genre_id,\n+ path_params)\nG.CACHE_MANAGEMENT.execute_pending_db_ops()\nreturn directory_items, {}\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/nfsession/directorybuilder/dir_builder_utils.py",
"new_path": "resources/lib/services/nfsession/directorybuilder/dir_builder_utils.py",
"diff": "@@ -18,11 +18,14 @@ def _get_custom_thumb_path(thumb_file_name):\nreturn os.path.join(G.ADDON_DATA_PATH, 'resources', 'media', thumb_file_name)\n-def add_items_previous_next_page(directory_items, pathitems, perpetual_range_selector, sub_genre_id=None):\n+def add_items_previous_next_page(directory_items, pathitems, perpetual_range_selector, sub_genre_id=None,\n+ path_params=None):\nif pathitems and perpetual_range_selector:\nif 'previous_start' in perpetual_range_selector:\nparams = {'perpetual_range_start': perpetual_range_selector.get('previous_start'),\n'sub_genre_id': sub_genre_id if perpetual_range_selector.get('previous_start') == 0 else None}\n+ if path_params:\n+ params.update(path_params)\nprevious_page_item = ListItemW(label=common.get_local_string(30148))\nprevious_page_item.setProperty('specialsort', 'top') # Force an item to stay on top\nprevious_page_item.setArt({'thumb': _get_custom_thumb_path('FolderPagePrevious.png')})\n@@ -31,6 +34,8 @@ def add_items_previous_next_page(directory_items, pathitems, perpetual_range_sel\nTrue))\nif 'next_start' in perpetual_range_selector:\nparams = {'perpetual_range_start': perpetual_range_selector.get('next_start')}\n+ if path_params:\n+ params.update(path_params)\nnext_page_item = ListItemW(label=common.get_local_string(30147))\nnext_page_item.setProperty('specialsort', 'bottom') # Force an item to stay on bottom\nnext_page_item.setArt({'thumb': _get_custom_thumb_path('FolderPageNext.png')})\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Add support to make search by text from json-rpc |
106,046 | 23.09.2021 18:27:33 | -7,200 | 170ce5daddb4b254a8feeeb66d4a5af62c631d81 | Fix search by language | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/navigation/directory_search.py",
"new_path": "resources/lib/navigation/directory_search.py",
"diff": "SPDX-License-Identifier: MIT\nSee LICENSES/MIT.md for more information.\n\"\"\"\n+from copy import deepcopy\n+\nimport xbmcgui\nimport xbmcplugin\n@@ -184,7 +186,7 @@ def search_query(row_id, perpetual_range_start, dir_update_listing):\ndef exec_query(row_id, search_type, search_params, search_value, perpetual_range_start, dir_update_listing,\npath_params=None):\n- menu_data = G.MAIN_MENU_ITEMS['search']\n+ menu_data = deepcopy(G.MAIN_MENU_ITEMS['search'])\nif search_type == 'text':\ncall_args = {\n'menu_data': menu_data,\n@@ -195,6 +197,7 @@ def exec_query(row_id, search_type, search_params, search_value, perpetual_range\n}\ndir_items, extra_data = common.make_call('get_video_list_search', call_args)\nelif search_type == 'audio_lang':\n+ menu_data['query_without_reference'] = True\ncall_args = {\n'menu_data': menu_data,\n'pathitems': ['search', 'search', row_id],\n@@ -204,6 +207,7 @@ def exec_query(row_id, search_type, search_params, search_value, perpetual_range\n}\ndir_items, extra_data = common.make_call('get_video_list_sorted_sp', call_args)\nelif search_type == 'subtitles_lang':\n+ menu_data['query_without_reference'] = True\ncall_args = {\n'menu_data': menu_data,\n'pathitems': ['search', 'search', row_id],\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Fix search by language |
106,046 | 24.09.2021 11:03:19 | -7,200 | cc1d93829d1664ea5c25a1e68c7bc10c7c4df163 | Disable hevc if unsupported after Kodi upgrade | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/upgrade_controller.py",
"new_path": "resources/lib/upgrade_controller.py",
"diff": "SPDX-License-Identifier: MIT\nSee LICENSES/MIT.md for more information.\n\"\"\"\n+from resources.lib.common import is_device_4k_capable\nfrom resources.lib.common.misc_utils import CmpVersion\nfrom resources.lib.database.db_update import run_local_db_updates, run_shared_db_updates\nfrom resources.lib.globals import G, remove_ver_suffix\n@@ -81,6 +82,10 @@ def _perform_service_changes(previous_ver, current_ver):\n# then we assume that add-on versions prior to 1.13 was on Kodi 18\n# The am_stream_continuity.py on Kodi 18 works differently and the existing data can not be used on Kodi 19\nG.SHARED_DB.clear_stream_continuity()\n+ # Disable enable_hevc_profiles if has been wrongly enabled by the user and it is unsupported by the systems\n+ with G.SETTINGS_MONITOR.ignore_events(1):\n+ is_4k_capable = is_device_4k_capable()\n+ G.ADDON.setSettingBool('enable_hevc_profiles', is_4k_capable)\nif CmpVersion(previous_ver) < '1.9.0':\n# In the version 1.9.0 has been changed the COOKIE_ filename with a static filename\nfrom resources.lib.upgrade_actions import rename_cookie_file\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Disable hevc if unsupported after Kodi upgrade |
106,046 | 12.10.2021 21:00:46 | -7,200 | 1c68c7d4c399603a5dcbeef1e7637de7a9036a72 | Sponsor links | [
{
"change_type": "ADD",
"old_path": null,
"new_path": ".github/FUNDING.yml",
"diff": "+# These are supported funding model platforms\n+\n+github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]\n+patreon: # Replace with a single Patreon username\n+open_collective: # Replace with a single Open Collective username\n+ko_fi: stefive\n+tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel\n+community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry\n+liberapay: # Replace with a single Liberapay username\n+issuehunt: # Replace with a single IssueHunt username\n+otechie: # Replace with a single Otechie username\n+custom: beacons.ai/castagnait\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Sponsor links |
106,046 | 15.10.2021 18:49:18 | -7,200 | 7ff87e22b1f5a69c6211ddfc82dacb13bed705be | Fix missing/wrong MPD data | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/nfsession/msl/converter.py",
"new_path": "resources/lib/services/nfsession/msl/converter.py",
"diff": "@@ -25,7 +25,6 @@ def convert_to_dash(manifest):\ncdn_index = int(G.ADDON.getSettingString('cdn_server')[-1]) - 1\nseconds = manifest['duration'] / 1000\n- init_length = int(seconds / 2 * 12 + 20 * 1000)\nduration = \"PT\" + str(int(seconds)) + \".00S\"\nroot = _mpd_manifest_root(duration)\n@@ -35,7 +34,7 @@ def convert_to_dash(manifest):\nvideo_protection_info = _get_protection_info(manifest['video_tracks'][0]) if has_video_drm_streams else None\nfor video_track in manifest['video_tracks']:\n- _convert_video_track(video_track, period, init_length, video_protection_info, has_video_drm_streams, cdn_index)\n+ _convert_video_track(video_track, period, video_protection_info, has_video_drm_streams, cdn_index)\ncommon.apply_lang_code_changes(manifest['audio_tracks'])\ncommon.apply_lang_code_changes(manifest['timedtexttracks'])\n@@ -45,7 +44,7 @@ def convert_to_dash(manifest):\nid_default_audio_tracks = _get_id_default_audio_tracks(manifest)\nfor audio_track in manifest['audio_tracks']:\nis_default = audio_track['id'] == id_default_audio_tracks\n- _convert_audio_track(audio_track, period, init_length, is_default, has_audio_drm_streams, cdn_index)\n+ _convert_audio_track(audio_track, period, is_default, has_audio_drm_streams, cdn_index)\nfor text_track in manifest['timedtexttracks']:\nif text_track['isNoneTrack']:\n@@ -71,12 +70,25 @@ def _add_base_url(representation, base_url):\nET.SubElement(representation, 'BaseURL').text = base_url\n-def _add_segment_base(representation, init_length):\n- ET.SubElement(\n+def _add_segment_base(representation, downloadable):\n+ if 'sidx' not in downloadable:\n+ return\n+ sidx_end_offset = downloadable['sidx']['offset'] + downloadable['sidx']['size']\n+ timescale = None\n+ if 'framerate_value' in downloadable:\n+ timescale = str(1000 * downloadable['framerate_value'] * downloadable['framerate_scale'])\n+ segment_base = ET.SubElement(\nrepresentation, # Parent\n'SegmentBase', # Tag\n- indexRange=f'0-{init_length}',\n+ xmlns='urn:mpeg:dash:schema:mpd:2011',\n+ indexRange=f'{downloadable[\"sidx\"][\"offset\"]}-{sidx_end_offset}',\nindexRangeExact='true')\n+ if timescale:\n+ segment_base.set('timescale', timescale)\n+ ET.SubElement(\n+ segment_base, # Parent\n+ 'Initialization', # Tag\n+ range=f'0-{downloadable[\"sidx\"][\"offset\"] - 1}')\ndef _get_protection_info(content):\n@@ -121,7 +133,7 @@ def _add_protection_info(adaptation_set, pssh, keyid):\nET.SubElement(protection, 'cenc:pssh').text = pssh\n-def _convert_video_track(video_track, period, init_length, protection, has_drm_streams, cdn_index):\n+def _convert_video_track(video_track, period, protection, has_drm_streams, cdn_index):\nadaptation_set = ET.SubElement(\nperiod, # Parent\n'AdaptationSet', # Tag\n@@ -138,7 +150,7 @@ def _convert_video_track(video_track, period, init_length, protection, has_drm_s\nif limit_res:\nif int(downloadable['res_h']) > limit_res:\ncontinue\n- _convert_video_downloadable(downloadable, adaptation_set, init_length, cdn_index)\n+ _convert_video_downloadable(downloadable, adaptation_set, cdn_index)\ndef _limit_video_resolution(video_tracks, has_drm_streams):\n@@ -166,12 +178,12 @@ def _limit_video_resolution(video_tracks, has_drm_streams):\nreturn None\n-def _convert_video_downloadable(downloadable, adaptation_set, init_length, cdn_index):\n+def _convert_video_downloadable(downloadable, adaptation_set, cdn_index):\n# pylint: disable=consider-using-f-string\nrepresentation = ET.SubElement(\nadaptation_set, # Parent\n'Representation', # Tag\n- id=str(downloadable['urls'][cdn_index]['cdn_id']),\n+ id=str(downloadable['downloadable_id']),\nwidth=str(downloadable['res_w']),\nheight=str(downloadable['res_h']),\nbandwidth=str(downloadable['bitrate'] * 1024),\n@@ -181,7 +193,7 @@ def _convert_video_downloadable(downloadable, adaptation_set, init_length, cdn_i\nfps_scale=downloadable['framerate_scale']),\nmimeType='video/mp4')\n_add_base_url(representation, downloadable['urls'][cdn_index]['url'])\n- _add_segment_base(representation, init_length)\n+ _add_segment_base(representation, downloadable)\ndef _determine_video_codec(content_profile):\n@@ -195,7 +207,7 @@ def _determine_video_codec(content_profile):\n# pylint: disable=unused-argument\n-def _convert_audio_track(audio_track, period, init_length, default, has_drm_streams, cdn_index):\n+def _convert_audio_track(audio_track, period, default, has_drm_streams, cdn_index):\nchannels_count = {'1.0': '1', '2.0': '2', '5.1': '6', '7.1': '8'}\nimpaired = 'true' if audio_track['trackType'] == 'ASSISTIVE' else 'false'\noriginal = 'true' if audio_track['isNative'] else 'false'\n@@ -218,18 +230,17 @@ def _convert_audio_track(audio_track, period, init_length, default, has_drm_stre\n# Some audio stream has no drm\n# if downloadable['isDrm'] != has_drm_streams:\n# continue\n- _convert_audio_downloadable(downloadable, adaptation_set, init_length, channels_count[downloadable['channels']],\n- cdn_index)\n+ _convert_audio_downloadable(downloadable, adaptation_set, channels_count[downloadable['channels']], cdn_index)\n-def _convert_audio_downloadable(downloadable, adaptation_set, init_length, channels_count, cdn_index):\n+def _convert_audio_downloadable(downloadable, adaptation_set, channels_count, cdn_index):\ncodec_type = 'aac'\nif 'ddplus-' in downloadable['content_profile'] or 'dd-' in downloadable['content_profile']:\ncodec_type = 'ec-3'\nrepresentation = ET.SubElement(\nadaptation_set, # Parent\n'Representation', # Tag\n- id=str(downloadable['urls'][cdn_index]['cdn_id']),\n+ id=str(downloadable['downloadable_id']),\ncodecs=codec_type,\nbandwidth=str(downloadable['bitrate'] * 1024),\nmimeType='audio/mp4')\n@@ -239,7 +250,7 @@ def _convert_audio_downloadable(downloadable, adaptation_set, init_length, chann\nschemeIdUri='urn:mpeg:dash:23003:3:audio_channel_configuration:2011',\nvalue=channels_count)\n_add_base_url(representation, downloadable['urls'][cdn_index]['url'])\n- _add_segment_base(representation, init_length)\n+ _add_segment_base(representation, downloadable)\ndef _convert_text_track(text_track, period, default, cdn_index):\n@@ -270,6 +281,7 @@ def _convert_text_track(text_track, period, default, cdn_index):\nrepresentation = ET.SubElement(\nadaptation_set, # Parent\n'Representation', # Tag\n+ id=str(list(text_track['downloadableIds'].values())[0]),\nnflxProfile=content_profile)\n_add_base_url(representation, list(downloadable[content_profile]['downloadUrls'].values())[cdn_index])\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Fix missing/wrong MPD data |
106,046 | 17.10.2021 17:08:40 | -7,200 | 628c2c437bf64442fb05104a6d2bb470cf8f83cf | Allow user disable system-based encryption | [
{
"change_type": "MODIFY",
"old_path": "resources/language/resource.language.en_gb/strings.po",
"new_path": "resources/language/resource.language.en_gb/strings.po",
"diff": "@@ -1102,7 +1102,16 @@ msgctxt \"#30609\"\nmsgid \"Do you want to reset all settings?\"\nmsgstr \"\"\n-# Unused 30610 to 30619\n+msgctxt \"#30610\"\n+msgid \"Use system-based encryption for credentials\"\n+msgstr \"\"\n+\n+# Help description for setting id 30610\n+msgctxt \"#30611\"\n+msgid \"[B]If disabled it will cause a security leak[/B]. If your operating system does not support it, you will be prompted to login each time you reboot the device, [B]only[/B] in this case disable it. If you change this setting you will be prompted to login again in the next time you reboot.\"\n+msgstr \"\"\n+\n+# Unused 30612 to 30619\nmsgctxt \"#30620\"\nmsgid \"This title will be available from: {}\"\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/common/uuid_device.py",
"new_path": "resources/lib/common/uuid_device.py",
"diff": "SPDX-License-Identifier: MIT\nSee LICENSES/MIT.md for more information.\n\"\"\"\n+from resources.lib.globals import G\nfrom resources.lib.utils.logging import LOG\nfrom .device_utils import get_system_platform\n@@ -43,7 +44,8 @@ def _get_system_uuid():\nTry to get an uuid from the system, if it's not possible generates a fake uuid\n:return: an uuid converted to MD5\n\"\"\"\n- uuid_value = None\n+ uuid_value = ''\n+ if G.ADDON.getSettingBool('credentials_system_encryption'):\nsystem = get_system_platform()\nif system in ['windows', 'uwp']:\nuuid_value = _get_windows_uuid()\n@@ -92,15 +94,14 @@ def _get_linux_uuid():\nimport subprocess\nuuid_value = None\ntry:\n- uuid_value = subprocess.check_output(['cat', '/var/lib/dbus/machine-id']).decode('utf-8')\n+ uuid_value = subprocess.check_output(['cat', '/etc/machine-id']).decode('utf-8')\nexcept Exception as exc:\nimport traceback\nLOG.error('_get_linux_uuid first attempt returned: {}', exc)\nLOG.error(traceback.format_exc())\nif not uuid_value:\ntry:\n- # Fedora linux\n- uuid_value = subprocess.check_output(['cat', '/etc/machine-id']).decode('utf-8')\n+ uuid_value = subprocess.check_output(['cat', '/var/lib/dbus/machine-id']).decode('utf-8')\nexcept Exception as exc:\nLOG.error('_get_linux_uuid second attempt returned: {}', exc)\nreturn uuid_value\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/settings.xml",
"new_path": "resources/settings.xml",
"diff": "<popup>false</popup>\n</control>\n</setting>\n+ <setting id=\"credentials_system_encryption\" type=\"boolean\" label=\"30610\" help=\"30611\">\n+ <level>0</level>\n+ <default>true</default>\n+ <control type=\"toggle\"/>\n+ </setting>\n</group>\n<!--GROUP: Cache-->\n<group id=\"4\" label=\"30117\">\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Allow user disable system-based encryption |
106,046 | 23.10.2021 12:59:45 | -7,200 | 5be3aa581cc7cabf2ef11275310e3704af44f32c | Prepare for Python 3.10 | [
{
"change_type": "MODIFY",
"old_path": ".github/workflows/ci.yml",
"new_path": ".github/workflows/ci.yml",
"diff": "@@ -10,7 +10,7 @@ jobs:\nstrategy:\nfail-fast: false\nmatrix:\n- python-version: [3.7, 3.8, 3.9]\n+ python-version: ['3.7', '3.8', '3.9', '3.10']\nsteps:\n- name: Check out ${{ github.sha }} from repository ${{ github.repository }}\nuses: actions/checkout@v2\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/playback/action_controller.py",
"new_path": "resources/lib/services/playback/action_controller.py",
"diff": "@@ -97,7 +97,7 @@ class ActionController(xbmc.Monitor):\nself._on_playback_started()\nif self._playback_tick is None or not self._playback_tick.is_alive():\nself._playback_tick = PlaybackTick(self.on_playback_tick)\n- self._playback_tick.setDaemon(True)\n+ self._playback_tick.daemon = True\nself._playback_tick.start()\nelif method == 'Player.OnSeek':\nself._on_playback_seek(json.loads(data)['player']['time'])\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/playback/am_video_events.py",
"new_path": "resources/lib/services/playback/am_video_events.py",
"diff": "@@ -181,8 +181,8 @@ class AMVideoEvents(ActionManager):\nelse:\nis_in_mylist = videoid_data['queue'].get('inQueue', False)\n- event_data = {'resume_position':\n- videoid_data['bookmarkPosition'] if videoid_data['bookmarkPosition'] > -1 else None,\n+ resume_position = videoid_data['bookmarkPosition'] if videoid_data['bookmarkPosition'] > -1 else None\n+ event_data = {'resume_position': resume_position,\n'runtime': videoid_data['runtime'],\n'request_id': videoid_data['requestId'],\n'watched': videoid_data['watched'],\n"
},
{
"change_type": "MODIFY",
"old_path": "tox.ini",
"new_path": "tox.ini",
"diff": "[tox]\n-envlist = py37,py38,py39,flake8\n+envlist = py37,py38,py39,py310,flake8\nskipsdist = True\nskip_missing_interpreters = True\n@@ -17,7 +17,7 @@ max-line-length = 160\nignore = E129,E402,F401,F403,FI13,FI50,FI51,FI53,FI54,W503,W504\nrequire-code = True\nmin-version = 3.7\n-exclude = .tox\n+exclude = .tox,packages\n[pytest]\nfilterwarnings = default\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Prepare for Python 3.10 |
106,046 | 23.10.2021 15:56:59 | -7,200 | 15008f4c635700cdb1ab99eba27f55d4208f7825 | Add missing slash backslash to illegal chars | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/kodi/library_utils.py",
"new_path": "resources/lib/kodi/library_utils.py",
"diff": "@@ -25,7 +25,7 @@ from resources.lib.utils.logging import LOG, measure_exec_time_decorator\nLIBRARY_HOME = 'library'\nFOLDER_NAME_MOVIES = 'movies'\nFOLDER_NAME_SHOWS = 'shows'\n-ILLEGAL_CHARACTERS = '[<|>|\"|?|$|!|:|#|*]'\n+ILLEGAL_CHARACTERS = '[<|>|\"|?|$|!|:|#|*|/|\\\\\\\\]'\ndef get_library_path():\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Add missing slash backslash to illegal chars |
106,046 | 23.10.2021 16:18:11 | -7,200 | adae2710601b6193ecdfa9f788d2f557d63affce | Version bump (1.18.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=\"1.17.0+matrix.1\" provider-name=\"libdev + jojo + asciidisco + caphm + castagnait\">\n+<addon id=\"plugin.video.netflix\" name=\"Netflix\" version=\"1.18.0+matrix.1\" provider-name=\"libdev + jojo + asciidisco + caphm + castagnait\">\n<requires>\n<import addon=\"xbmc.python\" version=\"3.0.0\"/>\n<import addon=\"script.module.addon.signals\" version=\"0.0.6+matrix.1\"/>\n<forum>https://forum.kodi.tv/showthread.php?tid=329767</forum>\n<source>https://github.com/CastagnaIT/plugin.video.netflix</source>\n<news>\n-v1.17.0 (2021-08-13)\n-- Migration to HTTP2 protocol\n-- Fixed login with username/password for more than 90% of cases\n+v1.18.0 (2021-10-23)\n+- Add support to make search by text from Json-RPC requests (see wiki)\n+- Add expert setting to disable system-based encryption (for persistent login request problem)\n+- Fixed bug in Kodi 20 which led to possible crashes when playing\n+- Fixed bug in search by subtitle/audio language\n+- Fixed problems with scrapers due to slash-backslash\n+- Update translations po, zh_tw, it, hr, hu, cz, de, fr, pt_br, ro\n+- Minor changes\n</news>\n</extension>\n</addon>\n"
},
{
"change_type": "MODIFY",
"old_path": "changelog.txt",
"new_path": "changelog.txt",
"diff": "+v1.18.0 (2021-10-23)\n+- Add support to make search by text from Json-RPC requests (see wiki)\n+- Add expert setting to disable system-based encryption (for persistent login request problem)\n+- Fixed bug in Kodi 20 which led to possible crashes when playing\n+- Fixed bug in search by subtitle/audio language\n+- Fixed problems with scrapers due to slash-backslash\n+- Update translations po, zh_tw, it, hr, hu, cz, de, fr, pt_br, ro\n+- Minor changes\n+\nv1.17.0 (2021-08-13)\n- Migration to HTTP2 protocol\n- Fixed login with username/password for more than 90% of cases\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Version bump (1.18.0) (#1246) |
106,046 | 15.11.2021 19:44:37 | -3,600 | 4a97b5fa7475d388e3606bb5ac529aeff9c14234 | Add missing videoid path to show_availability_message | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/nfsession/directorybuilder/dir_builder_items.py",
"new_path": "resources/lib/services/nfsession/directorybuilder/dir_builder_items.py",
"diff": "@@ -179,7 +179,7 @@ def _create_episode_item(seasonid, episodeid_value, episode, episodes_list, comm\nelse:\n# The video is not playable, try check if there is a date\nlist_item.setProperty('nf_availability_message', get_availability_message(episode))\n- url = common.build_url(['show_availability_message'], mode=G.MODE_ACTION)\n+ url = common.build_url(['show_availability_message'], videoid=episodeid, mode=G.MODE_ACTION)\nreturn url, list_item, False\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Add missing videoid path to show_availability_message |
106,046 | 22.11.2021 16:45:00 | -3,600 | 70c8c2f265d1bd6a318c74ce6a255b490cfc40ba | Changes from website related to watched status sync | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/nfsession/msl/events_handler.py",
"new_path": "resources/lib/services/nfsession/msl/events_handler.py",
"diff": "@@ -96,9 +96,9 @@ class EventsHandler(threading.Thread):\nself.loco_data['list_id'],\nself.loco_data['list_index'])\nelse:\n- LOG.warn('EventsHandler: LoCo list not updated due to missing list context data')\n- video_id = request_data['params']['sessionParams']['uiplaycontext']['video_id']\n- self.nfsession.update_videoid_bookmark(video_id)\n+ LOG.debug('EventsHandler: LoCo list not updated no list context data provided')\n+ # video_id = request_data['params']['sessionParams']['uiplaycontext']['video_id']\n+ # self.nfsession.update_videoid_bookmark(video_id)\nself.loco_data = None\nexcept Exception as exc: # pylint: disable=broad-except\nLOG.error('EVENT [{}] - The request has failed: {}', event_type, exc)\n@@ -150,20 +150,29 @@ class EventsHandler(threading.Thread):\n# else:\n# list_id = G.LOCAL_DB.get_value('last_menu_id', 'unknown')\n+ position = player_state['elapsed_seconds']\n+ if position != 1:\n+ position *= 1000\n+\nif msl_utils.is_media_changed(previous_player_state, player_state):\n- play_times, media_id = msl_utils.build_media_tag(player_state, manifest)\n+ play_times, video_track_id, audio_track_id, sub_track_id = msl_utils.build_media_tag(player_state, manifest,\n+ position)\nelse:\nplay_times = previous_data['playTimes']\nmsl_utils.update_play_times_duration(play_times, player_state)\n- media_id = previous_data['mediaId']\n+ video_track_id = previous_data['videoTrackId']\n+ audio_track_id = previous_data['audioTrackId']\n+ sub_track_id = previous_data['timedTextTrackId']\nparams = {\n'event': event_type,\n'xid': previous_data.get('xid', G.LOCAL_DB.get_value('xid', table=TABLE_SESSION)),\n- 'position': player_state['elapsed_seconds'] * 1000, # Video time elapsed\n+ 'position': position, # Video time elapsed\n'clientTime': timestamp,\n'sessionStartTime': previous_data.get('sessionStartTime', timestamp),\n- 'mediaId': media_id,\n+ 'videoTrackId': video_track_id,\n+ 'audioTrackId': audio_track_id,\n+ 'timedTextTrackId': sub_track_id,\n'trackId': str(event_data['track_id']),\n'sessionId': str(self.session_id),\n'appId': str(self.app_id or self.session_id),\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/nfsession/msl/msl_utils.py",
"new_path": "resources/lib/services/nfsession/msl/msl_utils.py",
"diff": "@@ -81,16 +81,14 @@ def update_play_times_duration(play_times, player_state):\nplay_times['video'][0]['duration'] = duration\n-def build_media_tag(player_state, manifest):\n+def build_media_tag(player_state, manifest, position):\n\"\"\"Build the playTimes and the mediaId data by parsing manifest and the current player streams used\"\"\"\ncommon.apply_lang_code_changes(manifest['audio_tracks'])\n- duration = player_state['elapsed_seconds'] * 1000\naudio_downloadable_id, audio_track_id = _find_audio_data(player_state, manifest)\nvideo_downloadable_id, video_track_id = _find_video_data(player_state, manifest)\n- # Todo: subtitles data set always as disabled, could be added in future\n- text_track_id = 'T:1:1;1;NONE;0;1;'\n-\n+ text_track_id = _find_subtitle_data(manifest)\n+ duration = position - 1 # 22//11/2021 The duration has the subtracted value of 1\nplay_times = {\n'total': duration,\n'audio': [{\n@@ -103,11 +101,7 @@ def build_media_tag(player_state, manifest):\n}],\n'text': []\n}\n-\n- # Format example: \"A:1:1;2;en;1;|V:2:1;2;;default;1;CE3;0;|T:1:1;1;NONE;0;1;\"\n- media_id = '|'.join([audio_track_id, video_track_id, text_track_id])\n-\n- return play_times, media_id\n+ return play_times, video_track_id, audio_track_id, text_track_id\ndef _find_audio_data(player_state, manifest):\n@@ -146,6 +140,19 @@ def _find_video_data(player_state, manifest):\n)\n+def _find_subtitle_data(manifest):\n+ \"\"\"\n+ Find the subtitle downloadable id and the subtitle track id\n+ \"\"\"\n+ # Todo: is needed to implement the code to find the appropriate data\n+ # for now we always return the \"disabled\" track\n+ for sub_track in manifest['timedtexttracks']:\n+ if sub_track['isNoneTrack']:\n+ return sub_track['new_track_id']\n+ # Not found?\n+ raise Exception('build_media_tag: unable to find subtitle data')\n+\n+\ndef generate_logblobs_params():\n\"\"\"Generate the initial log blog\"\"\"\n# It seems that this log is sent when logging in to a profile the first time\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/nfsession/nfsession_ops.py",
"new_path": "resources/lib/services/nfsession/nfsession_ops.py",
"diff": "@@ -47,8 +47,6 @@ class NFSessionOperations(SessionPathRequests):\nself.activate_profile,\nself.parental_control_data,\nself.get_metadata,\n- self.update_loco_context,\n- self.update_videoid_bookmark,\nself.get_videoid_info\n]\n# Share the activate profile function to SessionBase class\n@@ -228,10 +226,12 @@ class NFSessionOperations(SessionPathRequests):\n# serverDefs/date/requestId of reactContext nor to request_id of the video event request,\n# seem to have some kind of relationship with renoMessageId suspect with the logblob but i am not sure.\n# I noticed also that this request can also be made with the fourth parameter empty.\n+ # The fifth parameter unknown\nparams = [common.enclose_quotes(list_id),\nlist_index,\ncommon.enclose_quotes(list_context_name),\n- '']\n+ '\"\"',\n+ '\"\"']\n# path_suffixs = [\n# [{'from': 0, 'to': 100}, 'itemSummary'],\n# [['componentSummary']]\n@@ -254,6 +254,7 @@ class NFSessionOperations(SessionPathRequests):\n# You can check if this function works through the official android app\n# by checking if the red status bar of watched time position appears and will be updated, or also\n# if continueWatching list will be updated (e.g. try to play a new tvshow not contained in the \"my list\")\n+ # 22/11/2021: This method seem not more used\ncall_paths = [['refreshVideoCurrentPositions']]\nparams = [f'[{video_id}]', '[]']\ntry:\n@@ -293,7 +294,8 @@ class NFSessionOperations(SessionPathRequests):\nloco_data = self.path_request([['loco', [context_name], ['context', 'id', 'index']]])\nloco_root = loco_data['loco'][1]\n_loco_data = {'root_id': loco_root}\n- if context_name in loco_data['locos'][loco_root]:\n+ # 22/11/2021 With some users the API path request not provide the \"locos\" data\n+ if 'locos' in loco_data and context_name in loco_data['locos'][loco_root]:\n# NOTE: In the new profiles, there is no 'continueWatching' list and no data will be provided\n_loco_data['list_context_name'] = context_name\n_loco_data['list_index'] = loco_data['locos'][loco_root][context_name][2]\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/playback/am_video_events.py",
"new_path": "resources/lib/services/playback/am_video_events.py",
"diff": "@@ -91,9 +91,9 @@ class AMVideoEvents(ActionManager):\n# We do not use _on_playback_started() to send EVENT_START, because the action managers\n# AMStreamContinuity and AMPlayback may cause inconsistencies with the content of player_state data\n- # When the playback starts for the first time, for correctness should send elapsed_seconds value to 0\n+ # When the playback starts for the first time, for correctness should send elapsed_seconds value to 1\nif self.tick_elapsed < 5 and self.event_data['resume_position'] is None:\n- player_state['elapsed_seconds'] = 0\n+ player_state['elapsed_seconds'] = 1\nself._send_event(EVENT_START, self.event_data, player_state)\nself.is_event_start_sent = True\nself.tick_elapsed = 0\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Changes from website related to watched status sync |
106,046 | 26.11.2021 19:22:38 | -3,600 | adb0b61f14635ffa72e7bd56a32d20a623090365 | Version bump (1.18.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=\"1.18.0+matrix.1\" provider-name=\"libdev + jojo + asciidisco + caphm + castagnait\">\n+<addon id=\"plugin.video.netflix\" name=\"Netflix\" version=\"1.18.1+matrix.1\" provider-name=\"libdev + jojo + asciidisco + caphm + castagnait\">\n<requires>\n<import addon=\"xbmc.python\" version=\"3.0.0\"/>\n<import addon=\"script.module.addon.signals\" version=\"0.0.6+matrix.1\"/>\n<forum>https://forum.kodi.tv/showthread.php?tid=329767</forum>\n<source>https://github.com/CastagnaIT/plugin.video.netflix</source>\n<news>\n-v1.18.0 (2021-10-23)\n-- Add support to make search by text from Json-RPC requests (see wiki)\n-- Add expert setting to disable system-based encryption (for persistent login request problem)\n-- Fixed bug in Kodi 20 which led to possible crashes when playing\n-- Fixed bug in search by subtitle/audio language\n-- Fixed problems with scrapers due to slash-backslash\n-- Update translations po, zh_tw, it, hr, hu, cz, de, fr, pt_br, ro\n-- Minor changes\n+v1.18.1 (2021-11-26)\n+- Fix problems to watched status sync due to website changes\n+- Fix error when trying to play an episode not yet available\n+- Update translations zh_cn, jp, kr\n</news>\n</extension>\n</addon>\n"
},
{
"change_type": "MODIFY",
"old_path": "changelog.txt",
"new_path": "changelog.txt",
"diff": "+v1.18.1 (2021-11-26)\n+- Fix problems to watched status sync due to website changes\n+- Fix error when trying to play an episode not yet available\n+- Update translations zh_cn, jp, kr\n+\nv1.18.0 (2021-10-23)\n- Add support to make search by text from Json-RPC requests (see wiki)\n- Add expert setting to disable system-based encryption (for persistent login request problem)\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Version bump (1.18.1) (#1269) |
106,046 | 11.12.2021 18:18:48 | -3,600 | 8cc46d5d562e94b015858270516efa3dc7b6517a | Fix pylint error consider-iterating-dictionary | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/common/uuid_device.py",
"new_path": "resources/lib/common/uuid_device.py",
"diff": "@@ -144,9 +144,9 @@ def _get_macos_uuid():\nexcept Exception as exc:\nLOG.debug('Failed to fetch OSX/IOS system profile {}', exc)\nif sp_dict_values:\n- if 'UUID' in list(sp_dict_values.keys()):\n+ if 'UUID' in sp_dict_values:\nreturn sp_dict_values['UUID']\n- if 'serialnumber' in list(sp_dict_values.keys()):\n+ if 'serialnumber' in sp_dict_values:\nreturn sp_dict_values['serialnumber']\nreturn None\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Fix pylint error consider-iterating-dictionary |
106,046 | 12.12.2021 11:38:53 | -3,600 | 0c8023059a563e2e296113a4c7222cb36d14d843 | Version bump (1.18.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=\"1.18.1+matrix.1\" provider-name=\"libdev + jojo + asciidisco + caphm + castagnait\">\n+<addon id=\"plugin.video.netflix\" name=\"Netflix\" version=\"1.18.2+matrix.1\" provider-name=\"libdev + jojo + asciidisco + caphm + castagnait\">\n<requires>\n<import addon=\"xbmc.python\" version=\"3.0.0\"/>\n<import addon=\"script.module.addon.signals\" version=\"0.0.6+matrix.1\"/>\n<forum>https://forum.kodi.tv/showthread.php?tid=329767</forum>\n<source>https://github.com/CastagnaIT/plugin.video.netflix</source>\n<news>\n-v1.18.1 (2021-11-26)\n-- Fix problems to watched status sync due to website changes\n-- Fix error when trying to play an episode not yet available\n-- Update translations zh_cn, jp, kr\n+v1.18.2 (2021-12-12)\n+- Fix \"This title is not available to watch instantly\" error due to website changes\n</news>\n</extension>\n</addon>\n"
},
{
"change_type": "MODIFY",
"old_path": "changelog.txt",
"new_path": "changelog.txt",
"diff": "+v1.18.2 (2021-12-12)\n+- Fix \"This title is not available to watch instantly\" error due to website changes\n+\nv1.18.1 (2021-11-26)\n- Fix problems to watched status sync due to website changes\n- Fix error when trying to play an episode not yet available\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Version bump (1.18.2) (#1280) |
106,046 | 29.12.2021 14:33:06 | -3,600 | 652c639b1bfe8f16db0f1a9a86a34b89b42965ca | Add switch to manifest v1 | [
{
"change_type": "MODIFY",
"old_path": "resources/language/resource.language.en_gb/strings.po",
"new_path": "resources/language/resource.language.en_gb/strings.po",
"diff": "@@ -1111,7 +1111,11 @@ msgctxt \"#30611\"\nmsgid \"[B]If disabled it will cause a security leak[/B]. If your operating system does not support it, you will be prompted to login each time you reboot the device, [B]only[/B] in this case disable it. If you change this setting you will be prompted to login again in the next time you reboot.\"\nmsgstr \"\"\n-# Unused 30612 to 30619\n+msgctxt \"#30612\"\n+msgid \"MSL manifest version\"\n+msgstr \"\"\n+\n+# Unused 30613 to 30619\nmsgctxt \"#30620\"\nmsgid \"This title will be available from: {}\"\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/nfsession/msl/msl_handler.py",
"new_path": "resources/lib/services/nfsession/msl/msl_handler.py",
"diff": "@@ -106,6 +106,7 @@ class MSLHandler:\n@measure_exec_time_decorator(is_immediate=True)\ndef _get_manifest(self, viewable_id, esn, challenge, sid):\n+ from pprint import pformat\ncache_identifier = f'{esn}_{viewable_id}'\ntry:\n# The manifest must be requested once and maintained for its entire duration\n@@ -134,20 +135,79 @@ class MSLHandler:\nif hdcp_4k_capable and hdcp_override:\nhdcp_version = ['2.2']\n- LOG.info('Requesting licensed manifest for {} with ESN {} and HDCP {}',\n+ manifest_ver = G.ADDON.getSettingString('msl_manifest_version')\n+ profiles = enabled_profiles()\n+\n+ LOG.info('Requesting manifest (version {}) for\\nVIDEO ID: {}\\nESN: {}\\nHDCP: {}\\nPROFILES:\\n{}',\n+ manifest_ver,\nviewable_id,\ncommon.censure(esn) if len(esn) > 50 else esn,\n- hdcp_version)\n+ hdcp_version,\n+ pformat(profiles, indent=2))\n+ if manifest_ver == 'v1':\n+ endpoint_url, request_data = self._build_manifest_v1(viewable_id=viewable_id, hdcp_version=hdcp_version,\n+ hdcp_override=hdcp_override, profiles=profiles,\n+ challenge=challenge)\n+ else: # Default - most recent version\n+ endpoint_url, request_data = self._build_manifest_v2(viewable_id=viewable_id, hdcp_version=hdcp_version,\n+ hdcp_override=hdcp_override, profiles=profiles,\n+ challenge=challenge, sid=sid)\n+ manifest = self.msl_requests.chunked_request(endpoint_url, request_data, esn, disable_msl_switch=False)\n+ if LOG.is_enabled:\n+ # Save the manifest to disk as reference\n+ common.save_file_def('manifest.json', json.dumps(manifest).encode('utf-8'))\n+ # Save the manifest to the cache to retrieve it during its validity\n+ expiration = int(manifest['expiration'] / 1000)\n+ G.CACHE.add(CACHE_MANIFESTS, cache_identifier, manifest, expires=expiration)\n+ return manifest\n- profiles = enabled_profiles()\n- from pprint import pformat\n- LOG.info('Requested profiles:\\n{}', pformat(profiles, indent=2))\n+ def _build_manifest_v1(self, **kwargs):\n+ params = {\n+ 'type': 'standard',\n+ 'viewableId': [kwargs['viewable_id']],\n+ 'profiles': kwargs['profiles'],\n+ 'flavor': 'PRE_FETCH',\n+ 'drmType': 'widevine',\n+ 'drmVersion': 25,\n+ 'usePsshBox': True,\n+ 'isBranching': False,\n+ 'isNonMember': False,\n+ 'isUIAutoPlay': False,\n+ 'useHttpsStreams': True,\n+ 'imageSubtitleHeight': 1080,\n+ 'uiVersion': G.LOCAL_DB.get_value('ui_version', '', table=TABLE_SESSION),\n+ 'uiPlatform': 'SHAKTI',\n+ 'clientVersion': G.LOCAL_DB.get_value('client_version', '', table=TABLE_SESSION),\n+ 'desiredVmaf': 'plus_lts', # phone_plus_exp can be used to mobile, not tested\n+ 'supportsPreReleasePin': True,\n+ 'supportsWatermark': True,\n+ 'supportsUnequalizedDownloadables': True,\n+ 'showAllSubDubTracks': False,\n+ 'titleSpecificData': {\n+ str(kwargs['viewable_id']): {\n+ 'unletterboxed': True\n+ }\n+ },\n+ 'videoOutputInfo': [{\n+ 'type': 'DigitalVideoOutputDescriptor',\n+ 'outputType': 'unknown',\n+ 'supportedHdcpVersions': kwargs['hdcp_version'],\n+ 'isHdcpEngaged': kwargs['hdcp_override']\n+ }],\n+ 'preferAssistiveAudio': False\n+ }\n+ if kwargs['challenge']:\n+ params['challenge'] = kwargs['challenge']\n+ endpoint_url = ENDPOINTS['manifest'] + create_req_params(0, 'prefetch/manifest')\n+ request_data = self.msl_requests.build_request_data('/manifest', params)\n+ return endpoint_url, request_data\n+ def _build_manifest_v2(self, **kwargs):\nparams = {\n'type': 'standard',\n'manifestVersion': 'v2',\n- 'viewableId': viewable_id,\n- 'profiles': profiles,\n+ 'viewableId': kwargs['viewable_id'],\n+ 'profiles': kwargs['profiles'],\n'flavor': 'PRE_FETCH',\n'drmType': 'widevine',\n'drmVersion': 25,\n@@ -165,11 +225,11 @@ class MSLHandler:\n'videoOutputInfo': [{\n'type': 'DigitalVideoOutputDescriptor',\n'outputType': 'unknown',\n- 'supportedHdcpVersions': hdcp_version,\n- 'isHdcpEngaged': hdcp_override\n+ 'supportedHdcpVersions': kwargs['hdcp_version'],\n+ 'isHdcpEngaged': kwargs['hdcp_override']\n}],\n'titleSpecificData': {\n- str(viewable_id): {\n+ str(kwargs['viewable_id']): {\n'unletterboxed': True\n}\n},\n@@ -183,32 +243,22 @@ class MSLHandler:\n'contentPlaygraph': [],\n'profileGroups': [{\n'name': 'default',\n- 'profiles': profiles\n+ 'profiles': kwargs['profiles']\n}],\n'licenseType': 'limited' # standard / limited\n}\n- if challenge and sid:\n- params['challenge'] = challenge\n+ if kwargs['challenge'] and kwargs['sid']:\n+ params['challenge'] = kwargs['challenge']\nparams['challenges'] = {\n'default': [{\n- 'drmSessionId': sid,\n+ 'drmSessionId': kwargs['sid'],\n'clientTime': int(time.time()),\n- 'challengeBase64': challenge\n+ 'challengeBase64': kwargs['challenge']\n}]\n}\n-\nendpoint_url = ENDPOINTS['manifest'] + create_req_params(0, 'licensedManifest')\n- manifest = self.msl_requests.chunked_request(endpoint_url,\n- self.msl_requests.build_request_data('licensedManifest', params),\n- esn,\n- disable_msl_switch=False)\n- if LOG.is_enabled:\n- # Save the manifest to disk as reference\n- common.save_file_def('manifest.json', json.dumps(manifest).encode('utf-8'))\n- # Save the manifest to the cache to retrieve it during its validity\n- expiration = int(manifest['expiration'] / 1000)\n- G.CACHE.add(CACHE_MANIFESTS, cache_identifier, manifest, expires=expiration)\n- return manifest\n+ request_data = self.msl_requests.build_request_data('licensedManifest', params)\n+ return endpoint_url, request_data\n@display_error_info\n@measure_exec_time_decorator(is_immediate=True)\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/settings_monitor.py",
"new_path": "resources/lib/services/settings_monitor.py",
"diff": "@@ -109,7 +109,7 @@ class SettingsMonitor(xbmc.Monitor):\nG.LOCAL_DB.set_value('page_results', page_results, TABLE_SETTINGS_MONITOR)\nclean_buckets += [CACHE_COMMON, CACHE_MYLIST, CACHE_SEARCH]\n- _check_msl_profiles(clean_buckets)\n+ _check_manifest_settings_status(clean_buckets)\n_check_watched_status_sync()\n# Clean cache buckets if needed (to get new results and so on...)\n@@ -124,19 +124,20 @@ class SettingsMonitor(xbmc.Monitor):\ncommon.container_update(common.build_url(['root'], mode=G.MODE_DIRECTORY))\n-def _check_msl_profiles(clean_buckets):\n- \"\"\"Check for changes on content profiles settings\"\"\"\n- # This is necessary because it is possible that some manifests\n- # could be cached using the previous settings (see load_manifest on msl_handler.py)\n- menu_keys = ['enable_dolby_sound', 'enable_vp9_profiles', 'enable_hevc_profiles',\n+def _check_manifest_settings_status(clean_buckets):\n+ \"\"\"Check settings that require to clean Manifest cache bucket\"\"\"\n+ # When one of these settings changes they will affect the Manifest request,\n+ # therefore cached manifests must be deleted (see load_manifest on msl_handler.py)\n+ menu_keys_bool = ['enable_dolby_sound', 'enable_vp9_profiles', 'enable_hevc_profiles',\n'enable_hdr_profiles', 'enable_dolbyvision_profiles', 'enable_force_hdcp',\n'disable_webvtt_subtitle']\n- collect_int = ''\n- for menu_key in menu_keys:\n- collect_int += str(int(G.ADDON.getSettingBool(menu_key)))\n- collect_int_old = G.LOCAL_DB.get_value('content_profiles_int', '', TABLE_SETTINGS_MONITOR)\n- if collect_int != collect_int_old:\n- G.LOCAL_DB.set_value('content_profiles_int', collect_int, TABLE_SETTINGS_MONITOR)\n+ collected_data = ''\n+ for menu_key in menu_keys_bool:\n+ collected_data += str(int(G.ADDON.getSettingBool(menu_key)))\n+ collected_data += G.ADDON.getSettingString('msl_manifest_version')\n+ collected_data_old = G.LOCAL_DB.get_value('manifest_settings_status', '', TABLE_SETTINGS_MONITOR)\n+ if collected_data != collected_data_old:\n+ G.LOCAL_DB.set_value('manifest_settings_status', collected_data, TABLE_SETTINGS_MONITOR)\nclean_buckets.append(CACHE_MANIFESTS)\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/upgrade_controller.py",
"new_path": "resources/lib/upgrade_controller.py",
"diff": "@@ -120,6 +120,9 @@ def _perform_service_changes(previous_ver, current_ver):\n# we have done a new setting (ProgressManager_enabled >> to >> sync_watched_status)\nwith G.SETTINGS_MONITOR.ignore_events(1):\nG.ADDON.setSettingBool('sync_watched_status', G.ADDON.getSettingBool('ProgressManager_enabled'))\n+ if CmpVersion(previous_ver) < '1.18.3':\n+ # In the version 1.18.3 content_profiles_int has been replaced by manifest_settings_status\n+ G.LOCAL_DB.delete_key('content_profiles_int')\ndef _perform_local_db_changes(current_version, upgrade_to_version):\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/settings.xml",
"new_path": "resources/settings.xml",
"diff": "</constraints>\n<control type=\"spinner\" format=\"string\"/>\n</setting>\n+ <setting id=\"msl_manifest_version\" type=\"string\" label=\"30612\" help=\"\">\n+ <level>0</level>\n+ <default>default</default>\n+ <constraints>\n+ <options>\n+ <option label=\"Default\">default</option>\n+ <option label=\"Version 1\">v1</option>\n+ </options>\n+ <allowempty>false</allowempty>\n+ </constraints>\n+ <control type=\"spinner\" format=\"string\"/>\n+ </setting>\n<setting id=\"cdn_server\" type=\"string\" label=\"30241\" help=\"\">\n<level>0</level>\n<default>Server 1</default>\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Add switch to manifest v1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.