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
27.08.2020 18:50:11
-7,200
889b5dcdd096e5585e03d17048367f9cef410344
Add "Flatten TV show seasons" for single season
[ { "change_type": "MODIFY", "old_path": "resources/lib/navigation/directory.py", "new_path": "resources/lib/navigation/directory.py", "diff": "@@ -113,7 +113,6 @@ class Directory(object):\nelse:\nself._seasons(videoid, pathitems)\n- @custom_viewmode(G.VIEW_SEASON)\ndef _seasons(self, videoid, pathitems):\n\"\"\"Show the seasons list of a tv show\"\"\"\ncall_args = {\n@@ -122,7 +121,20 @@ class Directory(object):\n'perpetual_range_start': self.perpetual_range_start,\n}\nlist_data, extra_data = common.make_call('get_seasons', call_args)\n+ if 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\n+ pathitems = list_data[0]['url'].replace(G.BASE_URL, '').strip('/').split('/')[1:]\n+ videoid = common.VideoId.from_path(pathitems)\n+ self._episodes(videoid, pathitems)\n+ return\n+ self._seasons_directory(list_data, extra_data)\n+ @custom_viewmode(G.VIEW_SEASON)\n+ def _seasons_directory(self, list_data, extra_data):\nfinalize_directory(convert_list_to_dir_items(list_data), G.CONTENT_SEASON, 'sort_only_label',\ntitle=extra_data.get('title', ''))\nend_of_directory(self.dir_update_listing)\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
Add "Flatten TV show seasons" for single season
106,046
31.08.2020 19:53:30
-7,200
4673f7031e729b0b2c5c752b3993c3ab5a246dff
Moved namespace uuid generator in a method
[ { "change_type": "MODIFY", "old_path": "resources/lib/common/uuid_device.py", "new_path": "resources/lib/common/uuid_device.py", "diff": "@@ -41,12 +41,20 @@ def get_random_uuid():\nreturn unicode(uuid.uuid4())\n+def get_namespace_uuid(name):\n+ \"\"\"\n+ Generate a namespace uuid\n+ :return: uuid object\n+ \"\"\"\n+ import uuid\n+ return uuid.uuid5(uuid.NAMESPACE_DNS, name)\n+\n+\ndef _get_system_uuid():\n\"\"\"\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- import uuid\nuuid_value = None\nsystem = get_system_platform()\nif system in ['windows', 'uwp']:\n@@ -62,7 +70,7 @@ def _get_system_uuid():\nif not uuid_value:\nLOG.debug('It is not possible to get a system UUID creating a new UUID')\nuuid_value = _get_fake_uuid(system not in ['android', 'linux', 'linux raspberrypi'])\n- return uuid.uuid5(uuid.NAMESPACE_DNS, str(uuid_value)).bytes\n+ return get_namespace_uuid(str(uuid_value)).bytes\ndef _get_windows_uuid():\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
Moved namespace uuid generator in a method
106,046
31.08.2020 19:54:06
-7,200
600177e4e70b52bc4baf7c752f1a8fab847022bd
Add extensions param to show_browse_dialog
[ { "change_type": "MODIFY", "old_path": "resources/lib/kodi/ui/dialogs.py", "new_path": "resources/lib/kodi/ui/dialogs.py", "diff": "@@ -136,17 +136,18 @@ def show_library_task_errors(notify_errors, errors):\nfor err in errors]))\n-def show_browse_dialog(title, browse_type=0, default_path=None, multi_selection=False):\n+def show_browse_dialog(title, browse_type=0, default_path=None, multi_selection=False, extensions=None):\n\"\"\"\nShow a browse dialog to select files or folders\n:param title: The window title\n:param browse_type: Type of dialog as int value (0 = ShowAndGetDirectory, 1 = ShowAndGetFile, ..see doc)\n:param default_path: The initial path\n:param multi_selection: Allow 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\"\"\"\nret = G.py2_decode(xbmcgui.Dialog().browse(browse_type, title, shares='local', useThumbs=False, treatAsFolder=False,\n- defaultt=default_path, enableMultiple=multi_selection))\n+ defaultt=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...\nreturn None if not ret or ret == default_path else ret\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
Add extensions param to show_browse_dialog
106,046
31.08.2020 19:55:17
-7,200
6f6f3ece109e03638b89852a4246d3a60c5e4dbb
Add some note to auth scheme NETFLIXID
[ { "change_type": "MODIFY", "old_path": "resources/lib/services/msl/msl_request_builder.py", "new_path": "resources/lib/services/msl/msl_request_builder.py", "diff": "@@ -154,3 +154,13 @@ class MSLRequestBuilder(object):\n'password': credentials['password']\n}\n}\n+ # Authentication with user Netflix ID cookies\n+ # This not works on android,\n+ # will raise: User authentication data does not match entity identity\n+ # header_data['userauthdata'] = {\n+ # 'scheme': 'NETFLIXID',\n+ # 'authdata': {\n+ # 'netflixid': cookies['NetflixId'],\n+ # 'securenetflixid': cookies['SecureNetflixId']\n+ # }\n+ # }\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
Add some note to auth scheme NETFLIXID
106,046
31.08.2020 20:32:17
-7,200
2dc0ad0fdbcb81950378486a62f87c6d30a503aa
Deleted default value in list_dir param not works well
[ { "change_type": "MODIFY", "old_path": "resources/lib/common/fileops.py", "new_path": "resources/lib/common/fileops.py", "diff": "@@ -142,7 +142,7 @@ def delete_file(filename):\npass\n-def list_dir(path=G.DATA_PATH):\n+def list_dir(path):\n\"\"\"\nList the contents of a folder\n:return: The contents of the folder as tuple (directories, files)\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
Deleted default value in list_dir param not works well
106,046
31.08.2020 20:36:08
-7,200
dc181e8790a7b22533ffac0e80566f36963ab8d4
Removed account_hash I think the previous dev was planning to manage multiple accounts is already complicated so..
[ { "change_type": "MODIFY", "old_path": "resources/lib/services/nfsession/nfsession_ops.py", "new_path": "resources/lib/services/nfsession/nfsession_ops.py", "diff": "@@ -119,7 +119,7 @@ class NFSessionOperations(SessionPathRequests):\nG.LOCAL_DB.switch_active_profile(guid)\nG.CACHE_MANAGEMENT.identifier_prefix = guid\n- cookies.save(self.account_hash, self.session.cookies)\n+ cookies.save(self.session.cookies)\ndef parental_control_data(self, password):\n# Ask to the service if password is right and get the PIN status\n" }, { "change_type": "MODIFY", "old_path": "resources/lib/services/nfsession/session/access.py", "new_path": "resources/lib/services/nfsession/session/access.py", "diff": "@@ -112,7 +112,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.account_hash, self.session.cookies)\n+ cookies.save(self.session.cookies)\nreturn True\nexcept LoginValidateError as exc:\nself.session.cookies.clear()\n@@ -153,7 +153,7 @@ class SessionAccess(SessionCookie, SessionHTTPRequests):\n# Delete cookie and credentials\nself.session.cookies.clear()\n- cookies.delete(self.account_hash)\n+ cookies.delete()\ncommon.purge_credentials()\n# Reset the ESN obtained from website/generated\n" }, { "change_type": "MODIFY", "old_path": "resources/lib/services/nfsession/session/base.py", "new_path": "resources/lib/services/nfsession/session/base.py", "diff": "@@ -50,13 +50,6 @@ class SessionBase(object):\n})\nLOG.info('Initialized new session')\n- @property\n- def account_hash(self):\n- \"\"\"The unique hash of the current account\"\"\"\n- from base64 import urlsafe_b64encode\n- return urlsafe_b64encode(\n- common.get_credentials().get('email', 'NoMail').encode('utf-8')).decode('utf-8')\n-\n@property\ndef auth_url(self):\n\"\"\"Access rights to make HTTP requests on an endpoint\"\"\"\n" }, { "change_type": "MODIFY", "old_path": "resources/lib/services/nfsession/session/cookie.py", "new_path": "resources/lib/services/nfsession/session/cookie.py", "diff": "@@ -29,7 +29,7 @@ class SessionCookie(SessionBase):\n# pylint: disable=broad-except\nif not self.session.cookies:\ntry:\n- self.session.cookies = cookies.load(self.account_hash)\n+ self.session.cookies = cookies.load()\nexcept MissingCookiesError:\nreturn False\nexcept Exception as exc:\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": "@@ -86,7 +86,7 @@ class SessionHTTPRequests(SessionBase):\nfrom requests import exceptions\ntry:\nself.auth_url = website.extract_session_data(self.get('browse'))['auth_url']\n- cookies.save(self.account_hash, self.session.cookies)\n+ cookies.save(self.session.cookies)\nLOG.debug('Successfully refreshed session data')\nreturn True\nexcept MbrStatusError:\n" }, { "change_type": "MODIFY", "old_path": "resources/lib/utils/cookies.py", "new_path": "resources/lib/utils/cookies.py", "diff": "@@ -25,11 +25,11 @@ except ImportError:\nimport pickle\n-def save(account_hash, cookie_jar, log_output=True):\n+def save(cookie_jar, log_output=True):\n\"\"\"Save a cookie jar to file and in-memory storage\"\"\"\nif log_output:\nlog_cookie(cookie_jar)\n- cookie_file = xbmcvfs.File(cookie_file_path(account_hash), 'wb')\n+ cookie_file = xbmcvfs.File(cookie_file_path(), 'wb')\ntry:\n# pickle.dump(cookie_jar, cookie_file)\ncookie_file.write(bytearray(pickle.dumps(cookie_jar)))\n@@ -39,17 +39,17 @@ def save(account_hash, cookie_jar, log_output=True):\ncookie_file.close()\n-def delete(account_hash):\n+def delete():\n\"\"\"Delete cookies for an account from the disk\"\"\"\ntry:\n- xbmcvfs.delete(cookie_file_path(account_hash))\n+ xbmcvfs.delete(cookie_file_path())\nexcept Exception as exc: # pylint: disable=broad-except\nLOG.error('Failed to delete cookies on disk: {exc}', exc=exc)\n-def load(account_hash):\n+def load():\n\"\"\"Load cookies for a given account and check them for validity\"\"\"\n- file_path = cookie_file_path(account_hash)\n+ file_path = cookie_file_path()\nif not xbmcvfs.exists(file_path):\nLOG.debug('Cookies file does not exist')\nraise MissingCookiesError\n@@ -88,6 +88,6 @@ def log_cookie(cookie_jar):\nLOG.debug(debug_output)\n-def cookie_file_path(account_hash):\n- \"\"\"Return the file path to store cookies for a given account\"\"\"\n- return xbmc.translatePath('{}_{}'.format(G.COOKIE_PATH, account_hash))\n+def cookie_file_path():\n+ \"\"\"Return the file path to store cookies\"\"\"\n+ return xbmc.translatePath(G.COOKIE_PATH)\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
Removed account_hash I think the previous dev was planning to manage multiple accounts is already complicated so..
106,046
01.09.2020 08:38:35
-7,200
ec11a86a11b270fc7541b77259c8dc74e0c7cc65
Renamed 'cookie_xxx' file to cookies
[ { "change_type": "MODIFY", "old_path": "resources/lib/globals.py", "new_path": "resources/lib/globals.py", "diff": "@@ -243,7 +243,7 @@ class GlobalVariables(object):\nself.ADDON_DATA_PATH = self.py2_decode(self.ADDON.getAddonInfo('path')) # Add-on folder\nself.DATA_PATH = self.py2_decode(self.ADDON.getAddonInfo('profile')) # Add-on user data folder\nself.CACHE_PATH = os.path.join(self.DATA_PATH, 'cache')\n- self.COOKIE_PATH = os.path.join(self.DATA_PATH, 'COOKIE')\n+ self.COOKIES_PATH = os.path.join(self.DATA_PATH, 'COOKIES')\ntry:\nself.PLUGIN_HANDLE = int(argv[1])\nself.IS_SERVICE = False\n" }, { "change_type": "MODIFY", "old_path": "resources/lib/upgrade_actions.py", "new_path": "resources/lib/upgrade_actions.py", "diff": "@@ -14,13 +14,25 @@ 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+from resources.lib.common.fileops import (delete_folder_contents, list_dir, join_folders_paths, load_file, save_file,\n+ 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\nfrom resources.lib.utils.logging import LOG\n+def rename_cookie_file():\n+ # The file \"COOKIE_xxxxxx...\" will be renamed to \"COOKIES\"\n+ list_files = list_dir(G.DATA_PATH)[1]\n+ for filename in list_files:\n+ if 'COOKIE_' in G.py2_decode(filename):\n+ copy_file(join_folders_paths(G.DATA_PATH, G.py2_decode(filename)),\n+ join_folders_paths(G.DATA_PATH, 'COOKIES'))\n+ xbmc.sleep(80)\n+ delete_file(G.py2_decode(filename))\n+\n+\ndef delete_cache_folder():\n# Delete cache folder in the add-on userdata (no more needed with the new cache management)\ncache_path = os.path.join(G.DATA_PATH, 'cache')\n" }, { "change_type": "MODIFY", "old_path": "resources/lib/upgrade_controller.py", "new_path": "resources/lib/upgrade_controller.py", "diff": "@@ -88,6 +88,10 @@ def _perform_service_changes(previous_ver, current_ver):\nexcept TypeError:\n# In case of a previous rollback this could fails\nG.ADDON.setSettingInt('lib_auto_upd_mode', 1)\n+ if 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\n+ from resources.lib.upgrade_actions import rename_cookie_file\n+ rename_cookie_file()\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/lib/utils/cookies.py", "new_path": "resources/lib/utils/cookies.py", "diff": "@@ -90,4 +90,4 @@ def log_cookie(cookie_jar):\ndef cookie_file_path():\n\"\"\"Return the file path to store cookies\"\"\"\n- return xbmc.translatePath(G.COOKIE_PATH)\n+ return xbmc.translatePath(G.COOKIES_PATH)\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
Renamed 'cookie_xxx' file to cookies
106,046
03.09.2020 08:33:23
-7,200
4767f02a43bb94e0a3249cabb1554d331c632521
Add yourAccount endpoint
[ { "change_type": "MODIFY", "old_path": "resources/lib/services/nfsession/session/endpoints.py", "new_path": "resources/lib/services/nfsession/session/endpoints.py", "diff": "@@ -59,6 +59,12 @@ ENDPOINTS = {\n'use_default_params': False,\n'add_auth_url': None,\n'accept': 'text/html,application/xhtml+xml,application/xml'},\n+ 'your_account':\n+ {'address': '/YourAccount',\n+ 'is_api_call': False,\n+ 'use_default_params': False,\n+ 'add_auth_url': None,\n+ 'accept': 'text/html,application/xhtml+xml,application/xml'},\n'profiles_gate':\n# This endpoint is used after ending editing profiles page, i think to force close an active profile session\n{'address': '/ProfilesGate',\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": "@@ -123,7 +123,7 @@ class SessionHTTPRequests(SessionBase):\nparams = {}\nheaders = {'Accept': endpoint_conf.get('accept', '*/*')}\n- if endpoint_conf['address'] not in ['/login', '/browse', '/SignOut']:\n+ if endpoint_conf['address'] not in ['/login', '/browse', '/SignOut', '/YourAccount']:\nheaders['x-netflix.nq.stack'] = 'prod'\nheaders['x-netflix.request.client.user.guid'] = G.LOCAL_DB.get_active_profile_guid()\nif endpoint_conf.get('content_type'):\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
Add yourAccount endpoint
106,046
03.09.2020 14:15:58
-7,200
893515328f86283dce7934d8daf8456047212e96
Removed auto-login when refresh session data fails
[ { "change_type": "MODIFY", "old_path": "resources/lib/services/nfsession/session/access.py", "new_path": "resources/lib/services/nfsession/session/access.py", "diff": "@@ -37,11 +37,6 @@ except NameError: # Python 3\nclass SessionAccess(SessionCookie, SessionHTTPRequests):\n\"\"\"Handle the authentication access\"\"\"\n- def __init__(self):\n- super(SessionAccess, self).__init__()\n- # Share the login function to SessionBase class\n- self.external_func_login = self.login\n-\n@measure_exec_time_decorator(is_immediate=True)\ndef prefetch_login(self):\n\"\"\"Check if we have stored credentials.\n" }, { "change_type": "MODIFY", "old_path": "resources/lib/services/nfsession/session/base.py", "new_path": "resources/lib/services/nfsession/session/base.py", "diff": "@@ -26,7 +26,6 @@ class SessionBase(object):\n\"\"\"Use SSL verification when performing requests\"\"\"\n# Functions from derived classes to allow perform particular operations in parent classes\n- external_func_login = None # (set by access.py)\nexternal_func_activate_profile = None # (set by nfsession_op.py)\ndef __init__(self):\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": "@@ -12,10 +12,13 @@ from __future__ import absolute_import, division, unicode_literals\nimport json\n+from future.utils import raise_from\n+\nimport resources.lib.utils.website as website\nimport resources.lib.common as common\nfrom resources.lib.common.exceptions import (APIError, WebsiteParsingError, MbrStatusError, MbrStatusAnonymousError,\n- HttpError401)\n+ HttpError401, NotLoggedInError)\n+from resources.lib.kodi import ui\nfrom resources.lib.utils import cookies\nfrom resources.lib.database.db_utils import TABLE_SESSION\nfrom resources.lib.globals import G\n@@ -100,7 +103,10 @@ class SessionHTTPRequests(SessionBase):\nif isinstance(exc, MbrStatusAnonymousError):\n# This prevent the MSL error: No entity association record found for the user\ncommon.send_signal(signal=common.Signals.CLEAR_USER_ID_TOKENS)\n- return self.external_func_login() # pylint: disable=not-callable\n+ # Needed to do a new login\n+ common.purge_credentials()\n+ ui.show_notification(common.get_local_string(30008))\n+ raise_from(NotLoggedInError, exc)\nexcept exceptions.RequestException:\nimport traceback\nLOG.warn('Failed to refresh session data, request error (RequestException)')\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
Removed auto-login when refresh session data fails
106,046
03.09.2020 16:18:47
-7,200
cb85c18111ff9b5401aad052c0edd7952e8ff099
Ensure sql version is right for upsert linux distributions can differs in versions
[ { "change_type": "MODIFY", "old_path": "resources/lib/database/db_base_sqlite.py", "new_path": "resources/lib/database/db_base_sqlite.py", "diff": "@@ -245,13 +245,13 @@ 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 G.PY_IS_VER2:\n+ if common.is_less_version(sql.sqlite_version, '3.24.0'):\nquery = 'INSERT OR REPLACE INTO {} ({}, {}) VALUES (?, ?)'.format(table_name,\ntable_columns[0],\ntable_columns[1])\nrecords_values = [(key, common.convert_to_string(value)) for key, value in iteritems(dict_values)]\nelse:\n- # sqlite UPSERT clause exists only on sqlite >= 3.24.0 (not available on Kodi 18)\n+ # sqlite UPSERT clause exists only on sqlite >= 3.24.0\nquery = ('INSERT INTO {tbl_name} ({tbl_col1}, {tbl_col2}) VALUES (?, ?) '\n'ON CONFLICT({tbl_col1}) DO UPDATE SET {tbl_col2} = ? '\n'WHERE {tbl_col1} = ?').format(tbl_name=table_name,\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
Ensure sql version is right for upsert linux distributions can differs in versions
106,046
04.09.2020 09:40:12
-7,200
8899b786f5b5bbf45b9ecdd06844e56125dcbb00
Fixed ESN reset Before the ESN reset, was logging in again to reset the data due to current login problems and the new login method is no longer possible This change should be enough to ensure a proper ESN reset, but has not been tested on every system
[ { "change_type": "MODIFY", "old_path": "resources/lib/navigation/actions.py", "new_path": "resources/lib/navigation/actions.py", "diff": "@@ -11,15 +11,16 @@ from __future__ import absolute_import, division, unicode_literals\nimport xbmc\n-import resources.lib.utils.api_requests as api\nimport resources.lib.common as common\nimport resources.lib.kodi.ui as ui\n-from resources.lib.utils.esn import get_esn\n-from resources.lib.common.exceptions import MissingCredentialsError, CacheMiss\n-from resources.lib.utils.api_paths import VIDEO_LIST_RATING_THUMB_PATHS, SUPPLEMENTAL_TYPE_TRAILERS\n+import resources.lib.utils.api_requests as api\nfrom resources.lib.common import cache_utils\n+from resources.lib.common.exceptions import MissingCredentialsError, CacheMiss\n+from resources.lib.database.db_utils import (TABLE_SESSION, TABLE_SETTINGS_MONITOR)\nfrom resources.lib.globals import G\nfrom resources.lib.kodi.library import get_library_cls\n+from resources.lib.utils.api_paths import VIDEO_LIST_RATING_THUMB_PATHS, SUPPLEMENTAL_TYPE_TRAILERS\n+from resources.lib.utils.esn import get_esn, generate_android_esn, generate_esn\nfrom resources.lib.utils.logging import LOG, measure_exec_time_decorator\n@@ -172,10 +173,11 @@ class AddonActionExecutor(object):\ndef reset_esn(self, pathitems=None): # pylint: disable=unused-argument\n\"\"\"Reset the ESN stored (retrieved from website and manual)\"\"\"\n- from resources.lib.database.db_utils import (TABLE_SESSION, TABLE_SETTINGS_MONITOR)\nif not ui.ask_for_confirmation(common.get_local_string(30217),\ncommon.get_local_string(30218)):\nreturn\n+ # Generate a new ESN\n+ generated_esn = self._get_new_esn()\n# Reset the ESN obtained from website/generated\nG.LOCAL_DB.set_value('esn', '', TABLE_SESSION)\n# Reset the custom ESN (manual ESN from settings)\n@@ -183,12 +185,26 @@ class AddonActionExecutor(object):\nG.ADDON.setSetting('esn', '')\n# Reset the custom ESN (backup of manual ESN from settings, used in settings_monitor.py)\nG.LOCAL_DB.set_value('custom_esn', '', TABLE_SETTINGS_MONITOR)\n- # Perform a new login to get/generate a new ESN\n- api.login(ask_credentials=False)\n- # Warning after login netflix switch to the main profile! so return to the main screen\n+ # Save the new ESN\n+ G.LOCAL_DB.set_value('esn', generated_esn, TABLE_SESSION)\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+ # Show login notification\n+ ui.show_notification(common.get_local_string(30109))\n# Open root page\ncommon.container_update(G.BASE_URL, True)\n+ def _get_new_esn(self):\n+ if common.get_system_platform() == 'android':\n+ return generate_android_esn()\n+ # In the all other systems, create a new ESN by using the existing ESN prefix\n+ current_esn = G.LOCAL_DB.get_value('esn', table=TABLE_SESSION)\n+ from re import search\n+ esn_prefix_match = search(r'.+-', current_esn)\n+ if not esn_prefix_match:\n+ raise Exception('It was not possible to generate a new ESN. Before try login.')\n+ return generate_esn(esn_prefix_match.group(0))\n+\[email protected]_video_id(path_offset=1)\ndef change_watched_status(self, videoid):\n\"\"\"Change the watched status locally\"\"\"\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
Fixed ESN reset Before the ESN reset, was logging in again to reset the data due to current login problems and the new login method is no longer possible This change should be enough to ensure a proper ESN reset, but has not been tested on every system
106,046
04.09.2020 16:52:34
-7,200
00019aec86879bfcdf722ec4a49f95e7ff5b580a
Fixed problems with context menus when you add new search
[ { "change_type": "MODIFY", "old_path": "resources/lib/navigation/directory_search.py", "new_path": "resources/lib/navigation/directory_search.py", "diff": "@@ -94,7 +94,11 @@ def search_add():\n# Execute the research\nif row_id is None:\nreturn False\n- return search_query(row_id, None, False)\n+ # Redirect to \"search\" endpoint (otherwise causes problems with Container.Refresh used by context menus)\n+ end_of_directory(False)\n+ url = common.build_url(['search', 'search', row_id], mode=G.MODE_DIRECTORY)\n+ common.container_update(url, False)\n+ return True\ndef _search_add_bylang(search_type, dict_languages):\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
Fixed problems with context menus when you add new search
106,046
04.09.2020 17:51:11
-7,200
bb19fc708befe97238620cc2ddc252d5e0c108c8
translatePath moved to xbmcvfs commit:
[ { "change_type": "MODIFY", "old_path": "resources/lib/common/fileops.py", "new_path": "resources/lib/common/fileops.py", "diff": "@@ -23,6 +23,11 @@ try: # Kodi >= 19\nexcept ImportError: # Kodi 18\nfrom xbmc import makeLegalFilename # pylint: disable=ungrouped-imports\n+try: # Kodi >= 19\n+ from xbmcvfs import translatePath # pylint: disable=ungrouped-imports\n+except ImportError: # Kodi 18\n+ from xbmc import translatePath # pylint: disable=ungrouped-imports\n+\ndef check_folder_path(path):\n\"\"\"\n@@ -61,7 +66,7 @@ def file_exists(file_path):\n:param file_path: File path to check\n:return: True if exists\n\"\"\"\n- return xbmcvfs.exists(xbmc.translatePath(file_path))\n+ return xbmcvfs.exists(translatePath(file_path))\ndef copy_file(from_path, to_path):\n@@ -72,8 +77,8 @@ def copy_file(from_path, to_path):\n:return: True if copied\n\"\"\"\ntry:\n- return xbmcvfs.copy(xbmc.translatePath(from_path),\n- xbmc.translatePath(to_path))\n+ return xbmcvfs.copy(translatePath(from_path),\n+ translatePath(to_path))\nfinally:\npass\n@@ -95,7 +100,7 @@ def save_file(file_path, content, mode='wb'):\n:param content: The content of the file\n:param mode: optional mode options\n\"\"\"\n- file_handle = xbmcvfs.File(xbmc.translatePath(file_path), mode)\n+ file_handle = xbmcvfs.File(translatePath(file_path), mode)\ntry:\nfile_handle.write(bytearray(content))\nfinally:\n@@ -119,7 +124,7 @@ def load_file(file_path, mode='rb'):\n:param mode: optional mode options\n:return: The content of the file\n\"\"\"\n- file_handle = xbmcvfs.File(xbmc.translatePath(file_path), mode)\n+ file_handle = xbmcvfs.File(translatePath(file_path), mode)\ntry:\nreturn file_handle.readBytes().decode('utf-8')\nfinally:\n@@ -135,7 +140,7 @@ def delete_file_safe(file_path):\ndef delete_file(filename):\n- file_path = xbmc.translatePath(os.path.join(G.DATA_PATH, filename))\n+ file_path = translatePath(os.path.join(G.DATA_PATH, filename))\ntry:\nxbmcvfs.delete(file_path)\nfinally:\n@@ -156,7 +161,7 @@ def delete_folder_contents(path, delete_subfolders=False):\n:param path: Path to perform delete contents\n:param delete_subfolders: If True delete also all subfolders\n\"\"\"\n- directories, files = list_dir(xbmc.translatePath(path))\n+ directories, files = list_dir(translatePath(path))\nfor filename in files:\nxbmcvfs.delete(os.path.join(path, G.py2_decode(filename)))\nif not delete_subfolders:\n@@ -173,12 +178,12 @@ def delete_folder(path):\ndelete_folder_contents(path, True)\n# Give time because the system performs previous op. otherwise it can't delete the folder\nxbmc.sleep(80)\n- xbmcvfs.rmdir(xbmc.translatePath(path))\n+ xbmcvfs.rmdir(translatePath(path))\ndef write_strm_file(videoid, file_path):\n\"\"\"Write a playable URL to a STRM file\"\"\"\n- filehandle = xbmcvfs.File(xbmc.translatePath(file_path), 'wb')\n+ filehandle = xbmcvfs.File(translatePath(file_path), 'wb')\ntry:\nfilehandle.write(bytearray(build_url(videoid=videoid,\nmode=G.MODE_PLAY_STRM).encode('utf-8')))\n@@ -188,7 +193,7 @@ def write_strm_file(videoid, file_path):\ndef write_nfo_file(nfo_data, file_path):\n\"\"\"Write a NFO file\"\"\"\n- filehandle = xbmcvfs.File(xbmc.translatePath(file_path), 'wb')\n+ filehandle = xbmcvfs.File(translatePath(file_path), 'wb')\ntry:\nfilehandle.write(bytearray('<?xml version=\\'1.0\\' encoding=\\'UTF-8\\'?>'.encode('utf-8')))\nfilehandle.write(bytearray(ET.tostring(nfo_data, encoding='utf-8', method='xml')))\n" }, { "change_type": "MODIFY", "old_path": "resources/lib/common/kodi_library_ops.py", "new_path": "resources/lib/common/kodi_library_ops.py", "diff": "@@ -12,8 +12,6 @@ from __future__ import absolute_import, division, unicode_literals\nimport os\nfrom future.utils import raise_from\n-import xbmc\n-\nfrom resources.lib.globals import G\nfrom resources.lib.utils.logging import LOG\nfrom .exceptions import ItemNotFound\n@@ -25,6 +23,11 @@ try: # Kodi >= 19\nexcept ImportError: # Kodi 18\nfrom xbmc import makeLegalFilename # pylint: disable=ungrouped-imports\n+try: # Kodi >= 19\n+ from xbmcvfs import translatePath # pylint: disable=ungrouped-imports\n+except ImportError: # Kodi 18\n+ from xbmc import translatePath # pylint: disable=ungrouped-imports\n+\nLIBRARY_PROPS = {\n'episode': ['title', 'plot', 'writer', 'playcount', 'director', 'season',\n@@ -121,8 +124,8 @@ def _get_item_details_from_kodi(mediatype, file_path):\n\"\"\"Get a Kodi library item with details (from Kodi database) by searching with the file path\"\"\"\n# To ensure compatibility with previously exported items, make the filename legal\nfile_path = makeLegalFilename(file_path)\n- dir_path = os.path.dirname(G.py2_decode(xbmc.translatePath(file_path)))\n- filename = os.path.basename(G.py2_decode(xbmc.translatePath(file_path)))\n+ dir_path = os.path.dirname(G.py2_decode(translatePath(file_path)))\n+ filename = os.path.basename(G.py2_decode(translatePath(file_path)))\n# We get the data from Kodi library using filters, this is much faster than loading all episodes in memory.\nif file_path[:10] == 'special://':\n# If the path is special, search with real directory path and also special path\n" }, { "change_type": "MODIFY", "old_path": "resources/lib/database/db_utils.py", "new_path": "resources/lib/database/db_utils.py", "diff": "@@ -11,12 +11,16 @@ from __future__ import absolute_import, division, unicode_literals\nimport os\n-import xbmc\nimport xbmcvfs\nfrom resources.lib.common import folder_exists\nfrom resources.lib.globals import G\n+try: # Kodi >= 19\n+ from xbmcvfs import translatePath # pylint: disable=ungrouped-imports\n+except ImportError: # Kodi 18\n+ from xbmc import translatePath # pylint: disable=ungrouped-imports\n+\nLOCAL_DB_FILENAME = 'nf_local.sqlite3'\nSHARED_DB_FILENAME = 'nf_shared.sqlite3'\n@@ -39,7 +43,7 @@ VidLibProp = {\ndef get_local_db_path(db_filename):\n# First ensure database folder exists\n- db_folder = G.py2_decode(xbmc.translatePath(os.path.join(G.DATA_PATH, 'database')))\n+ db_folder = G.py2_decode(translatePath(os.path.join(G.DATA_PATH, 'database')))\nif not folder_exists(db_folder):\nxbmcvfs.mkdirs(db_folder)\nreturn os.path.join(db_folder, db_filename)\n" }, { "change_type": "MODIFY", "old_path": "resources/lib/globals.py", "new_path": "resources/lib/globals.py", "diff": "@@ -25,9 +25,13 @@ except ImportError: # Python 2\nfrom future.utils import iteritems\n-import xbmc\nimport xbmcaddon\n+try: # Kodi >= 19\n+ from xbmcvfs import translatePath # pylint: disable=ungrouped-imports\n+except ImportError: # Kodi 18\n+ from xbmc import translatePath # pylint: disable=ungrouped-imports\n+\ntry: # Python 2\nunicode\nexcept NameError: # Python 3\n@@ -265,7 +269,7 @@ class GlobalVariables(object):\n# This fixes comparison errors between str/unicode\nsys_path_filtered = [value for value in sys.path if isinstance(value, unicode)]\nfor path in packages_paths: # packages_paths has unicode type values\n- path = G.py2_decode(xbmc.translatePath(path))\n+ path = G.py2_decode(translatePath(path))\nif path not in sys_path_filtered:\n# Add embedded package path to python system directory\n# The \"path\" will add an unicode type to avoids problems with OS using symbolic characters\n" }, { "change_type": "MODIFY", "old_path": "resources/lib/kodi/library.py", "new_path": "resources/lib/kodi/library.py", "diff": "@@ -15,8 +15,6 @@ from datetime import datetime\nfrom future.utils import iteritems\n-import xbmc\n-\nimport resources.lib.utils.api_requests as api\nimport resources.lib.common as common\nimport resources.lib.kodi.nfo as nfo\n@@ -30,6 +28,11 @@ from resources.lib.kodi.library_utils import (request_kodi_library_update, get_l\nget_library_subfolders, delay_anti_ban)\nfrom resources.lib.utils.logging import LOG, measure_exec_time_decorator\n+try: # Kodi >= 19\n+ from xbmcvfs import translatePath # pylint: disable=ungrouped-imports\n+except ImportError: # Kodi 18\n+ from xbmc import translatePath # pylint: disable=ungrouped-imports\n+\ntry: # Python 2\nunicode\nexcept NameError: # Python 3\n@@ -320,7 +323,7 @@ class Library(LibraryTasks):\nfolders = get_library_subfolders(FOLDER_NAME_MOVIES, path) + get_library_subfolders(FOLDER_NAME_SHOWS, path)\nwith ui.ProgressDialog(True, max_value=len(folders)) as progress_bar:\nfor folder_path in folders:\n- folder_name = os.path.basename(G.py2_decode(xbmc.translatePath(folder_path)))\n+ folder_name = os.path.basename(G.py2_decode(translatePath(folder_path)))\nprogress_bar.set_message(folder_name)\ntry:\nvideoid = self.import_videoid_from_existing_strm(folder_path, folder_name)\n" }, { "change_type": "MODIFY", "old_path": "resources/lib/kodi/library_jobs.py", "new_path": "resources/lib/kodi/library_jobs.py", "diff": "@@ -22,6 +22,11 @@ from resources.lib.globals import G\nfrom resources.lib.kodi.library_utils import remove_videoid_from_db, insert_videoid_to_db\nfrom resources.lib.utils.logging import LOG\n+try: # Kodi >= 19\n+ from xbmcvfs import translatePath # pylint: disable=ungrouped-imports\n+except ImportError: # Kodi 18\n+ from xbmc import translatePath # pylint: disable=ungrouped-imports\n+\nclass LibraryJobs(object):\n\"\"\"Type of jobs for a task in order to execute library operations\"\"\"\n@@ -64,10 +69,10 @@ class LibraryJobs(object):\nLOG.debug('Removing {} ({}) from add-on library', videoid, job_data['title'])\ntry:\n# Remove the STRM file exported\n- exported_file_path = G.py2_decode(xbmc.translatePath(job_data['file_path']))\n+ exported_file_path = G.py2_decode(translatePath(job_data['file_path']))\ncommon.delete_file_safe(exported_file_path)\n- parent_folder = G.py2_decode(xbmc.translatePath(os.path.dirname(exported_file_path)))\n+ parent_folder = G.py2_decode(translatePath(os.path.dirname(exported_file_path)))\n# Remove the NFO file of the related STRM file\nnfo_file = os.path.splitext(exported_file_path)[0] + '.nfo'\n" }, { "change_type": "MODIFY", "old_path": "resources/lib/services/library_updater.py", "new_path": "resources/lib/services/library_updater.py", "diff": "@@ -24,6 +24,11 @@ try: # Kodi >= 19\nexcept ImportError: # Kodi 18\nfrom xbmc import makeLegalFilename # pylint: disable=ungrouped-imports\n+try: # Kodi >= 19\n+ from xbmcvfs import translatePath # pylint: disable=ungrouped-imports\n+except ImportError: # Kodi 18\n+ from xbmc import translatePath # pylint: disable=ungrouped-imports\n+\nclass LibraryUpdateService(xbmc.Monitor):\n\"\"\"\n@@ -143,7 +148,7 @@ class LibraryUpdateService(xbmc.Monitor):\nself.scan_awaiting = False\n# Update only the library elements in the add-on export folder\n# for faster processing (on Kodi 18.x) with a large library\n- common.scan_library(makeLegalFilename(xbmc.translatePath(get_library_path())))\n+ common.scan_library(makeLegalFilename(translatePath(get_library_path())))\nelse:\nself.scan_awaiting = 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": "\"\"\"\nfrom __future__ import absolute_import, division, unicode_literals\n-import xbmc\n-\nimport resources.lib.common as common\nfrom resources.lib.globals import G\nfrom resources.lib.utils.logging import LOG\nfrom .action_manager import ActionManager\n+try: # Kodi >= 19\n+ from xbmcvfs import translatePath # pylint: disable=ungrouped-imports\n+except ImportError: # Kodi 18\n+ from xbmc import translatePath # pylint: disable=ungrouped-imports\n+\nclass AMUpNextNotifier(ActionManager):\n\"\"\"\n@@ -61,7 +64,7 @@ def get_upnext_info(videoid, videoid_next_episode, info_data, metadata, is_playe\nvideoid_next_episode.tvshowid,\nvideoid_next_episode.seasonid,\nvideoid_next_episode.episodeid)\n- url = G.py2_decode(xbmc.translatePath(file_path))\n+ url = G.py2_decode(translatePath(file_path))\nelse:\nurl = common.build_url(videoid=videoid_next_episode,\nmode=G.MODE_PLAY,\n" }, { "change_type": "MODIFY", "old_path": "resources/lib/upgrade_actions.py", "new_path": "resources/lib/upgrade_actions.py", "diff": "@@ -21,6 +21,11 @@ from resources.lib.kodi import ui\nfrom resources.lib.kodi.library_utils import get_library_subfolders, FOLDER_NAME_MOVIES, FOLDER_NAME_SHOWS\nfrom resources.lib.utils.logging import LOG\n+try: # Kodi >= 19\n+ from xbmcvfs import translatePath # pylint: disable=ungrouped-imports\n+except ImportError: # Kodi 18\n+ from xbmc import translatePath # pylint: disable=ungrouped-imports\n+\ndef rename_cookie_file():\n# The file \"COOKIE_xxxxxx...\" will be renamed to \"COOKIES\"\n@@ -36,7 +41,7 @@ def rename_cookie_file():\ndef delete_cache_folder():\n# Delete cache folder in the add-on userdata (no more needed with the new cache management)\ncache_path = os.path.join(G.DATA_PATH, 'cache')\n- if not os.path.exists(G.py2_decode(xbmc.translatePath(cache_path))):\n+ if not os.path.exists(G.py2_decode(translatePath(cache_path))):\nreturn\nLOG.debug('Deleting the cache folder from add-on userdata folder')\ntry:\n@@ -61,7 +66,7 @@ def migrate_library():\ntitle='Migrating library to new format',\nmax_value=len(folders)) as progress_bar:\nfor folder_path in folders:\n- folder_name = os.path.basename(G.py2_decode(xbmc.translatePath(folder_path)))\n+ folder_name = os.path.basename(G.py2_decode(translatePath(folder_path)))\nprogress_bar.set_message('PLEASE WAIT - Migrating: ' + folder_name)\n_migrate_strm_files(folder_path)\nexcept Exception as exc: # pylint: disable=broad-except\n" }, { "change_type": "MODIFY", "old_path": "resources/lib/utils/cookies.py", "new_path": "resources/lib/utils/cookies.py", "diff": "@@ -12,7 +12,6 @@ from __future__ import absolute_import, division, unicode_literals\nfrom time import time\nfrom future.utils import raise_from\n-import xbmc\nimport xbmcvfs\nfrom resources.lib.common.exceptions import MissingCookiesError\n@@ -24,6 +23,11 @@ try:\nexcept ImportError:\nimport pickle\n+try: # Kodi >= 19\n+ from xbmcvfs import translatePath # pylint: disable=ungrouped-imports\n+except ImportError: # Kodi 18\n+ from xbmc import translatePath # pylint: disable=ungrouped-imports\n+\ndef save(cookie_jar, log_output=True):\n\"\"\"Save a cookie jar to file and in-memory storage\"\"\"\n@@ -90,7 +94,7 @@ def log_cookie(cookie_jar):\ndef cookie_file_path():\n\"\"\"Return the file path to store cookies\"\"\"\n- return xbmc.translatePath(G.COOKIES_PATH)\n+ return translatePath(G.COOKIES_PATH)\ndef convert_chrome_cookie(cookie):\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
translatePath moved to xbmcvfs commit: https://github.com/xbmc/xbmc/commit/94dc6c9d894a0bc5a6409445399001978df7b071
106,046
06.09.2020 10:09:08
-7,200
8e0f1a7c037322804ae036eedf2411fe5d3f05d3
Fixed wrong check to upgrade shared databases
[ { "change_type": "MODIFY", "old_path": "resources/lib/upgrade_controller.py", "new_path": "resources/lib/upgrade_controller.py", "diff": "@@ -44,7 +44,7 @@ def check_service_upgrade():\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'\n- if current_local_db_version != upgrade_to_local_db_version:\n+ if current_shared_db_version != upgrade_to_shared_db_version:\n_perform_shared_db_changes(current_shared_db_version, upgrade_to_shared_db_version)\n# Perform service changes\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
Fixed wrong check to upgrade shared databases
106,046
06.09.2020 10:38:56
-7,200
463b4cfbe98895b882ece774e6fc0c261d729e9a
Ensures that the table does not exist before create it
[ { "change_type": "MODIFY", "old_path": "resources/lib/database/db_update.py", "new_path": "resources/lib/database/db_update.py", "diff": "@@ -56,6 +56,11 @@ def run_shared_db_updates(current_version, upgrade_to_version): # pylint: disab\nisolation_level=CONN_ISOLATION_LEVEL)\ncur = shared_db_conn.cursor()\n+ cur.execute('SELECT name FROM sqlite_master WHERE type=\"table\";')\n+ tables = cur.fetchall()\n+ # Check if watched_status_override exists\n+ # (temporary check, usually not needed, applied for previous oversight in the code, can be removed in future)\n+ if ('watched_status_override',) not in tables:\ntable = str('CREATE TABLE watched_status_override ('\n'ProfileGuid TEXT NOT NULL,'\n'VideoID INTEGER NOT NULL,'\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
Ensures that the table does not exist before create it
106,046
06.09.2020 11:36:36
-7,200
e3c427c60a93554760ab2a65247b39debffc2c9c
Add pip install kodi-addon-checker
[ { "change_type": "MODIFY", "old_path": ".github/workflows/addon-check.yml", "new_path": ".github/workflows/addon-check.yml", "diff": "@@ -23,10 +23,8 @@ jobs:\n- name: Install dependencies\nrun: |\nsudo apt-get install xmlstarlet\n- python -m pip install --upgrade pip packaging\n- # FIXME: Requires changes from xbmc/addon-check#217\n- #pip install kodi-addon-checker\n- pip install git+git://github.com/xbmc/addon-check.git@master\n+ python -m pip install --upgrade pip\n+ pip install kodi-addon-checker\n- name: Remove unwanted files\nrun: awk '/export-ignore/ { print $1 }' .gitattributes | xargs rm -rf --\nworking-directory: ${{ github.repository }}\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
Add pip install kodi-addon-checker
106,046
06.09.2020 12:45:19
-7,200
6487be77c63c8bc0a63ef7d46ac2828ffc65141e
Version bump (1.9.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.8.0\" provider-name=\"libdev + jojo + asciidisco + caphm + castagnait\">\n+<addon id=\"plugin.video.netflix\" name=\"Netflix\" version=\"1.9.0\" provider-name=\"libdev + jojo + asciidisco + caphm + castagnait\">\n<requires>\n<import addon=\"xbmc.python\" version=\"2.26.0\"/>\n<import addon=\"script.module.addon.signals\" version=\"0.0.3\"/>\n<forum>https://forum.kodi.tv/showthread.php?tid=329767</forum>\n<source>https://github.com/CastagnaIT/plugin.video.netflix</source>\n<news>\n-v1.8.0 (2020-08-20)\n--Attempt to fix the login (not full solved)\n--Reimplemented menus \"All movies\", \"All TV Shows\", \"Browse subgenres\"\n--Added new search option \"By genre/subgenre ID\"\n--Added sort order setting for search history (Last used or A-Z)\n--Fixed Previous/Next page buttons on alphabetically sorted lists\n--Fixed regression in http IPC switch setting\n--Updated translations it, de, pt_br, el_gr, hu, zh_ch, jp, kr, ro, fr, pl\n--Minor fixes\n+v1.9.0 (2020-09-06)\n+-New login method \"Authentication key\" details on GitHub readme\n+-Add possibility to import library from a different folder\n+-Add flatted tvshow for single season (depends from kodi setting)\n+-Big speedup improvement for Kodi 18 in service loading and opening profiles page\n+-Fixed a problem that could cause the addon to not start after login unexpected errors\n+-Fixed a wrong behaviour that caused timeout error after credentials login fails\n+-Fixed context menus issues after add a new search\n+-Updated translations de, it, fr, pl, zh_ch, pt_br, hu, jp, kr, el_gr, es\n</news>\n</extension>\n</addon>\n" }, { "change_type": "MODIFY", "old_path": "changelog.txt", "new_path": "changelog.txt", "diff": "+v1.9.0 (2020-09-06)\n+-New login method \"Authentication key\" details on GitHub readme\n+-Add possibility to import library from a different folder\n+-Add flatted tvshow for single season (depends from kodi setting)\n+-Big speedup improvement for Kodi 18 in service loading and opening profiles page\n+-Fixed a problem that could cause the addon to not start after login unexpected errors\n+-Fixed a wrong behaviour that caused timeout error after credentials login fails\n+-Fixed context menus issues after add a new search\n+-Updated translations de, it, fr, pl, zh_ch, pt_br, hu, jp, kr, el_gr, es\n+\nv1.8.0 (2020-08-20)\n-Attempt to fix the login (not full solved)\n-Reimplemented menus \"All movies\", \"All TV Shows\", \"Browse subgenres\"\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
Version bump (1.9.0) (#839)
106,046
10.09.2020 08:41:11
-7,200
6628e8aecf7a7f77cd9e5845c92274c5d365084f
Add NFAuthenticationKey for linux
[ { "change_type": "MODIFY", "old_path": "resources/lib/common/credentials.py", "new_path": "resources/lib/common/credentials.py", "diff": "@@ -186,4 +186,14 @@ def _prepare_authentication_key_data(data):\ncontinue\nresult_data['cookies'].append(convert_chrome_cookie(cookie))\nreturn result_data\n+ if (data['app_name'] == 'NFAuthenticationKey' and\n+ data['app_system'] == 'Linux' and\n+ # data['app_version'] == '1.0.0' and\n+ data['app_author'] == 'CastagnaIT'):\n+ result_data = {'cookies': []}\n+ for cookie in data['data']['cookies']:\n+ if 'netflix' not in cookie['domain']:\n+ continue\n+ result_data['cookies'].append(convert_chrome_cookie(cookie))\n+ return result_data\nraise Exception('Authentication key file not supported')\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
Add NFAuthenticationKey for linux
106,046
16.09.2020 14:06:37
-7,200
72d289603e87c5b8c6e5f79128951718aad65d15
Fixed possible unreferenced variables
[ { "change_type": "MODIFY", "old_path": "resources/lib/utils/website.py", "new_path": "resources/lib/utils/website.py", "diff": "@@ -327,11 +327,11 @@ def extract_parental_control_data(content, current_maturity):\n'description': parse_html(rating_level['labels'][0]['description'])})\nif level_value == current_maturity:\ncurrent_level_index = index\n- except KeyError as exc:\n- raise_from(WebsiteParsingError('Unable to get path in to reactContext data'), exc)\nif not rating_levels:\nraise WebsiteParsingError('Unable to get maturity rating levels')\nreturn {'rating_levels': rating_levels, 'current_level_index': current_level_index}\n+ except KeyError as exc:\n+ raise_from(WebsiteParsingError('Unable to get path in to reactContext data'), exc)\ndef parse_html(html_value):\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
Fixed possible unreferenced variables
106,046
16.09.2020 17:39:33
-7,200
c6f9e75389aeaeedda6cc915f53f77c6f8e5d4fc
Fixed possible unreferenced variable
[ { "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": "@@ -84,11 +84,10 @@ class DirectoryPathRequests(object):\ndef get_loco_list_id_by_context(self, context):\n\"\"\"Return the dynamic video list ID for a LoCo context\"\"\"\ntry:\n- list_id = next(iter(self.req_loco_list_root().lists_by_context([context], True)))[0]\n+ return next(iter(self.req_loco_list_root().lists_by_context([context], True)))[0]\nexcept StopIteration as exc:\nraise_from(InvalidVideoListTypeError('No lists with context {} available'.format(context)),\nexc)\n- return list_id\n@cache_utils.cache_output(cache_utils.CACHE_COMMON, fixed_identifier='profiles_raw_data',\nttl=300, ignore_self_class=True)\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
Fixed possible unreferenced variable
106,046
16.09.2020 17:52:59
-7,200
75d2dc11ff68b209f5fec699e7780c8410ba8e91
Add new menu config no_use_cache
[ { "change_type": "MODIFY", "old_path": "resources/lib/common/cache_utils.py", "new_path": "resources/lib/common/cache_utils.py", "diff": "@@ -67,6 +67,7 @@ def cache_output(bucket, fixed_identifier=None,\ndef caching_decorator(func):\n@wraps(func)\ndef wrapper(*args, **kwargs):\n+ # To avoid use cache add to the kwargs the value: 'no_use_cache'=True\narg_value, identifier = _get_identifier(fixed_identifier,\nidentify_from_kwarg_name,\nidentify_append_from_kwarg_name,\n@@ -92,6 +93,8 @@ def _get_identifier(fixed_identifier, identify_from_kwarg_name,\n\"\"\"Return the identifier to use with the caching_decorator\"\"\"\n# LOG.debug('Get_identifier args: {}', args)\n# LOG.debug('Get_identifier kwargs: {}', kwargs)\n+ if kwargs.pop('no_use_cache', False):\n+ return None, None\narg_value = None\nif fixed_identifier:\nidentifier = fixed_identifier\n" }, { "change_type": "MODIFY", "old_path": "resources/lib/globals.py", "new_path": "resources/lib/globals.py", "diff": "@@ -77,6 +77,7 @@ class GlobalVariables(object):\ncontent_type Override the default content type (CONTENT_SHOW)\nhas_show_setting Means that the menu has the show/hide settings, by default is True\nhas_sort_setting Means that the menu has the sort settings, by default is False\n+ no_use_cache The cache will not be used to store the contents of the menu\nExplanation of function names in the 'path' key:\nvideo_list Automatically gets the list_id by making a loco request,\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": "@@ -82,7 +82,10 @@ class DirectoryBuilder(DirectoryPathRequests):\ndef get_video_list(self, list_id, menu_data, is_dynamic_id):\nif not is_dynamic_id:\nlist_id = self.get_loco_list_id_by_context(menu_data['loco_contexts'][0])\n- return build_video_listing(self.req_video_list(list_id), menu_data, mylist_items=self.req_mylist_items())\n+ # pylint: disable=unexpected-keyword-arg\n+ video_list = self.req_video_list(list_id, no_use_cache=menu_data.get('no_use_cache'))\n+ return build_video_listing(video_list, menu_data,\n+ mylist_items=self.req_mylist_items())\n@measure_exec_time_decorator(is_immediate=True)\ndef get_video_list_sorted(self, pathitems, menu_data, sub_genre_id, perpetual_range_start, is_dynamic_id):\n@@ -94,10 +97,12 @@ class DirectoryBuilder(DirectoryPathRequests):\n# -In the video list: 'sub-genre id'\n# -In the list of genres: 'sub-genre id'\ncontext_id = pathitems[2]\n+ # pylint: disable=unexpected-keyword-arg\nvideo_list = self.req_video_list_sorted(menu_data['request_context_name'],\ncontext_id=context_id,\nperpetual_range_start=perpetual_range_start,\n- menu_data=menu_data)\n+ menu_data=menu_data,\n+ no_use_cache=menu_data.get('no_use_cache'))\nreturn build_video_listing(video_list, menu_data, sub_genre_id, pathitems, perpetual_range_start,\nself.req_mylist_items())\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
Add new menu config no_use_cache
106,046
16.09.2020 17:42:56
-7,200
a07db88dc7979cdd93d73af0e50f556397bc4c96
Add Top 10 for tv shows/movies
[ { "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": "@@ -207,12 +207,16 @@ def build_loco_listing(loco_list, menu_data, force_use_videolist_id=False, exclu\nmenu_parameters = common.MenuIdParameters(video_list_id)\nif not menu_parameters.is_menu_id:\ncontinue\n- if exclude_loco_known and menu_parameters.type_id != '28':\n- # Keep only the menus genre\n- continue\nlist_id = (menu_parameters.context_id\nif menu_parameters.context_id and not force_use_videolist_id\nelse video_list_id)\n+ # Keep only some type of menus: 28=genre, 101=top 10\n+ if exclude_loco_known:\n+ if menu_parameters.type_id not in ['28', '101']:\n+ continue\n+ if menu_parameters.type_id == '101':\n+ # Top 10 list can be obtained only with 'video_list' query\n+ force_use_videolist_id = True\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" } ]
Python
MIT License
castagnait/plugin.video.netflix
Add Top 10 for tv shows/movies
106,046
16.09.2020 17:43:56
-7,200
b237629dbae52d2cd1b417db505608015d6fa629
Avoid use cache to all Top 10 menus Could cause wrong results when the TTL is high and netflix update the list
[ { "change_type": "MODIFY", "old_path": "resources/lib/globals.py", "new_path": "resources/lib/globals.py", "diff": "@@ -116,7 +116,8 @@ class GlobalVariables(object):\n'loco_known': True}),\n('mostWatched', {'path': ['video_list', 'mostWatched'], # Top 10 menu\n'loco_contexts': ['mostWatched'],\n- 'loco_known': True}),\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": "@@ -226,6 +226,7 @@ def build_loco_listing(loco_list, menu_data, force_use_videolist_id=False, exclu\nsub_menu_data['force_use_videolist_id'] = force_use_videolist_id\nsub_menu_data['title'] = video_list['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'\nG.LOCAL_DB.set_value(list_id, sub_menu_data, TABLE_MENU_DATA)\ndirectory_items.append(_create_videolist_item(list_id, video_list, sub_menu_data, common_data))\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
Avoid use cache to all Top 10 menus Could cause wrong results when the TTL is high and netflix update the list
106,028
09.09.2020 22:40:29
-36,000
0e599eb3465e67eb082d8b4048527ae32bfb0608
Fix for search results in JSON RPC plus history rewrite to avoid search dialog reopening onback
[ { "change_type": "MODIFY", "old_path": "resources/lib/navigation/directory.py", "new_path": "resources/lib/navigation/directory.py", "diff": "@@ -46,6 +46,9 @@ class Directory(object):\n# After build url the param value is converted as string\nself.perpetual_range_start = (None if self.params.get('perpetual_range_start') == 'None'\nelse self.params.get('perpetual_range_start'))\n+ if 'dir_update_listing' in self.params:\n+ self.dir_update_listing = self.params['dir_update_listing'] == 'True'\n+ else:\nself.dir_update_listing = bool(self.perpetual_range_start)\nif self.perpetual_range_start == '0':\n# For cache identifier purpose\n" }, { "change_type": "MODIFY", "old_path": "resources/lib/navigation/directory_search.py", "new_path": "resources/lib/navigation/directory_search.py", "diff": "@@ -91,14 +91,13 @@ def search_add():\nrow_id = _search_add_bygenreid(SEARCH_TYPES[type_index], genre_id)\nelse:\nraise NotImplementedError('Search type index {} not implemented'.format(type_index))\n- # Execute the research\n- if row_id is None:\n- return False\n- # Redirect to \"search\" endpoint (otherwise causes problems with Container.Refresh used by context menus)\n- end_of_directory(False)\n- url = common.build_url(['search', 'search', row_id], mode=G.MODE_DIRECTORY)\n+ # Redirect to \"search\" endpoint (otherwise no results in JSON-RPC)\n+ # Rewrite path history using dir_update_listing + container_update (otherwise will retrigger input dialog on Back or Container.Refresh)\n+ if row_id is not None and search_query(row_id, 0, False):\n+ url = common.build_url(['search', 'search', row_id], mode=G.MODE_DIRECTORY, params={'dir_update_listing': True})\ncommon.container_update(url, False)\nreturn True\n+ return False\ndef _search_add_bylang(search_type, dict_languages):\n@@ -155,7 +154,7 @@ def search_clear():\nif not ui.ask_for_confirmation(common.get_local_string(30404), common.get_local_string(30406)):\nreturn False\nG.LOCAL_DB.clear_search_items()\n- search_list(dir_update_listing=True)\n+ common.container_refresh()\nreturn True\n@@ -244,7 +243,8 @@ def _get_dictitem_clear():\n'url': common.build_url(['search', 'search', 'clear'], mode=G.MODE_DIRECTORY),\n'label': common.get_local_string(30404),\n'art': {'icon': 'icons\\\\infodialogs\\\\uninstall.png'},\n- 'is_folder': True,\n+ 'is_folder': False, # Set folder to false to run as command so that clear is not in directory history\n+ 'media_type': None, # Set media type none to avoid setting isplayable flag for non-folder item\n'properties': {'specialsort': 'bottom'} # Force an item to stay on bottom (not documented in Kodi)\n}\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
Fix for search results in JSON RPC plus history rewrite to avoid search dialog reopening onback
106,046
18.09.2020 08:51:07
-7,200
08042a93d2f8614eff6ff7b1880be7a1724b59f9
Version bump (1.9.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.9.0\" provider-name=\"libdev + jojo + asciidisco + caphm + castagnait\">\n+<addon id=\"plugin.video.netflix\" name=\"Netflix\" version=\"1.9.1\" provider-name=\"libdev + jojo + asciidisco + caphm + castagnait\">\n<requires>\n<import addon=\"xbmc.python\" version=\"2.26.0\"/>\n<import addon=\"script.module.addon.signals\" version=\"0.0.3\"/>\n<forum>https://forum.kodi.tv/showthread.php?tid=329767</forum>\n<source>https://github.com/CastagnaIT/plugin.video.netflix</source>\n<news>\n-v1.9.0 (2020-09-06)\n--New login method \"Authentication key\" details on GitHub readme\n--Add possibility to import library from a different folder\n--Add flatted tvshow for single season (depends from kodi setting)\n--Big speedup improvement for Kodi 18 in service loading and opening profiles page\n--Fixed a problem that could cause the addon to not start after login unexpected errors\n--Fixed a wrong behaviour that caused timeout error after credentials login fails\n--Fixed context menus issues after add a new search\n--Updated translations de, it, fr, pl, zh_ch, pt_br, hu, jp, kr, el_gr, es\n+v1.9.1 (2020-09-18)\n+-Add TV Shows/Movies Top 10\n+-Add support to NFAuthenticationKey for linux\n+-Fixed search results via JSON-RPC\n+-Fixed an issue that cause to ask to clear search history again when you return to previous menu\n+-Fixed possible wrong results on Top 10 menu due to cache TTL\n+-Updated translations ro, nl\n</news>\n</extension>\n</addon>\n" }, { "change_type": "MODIFY", "old_path": "changelog.txt", "new_path": "changelog.txt", "diff": "+v1.9.1 (2020-09-18)\n+-Add TV Shows/Movies Top 10\n+-Add support to NFAuthenticationKey for linux\n+-Fixed search results via JSON-RPC\n+-Fixed an issue that cause to ask to clear search history again when you return to previous menu\n+-Fixed possible wrong results on Top 10 menu due to cache TTL\n+-Updated translations ro, nl\n+\nv1.9.0 (2020-09-06)\n-New login method \"Authentication key\" details on GitHub readme\n-Add possibility to import library from a different folder\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
Version bump (1.9.1) (#862)
106,046
19.09.2020 14:28:45
-7,200
c3ff6941e98bd75b403aaa77430dddf28f069dbe
Moved again crypto imports within the method
[ { "change_type": "MODIFY", "old_path": "resources/lib/common/credentials.py", "new_path": "resources/lib/common/credentials.py", "diff": "@@ -23,15 +23,6 @@ from .fileops import load_file\nfrom .kodi_ops import get_local_string\nfrom .uuid_device import get_crypt_key\n-try: # The crypto package depends on the library installed (see Wiki)\n- from Crypto import Random\n- from Crypto.Cipher import AES\n- from Crypto.Util import Padding\n-except ImportError:\n- from Cryptodome import Random\n- from Cryptodome.Cipher import AES\n- from Cryptodome.Util import Padding\n-\n__BLOCK_SIZE__ = 32\n@@ -42,6 +33,16 @@ def encrypt_credential(raw):\n:type raw: str\n:returns: string -- Encoded data\n\"\"\"\n+ # Keep these imports within the method otherwise if the packages are not installed,\n+ # the addon crashes and the user does not read the warning message\n+ try: # The crypto package depends on the library installed (see Wiki)\n+ from Crypto import Random\n+ from Crypto.Cipher import AES\n+ from Crypto.Util import Padding\n+ except ImportError:\n+ from Cryptodome import Random\n+ from Cryptodome.Cipher import AES\n+ from Cryptodome.Util import Padding\nraw = bytes(Padding.pad(data_to_pad=raw.encode('utf-8'), block_size=__BLOCK_SIZE__))\niv = Random.new().read(AES.block_size)\ncipher = AES.new(get_crypt_key(), AES.MODE_CBC, iv)\n@@ -55,6 +56,14 @@ def decrypt_credential(enc):\n:type enc: str\n:returns: string -- Decoded data\n\"\"\"\n+ # Keep these imports within the method otherwise if the packages are not installed,\n+ # the addon crashes and the user does not read the warning message\n+ try: # The crypto package depends on the library installed (see Wiki)\n+ from Crypto.Cipher import AES\n+ from Crypto.Util import Padding\n+ except ImportError:\n+ from Cryptodome.Cipher import AES\n+ from Cryptodome.Util import Padding\nenc = base64.b64decode(enc)\niv = enc[:AES.block_size]\ncipher = AES.new(get_crypt_key(), AES.MODE_CBC, iv)\n@@ -139,6 +148,14 @@ def run_nf_authentication_key():\ndef _get_authentication_key_data(file_path, pin):\n\"\"\"Open the auth key file\"\"\"\nfrom resources.lib.kodi import ui\n+ # Keep these imports within the method otherwise if the packages are not installed,\n+ # the addon crashes and the user does not read the warning message\n+ try: # The crypto package depends on the library installed (see Wiki)\n+ from Crypto.Cipher import AES\n+ from Crypto.Util import Padding\n+ except ImportError:\n+ from Cryptodome.Cipher import AES\n+ from Cryptodome.Util import Padding\ntry:\nfile_content = load_file(file_path)\niv = '\\x00' * 16\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
Moved again crypto imports within the method
105,978
22.09.2020 18:24:37
-7,200
1236808a6cd5c7da29d891fdb71f377dcfb8abc6
FIx Hungarian
[ { "change_type": "MODIFY", "old_path": "resources/language/resource.language.hu_hu/strings.po", "new_path": "resources/language/resource.language.hu_hu/strings.po", "diff": "@@ -9,7 +9,12 @@ msgstr \"\"\n\"POT-Creation-Date: 2017-07-24 16:15+0000\\n\"\n\"PO-Revision-Date: 2020-09-05 07:40+0000\\n\"\n\"Last-Translator: frodo19\\n\"\n-\"Language-Team: Hungarian[CR]MIME-Version: 1.0[CR]Content-Type: text/plain; charset=UTF-8[CR]Content-Transfer-Encoding: 8bit[CR]Language: hu[CR]Plural-Forms: nplurals=2; plural=(n != 1);[CR]\\n\"\n+\"Language-Team: Hungarian\\n\"\n+\"Language: hu\\n\"\n+\"MIME-Version: 1.0\\n\"\n+\"Content-Type: text/plain; charset=UTF-8\\n\"\n+\"Content-Transfer-Encoding: 8bit\\n\"\n+\"Plural-Forms: nplurals=2; plural=(n != 1);\\n\"\nmsgctxt \"Addon Summary\"\nmsgid \"Netflix\"\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
FIx Hungarian
106,046
26.09.2020 11:23:18
-7,200
d1129f9abc3eedfce5ee4e21d321cce988097c89
Moved is_parent_root_path to directory_utils
[ { "change_type": "MODIFY", "old_path": "resources/lib/navigation/directory.py", "new_path": "resources/lib/navigation/directory.py", "diff": "\"\"\"\nfrom __future__ import absolute_import, division, unicode_literals\n-import xbmc\nimport xbmcplugin\nimport resources.lib.common as common\n@@ -18,7 +17,8 @@ import resources.lib.kodi.ui as ui\nfrom resources.lib.database.db_utils import TABLE_MENU_DATA\nfrom resources.lib.globals import G\nfrom resources.lib.navigation.directory_utils import (finalize_directory, convert_list_to_dir_items, custom_viewmode,\n- end_of_directory, get_title, activate_profile, auto_scroll)\n+ end_of_directory, get_title, activate_profile, auto_scroll,\n+ is_parent_root_path)\nfrom resources.lib.utils.logging import LOG, measure_exec_time_decorator\n@@ -56,21 +56,19 @@ class Directory(object):\ndef root(self, pathitems=None): # pylint: disable=unused-argument\n\"\"\"Show profiles or home listing when profile auto-selection is enabled\"\"\"\n- # Get the URL parent path of the navigation: xbmc.getInfoLabel('Container.FolderPath')\n- # it can be found in Kodi log as \"ParentPath = [xyz]\" but not always return the exact value\n- is_parent_root_path = xbmc.getInfoLabel('Container.FolderPath') == G.BASE_URL + '/'\n+ _is_parent_root_path = is_parent_root_path()\n# Fetch initial page to refresh all session data\n- if is_parent_root_path and not G.IS_CONTAINER_REFRESHED:\n+ if _is_parent_root_path and not G.IS_CONTAINER_REFRESHED:\ncommon.make_call('fetch_initial_page')\n# Note when the profiles are updated to the database (by fetch_initial_page call),\n# the update sanitize also relative settings to profiles (see _delete_non_existing_profiles in website.py)\nautoselect_profile_guid = G.LOCAL_DB.get_value('autoselect_profile_guid', '')\nif autoselect_profile_guid and not G.IS_CONTAINER_REFRESHED:\n- if is_parent_root_path:\n+ if _is_parent_root_path:\nLOG.info('Performing auto-selection of profile {}', autoselect_profile_guid)\n# Do not perform the profile switch if navigation come from a page that is not the root url,\n# prevents profile switching when returning to the main menu from one of the sub-menus\n- if not is_parent_root_path or activate_profile(autoselect_profile_guid):\n+ if not _is_parent_root_path or activate_profile(autoselect_profile_guid):\nself.home(None, True)\nreturn\n# IS_CONTAINER_REFRESHED is temporary set from the profiles context menu actions\n" }, { "change_type": "MODIFY", "old_path": "resources/lib/navigation/directory_utils.py", "new_path": "resources/lib/navigation/directory_utils.py", "diff": "@@ -221,3 +221,9 @@ def _find_index_last_watched(total_items, list_data):\n# Last partial watched item\nreturn index\nreturn 0\n+\n+\n+def is_parent_root_path():\n+ \"\"\"Check if the navigation come from the root path\"\"\"\n+ # Compare the current navigation path from xbmc.getInfoLabel('Container.FolderPath') with the root path\n+ return xbmc.getInfoLabel('Container.FolderPath') == G.BASE_URL + '/'\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
Moved is_parent_root_path to directory_utils
106,046
26.09.2020 11:18:22
-7,200
502affe44573683b30a1186d2bc00d10b03a025a
Fixed regression PIN request at each mainmenu loading
[ { "change_type": "MODIFY", "old_path": "resources/lib/navigation/directory.py", "new_path": "resources/lib/navigation/directory.py", "diff": "@@ -69,7 +69,7 @@ class Directory(object):\n# Do not perform the profile switch if navigation come from a page that is not the root url,\n# prevents profile switching when returning to the main menu from one of the sub-menus\nif not _is_parent_root_path or activate_profile(autoselect_profile_guid):\n- self.home(None, True)\n+ self.home(is_exec_profile_switch=False)\nreturn\n# IS_CONTAINER_REFRESHED is temporary set from the profiles context menu actions\n# to avoid perform the fetch_initial_page/auto-selection every time when the container will be refreshed\n@@ -92,10 +92,10 @@ class Directory(object):\n@measure_exec_time_decorator()\n@custom_viewmode(G.VIEW_MAINMENU)\n- def home(self, pathitems=None, is_autoselect_profile=False): # pylint: disable=unused-argument\n+ def home(self, pathitems=None, is_exec_profile_switch=True): # pylint: disable=unused-argument\n\"\"\"Show home listing\"\"\"\n- if not is_autoselect_profile and 'switch_profile_guid' in self.params:\n- # This is executed only when you have selected a profile from the profile list\n+ if is_exec_profile_switch and 'switch_profile_guid' in self.params and is_parent_root_path():\n+ # This must be executed only when you have selected a profile from the profile list\nif not activate_profile(self.params['switch_profile_guid']):\nxbmcplugin.endOfDirectory(G.PLUGIN_HANDLE, succeeded=False)\nreturn\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
Fixed regression PIN request at each mainmenu loading
106,046
27.09.2020 09:27:35
-7,200
77b064b6990dc2a0bdaec7f40ff0dce17eee0817
Fixed locale conversion problem on fixed locale
[ { "change_type": "MODIFY", "old_path": "resources/lib/services/msl/msl_utils.py", "new_path": "resources/lib/services/msl/msl_utils.py", "diff": "@@ -125,9 +125,10 @@ def _find_audio_data(player_state, manifest):\n\"\"\"\nFind the audio downloadable id and the audio track id\n\"\"\"\n- language = common.convert_language_iso(player_state['currentaudiostream']['language'])\n+ language = common.convert_language_iso(player_state['currentaudiostream']['language'], use_fallback=False)\n+ if not language: # If there is no language, means that is a fixed locale (fix_locale_languages in kodi_ops.py)\n+ language = player_state['currentaudiostream']['language']\nchannels = AUDIO_CHANNELS_CONV[player_state['currentaudiostream']['channels']]\n-\nfor audio_track in manifest['audio_tracks']:\nif audio_track['language'] == language and audio_track['channels'] == channels:\n# Get the stream dict with the highest bitrate\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
Fixed locale conversion problem on fixed locale
105,993
27.09.2020 15:26:32
-7,200
42763451236aa00779adb19d3dc9cfde5bfff541
Add a release workflow This will create a new release and adds the Changelog and Leia + Matrix ZIP files to the release page whenever a new release is tagged and pushed to the repository. Remove modules directories
[ { "change_type": "MODIFY", "old_path": ".github/workflows/ci.yml", "new_path": ".github/workflows/ci.yml", "diff": "name: CI\non:\n- pull_request:\n- branch:\n- - master\n- push:\n- branch:\n- - master\n+- pull_request\n+- push\njobs:\ntests:\nname: Add-on testing\n@@ -31,7 +27,20 @@ jobs:\npip install -r requirements.txt\n- name: Run tox\nrun: python -m tox -q -e flake8,py\n+ if: always()\n- name: Run pylint\nrun: python -m pylint resources/lib/ tests/\n+ if: always()\n- name: Compare translations\nrun: 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" }, { "change_type": "ADD", "old_path": null, "new_path": ".github/workflows/release.yml", "diff": "+name: Release\n+on:\n+ push:\n+ tags:\n+ - 'v*'\n+jobs:\n+ build:\n+ name: Release plugin.video.netflix\n+ runs-on: ubuntu-latest\n+ steps:\n+ - name: Checkout code\n+ uses: actions/checkout@v2\n+ - name: Build zip files\n+ run: |\n+ sudo apt-get install libxml2-utils\n+ make multizip release=1\n+ - name: Get Leia filename\n+ id: get-leia-filename\n+ run: |\n+ echo ::set-output name=leia-filename::$(cd ..;ls plugin.video.netflix*.zip | grep -v '+matrix.' | head -1)\n+ - name: Get Matrix filename\n+ id: get-matrix-filename\n+ run: |\n+ echo ::set-output name=matrix-filename::$(cd ..;ls plugin.video.netflix*+matrix.*.zip | head -1)\n+ - name: Get body\n+ id: get-body\n+ run: |\n+ description=$(sed '1,/v[0-9\\.]* ([0-9-]*)/d;/^$/,$d' changelog.txt)\n+ echo $description\n+ description=\"${description//'%'/'%25'}\"\n+ description=\"${description//$'\\n'/'%0A'}\"\n+ description=\"${description//$'\\r'/'%0D'}\"\n+ echo ::set-output name=body::$description\n+ - name: Create Release\n+ id: create_release\n+ uses: actions/create-release@v1\n+ env:\n+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}\n+ with:\n+ tag_name: ${{ github.ref }}\n+ release_name: ${{ github.ref }}\n+ body: ${{ steps.get-body.outputs.body }}\n+ draft: false\n+ prerelease: false\n+ - name: Upload Leia zip\n+ id: upload-leia-zip\n+ uses: actions/upload-release-asset@v1\n+ env:\n+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}\n+ with:\n+ upload_url: ${{ steps.create_release.outputs.upload_url }}\n+ asset_name: ${{ steps.get-leia-filename.outputs.leia-filename }}\n+ asset_path: ../${{ steps.get-leia-filename.outputs.leia-filename }}\n+ asset_content_type: application/zip\n+ - name: Upload Matrix zip\n+ id: upload-matrix-zip\n+ uses: actions/upload-release-asset@v1\n+ env:\n+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}\n+ with:\n+ upload_url: ${{ steps.create_release.outputs.upload_url }}\n+ asset_name: ${{ steps.get-matrix-filename.outputs.matrix-filename }}\n+ asset_path: ../${{ steps.get-matrix-filename.outputs.matrix-filename }}\n+ asset_content_type: application/zip\n" }, { "change_type": "MODIFY", "old_path": "Makefile", "new_path": "Makefile", "diff": "-export PYTHONPATH := .:$(CURDIR)/modules/mysql-connector-python:$(CURDIR)/resources/lib:$(CURDIR)/test\n+export PYTHONPATH := .:$(CURDIR)/test\nPYTHON := python\nname = $(shell xmllint --xpath 'string(/addon/@id)' addon.xml)\n@@ -7,7 +7,7 @@ git_branch = $(shell git rev-parse --abbrev-ref HEAD)\ngit_hash = $(shell git rev-parse --short HEAD)\nzip_name = $(name)-$(version)-$(git_branch)-$(git_hash).zip\n-include_files = addon.py addon.xml LICENSE.txt modules/ README.md resources/ service.py\n+include_files = addon.py addon.xml LICENSE.txt README.md resources/ service.py\ninclude_paths = $(patsubst %,$(name)/%,$(include_files))\nexclude_files = \\*.new \\*.orig \\*.pyc \\*.pyo\nzip_dir = $(name)/\n" }, { "change_type": "MODIFY", "old_path": "changelog.txt", "new_path": "changelog.txt", "diff": "@@ -28,8 +28,8 @@ v1.8.0 (2020-08-20)\nv1.7.1 (2020-08-12)\n- Added Profiles menu with new profiles context menus:\n- * Set for auto-selection\n- * Set for library playback\n+ - Set for auto-selection\n+ - Set for library playback\nThese two options now are managed only from the Profiles list\n- Added setting to enable nf watched status sync with library (one way)\n- Added expert setting to customize results per page\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
Add a release workflow This will create a new release and adds the Changelog and Leia + Matrix ZIP files to the release page whenever a new release is tagged and pushed to the repository. Remove modules directories
106,046
28.09.2020 09:04:01
-7,200
86b4fc7fe039a3e1f42952936bd1ea712eef9a80
Simplified the management of "Stop" events specific cases This is needed to fix another case: Previously has not been considered the case to play a non-netflix video content while a video is played in background
[ { "change_type": "MODIFY", "old_path": "resources/lib/services/playback/action_controller.py", "new_path": "resources/lib/services/playback/action_controller.py", "diff": "@@ -33,10 +33,10 @@ class ActionController(xbmc.Monitor):\nxbmc.Monitor.__init__(self)\nself._init_data = None\nself.tracking = False\n- self.events_workaround = False\nself.active_player_id = None\nself.action_managers = None\nself._last_player_state = {}\n+ self._is_pause_called = False\ncommon.register_slot(self.initialize_playback, common.Signals.PLAYBACK_INITIATED)\ndef initialize_playback(self, data):\n@@ -45,21 +45,15 @@ class ActionController(xbmc.Monitor):\n\"\"\"\nself._init_data = data\nself.active_player_id = None\n- # WARNING KODI EVENTS SIDE EFFECTS - TO CONSIDER FOR ACTION MANAGER'S BEHAVIOURS!\n- # If action_managers is not None, means that 'Player.OnStop' event did not happen\n- if self.action_managers is not None:\n- # When you try to play a video while another one is currently in playing, Kodi have some side effects:\n- # - The event \"Player.OnStop\" not exists. This can happen for example when using context menu\n- # \"Play From Here\" or with UpNext add-on, so to fix this we generate manually the stop event\n- # when Kodi send 'Player.OnPlay' event.\n- # - The event \"Player.OnResume\" is sent without apparent good reason.\n- # When you use ctx menu \"Play From Here\", this happen when click to next button (can not be avoided).\n- # When you use UpNext add-on, happen a bit after, then can be avoided (by events_workaround).\n- self.events_workaround = True\n- else:\n+ # WARNING KODI EVENTS SIDE EFFECTS!\n+ # If action_managers is not None, means that 'Player.OnStop' event did not happen,\n+ # this means that you have tried to play a video while another one is currently in playing\n+ if self.action_managers is None:\nself._initialize_am()\ndef _initialize_am(self):\n+ if not self._init_data:\n+ return\nself._last_player_state = {}\nself.action_managers = [\nAMPlayback(),\n@@ -69,32 +63,38 @@ class ActionController(xbmc.Monitor):\nAMUpNextNotifier()\n]\nself._notify_all(ActionManager.call_initialize, self._init_data)\n+ self._init_data = None\n+ self._is_pause_called = False\nself.tracking = True\ndef onNotification(self, sender, method, data): # pylint: disable=unused-argument\n\"\"\"\nCallback for Kodi notifications that handles and dispatches playback events\n\"\"\"\n- if not self.tracking or 'Player.' not in method:\n- return\n- try:\n- if method == 'Player.OnPlay':\n- if self.events_workaround:\n- self._on_playback_stopped()\n- self._initialize_am()\n- elif method == 'Player.OnAVStart':\n# WARNING: Do not get playerid from 'data',\n# Because when Up Next add-on play a video while we are inside Netflix add-on and\n# not externally like Kodi library, the playerid become -1 this id does not exist\n+ if not self.tracking or 'Player.' not in method:\n+ return\n+ try:\n+ if method == 'Player.OnAVStart':\nself._on_playback_started()\nelif method == 'Player.OnSeek':\nself._on_playback_seek()\nelif method == 'Player.OnPause':\n+ self._is_pause_called = True\nself._on_playback_pause()\nelif method == 'Player.OnResume':\n- if self.events_workaround:\n- LOG.debug('ActionController: Player.OnResume event has been ignored')\n+ # Kodi can call this event instead the \"OnStop\" event when you try to play a video\n+ # when another one is in playing, can be one of following cases:\n+ # - When you use ctx menu \"Play From Here\", this happen when click to next button\n+ # - When you use UpNext add-on\n+ # - When you play a non-Netflix video when a Netflix video is in playback in background\n+ if not self._is_pause_called:\n+ self._on_playback_stopped()\n+ self._initialize_am()\nreturn\n+ self._is_pause_called = False\nself._on_playback_resume()\nelif method == 'Player.OnStop':\n# When an error occurs before the video can be played,\n@@ -104,10 +104,7 @@ class ActionController(xbmc.Monitor):\nLOG.warn('ActionController: Possible problem with video playback, action managers disabled.')\nself.tracking = False\nself.action_managers = None\n- self.events_workaround = False\nreturn\n- # It should not happen, but we avoid a possible double Stop event when using the workaround\n- if not self.events_workaround:\nself._on_playback_stopped()\nexcept Exception: # pylint: disable=broad-except\nimport traceback\n@@ -158,7 +155,6 @@ class ActionController(xbmc.Monitor):\nself._notify_all(ActionManager.call_on_playback_stopped,\nself._last_player_state)\nself.action_managers = None\n- self.events_workaround = False\ndef _notify_all(self, notification, data=None):\nLOG.debug('Notifying all action managers of {} (data={})', notification.__name__, data)\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
Simplified the management of "Stop" events specific cases This is needed to fix another case: Previously has not been considered the case to play a non-netflix video content while a video is played in background
106,046
28.09.2020 09:28:24
-7,200
d383625d6e9bdd693a986cb02a115618b62b41b4
Removed no more needed comment
[ { "change_type": "MODIFY", "old_path": "resources/lib/navigation/player.py", "new_path": "resources/lib/navigation/player.py", "diff": "@@ -135,8 +135,6 @@ def _play(videoid, is_played_from_strm=False):\n'is_played_from_strm': is_played_from_strm,\n'resume_position': resume_position,\n'event_data': event_data}, non_blocking=True)\n- # Send callback after send the initialization signal\n- # to give a bit of more time to the action controller (see note in initialize_playback of action_controller.py)\nxbmcplugin.setResolvedUrl(handle=G.PLUGIN_HANDLE, succeeded=True, listitem=list_item)\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
Removed no more needed comment
106,046
27.09.2020 15:49:32
-7,200
45d3c0190a38ff20016142a37cd514bd912bddd4
Add videoid to_string
[ { "change_type": "MODIFY", "old_path": "resources/lib/common/videoid.py", "new_path": "resources/lib/common/videoid.py", "diff": "@@ -166,6 +166,21 @@ class VideoId(object):\nreturn VideoId.from_dict(videoid_dict)\nreturn self\n+ def to_string(self):\n+ \"\"\"Generate a valid pathitems as string ('show'/tvshowid/...) from this instance\"\"\"\n+ if self.videoid:\n+ return self.videoid\n+ if self.movieid:\n+ return '/'.join([self.MOVIE, self.movieid])\n+ if self.supplementalid:\n+ return '/'.join([self.SUPPLEMENTAL, self.supplementalid])\n+ pathitems = [self.SHOW, self.tvshowid]\n+ if self.seasonid:\n+ pathitems.extend([self.SEASON, self.seasonid])\n+ if self.episodeid:\n+ pathitems.extend([self.EPISODE, self.episodeid])\n+ return '/'.join(pathitems)\n+\ndef to_path(self):\n\"\"\"Generate a valid pathitems list (['show', tvshowid, ...]) from\nthis instance\"\"\"\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
Add videoid to_string
106,046
29.09.2020 13:08:34
-7,200
7a83340a8bf7ef948d02d2f0f537d248b0e97296
Add keymaps navigation
[ { "change_type": "MODIFY", "old_path": "resources/lib/globals.py", "new_path": "resources/lib/globals.py", "diff": "@@ -205,6 +205,7 @@ class GlobalVariables(object):\nMODE_PLAY = 'play'\nMODE_PLAY_STRM = 'play_strm'\nMODE_LIBRARY = 'library'\n+ MODE_KEYMAPS = 'keymaps'\ndef __init__(self):\n\"\"\"Do nothing on constructing the object\"\"\"\n" }, { "change_type": "MODIFY", "old_path": "resources/lib/navigation/actions.py", "new_path": "resources/lib/navigation/actions.py", "diff": "@@ -121,7 +121,7 @@ class AddonActionExecutor(object):\n\"\"\"Add or remove an item from my list\"\"\"\noperation = pathitems[1]\napi.update_my_list(videoid, operation, self.params)\n- _sync_library(videoid, operation)\n+ sync_library(videoid, operation)\ncommon.container_refresh()\[email protected]_video_id(path_offset=1)\n@@ -207,22 +207,8 @@ class AddonActionExecutor(object):\[email protected]_video_id(path_offset=1)\ndef change_watched_status(self, videoid):\n- \"\"\"Change the watched status locally\"\"\"\n- # Todo: how get resumetime/playcount of selected item for calculate current watched status?\n-\n- profile_guid = G.LOCAL_DB.get_active_profile_guid()\n- current_value = G.SHARED_DB.get_watched_status(profile_guid, videoid.value, None, bool)\n- if current_value:\n- txt_index = 1\n- G.SHARED_DB.set_watched_status(profile_guid, videoid.value, False)\n- elif current_value is not None and not current_value:\n- txt_index = 2\n- G.SHARED_DB.delete_watched_status(profile_guid, videoid.value)\n- else:\n- txt_index = 0\n- G.SHARED_DB.set_watched_status(profile_guid, videoid.value, True)\n- ui.show_notification(common.get_local_string(30237).split('|')[txt_index])\n- common.container_refresh()\n+ \"\"\"Change the watched status of a video, only when sync of watched status with NF is enabled\"\"\"\n+ change_watched_status_locally(videoid)\ndef configuration_wizard(self, pathitems=None): # pylint: disable=unused-argument\n\"\"\"Run the add-on configuration wizard\"\"\"\n@@ -253,7 +239,7 @@ class AddonActionExecutor(object):\ncommon.container_refresh()\n-def _sync_library(videoid, operation):\n+def sync_library(videoid, operation):\nif operation and G.ADDON.getSettingBool('lib_sync_mylist') and G.ADDON.getSettingInt('lib_auto_upd_mode') == 2:\nsync_mylist_profile_guid = G.SHARED_DB.get_value('sync_mylist_profile_guid',\nG.LOCAL_DB.get_guid_owner_profile())\n@@ -265,3 +251,21 @@ def _sync_library(videoid, operation):\nget_library_cls().export_to_library(videoid, False)\nelif operation == 'remove':\nget_library_cls().remove_from_library(videoid, False)\n+\n+\n+def change_watched_status_locally(videoid):\n+ \"\"\"Change the watched status locally\"\"\"\n+ # Todo: how get resumetime/playcount of selected item for calculate current watched status?\n+ profile_guid = G.LOCAL_DB.get_active_profile_guid()\n+ current_value = G.SHARED_DB.get_watched_status(profile_guid, videoid.value, None, bool)\n+ if current_value:\n+ txt_index = 1\n+ G.SHARED_DB.set_watched_status(profile_guid, videoid.value, False)\n+ elif current_value is not None and not current_value:\n+ txt_index = 2\n+ G.SHARED_DB.delete_watched_status(profile_guid, videoid.value)\n+ else:\n+ txt_index = 0\n+ G.SHARED_DB.set_watched_status(profile_guid, videoid.value, True)\n+ ui.show_notification(common.get_local_string(30237).split('|')[txt_index])\n+ common.container_refresh()\n" }, { "change_type": "ADD", "old_path": null, "new_path": "resources/lib/navigation/keymaps.py", "diff": "+# -*- coding: utf-8 -*-\n+\"\"\"\n+ Copyright (C) 2017 Sebastian Golasch (plugin.video.netflix)\n+ Copyright (C) 2020 Stefano Gottardo (original implementation module)\n+ Navigation handler for keyboard shortcut keys\n+\n+ SPDX-License-Identifier: MIT\n+ See LICENSES/MIT.md for more information.\n+\"\"\"\n+from __future__ import absolute_import, division, unicode_literals\n+\n+from functools import wraps\n+\n+import xbmc\n+\n+from resources.lib import common\n+from resources.lib.globals import G\n+from resources.lib.kodi import ui\n+from resources.lib.kodi.library import get_library_cls\n+from resources.lib.navigation.actions import change_watched_status_locally, sync_library\n+from resources.lib.utils.logging import LOG\n+import resources.lib.utils.api_requests as api\n+import resources.lib.kodi.library_utils as lib_utils\n+\n+\n+def allow_execution_decorator(check_addon=True, check_lib=False, inject_videoid=False):\n+ def allow_execution(func):\n+ \"\"\"Decorator that catch exceptions\"\"\"\n+ @wraps(func)\n+ def wrapper(*args, **kwargs):\n+ if check_addon and not _is_addon_opened():\n+ return\n+ if check_lib and not _is_library_ops_allowed():\n+ return\n+ if inject_videoid:\n+ videoid = _get_selected_videoid()\n+ if not videoid:\n+ return\n+ kwargs['videoid'] = videoid\n+ func(*args, **kwargs)\n+ return wrapper\n+ return allow_execution\n+\n+\n+class KeymapsActionExecutor(object):\n+ \"\"\"Executes keymaps actions\"\"\"\n+\n+ def __init__(self, params):\n+ LOG.debug('Initializing \"KeymapsActionExecutor\" with params: {}', params)\n+ self.params = params\n+\n+ @allow_execution_decorator(check_lib=True, inject_videoid=True)\n+ def lib_export(self, pathitems, videoid=None): # pylint: disable=unused-argument\n+ \"\"\"Export or update an item to the Kodi library\"\"\"\n+ if videoid.mediatype in [common.VideoId.SUPPLEMENTAL, common.VideoId.EPISODE]:\n+ return\n+ if lib_utils.is_videoid_in_db(videoid):\n+ get_library_cls().update_library(videoid)\n+ else:\n+ get_library_cls().export_to_library(videoid)\n+ common.container_refresh()\n+\n+ @allow_execution_decorator(check_lib=True, inject_videoid=True)\n+ def lib_remove(self, pathitems, videoid=None): # pylint: disable=unused-argument\n+ \"\"\"Remove an item to the Kodi library\"\"\"\n+ if videoid.mediatype in [common.VideoId.SUPPLEMENTAL, common.VideoId.EPISODE]:\n+ return\n+ if not ui.ask_for_confirmation(common.get_local_string(30030),\n+ common.get_local_string(30124)):\n+ return\n+ get_library_cls().remove_from_library(videoid)\n+ common.container_refresh(use_delay=True)\n+\n+ @allow_execution_decorator(inject_videoid=True)\n+ def change_watched_status(self, pathitems, videoid=None): # pylint: disable=unused-argument\n+ \"\"\"Change the watched status of a video, only when sync of watched status with NF is enabled\"\"\"\n+ if videoid.mediatype not in [common.VideoId.MOVIE, common.VideoId.EPISODE]:\n+ return\n+ if G.ADDON.getSettingBool('ProgressManager_enabled'):\n+ change_watched_status_locally(videoid)\n+\n+ @allow_execution_decorator(inject_videoid=True)\n+ def my_list(self, pathitems, videoid=None): # pylint: disable=unused-argument\n+ \"\"\"Add or remove an item from my list\"\"\"\n+ if videoid.mediatype not in [common.VideoId.MOVIE, common.VideoId.SHOW]:\n+ return\n+ perpetual_range_start = xbmc.getInfoLabel('ListItem.Property(nf_perpetual_range_start)')\n+ is_in_mylist = xbmc.getInfoLabel('ListItem.Property(nf_is_in_mylist)') == 'True'\n+ operation = 'remove' if is_in_mylist else 'add'\n+ api.update_my_list(videoid, operation, {'perpetual_range_start': perpetual_range_start})\n+ sync_library(videoid, operation)\n+ common.container_refresh()\n+\n+\n+def _get_selected_videoid():\n+ \"\"\"Return the videoid from the current selected ListItem\"\"\"\n+ videoid_str = xbmc.getInfoLabel('ListItem.Property(nf_videoid)')\n+ if not videoid_str:\n+ return None\n+ return common.VideoId.from_path(videoid_str.split('/'))\n+\n+\n+def _is_library_ops_allowed():\n+ \"\"\"Check if library operations are allowed\"\"\"\n+ allow_lib_operations = True\n+ lib_auto_upd_mode = G.ADDON.getSettingInt('lib_auto_upd_mode')\n+ if lib_auto_upd_mode == 0:\n+ return False\n+ is_lib_sync_with_mylist = (G.ADDON.getSettingBool('lib_sync_mylist') and\n+ lib_auto_upd_mode == 2)\n+ if is_lib_sync_with_mylist:\n+ # If the synchronization of Netflix \"My List\" with the Kodi library is enabled\n+ # only in the chosen profile allow to do operations in the Kodi library otherwise\n+ # it creates inconsistency to the exported elements and increases the work for sync\n+ sync_mylist_profile_guid = G.SHARED_DB.get_value('sync_mylist_profile_guid',\n+ G.LOCAL_DB.get_guid_owner_profile())\n+ allow_lib_operations = sync_mylist_profile_guid == G.LOCAL_DB.get_active_profile_guid()\n+ return allow_lib_operations\n+\n+\n+def _is_addon_opened():\n+ \"\"\"Check if the add-on is opened on screen\"\"\"\n+ return xbmc.getInfoLabel('Container.PluginName') == G.ADDON.getAddonInfo('id')\n" }, { "change_type": "MODIFY", "old_path": "resources/lib/run_addon.py", "new_path": "resources/lib/run_addon.py", "diff": "@@ -132,12 +132,15 @@ def _get_nav_handler(root_handler, pathitems):\nif root_handler == G.MODE_DIRECTORY:\nfrom resources.lib.navigation.directory import Directory\nnav_handler = Directory\n- if root_handler == G.MODE_ACTION:\n+ elif root_handler == G.MODE_ACTION:\nfrom resources.lib.navigation.actions import AddonActionExecutor\nnav_handler = AddonActionExecutor\n- if root_handler == G.MODE_LIBRARY:\n+ elif root_handler == G.MODE_LIBRARY:\nfrom resources.lib.navigation.library import LibraryActionExecutor\nnav_handler = LibraryActionExecutor\n+ elif root_handler == G.MODE_KEYMAPS:\n+ from resources.lib.navigation.keymaps import KeymapsActionExecutor\n+ nav_handler = KeymapsActionExecutor\nif not nav_handler:\nraise InvalidPathError('No root handler for path {}'.format('/'.join(pathitems)))\nreturn nav_handler\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": "@@ -150,7 +150,8 @@ def _create_season_item(tvshowid, seasonid_value, season, season_list, common_da\n'video_id': seasonid_value,\n'media_type': seasonid.mediatype,\n'label': season['summary']['name'],\n- 'is_folder': True\n+ 'is_folder': True,\n+ 'properties': {'nf_videoid': seasonid.to_string()}\n}\nadd_info_dict_item(dict_item, seasonid, season, season_list.data, False, common_data)\ndict_item['art'] = get_art(tvshowid, season, common_data['profile_language_code'])\n@@ -181,7 +182,8 @@ def _create_episode_item(seasonid, episodeid_value, episode, episodes_list, comm\ndict_item = {'video_id': episodeid_value,\n'media_type': episodeid.mediatype,\n'label': episode['title'],\n- 'is_folder': False}\n+ 'is_folder': False,\n+ 'properties': {'nf_videoid': episodeid.to_string()}}\nadd_info_dict_item(dict_item, episodeid, episode, episodes_list.data, False, common_data)\nset_watched_status(dict_item, episode, common_data)\ndict_item['art'] = get_art(episodeid, episode, common_data['profile_language_code'])\n@@ -308,7 +310,10 @@ def _create_video_item(videoid_value, video, video_list, perpetual_range_start,\ndict_item = {'video_id': videoid_value,\n'media_type': videoid.mediatype,\n'label': video['title'],\n- 'is_folder': is_folder}\n+ 'is_folder': is_folder,\n+ 'properties': {'nf_videoid': videoid.to_string(),\n+ 'nf_is_in_mylist': str(is_in_mylist),\n+ 'nf_perpetual_range_start': perpetual_range_start}}\nadd_info_dict_item(dict_item, videoid, video, video_list.data, is_in_mylist, common_data)\nset_watched_status(dict_item, video, common_data)\ndict_item['art'] = get_art(videoid, video, common_data['profile_language_code'])\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
Add keymaps navigation
106,046
01.10.2020 09:06:26
-7,200
390d4488068afb52179649a6f9506d14a1d7e382
Give priority to import cryptodomex should solve the rare cases where a version of Crypto is installed on a system without Padding utils
[ { "change_type": "MODIFY", "old_path": "resources/lib/common/credentials.py", "new_path": "resources/lib/common/credentials.py", "diff": "@@ -36,13 +36,13 @@ def encrypt_credential(raw):\n# Keep these imports within the method otherwise if the packages are not installed,\n# the addon crashes and the user does not read the warning message\ntry: # The crypto package depends on the library installed (see Wiki)\n- from Crypto import Random\n- from Crypto.Cipher import AES\n- from Crypto.Util import Padding\n- except ImportError:\nfrom Cryptodome import Random\nfrom Cryptodome.Cipher import AES\nfrom Cryptodome.Util import Padding\n+ except ImportError:\n+ from Crypto import Random\n+ from Crypto.Cipher import AES\n+ from Crypto.Util import Padding\nraw = bytes(Padding.pad(data_to_pad=raw.encode('utf-8'), block_size=__BLOCK_SIZE__))\niv = Random.new().read(AES.block_size)\ncipher = AES.new(get_crypt_key(), AES.MODE_CBC, iv)\n@@ -59,11 +59,11 @@ def decrypt_credential(enc):\n# Keep these imports within the method otherwise if the packages are not installed,\n# the addon crashes and the user does not read the warning message\ntry: # The crypto package depends on the library installed (see Wiki)\n- from Crypto.Cipher import AES\n- from Crypto.Util import Padding\n- except ImportError:\nfrom Cryptodome.Cipher import AES\nfrom Cryptodome.Util import Padding\n+ except ImportError:\n+ from Crypto.Cipher import AES\n+ from Crypto.Util import Padding\nenc = base64.b64decode(enc)\niv = enc[:AES.block_size]\ncipher = AES.new(get_crypt_key(), AES.MODE_CBC, iv)\n@@ -151,11 +151,11 @@ def _get_authentication_key_data(file_path, pin):\n# Keep these imports within the method otherwise if the packages are not installed,\n# the addon crashes and the user does not read the warning message\ntry: # The crypto package depends on the library installed (see Wiki)\n- from Crypto.Cipher import AES\n- from Crypto.Util import Padding\n- except ImportError:\nfrom Cryptodome.Cipher import AES\nfrom Cryptodome.Util import Padding\n+ except ImportError:\n+ from Crypto.Cipher import AES\n+ from Crypto.Util import Padding\ntry:\nfile_content = load_file(file_path)\niv = '\\x00' * 16\n" }, { "change_type": "MODIFY", "old_path": "resources/lib/services/msl/default_crypto.py", "new_path": "resources/lib/services/msl/default_crypto.py", "diff": "@@ -15,19 +15,19 @@ import json\ntry: # The crypto package depends on the library installed (see Wiki)\n- from Crypto.Random import get_random_bytes\n- from Crypto.Hash import HMAC, SHA256\n- from Crypto.Cipher import PKCS1_OAEP\n- from Crypto.PublicKey import RSA\n- from Crypto.Util import Padding\n- from Crypto.Cipher import AES\n-except ImportError:\nfrom Cryptodome.Random import get_random_bytes\nfrom Cryptodome.Hash import HMAC, SHA256\nfrom Cryptodome.Cipher import PKCS1_OAEP\nfrom Cryptodome.PublicKey import RSA\nfrom Cryptodome.Util import Padding\nfrom Cryptodome.Cipher import AES\n+except ImportError:\n+ from Crypto.Random import get_random_bytes\n+ from Crypto.Hash import HMAC, SHA256\n+ from Crypto.Cipher import PKCS1_OAEP\n+ from Crypto.PublicKey import RSA\n+ from Crypto.Util import Padding\n+ from Crypto.Cipher import AES\nfrom resources.lib.common.exceptions import MSLError\nfrom resources.lib.utils.logging import LOG\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
Give priority to import cryptodomex should solve the rare cases where a version of Crypto is installed on a system without Padding utils
106,046
03.10.2020 09:55:52
-7,200
246dbd00acf33399f70cfea88fd28164a765c3d8
Release workflows fixes
[ { "change_type": "MODIFY", "old_path": "Makefile", "new_path": "Makefile", "diff": "export PYTHONPATH := .:$(CURDIR)/test\nPYTHON := python\n+KODI_PYTHON_ABIS := 3.0.0 2.25.0\nname = $(shell xmllint --xpath 'string(/addon/@id)' addon.xml)\nversion = $(shell xmllint --xpath 'string(/addon/@version)' addon.xml)\ngit_branch = $(shell git rev-parse --abbrev-ref HEAD)\ngit_hash = $(shell git rev-parse --short HEAD)\n+matrix = $(findstring $(shell xmllint --xpath 'string(/addon/requires/import[@addon=\"xbmc.python\"]/@version)' addon.xml), $(word 1,$(KODI_PYTHON_ABIS)))\n+ifdef release\n+ zip_name = $(name)-$(version).zip\n+else\nzip_name = $(name)-$(version)-$(git_branch)-$(git_hash).zip\n-include_files = addon.py addon.xml LICENSE.txt README.md resources/ service.py\n+endif\n+\n+include_files = addon.py addon.xml LICENSE.txt README.md resources/ service.py packages/\ninclude_paths = $(patsubst %,$(name)/%,$(include_files))\nexclude_files = \\*.new \\*.orig \\*.pyc \\*.pyo\nzip_dir = $(name)/\n@@ -83,6 +90,15 @@ build: clean\ncd ..; zip -r $(zip_name) $(include_paths) -x $(exclude_files)\n@echo -e \"$(white)=$(blue) Successfully wrote package as: $(white)../$(zip_name)$(reset)\"\n+multizip: clean\n+ @-$(foreach abi,$(KODI_PYTHON_ABIS), \\\n+ echo \"cd /addon/requires/import[@addon='xbmc.python']/@version\\nset $(abi)\\nsave\\nbye\" | xmllint --shell addon.xml; \\\n+ matrix=$(findstring $(abi), $(word 1,$(KODI_PYTHON_ABIS))); \\\n+ if [ $$matrix ]; then version=$(version)+matrix.1; else version=$(version); fi; \\\n+ echo \"cd /addon/@version\\nset $$version\\nsave\\nbye\" | xmllint --shell addon.xml; \\\n+ make build; \\\n+ )\n+\nclean:\n@echo -e \"$(white)=$(blue) Cleaning up$(reset)\"\nfind . -name '*.py[cod]' -type f -delete\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
Release workflows fixes
106,046
03.10.2020 10:45:58
-7,200
cc6ebdf8b8311fc5c0013a7284530ad4e17d32bb
Version bump (1.10.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.9.1\" provider-name=\"libdev + jojo + asciidisco + caphm + castagnait\">\n+<addon id=\"plugin.video.netflix\" name=\"Netflix\" version=\"1.10.0\" provider-name=\"libdev + jojo + asciidisco + caphm + castagnait\">\n<requires>\n<import addon=\"xbmc.python\" version=\"2.26.0\"/>\n<import addon=\"script.module.addon.signals\" version=\"0.0.3\"/>\n<forum>https://forum.kodi.tv/showthread.php?tid=329767</forum>\n<source>https://github.com/CastagnaIT/plugin.video.netflix</source>\n<news>\n-v1.9.1 (2020-09-18)\n--Add TV Shows/Movies Top 10\n--Add support to NFAuthenticationKey for linux\n--Fixed search results via JSON-RPC\n--Fixed an issue that cause to ask to clear search history again when you return to previous menu\n--Fixed possible wrong results on Top 10 menu due to cache TTL\n--Updated translations ro, nl\n+v1.10.0 (2020-10-02)\n+- Add initial support to keymapping (details to Wiki)\n+- Fixed regression causing PIN request each time the main menu is loaded\n+- Fixed an issue that caused build_media_tag exception while watching video\n+- Fixed an issue that caused build_media_tag exception while watching a non-netflix content\n+- Improvements to english language and related translations\n</news>\n</extension>\n</addon>\n" }, { "change_type": "MODIFY", "old_path": "changelog.txt", "new_path": "changelog.txt", "diff": "+v1.10.0 (2020-10-02)\n+- Add initial support to keymapping (details to Wiki)\n+- Fixed regression causing PIN request each time the main menu is loaded\n+- Fixed an issue that caused build_media_tag exception while watching video\n+- Fixed an issue that caused build_media_tag exception while watching a non-netflix content\n+- Improvements to english language and related translations\n+\nv1.9.1 (2020-09-18)\n- Add TV Shows/Movies Top 10\n- Add support to NFAuthenticationKey for linux\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
Version bump (1.10.0) (#883)
106,046
03.10.2020 11:05:23
-7,200
3927ef28af55ae6fd802e6bd8a1136cf145ca766
Set right kodi python abi
[ { "change_type": "MODIFY", "old_path": "Makefile", "new_path": "Makefile", "diff": "export PYTHONPATH := .:$(CURDIR)/test\nPYTHON := python\n-KODI_PYTHON_ABIS := 3.0.0 2.25.0\n+KODI_PYTHON_ABIS := 3.0.0 2.26.0\nname = $(shell xmllint --xpath 'string(/addon/@id)' addon.xml)\nversion = $(shell xmllint --xpath 'string(/addon/@version)' addon.xml)\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
Set right kodi python abi
106,046
03.10.2020 13:50:05
-7,200
a5643b6f9f62f57c310fb95aee124cbc72e4e921
Fixed sed regex
[ { "change_type": "MODIFY", "old_path": ".github/workflows/release.yml", "new_path": ".github/workflows/release.yml", "diff": "@@ -25,7 +25,7 @@ jobs:\n- name: Get body\nid: get-body\nrun: |\n- description=$(sed '1,/v[0-9\\.]* ([0-9-]*)/d;/^$/,$d' changelog.txt)\n+ description=$(sed '/v[0-9\\.]*\\s([0-9-]*)/d;/^$/,$d' changelog.txt)\necho $description\ndescription=\"${description//'%'/'%25'}\"\ndescription=\"${description//$'\\n'/'%0A'}\"\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
Fixed sed regex
106,046
11.10.2020 18:38:55
-7,200
cde05f6007a9055a71679814059445628dc59241
Execute a single db transaction for all add operations This is needed to fix performance problem with slow storages, that do not have enough speed performance to perform multiple individual db writing operations, and cause long delay in loading lists and in the worst cases raise AddonSignals call timeout error
[ { "change_type": "MODIFY", "old_path": "resources/lib/common/cache.py", "new_path": "resources/lib/common/cache.py", "diff": "@@ -39,7 +39,7 @@ class Cache(object):\ndata = self._make_call('get', call_args)\nreturn deserialize_data(data)\n- def add(self, bucket, identifier, data, ttl=None, expires=None):\n+ def add(self, bucket, identifier, data, ttl=None, expires=None, delayed_db_op=False):\n\"\"\"\nAdd or update an item to a cache bucket\n@@ -48,13 +48,17 @@ class Cache(object):\n:param data: the content\n:param ttl: override default expiration (in seconds)\n:param expires: override default expiration (in timestamp) if specified override also the 'ttl' value\n+ :param delayed_db_op: if True, queues the adding operation for the db, then is mandatory to call\n+ 'execute_pending_db_add' at end of all operations to apply the changes to the db\n+ (only for persistent buckets)\n\"\"\"\ncall_args = {\n'bucket': bucket,\n'identifier': identifier,\n'data': None, # This value is injected after the _make_call\n'ttl': ttl,\n- 'expires': expires\n+ 'expires': expires,\n+ 'delayed_db_op': delayed_db_op\n}\nself._make_call('add', call_args, serialize_data(data))\n" }, { "change_type": "MODIFY", "old_path": "resources/lib/kodi/infolabels.py", "new_path": "resources/lib/kodi/infolabels.py", "diff": "@@ -48,7 +48,7 @@ MEDIA_TYPE_MAPPINGS = {\n}\n-def get_info(videoid, item, raw_data, profile_language_code=''):\n+def get_info(videoid, item, raw_data, profile_language_code='', delayed_db_op=False):\n\"\"\"Get the infolabels data\"\"\"\ncache_identifier = videoid.value + '_' + profile_language_code\ntry:\n@@ -57,13 +57,15 @@ def get_info(videoid, item, raw_data, profile_language_code=''):\nquality_infos = cache_entry['quality_infos']\nexcept CacheMiss:\ninfos, quality_infos = parse_info(videoid, item, raw_data)\n- G.CACHE.add(CACHE_INFOLABELS, cache_identifier, {'infos': infos, 'quality_infos': quality_infos})\n+ G.CACHE.add(CACHE_INFOLABELS, cache_identifier, {'infos': infos, 'quality_infos': quality_infos},\n+ delayed_db_op=delayed_db_op)\nreturn infos, quality_infos\n-def add_info_dict_item(dict_item, videoid, item, raw_data, is_in_mylist, common_data):\n- \"\"\"Add infolabels to a dict_item\"\"\"\n- infos, quality_infos = get_info(videoid, item, raw_data)\n+def add_info_dict_item(dict_item, videoid, item, raw_data, is_in_mylist, common_data, art_item=None):\n+ \"\"\"Add infolabels and art to a dict_item\"\"\"\n+ infos, quality_infos = get_info(videoid, item, raw_data,\n+ delayed_db_op=True)\ndict_item['quality_info'] = quality_infos\n# Use a deepcopy of dict to not reflect future changes to the dictionary also to the cache\ninfos_copy = copy.deepcopy(infos)\n@@ -76,6 +78,8 @@ def add_info_dict_item(dict_item, videoid, item, raw_data, is_in_mylist, common_\ndict_item['label'] = _colorize_text(common_data['mylist_titles_color'], dict_item['label'])\ninfos_copy['title'] = dict_item['label']\ndict_item['info'] = infos_copy\n+ dict_item['art'] = get_art(videoid, art_item or item, common_data['profile_language_code'],\n+ delayed_db_op=True)\ndef _add_supplemental_plot_info(infos_copy, item, common_data):\n@@ -103,19 +107,21 @@ def _add_supplemental_plot_info(infos_copy, item, common_data):\ninfos_copy.update({'PlotOutline': plotoutline + suppl_text})\n-def get_art(videoid, item, profile_language_code=''):\n+def 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+ return _get_art(videoid, item or {}, profile_language_code,\n+ delayed_db_op=delayed_db_op)\n-def _get_art(videoid, item, profile_language_code):\n+def _get_art(videoid, item, profile_language_code, delayed_db_op=False):\n# If item is None this method raise TypeError\ncache_identifier = videoid.value + '_' + profile_language_code\ntry:\nart = G.CACHE.get(CACHE_ARTINFO, cache_identifier)\nexcept CacheMiss:\nart = parse_art(videoid, item)\n- G.CACHE.add(CACHE_ARTINFO, cache_identifier, art)\n+ G.CACHE.add(CACHE_ARTINFO, cache_identifier, art,\n+ delayed_db_op=delayed_db_op)\nreturn art\n" }, { "change_type": "MODIFY", "old_path": "resources/lib/services/cache/cache_management.py", "new_path": "resources/lib/services/cache/cache_management.py", "diff": "@@ -62,6 +62,7 @@ class CacheManagement(object):\nself.next_schedule = _compute_next_schedule()\nself.ttl_values = {}\nself.load_ttl_values()\n+ self.pending_db_ops_add = []\ndef load_ttl_values(self):\n\"\"\"Load the ttl values from add-on settings\"\"\"\n@@ -165,7 +166,7 @@ class CacheManagement(object):\nLOG.error('SQLite error {}:', exc.args[0])\nraise_from(DBSQLiteError, exc)\n- def add(self, bucket, identifier, data, ttl=None, expires=None):\n+ def add(self, bucket, identifier, data, ttl=None, expires=None, delayed_db_op=False):\n\"\"\"\nAdd or update an item to a cache bucket\n@@ -174,6 +175,9 @@ class CacheManagement(object):\n:param data: the content\n:param ttl: override default expiration (in seconds)\n:param expires: override default expiration (in timestamp) if specified override also the 'ttl' value\n+ :param delayed_db_op: if True, queues the adding operation for the db, then is mandatory to call\n+ 'execute_pending_db_add' at end of all operations to apply the changes to the db\n+ (only for persistent buckets)\n\"\"\"\ntry:\nidentifier = self._add_prefix(identifier)\n@@ -185,23 +189,47 @@ class CacheManagement(object):\n# Save the item data to memory-cache\nself._get_cache_bucket(bucket['name']).update({identifier: cache_entry})\nif bucket['is_persistent']:\n+ row_data = (bucket['name'], identifier, sql.Binary(data), expires, int(time()))\n+ if delayed_db_op:\n+ # Add to pending operations\n+ self.pending_db_ops_add.append(row_data)\n+ else:\n# Save the item data to the cache database\n- self._add_db(bucket['name'], identifier, data, expires)\n+ self._add_db(row_data)\nexcept DBProfilesMissing:\n# Raised by _add_prefix there is no active profile guid when add-on is installed from scratch\npass\n@handle_connection\n- def _add_db(self, bucket_name, identifier, data, expires):\n+ def _add_db(self, row_data):\ntry:\ncursor = self.conn.cursor()\nquery = ('REPLACE INTO cache_data (bucket, identifier, value, expires, last_modified) '\n'VALUES(?, ?, ?, ?, ?)')\n- cursor.execute(query, (bucket_name, identifier, sql.Binary(data), expires, int(time())))\n+ cursor.execute(query, row_data)\nexcept sql.Error as exc:\nLOG.error('SQLite error {}:', exc.args[0])\nraise_from(DBSQLiteError, exc)\n+ @handle_connection\n+ def execute_pending_db_ops(self):\n+ \"\"\"Execute all pending db operations at once\"\"\"\n+ # Required for cases when the devices has a slow performance storage like old sdcard or mechanical hdd,\n+ # this devices do not have enough speed performance to perform multiple individual db writing operations\n+ # in a faster way and this results in a long delay in loading the lists,\n+ # making a single db write for all changes greatly speeds up the loading of the lists\n+ if self.pending_db_ops_add:\n+ try:\n+ cursor = self.conn.cursor()\n+ cursor.execute(\"BEGIN TRANSACTION;\")\n+ query = ('REPLACE INTO cache_data (bucket, identifier, value, expires, last_modified) '\n+ 'VALUES(?, ?, ?, ?, ?)')\n+ cursor.executemany(query, self.pending_db_ops_add)\n+ cursor.execute(\"COMMIT;\")\n+ self.pending_db_ops_add = []\n+ except sql.Error as exc:\n+ LOG.error('SQLite error {}:', exc.args[0])\n+\ndef delete(self, bucket, identifier, including_suffixes):\n\"\"\"\nDelete an item from cache bucket\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": "@@ -15,7 +15,7 @@ import resources.lib.common as common\nfrom resources.lib.database.db_utils import (TABLE_MENU_DATA)\nfrom resources.lib.globals import G\nfrom resources.lib.kodi.context_menu import generate_context_menu_items, generate_context_menu_profile\n-from resources.lib.kodi.infolabels import get_art, get_color_name, add_info_dict_item, set_watched_status\n+from resources.lib.kodi.infolabels import get_color_name, add_info_dict_item, set_watched_status\nfrom resources.lib.services.nfsession.directorybuilder.dir_builder_utils import (get_param_watched_status_by_profile,\nadd_items_previous_next_page)\nfrom resources.lib.utils.logging import measure_exec_time_decorator\n@@ -75,6 +75,7 @@ def build_mainmenu_listing(loco_list):\n'art': {'icon': 'DefaultUser.png'},\n'is_folder': True\n})\n+ G.CACHE_MANAGEMENT.execute_pending_db_ops()\nreturn directory_items, {}\n@@ -141,6 +142,7 @@ def build_season_listing(season_list, tvshowid, pathitems=None):\nin iteritems(season_list.seasons)]\n# add_items_previous_next_page use the new value of perpetual_range_selector\nadd_items_previous_next_page(directory_items, pathitems, season_list.perpetual_range_selector, tvshowid)\n+ G.CACHE_MANAGEMENT.execute_pending_db_ops()\nreturn directory_items, {'title': season_list.tvshow['title'] + ' - ' + common.get_local_string(20366)[2:]}\n@@ -154,7 +156,6 @@ def _create_season_item(tvshowid, seasonid_value, season, season_list, common_da\n'properties': {'nf_videoid': seasonid.to_string()}\n}\nadd_info_dict_item(dict_item, seasonid, season, season_list.data, False, common_data)\n- dict_item['art'] = get_art(tvshowid, season, common_data['profile_language_code'])\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@@ -174,6 +175,7 @@ def build_episode_listing(episodes_list, seasonid, pathitems=None):\nin iteritems(episodes_list.episodes)]\n# add_items_previous_next_page use the new value of perpetual_range_selector\nadd_items_previous_next_page(directory_items, pathitems, episodes_list.perpetual_range_selector)\n+ G.CACHE_MANAGEMENT.execute_pending_db_ops()\nreturn directory_items, {'title': episodes_list.tvshow['title'] + ' - ' + episodes_list.season['summary']['name']}\n@@ -186,7 +188,6 @@ def _create_episode_item(seasonid, episodeid_value, episode, episodes_list, comm\n'properties': {'nf_videoid': episodeid.to_string()}}\nadd_info_dict_item(dict_item, episodeid, episode, episodes_list.data, False, common_data)\nset_watched_status(dict_item, episode, common_data)\n- dict_item['art'] = get_art(episodeid, episode, common_data['profile_language_code'])\ndict_item['url'] = common.build_url(videoid=episodeid, mode=G.MODE_PLAY, params=common_data['params'])\ndict_item['menu_items'] = generate_context_menu_items(episodeid, False, None)\nreturn dict_item\n@@ -232,6 +233,7 @@ def build_loco_listing(loco_list, menu_data, force_use_videolist_id=False, exclu\nG.LOCAL_DB.set_value(list_id, sub_menu_data, TABLE_MENU_DATA)\ndirectory_items.append(_create_videolist_item(list_id, video_list, sub_menu_data, common_data))\n+ G.CACHE_MANAGEMENT.execute_pending_db_ops()\nreturn directory_items, {}\n@@ -248,8 +250,8 @@ def _create_videolist_item(list_id, video_list, menu_data, common_data, static_l\npathitems = [path, menu_data['path'][1], list_id]\ndict_item = {'label': video_list['displayName'],\n'is_folder': True}\n- add_info_dict_item(dict_item, video_list.videoid, video_list, video_list.data, False, common_data)\n- dict_item['art'] = get_art(video_list.videoid, video_list.artitem, common_data['profile_language_code'])\n+ add_info_dict_item(dict_item, video_list.videoid, video_list, video_list.data, False, common_data,\n+ art_item=video_list.artitem)\n# Add possibility to browse the sub-genres (see build_video_listing)\nsub_genre_id = video_list.get('genreId')\nparams = {'sub_genre_id': unicode(sub_genre_id)} if sub_genre_id else None\n@@ -300,6 +302,7 @@ def build_video_listing(video_list, menu_data, sub_genre_id=None, pathitems=None\ndirectory_items.insert(0, folder_dict_item)\n# add_items_previous_next_page use the new value of perpetual_range_selector\nadd_items_previous_next_page(directory_items, pathitems, video_list.perpetual_range_selector, sub_genre_id)\n+ G.CACHE_MANAGEMENT.execute_pending_db_ops()\nreturn directory_items, {}\n@@ -316,7 +319,6 @@ def _create_video_item(videoid_value, video, video_list, perpetual_range_start,\n'nf_perpetual_range_start': perpetual_range_start}}\nadd_info_dict_item(dict_item, videoid, video, video_list.data, is_in_mylist, common_data)\nset_watched_status(dict_item, video, common_data)\n- dict_item['art'] = get_art(videoid, video, common_data['profile_language_code'])\ndict_item['url'] = common.build_url(videoid=videoid,\nmode=G.MODE_DIRECTORY if is_folder else G.MODE_PLAY,\nparams=None if is_folder else common_data['params'])\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
Execute a single db transaction for all add operations This is needed to fix performance problem with slow storages, that do not have enough speed performance to perform multiple individual db writing operations, and cause long delay in loading lists and in the worst cases raise AddonSignals call timeout error
106,046
15.10.2020 13:46:24
-7,200
0f9fb9f18c6a36a06283ddd59b8534b56e1f7790
Convert videoid once and use the same variables
[ { "change_type": "MODIFY", "old_path": "resources/lib/services/playback/action_controller.py", "new_path": "resources/lib/services/playback/action_controller.py", "diff": "@@ -43,6 +43,12 @@ class ActionController(xbmc.Monitor):\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+ if data['videoid_next_episode']:\n+ data['videoid_next_episode'] = common.VideoId.from_dict(data['videoid_next_episode'])\nself._init_data = data\nself.active_player_id = None\n# WARNING KODI EVENTS SIDE EFFECTS!\n" }, { "change_type": "MODIFY", "old_path": "resources/lib/services/playback/action_manager.py", "new_path": "resources/lib/services/playback/action_manager.py", "diff": "@@ -22,6 +22,10 @@ class ActionManager(object):\ndef __init__(self):\nself._enabled = None\n+ self.videoid = None\n+ self.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@@ -48,6 +52,9 @@ class ActionManager(object):\n\"\"\"\nInitialize the manager with data when the addon initiates a playback.\n\"\"\"\n+ self.videoid = data['videoid']\n+ self.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_stream_continuity.py", "new_path": "resources/lib/services/playback/am_stream_continuity.py", "diff": "@@ -47,8 +47,6 @@ class AMStreamContinuity(ActionManager):\ndef __init__(self):\nsuper(AMStreamContinuity, self).__init__()\n- self.videoid = None\n- self.current_videoid = None\nself.current_streams = {}\nself.sc_settings = {}\nself.player = xbmc.Player()\n@@ -58,17 +56,15 @@ class AMStreamContinuity(ActionManager):\nself.kodi_only_forced_subtitles = None\ndef __str__(self):\n- return ('enabled={}, current_videoid={}'\n- .format(self.enabled, self.current_videoid))\n+ return ('enabled={}, videoid_parent={}'\n+ .format(self.enabled, self.videoid_parent))\ndef initialize(self, data):\n- self.videoid = common.VideoId.from_dict(data['videoid'])\nif self.videoid.mediatype not in [common.VideoId.MOVIE, common.VideoId.EPISODE]:\nself.enabled = False\nreturn\n- self.current_videoid = self.videoid.derive_parent(common.VideoId.SHOW)\nself.sc_settings = G.SHARED_DB.get_stream_continuity(G.LOCAL_DB.get_active_profile_guid(),\n- self.current_videoid.value, {})\n+ self.videoid_parent.value, {})\nself.kodi_only_forced_subtitles = common.get_kodi_subtitle_language() == 'forced_only'\ndef on_playback_started(self, player_state):\n@@ -171,7 +167,7 @@ class AMStreamContinuity(ActionManager):\nstored_stream)\nif index is None:\nLOG.debug('No stream match found for {} and {} for videoid {}',\n- stype, stored_stream, self.current_videoid)\n+ stype, stored_stream, self.videoid_parent)\nreturn\nvalue = index\nelse:\n@@ -185,7 +181,7 @@ class AMStreamContinuity(ActionManager):\nLOG.debug('Save changed stream {} for {}', stream, stype)\nself.sc_settings[stype] = stream\nG.SHARED_DB.set_stream_continuity(G.LOCAL_DB.get_active_profile_guid(),\n- self.current_videoid.value,\n+ self.videoid_parent.value,\nself.sc_settings)\ndef _find_stream_index(self, streams, stored_stream):\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": "@@ -36,12 +36,9 @@ class AMUpNextNotifier(ActionManager):\nreturn 'enabled={}'.format(self.enabled)\ndef initialize(self, data):\n- if not data['videoid_next_episode'] or not data['info_data']:\n+ if not self.videoid_next_episode or not data['info_data']:\nreturn\n- videoid = common.VideoId.from_dict(data['videoid'])\n- videoid_next_episode = common.VideoId.from_dict(data['videoid_next_episode'])\n- self.upnext_info = get_upnext_info(videoid, videoid_next_episode, data['info_data'], data['metadata'],\n- data['is_played_from_strm'])\n+ self.upnext_info = self._get_upnext_info(data['info_data'], data['metadata'], data['is_played_from_strm'])\ndef on_playback_started(self, player_state): # pylint: disable=unused-argument\nLOG.debug('Sending initialization signal to Up Next Add-on')\n@@ -50,23 +47,22 @@ class AMUpNextNotifier(ActionManager):\ndef on_tick(self, player_state):\npass\n-\n-def get_upnext_info(videoid, videoid_next_episode, info_data, metadata, is_played_from_strm):\n+ def _get_upnext_info(self, info_data, metadata, is_played_from_strm):\n\"\"\"Get the data to send to Up Next add-on\"\"\"\nupnext_info = {\n- 'current_episode': _upnext_info(videoid, *info_data[videoid.value]),\n- 'next_episode': _upnext_info(videoid_next_episode, *info_data[videoid_next_episode.value])\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}\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- videoid_next_episode.tvshowid,\n- videoid_next_episode.seasonid,\n- videoid_next_episode.episodeid)\n+ self.videoid_next_episode.tvshowid,\n+ self.videoid_next_episode.seasonid,\n+ self.videoid_next_episode.episodeid)\nurl = G.py2_decode(translatePath(file_path))\nelse:\n- url = common.build_url(videoid=videoid_next_episode,\n+ url = common.build_url(videoid=self.videoid_next_episode,\nmode=G.MODE_PLAY,\nparams={'profile_guid': G.LOCAL_DB.get_active_profile_guid()})\nupnext_info['play_url'] = url\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": "@@ -25,7 +25,6 @@ class AMVideoEvents(ActionManager):\ndef __init__(self):\nsuper(AMVideoEvents, self).__init__()\nself.event_data = {}\n- self.videoid = None\nself.is_event_start_sent = False\nself.last_tick_count = 0\nself.tick_elapsed = 0\n@@ -42,14 +41,12 @@ class AMVideoEvents(ActionManager):\nself.enabled = False\nreturn\nself.event_data = data['event_data']\n- self.videoid = common.VideoId.from_dict(data['videoid'])\ndef on_playback_started(self, player_state):\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\n- current_videoid = self.videoid.derive_parent(common.VideoId.SHOW)\nvideoid_exists, list_id = common.make_http_call('get_continuewatching_videoid_exists',\n- {'video_id': str(current_videoid.value)})\n+ {'video_id': str(self.videoid_parent.value)})\nif not videoid_exists:\n# Delete the cache of continueWatching list\nG.CACHE.delete(CACHE_COMMON, list_id, including_suffixes=True)\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
Convert videoid once and use the same variables
106,046
15.10.2020 20:22:55
-7,200
a24c548ecee761790096ce8593af764b22323acd
Fixed wrong time position when player seek
[ { "change_type": "MODIFY", "old_path": "resources/lib/services/playback/action_controller.py", "new_path": "resources/lib/services/playback/action_controller.py", "diff": "\"\"\"\nfrom __future__ import absolute_import, division, unicode_literals\n+import json\nimport time\nimport xbmc\n@@ -86,7 +87,7 @@ class ActionController(xbmc.Monitor):\nif method == 'Player.OnAVStart':\nself._on_playback_started()\nelif method == 'Player.OnSeek':\n- self._on_playback_seek()\n+ self._on_playback_seek(json.loads(data)['player']['seekoffset'])\nelif method == 'Player.OnPause':\nself._is_pause_called = True\nself._on_playback_pause()\n@@ -132,9 +133,9 @@ class ActionController(xbmc.Monitor):\ncommon.json_rpc('Input.ExecuteAction', {'action': 'codecinfo'})\nself.active_player_id = player_id\n- def _on_playback_seek(self):\n+ def _on_playback_seek(self, time_override):\nif self.tracking and self.active_player_id is not None:\n- player_state = self._get_player_state()\n+ player_state = self._get_player_state(time_override=time_override)\nif player_state:\nself._notify_all(ActionManager.call_on_playback_seek,\nplayer_state)\n@@ -167,7 +168,7 @@ class ActionController(xbmc.Monitor):\nfor manager in self.action_managers:\n_notify_managers(manager, notification, data)\n- def _get_player_state(self, player_id=None):\n+ def _get_player_state(self, player_id=None, time_override=None):\ntry:\nplayer_state = common.json_rpc('Player.GetProperties', {\n'playerid': self.active_player_id or player_id,\n@@ -186,11 +187,18 @@ class ActionController(xbmc.Monitor):\nreturn {}\n# convert time dict to elapsed seconds\n- player_state['elapsed_seconds'] = (\n- player_state['time']['hours'] * 3600 +\n+ player_state['elapsed_seconds'] = (player_state['time']['hours'] * 3600 +\nplayer_state['time']['minutes'] * 60 +\nplayer_state['time']['seconds'])\n+ if time_override:\n+ player_state['time'] = time_override\n+ elapsed_seconds = (time_override['hours'] * 3600 +\n+ time_override['minutes'] * 60 +\n+ time_override['seconds'])\n+ player_state['percentage'] = player_state['percentage'] / player_state['elapsed_seconds'] * elapsed_seconds\n+ player_state['elapsed_seconds'] = elapsed_seconds\n+\n# Sometimes may happen that when you stop playback the player status is partial,\n# this is because the Kodi player stop immediately but the stop notification (from the Monitor)\n# arrives late, meanwhile in this interval of time a service tick may occur.\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
Fixed wrong time position when player seek
106,046
16.10.2020 09:39:37
-7,200
a53add8c8e960597d1692e61acbf036b4b2d9247
Updated msl endpoints New changes on msl endpoints seems to cause no problems
[ { "change_type": "MODIFY", "old_path": "resources/lib/services/msl/msl_handler.py", "new_path": "resources/lib/services/msl/msl_handler.py", "diff": "@@ -281,7 +281,7 @@ class MSLHandler(object):\n# playback, and only the first time after a switch,\n# in the response you can also understand if the msl switch has worked\nLOG.debug('Requesting bind events')\n- response = self.msl_requests.chunked_request(ENDPOINTS['events'],\n+ response = self.msl_requests.chunked_request(ENDPOINTS['manifest'],\nself.msl_requests.build_request_data('/bind', {}),\nget_esn(),\ndisable_msl_switch=False)\n" }, { "change_type": "MODIFY", "old_path": "resources/lib/services/msl/msl_utils.py", "new_path": "resources/lib/services/msl/msl_utils.py", "diff": "@@ -29,12 +29,14 @@ except NameError: # Python 3\nunicode = str # pylint: disable=redefined-builtin\nCHROME_BASE_URL = 'https://www.netflix.com/nq/msl_v1/cadmium/'\n+# 16/10/2020 There is a new api endpoint to now used only for events/logblobs\n+CHROME_PLAYAPI_URL = 'https://www.netflix.com/msl/playapi/cadmium/'\nENDPOINTS = {\n'manifest': CHROME_BASE_URL + 'pbo_manifests/%5E1.0.0/router', # \"pbo_manifests/^1.0.0/router\"\n'license': CHROME_BASE_URL + 'pbo_licenses/%5E1.0.0/router',\n- 'events': CHROME_BASE_URL + 'pbo_events/%5E1.0.0/router',\n- 'logblobs': CHROME_BASE_URL + 'pbo_logblobs/%5E1.0.0/router'\n+ 'events': CHROME_PLAYAPI_URL + 'event/1',\n+ 'logblobs': CHROME_PLAYAPI_URL + 'logblob/1'\n}\nMSL_DATA_FILENAME = 'msl_data.json'\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
Updated msl endpoints New changes on msl endpoints seems to cause no problems
106,046
16.10.2020 11:22:13
-7,200
75293af2dff1c3fe5daf7c365e7a29c4472574af
Implemented clean library by directory
[ { "change_type": "MODIFY", "old_path": "resources/lib/common/kodi_library_ops.py", "new_path": "resources/lib/common/kodi_library_ops.py", "diff": "@@ -68,18 +68,27 @@ def get_library_item_details(dbtype, itemid):\nreturn json_rpc(method, params)[dbtype + 'details']\n-def scan_library(path=\"\"):\n- \"\"\"Start a Kodi library scanning in a specified folder to find new items\"\"\"\n+def scan_library(path=''):\n+ \"\"\"\n+ Start a Kodi library scanning in a specified folder to find new items\n+ :param path: Update only the library elements in the specified path (fast processing)\n+ \"\"\"\nmethod = 'VideoLibrary.Scan'\n- params = {'directory': path}\n+ params = {'directory': makeLegalFilename(translatePath(path))}\nreturn json_rpc(method, params)\n-def clean_library(show_dialog=True):\n- \"\"\"Start a Kodi library scanning to remove non-existing items\"\"\"\n+def clean_library(show_dialog=True, path=''):\n+ \"\"\"\n+ Start a Kodi library cleaning to remove non-existing items\n+ :param show_dialog: True a progress dialog is shown\n+ :param path: Clean only the library elements in the specified path (fast processing)\n+ \"\"\"\nmethod = 'VideoLibrary.Clean'\nparams = {'content': 'video',\n'showdialogs': show_dialog}\n+ if not G.KODI_VERSION.is_major_ver('18') and path:\n+ params['directory'] = makeLegalFilename(translatePath(path))\nreturn json_rpc(method, params)\n" }, { "change_type": "MODIFY", "old_path": "resources/lib/kodi/library.py", "new_path": "resources/lib/kodi/library.py", "diff": "@@ -169,7 +169,7 @@ class Library(LibraryTasks):\nsection_root_dir = common.join_folders_paths(get_library_path(), folder_name)\ncommon.delete_folder_contents(section_root_dir, delete_subfolders=True)\n# Clean the Kodi library database\n- common.clean_library(show_prg_dialog)\n+ common.clean_library(show_prg_dialog, get_library_path())\ndef auto_update_library(self, sync_with_mylist, show_prg_dialog=True, show_nfo_dialog=False, clear_on_cancel=False,\nupdate_profiles=False):\n" }, { "change_type": "MODIFY", "old_path": "resources/lib/services/library_updater.py", "new_path": "resources/lib/services/library_updater.py", "diff": "@@ -19,16 +19,6 @@ import resources.lib.common as common\nfrom resources.lib.kodi.library_utils import get_library_path\nfrom resources.lib.utils.logging import LOG\n-try: # Kodi >= 19\n- from xbmcvfs import makeLegalFilename # pylint: disable=ungrouped-imports\n-except ImportError: # Kodi 18\n- from xbmc import makeLegalFilename # pylint: disable=ungrouped-imports\n-\n-try: # Kodi >= 19\n- from xbmcvfs import translatePath # pylint: disable=ungrouped-imports\n-except ImportError: # Kodi 18\n- from xbmc import translatePath # pylint: disable=ungrouped-imports\n-\nclass LibraryUpdateService(xbmc.Monitor):\n\"\"\"\n@@ -146,9 +136,7 @@ class LibraryUpdateService(xbmc.Monitor):\nLOG.debug('Start Kodi library scan')\nself.scan_in_progress = True # Set as in progress (avoid wait \"started\" callback it comes late)\nself.scan_awaiting = False\n- # Update only the library elements in the add-on export folder\n- # for faster processing (on Kodi 18.x) with a large library\n- common.scan_library(makeLegalFilename(translatePath(get_library_path())))\n+ common.scan_library(get_library_path())\nelse:\nself.scan_awaiting = True\n@@ -157,7 +145,7 @@ class LibraryUpdateService(xbmc.Monitor):\nLOG.debug('Start Kodi library clean')\nself.clean_in_progress = True # Set as in progress (avoid wait \"started\" callback it comes late)\nself.clean_awaiting = False\n- common.clean_library(False)\n+ common.clean_library(False, get_library_path())\nelse:\nself.clean_awaiting = True\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
Implemented clean library by directory
106,046
18.10.2020 09:48:07
-7,200
09595cadc697cce3abcd6672d8a6bc2204588887
Ignore extrafanart invocations on each addon path E.g. Black Glass Nova skin use extrafanart, and call multiple times the addon at each path, mainly cause problem with the playback, but also makes multiple list loads
[ { "change_type": "MODIFY", "old_path": "resources/lib/run_addon.py", "new_path": "resources/lib/run_addon.py", "diff": "@@ -111,16 +111,19 @@ def lazy_login(func):\ndef route(pathitems):\n\"\"\"Route to the appropriate handler\"\"\"\nLOG.debug('Routing navigation request')\n- root_handler = pathitems[0] if pathitems else G.MODE_DIRECTORY\n+ if pathitems:\n+ if 'extrafanart' in pathitems:\n+ LOG.warn('Route: ignoring extrafanart invocation')\n+ return False\n+ root_handler = pathitems[0]\n+ else:\n+ root_handler = G.MODE_DIRECTORY\nif root_handler == G.MODE_PLAY:\nfrom resources.lib.navigation.player import play\nplay(videoid=pathitems[1:])\nelif root_handler == G.MODE_PLAY_STRM:\nfrom resources.lib.navigation.player import play_strm\nplay_strm(videoid=pathitems[1:])\n- elif root_handler == 'extrafanart':\n- LOG.warn('Route: ignoring extrafanart invocation')\n- return False\nelse:\nnav_handler = _get_nav_handler(root_handler, pathitems)\n_execute(nav_handler, pathitems[1:], G.REQUEST_PARAMS, root_handler)\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
Ignore extrafanart invocations on each addon path E.g. Black Glass Nova skin use extrafanart, and call multiple times the addon at each path, mainly cause problem with the playback, but also makes multiple list loads
106,046
19.10.2020 11:31:03
-7,200
135900ba7ce7d44ef846deb45e5f641bd025876c
Add class to read/write properties to kodi home window
[ { "change_type": "MODIFY", "old_path": "resources/lib/common/kodi_ops.py", "new_path": "resources/lib/common/kodi_ops.py", "diff": "@@ -117,12 +117,44 @@ def stop_playback():\ndef get_current_kodi_profile_name(no_spaces=True):\n\"\"\"Lazily gets the name of the Kodi profile currently used\"\"\"\n- # pylint: disable=global-statement\n- global __CURRENT_KODI_PROFILE_NAME__\n- if not __CURRENT_KODI_PROFILE_NAME__:\n+ if not hasattr(get_current_kodi_profile_name, 'cached'):\nname = json_rpc('Profiles.GetCurrentProfile', {'properties': ['thumbnail', 'lockmode']}).get('label', 'unknown')\n- __CURRENT_KODI_PROFILE_NAME__ = name.replace(' ', '_') if no_spaces else name\n- return __CURRENT_KODI_PROFILE_NAME__\n+ get_current_kodi_profile_name.cached = name.replace(' ', '_') if no_spaces else name\n+ return get_current_kodi_profile_name.cached\n+\n+\n+class _WndProps(object): # pylint: disable=no-init\n+ \"\"\"Read and write a property to the Kodi home window\"\"\"\n+ # Default Properties keys\n+ SERVICE_STATUS = 'service_status'\n+ \"\"\"Return current service status\"\"\"\n+ IS_CONTAINER_REFRESHED = 'is_container_refreshed'\n+ \"\"\"Return 'True' when container_refresh in kodi_ops.py is used by context menus, etc.\"\"\"\n+ CURRENT_DIRECTORY = 'current_directory'\n+ \"\"\"\n+ Return 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+ ['root'] When add-on startup page is re-loaded (like refresh) or manually called\n+ Notice: In some cases the value may not be consistent example:\n+ - when you exit to Kodi home\n+ - external calls to the add-on while browsing the add-on\n+ \"\"\"\n+ def __getitem__(self, key):\n+ try:\n+ # If you use multiple Kodi profiles you need to distinguish the property of current profile\n+ return G.WND_KODI_HOME.getProperty(G.py2_encode('netflix_{}_{}'.format(get_current_kodi_profile_name(),\n+ key)))\n+ except Exception: # pylint: disable=broad-except\n+ return ''\n+\n+ def __setitem__(self, key, newvalue):\n+ # If you use multiple Kodi profiles you need to distinguish the property of current profile\n+ G.WND_KODI_HOME.setProperty(G.py2_encode('netflix_{}_{}'.format(get_current_kodi_profile_name(),\n+ key)),\n+ newvalue)\n+\n+\n+WndHomeProps = _WndProps()\ndef get_kodi_audio_language(iso_format=xbmc.ISO_639_1, use_fallback=True):\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
Add class to read/write properties to kodi home window
106,046
19.10.2020 10:52:58
-7,200
d94c06f5647a3c53c04aff8dcca5ed01c712f3f3
Use WndHomeProps to service status
[ { "change_type": "MODIFY", "old_path": "resources/lib/globals.py", "new_path": "resources/lib/globals.py", "diff": "@@ -26,6 +26,7 @@ except ImportError: # Python 2\nfrom future.utils import iteritems\nimport xbmcaddon\n+from xbmcgui import Window\ntry: # Kodi >= 19\nfrom xbmcvfs import translatePath # pylint: disable=ungrouped-imports\n@@ -213,6 +214,7 @@ class GlobalVariables(object):\n# on subsequent add-on invocations (invoked by reuseLanguageInvoker) will have no effect.\n# Define here also any other variables necessary for the correct loading of the other project modules\nself.PY_IS_VER2 = sys.version_info.major == 2\n+ self.WND_KODI_HOME = Window(10000) # Kodi home window\nself.IS_ADDON_FIRSTRUN = None\nself.ADDON = None\nself.ADDON_DATA_PATH = None\n" }, { "change_type": "MODIFY", "old_path": "resources/lib/run_addon.py", "new_path": "resources/lib/run_addon.py", "diff": "@@ -12,12 +12,11 @@ from functools import wraps\nfrom future.utils import raise_from\nfrom xbmc import getCondVisibility, Monitor, getInfoLabel\n-from xbmcgui import Window\nfrom resources.lib.common.exceptions import (HttpError401, InputStreamHelperError, MbrStatusNeverMemberError,\nMbrStatusFormerMemberError, MissingCredentialsError, LoginError,\nNotLoggedInError, InvalidPathError, BackendNotReady)\n-from resources.lib.common import check_credentials, get_current_kodi_profile_name, get_local_string\n+from 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\nfrom resources.lib.utils.logging import LOG\n@@ -163,16 +162,16 @@ def _execute(executor_type, pathitems, params, root_handler):\nraise_from(InvalidPathError('Unknown action {}'.format('/'.join(pathitems))), exc)\n-def _get_service_status(window_cls, prop_nf_service_status):\n+def _get_service_status():\nfrom json import loads\ntry:\n- status = window_cls.getProperty(prop_nf_service_status)\n+ status = WndHomeProps[WndHomeProps.SERVICE_STATUS]\nreturn loads(status) if status else {}\nexcept Exception: # pylint: disable=broad-except\nreturn {}\n-def _check_addon_external_call(window_cls, prop_nf_service_status):\n+def _check_addon_external_call():\n\"\"\"Check system to verify if the calls to the add-on are originated externally\"\"\"\n# The calls that are made from outside do not respect and do not check whether the services required\n# for the add-on are actually working and operational, causing problems with the execution of the frontend.\n@@ -222,12 +221,8 @@ def run(argv):\nLOG.info('URL is {}'.format(G.URL))\nsuccess = True\n- window_cls = Window(10000) # Kodi home window\n-\n- # If you use multiple Kodi profiles you need to distinguish the property of current profile\n- prop_nf_service_status = G.py2_encode('nf_service_status_' + get_current_kodi_profile_name())\n- is_external_call = _check_addon_external_call(window_cls, prop_nf_service_status)\n- service_status = _get_service_status(window_cls, prop_nf_service_status)\n+ is_external_call = _check_addon_external_call()\n+ service_status = _get_service_status()\nif service_status.get('status') != 'running':\nif not is_external_call:\n" }, { "change_type": "MODIFY", "old_path": "resources/lib/run_service.py", "new_path": "resources/lib/run_service.py", "diff": "@@ -11,11 +11,9 @@ from __future__ import absolute_import, division, unicode_literals\nimport threading\nfrom socket import gaierror\n-from xbmcgui import Window\n-\n# Global cache must not be used within these modules, because stale values may\n# be used and cause inconsistencies!\n-from resources.lib.common import select_port, get_local_string, get_current_kodi_profile_name\n+from resources.lib.common import select_port, get_local_string, WndHomeProps\nfrom resources.lib.globals import G\nfrom resources.lib.upgrade_controller import check_service_upgrade\nfrom resources.lib.utils.logging import LOG\n@@ -34,9 +32,6 @@ class NetflixService(object):\nHOST_ADDRESS = '127.0.0.1'\ndef __init__(self):\n- self.window_cls = Window(10000) # Kodi home window\n- # If you use multiple Kodi profiles you need to distinguish the property of current profile\n- self.prop_nf_service_status = G.py2_encode('nf_service_status_' + get_current_kodi_profile_name())\nself.controller = None\nself.library_updater = None\nself.settings_monitor = None\n@@ -162,7 +157,7 @@ class NetflixService(object):\n\"\"\"Save the service status to a Kodi property\"\"\"\nfrom json import dumps\nstatus = {'status': status, 'message': message}\n- self.window_cls.setProperty(self.prop_nf_service_status, dumps(status))\n+ WndHomeProps[WndHomeProps.SERVICE_STATUS] = dumps(status)\ndef run(argv):\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
Use WndHomeProps to service status
106,046
19.10.2020 10:53:41
-7,200
c52441ce6b1bc68067eed69d0a25f7f8a3a2f076
Changes to directory behaviours and profile switch activation
[ { "change_type": "MODIFY", "old_path": "resources/lib/common/kodi_ops.py", "new_path": "resources/lib/common/kodi_ops.py", "diff": "@@ -71,7 +71,7 @@ def container_refresh(use_delay=False):\n# seems to be caused by a race condition with the Kodi library update (but i am not really sure)\nfrom time import sleep\nsleep(1)\n- G.IS_CONTAINER_REFRESHED = True\n+ WndHomeProps[WndHomeProps.IS_CONTAINER_REFRESHED] = 'True'\nxbmc.executebuiltin('Container.Refresh')\n" }, { "change_type": "MODIFY", "old_path": "resources/lib/globals.py", "new_path": "resources/lib/globals.py", "diff": "@@ -224,11 +224,6 @@ class GlobalVariables(object):\nself.CACHE_TTL = None\nself.CACHE_MYLIST_TTL = None\nself.CACHE_METADATA_TTL = None\n- self.IS_CONTAINER_REFRESHED = False # True when container_refresh in kodi_ops.py is used by context menus, etc.\n- # The currently loaded directory page (method name of directory.py):\n- # None value means in the real addon startup page, so first run instance\n- # 'root' value always means addon startup page, but in this case is called by a Container refresh or manually\n- self.CURRENT_LOADED_DIRECTORY = None\ndef init_globals(self, argv, reinitialize_database=False, reload_settings=False):\n\"\"\"Initialized globally used module variables. Needs to be called at start of each plugin instance!\"\"\"\n" }, { "change_type": "MODIFY", "old_path": "resources/lib/navigation/directory.py", "new_path": "resources/lib/navigation/directory.py", "diff": "@@ -56,13 +56,16 @@ class Directory(object):\ndef root(self, pathitems=None): # pylint: disable=unused-argument\n\"\"\"Show profiles or home listing when profile auto-selection is enabled\"\"\"\n# Fetch initial page to refresh all session data\n- if G.CURRENT_LOADED_DIRECTORY is None:\n+ current_directory = common.WndHomeProps[common.WndHomeProps.CURRENT_DIRECTORY]\n+ if not current_directory:\n# Note when the profiles are updated to the database (by fetch_initial_page call),\n# the update sanitize also relative settings to profiles (see _delete_non_existing_profiles in website.py)\ncommon.make_call('fetch_initial_page')\n+ # When the add-on is used in a browser window, we do not have to execute the auto profile selection\n+ if not G.IS_ADDON_EXTERNAL_CALL:\nautoselect_profile_guid = G.LOCAL_DB.get_value('autoselect_profile_guid', '')\n- if autoselect_profile_guid and not G.IS_CONTAINER_REFRESHED:\n- if G.CURRENT_LOADED_DIRECTORY is None:\n+ if autoselect_profile_guid and not common.WndHomeProps[common.WndHomeProps.IS_CONTAINER_REFRESHED]:\n+ if not current_directory:\nLOG.info('Performing auto-selection of profile {}', autoselect_profile_guid)\nself.params['switch_profile_guid'] = autoselect_profile_guid\nself.home(None)\n@@ -87,8 +90,14 @@ class Directory(object):\n@custom_viewmode(G.VIEW_MAINMENU)\ndef home(self, pathitems=None): # pylint: disable=unused-argument\n\"\"\"Show home listing\"\"\"\n- if 'switch_profile_guid' in self.params and G.CURRENT_LOADED_DIRECTORY in [None, 'root', 'profiles']:\n- if not activate_profile(self.params['switch_profile_guid']):\n+ if 'switch_profile_guid' in self.params:\n+ if G.IS_ADDON_EXTERNAL_CALL:\n+ # Profile switch/ask PIN only once\n+ ret = not self.params['switch_profile_guid'] == G.LOCAL_DB.get_active_profile_guid()\n+ else:\n+ # Profile switch/ask PIN every time you come from ...\n+ ret = common.WndHomeProps[common.WndHomeProps.CURRENT_DIRECTORY] in ['', 'root', 'profiles']\n+ if ret and not activate_profile(self.params['switch_profile_guid']):\nxbmcplugin.endOfDirectory(G.PLUGIN_HANDLE, succeeded=False)\nreturn\nLOG.debug('Showing home listing')\n" }, { "change_type": "MODIFY", "old_path": "resources/lib/run_addon.py", "new_path": "resources/lib/run_addon.py", "diff": "@@ -154,10 +154,10 @@ def _execute(executor_type, pathitems, params, root_handler):\nexecutor = executor_type(params).__getattribute__(pathitems[0] if pathitems else 'root')\nLOG.debug('Invoking action: {}', executor.__name__)\nexecutor(pathitems=pathitems)\n- if root_handler == G.MODE_DIRECTORY:\n+ if root_handler == G.MODE_DIRECTORY and not G.IS_ADDON_EXTERNAL_CALL:\n# Save the method name of current loaded directory\n- G.CURRENT_LOADED_DIRECTORY = executor.__name__\n- G.IS_CONTAINER_REFRESHED = False\n+ WndHomeProps[WndHomeProps.CURRENT_DIRECTORY] = executor.__name__\n+ WndHomeProps[WndHomeProps.IS_CONTAINER_REFRESHED] = None\nexcept AttributeError as exc:\nraise_from(InvalidPathError('Unknown action {}'.format('/'.join(pathitems))), exc)\n@@ -200,7 +200,7 @@ def _check_addon_external_call():\nif is_other_plugin_name or not getCondVisibility(\"Window.IsMedia\"):\nmonitor = Monitor()\nsec_elapsed = 0\n- while not _get_service_status(window_cls, prop_nf_service_status).get('status') == 'running':\n+ while not _get_service_status().get('status') == 'running':\nif sec_elapsed >= limit_sec or monitor.abortRequested() or monitor.waitForAbort(0.5):\nbreak\nsec_elapsed += 0.5\n" }, { "change_type": "MODIFY", "old_path": "resources/lib/run_service.py", "new_path": "resources/lib/run_service.py", "diff": "@@ -105,6 +105,8 @@ class NetflixService(object):\nself.controller = ActionController()\nself.library_updater = LibraryUpdateService()\nself.settings_monitor = SettingsMonitor()\n+ # We reset the value in case of any eventuality (add-on disabled, update, etc)\n+ WndHomeProps[WndHomeProps.CURRENT_DIRECTORY] = None\n# Mark the service as active\nself._set_service_status('running')\nif not G.ADDON.getSettingBool('disable_startup_notification'):\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
Changes to directory behaviours and profile switch activation
106,046
19.10.2020 16:22:20
-7,200
53c6ae3ddcbc6a4e28834e02fac26d7ac54d6646
Fixed error when no subtitles (on kodi 19) currentsubtitle can be "None" but also an empty dict
[ { "change_type": "MODIFY", "old_path": "resources/lib/services/playback/am_stream_continuity.py", "new_path": "resources/lib/services/playback/am_stream_continuity.py", "diff": "@@ -279,7 +279,7 @@ class AMStreamContinuity(ActionManager):\naudio_language = audio_track['language']\nbreak\nplayer_stream = self.player_state.get(STREAMS['subtitle']['current'])\n- if player_stream is None:\n+ if not player_stream:\nreturn\nif audio_language == 'original':\n# Do nothing\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
Fixed error when no subtitles (on kodi 19) currentsubtitle can be "None" but also an empty dict
106,046
20.10.2020 10:15:10
-7,200
9b39e8009fddfa37cc4e9022b1ece4c3bdcfa7e0
Print debug metadata as json
[ { "change_type": "MODIFY", "old_path": "resources/lib/navigation/player.py", "new_path": "resources/lib/navigation/player.py", "diff": "\"\"\"\nfrom __future__ import absolute_import, division, unicode_literals\n+import json\n+\nfrom future.utils import raise_from\nimport xbmcgui\n@@ -76,7 +78,7 @@ def _play(videoid, is_played_from_strm=False):\n# Get metadata of videoid\ntry:\nmetadata = api.get_metadata(videoid)\n- LOG.debug('Metadata is {}', metadata)\n+ LOG.debug('Metadata is {}', json.dumps(metadata))\nexcept MetadataNotAvailable:\nLOG.warn('Metadata not available for {}', videoid)\nmetadata = [{}, {}]\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
Print debug metadata as json
106,046
20.10.2020 10:26:36
-7,200
49c12a596118ea19930036d5429eb3062f96a042
Slight speeding up the loading of video list
[ { "change_type": "MODIFY", "old_path": "resources/lib/kodi/infolabels.py", "new_path": "resources/lib/kodi/infolabels.py", "diff": "@@ -308,14 +308,11 @@ def set_watched_status(dict_item, video_data, common_data):\n\"\"\"Check and set progress status (watched and resume)\"\"\"\nif not common_data['set_watched_status'] or dict_item['is_folder']:\nreturn\n-\nvideo_id = str(video_data['summary']['id'])\n# Check from db if user has manually changed the watched status\n- profile_guid = G.LOCAL_DB.get_active_profile_guid()\n- override_is_watched = G.SHARED_DB.get_watched_status(profile_guid, video_id, None, bool)\n+ is_watched_user_overrided = G.SHARED_DB.get_watched_status(common_data['active_profile_guid'], video_id, None, bool)\nresume_time = 0\n-\n- if override_is_watched is None:\n+ if is_watched_user_overrided is None:\n# NOTE shakti 'watched' tag value:\n# in my tests playing a video (via web browser) until to the end this value is not changed to True\n# seem not respect really if a video is watched to the end or this tag have other purposes\n@@ -333,12 +330,11 @@ def set_watched_status(dict_item, video_data, common_data):\nexcept CacheMiss:\n# NOTE shakti 'bookmarkPosition' tag when it is not set have -1 value\nbookmark_position = video_data['bookmarkPosition']\n-\nplaycount = '1' if bookmark_position >= watched_threshold else '0'\nif playcount == '0' and bookmark_position > 0:\nresume_time = bookmark_position\nelse:\n- playcount = '1' if override_is_watched else '0'\n+ playcount = '1' if is_watched_user_overrided else '0'\n# We have to set playcount with setInfo(), because the setProperty('PlayCount', ) have a bug\n# when a item is already watched and you force to set again watched, the override do not work\ndict_item['info']['PlayCount'] = playcount\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": "@@ -168,7 +168,8 @@ def build_episode_listing(episodes_list, seasonid, pathitems=None):\n'params': get_param_watched_status_by_profile(),\n'set_watched_status': G.ADDON.getSettingBool('ProgressManager_enabled'),\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+ 'profile_language_code': G.LOCAL_DB.get_profile_config('language', ''),\n+ 'active_profile_guid': G.LOCAL_DB.get_active_profile_guid()\n}\ndirectory_items = [_create_episode_item(seasonid, episodeid_value, episode, episodes_list, common_data)\nfor episodeid_value, episode\n@@ -274,7 +275,8 @@ def build_video_listing(video_list, menu_data, sub_genre_id=None, pathitems=None\nif menu_data['path'][1] != 'myList'\nelse None),\n'profile_language_code': G.LOCAL_DB.get_profile_config('language', ''),\n- 'ctxmenu_remove_watched_status': menu_data['path'][1] == 'continueWatching'\n+ 'ctxmenu_remove_watched_status': menu_data['path'][1] == 'continueWatching',\n+ 'active_profile_guid': G.LOCAL_DB.get_active_profile_guid()\n}\ndirectory_items = [_create_video_item(videoid_value, video, video_list, perpetual_range_start, common_data)\nfor videoid_value, video\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
Slight speeding up the loading of video list
106,046
20.10.2020 18:07:19
-7,200
f6b2c9a3dc73c23e2d35821550592922e23fb414
Update resume time also on stop event Let's give you a chance to update the list with the correct value, although it may fail with low-end devices
[ { "change_type": "MODIFY", "old_path": "resources/lib/services/playback/am_video_events.py", "new_path": "resources/lib/services/playback/am_video_events.py", "diff": "@@ -112,6 +112,8 @@ 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+ self._save_resume_time(player_state['elapsed_seconds'])\ndef _save_resume_time(self, resume_time):\n\"\"\"Save resume time value in order to update the infolabel cache\"\"\"\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
Update resume time also on stop event Let's give you a chance to update the list with the correct value, although it may fail with low-end devices
106,046
20.10.2020 18:10:46
-7,200
bc676ae402499833cd63562b0c7f66f9ba549464
Improved watched status when nf sync is enabled
[ { "change_type": "MODIFY", "old_path": "resources/lib/kodi/infolabels.py", "new_path": "resources/lib/kodi/infolabels.py", "diff": "@@ -313,16 +313,21 @@ def set_watched_status(dict_item, video_data, common_data):\nis_watched_user_overrided = G.SHARED_DB.get_watched_status(common_data['active_profile_guid'], video_id, None, bool)\nresume_time = 0\nif is_watched_user_overrided is None:\n- # NOTE shakti 'watched' tag value:\n- # in my tests playing a video (via web browser) until to the end this value is not changed to True\n- # seem not respect really if a video is watched to the end or this tag have other purposes\n- # to now, the only way to know if a video is watched is compare the bookmarkPosition with creditsOffset value\n-\n- # NOTE shakti 'creditsOffset' tag not exists on video type 'movie',\n- # then simulate the default Kodi playcount behaviour (playcountminimumpercent)\n- watched_threshold = min(video_data['runtime'] / 100 * 90,\n- video_data.get('creditsOffset', video_data['runtime']))\n-\n+ # Note to shakti properties:\n+ # 'watched': unlike the name this value is used to other purposes, so not to set a video as watched\n+ # 'watchedToEndOffset': this value is used to determine if a video is watched but\n+ # is available only with the metadata api and only for \"episode\" video type\n+ # 'creditsOffset' : this value is used as position where to show the (play) \"Next\" (episode) button\n+ # on the website, but it may not be always available with the \"movie\" video type\n+ if 'creditsOffset' in video_data:\n+ # To better ensure that a video is marked as watched also when a user do not reach the ending credits\n+ # we generally lower the watched threshold by 50 seconds for 50 minutes of video (3000 secs)\n+ lower_value = video_data['runtime'] / 3000 * 50\n+ watched_threshold = video_data['creditsOffset'] - lower_value\n+ else:\n+ # When missing the value should be only a video of movie type,\n+ # then we simulate the default Kodi playcount behaviour (playcountminimumpercent)\n+ watched_threshold = video_data['runtime'] / 100 * 90\n# To avoid asking to the server again the entire list of titles (after watched a video)\n# to get the updated value, we override the value with the value saved in memory (see am_video_events.py)\ntry:\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
Improved watched status when nf sync is enabled
106,046
20.10.2020 18:16:14
-7,200
2290c0a7912de81618b094329b7926ff8c047c8d
Ensuring that videos are set as watched Except when netflix sync is enabled
[ { "change_type": "MODIFY", "old_path": "resources/lib/services/playback/am_playback.py", "new_path": "resources/lib/services/playback/am_playback.py", "diff": "@@ -14,9 +14,15 @@ import time\nimport xbmc\nimport resources.lib.common as common\n+from resources.lib.globals import G\nfrom resources.lib.utils.logging import LOG\nfrom .action_manager import ActionManager\n+try: # Kodi >= 19\n+ from xbmcvfs import translatePath # pylint: disable=ungrouped-imports\n+except ImportError: # Kodi 18\n+ from xbmc import translatePath # pylint: disable=ungrouped-imports\n+\nclass AMPlayback(ActionManager):\n\"\"\"Operations for changing the playback status\"\"\"\n@@ -29,16 +35,27 @@ class AMPlayback(ActionManager):\nself.enabled = True\nself.start_time = None\nself.is_player_in_pause = False\n+ self.is_played_from_strm = False\n+ self.watched_threshold = None\ndef __str__(self):\nreturn 'enabled={}'.format(self.enabled)\ndef initialize(self, data):\n- # Due to a bug on Kodi the resume on SRTM files not works correctly, so we force the skip to the resume point\nself.resume_position = data.get('resume_position')\n+ self.is_played_from_strm = data['is_played_from_strm']\n+ if 'watchedToEndOffset' in data['metadata'][0]:\n+ self.watched_threshold = data['metadata'][0]['watchedToEndOffset']\n+ elif 'creditsOffset' in data['metadata'][0]:\n+ # To better ensure that a video is marked as watched also when a user do not reach the ending credits\n+ # we generally lower the watched threshold by 50 seconds for 50 minutes of video (3000 secs)\n+ lower_value = data['metadata'][0]['runtime'] / 3000 * 50\n+ self.watched_threshold = data['metadata'][0]['creditsOffset'] - lower_value\ndef on_playback_started(self, player_state):\nif self.resume_position:\n+ # Due to a bug on Kodi the resume on STRM files not works correctly,\n+ # so we force the skip to the resume point\nLOG.info('AMPlayback has forced resume point to {}', self.resume_position)\nxbmc.Player().seekTime(int(self.resume_position))\n@@ -57,3 +74,42 @@ class AMPlayback(ActionManager):\ndef on_playback_resume(self, player_state):\nself.is_player_in_pause = False\n+\n+ def on_playback_stopped(self, player_state):\n+ # It could happen that Kodi does not assign as watched a video,\n+ # this because the credits can take too much time, then the point where playback is stopped\n+ # falls in the part that kodi recognizes as unwatched (playcountminimumpercent 90% + no-mans land 2%)\n+ # https://kodi.wiki/view/HOW-TO:Modify_automatic_watch_and_resume_points#Settings_explained\n+ # In these cases we try change/fix manually the watched status of the video by using netflix offset data\n+ if int(player_state['percentage']) > 92:\n+ return\n+ if not self.watched_threshold or not player_state['elapsed_seconds'] > self.watched_threshold:\n+ return\n+ if G.ADDON.getSettingBool('ProgressManager_enabled') 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\n+ return\n+ if self.is_played_from_strm:\n+ # The current video played is a STRM, then generate the path of a STRM file\n+ file_path = G.SHARED_DB.get_episode_filepath(\n+ self.videoid.tvshowid,\n+ self.videoid.seasonid,\n+ self.videoid.episodeid)\n+ url = G.py2_decode(translatePath(file_path))\n+ if G.KODI_VERSION.is_major_ver('18'):\n+ common.json_rpc('Files.SetFileDetails',\n+ {\"file\": url, \"media\": \"video\", \"resume\": {\"position\": 0, \"total\": 0}, \"playcount\": 1})\n+ # After apply the change Kodi 18 not update the library directory item\n+ common.container_refresh()\n+ else:\n+ common.json_rpc('Files.SetFileDetails',\n+ {\"file\": url, \"media\": \"video\", \"resume\": None, \"playcount\": 1})\n+ else:\n+ if G.KODI_VERSION.is_major_ver('18'):\n+ # \"Files.SetFileDetails\" on Kodi 18 not support \"plugin://\" path\n+ return\n+ url = common.build_url(videoid=self.videoid,\n+ mode=G.MODE_PLAY,\n+ params={'profile_guid': G.LOCAL_DB.get_active_profile_guid()})\n+ common.json_rpc('Files.SetFileDetails',\n+ {\"file\": url, \"media\": \"video\", \"resume\": None, \"playcount\": 1})\n+ LOG.info('Has been fixed the watched status of the video: {}', url)\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
Ensuring that videos are set as watched Except when netflix sync is enabled
106,046
24.10.2020 09:39:32
-7,200
649f7efb3f70819c7818d3cb37cd36048322401c
Version bump (1.10.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.10.0\" provider-name=\"libdev + jojo + asciidisco + caphm + castagnait\">\n+<addon id=\"plugin.video.netflix\" name=\"Netflix\" version=\"1.10.1\" provider-name=\"libdev + jojo + asciidisco + caphm + castagnait\">\n<requires>\n<import addon=\"xbmc.python\" version=\"2.26.0\"/>\n<import addon=\"script.module.addon.signals\" version=\"0.0.3\"/>\n<forum>https://forum.kodi.tv/showthread.php?tid=329767</forum>\n<source>https://github.com/CastagnaIT/plugin.video.netflix</source>\n<news>\n-v1.10.0 (2020-10-02)\n-- Add initial support to keymapping (details to Wiki)\n-- Fixed regression causing PIN request each time the main menu is loaded\n-- Fixed an issue that caused build_media_tag exception while watching video\n-- Fixed an issue that caused build_media_tag exception while watching a non-netflix content\n-- Improvements to english language and related translations\n+v1.10.1 (2020-10-24)\n+- Improved watched status, now videos will be marked as watched correctly (Kodi 19 all cases/Kodi 18 library only)\n+- Improved loading video lists speed on slow hdd/sdcard\n+- Updated some MSL endpoints\n+- Implemented clean library by directory (Kodi 19)\n+- Fixed problems with skins that cause add-on problems due to extrafanart\n+- Fixed broken profile switch when profile autoselection was enabled\n+- Fixed wrong time position sent to netflix server when player seek\n+- Fixed notification error when playback a video with no subtitles (Kodi 19)\n+- Add Galicial translation\n</news>\n</extension>\n</addon>\n" }, { "change_type": "MODIFY", "old_path": "changelog.txt", "new_path": "changelog.txt", "diff": "+v1.10.1 (2020-10-24)\n+- Improved watched status, now videos will be marked as watched correctly (Kodi 19 all cases/Kodi 18 library only)\n+- Improved loading video lists speed on slow hdd/sdcard\n+- Updated some MSL endpoints\n+- Implemented clean library by directory (Kodi 19)\n+- Fixed problems with skins that cause add-on problems due to extrafanart\n+- Fixed broken profile switch when profile autoselection was enabled\n+- Fixed wrong time position sent to netflix server when player seek\n+- Fixed notification error when playback a video with no subtitles (Kodi 19)\n+- Add Galicial translation\n+\nv1.10.0 (2020-10-02)\n- Add initial support to keymapping (details to Wiki)\n- Fixed regression causing PIN request each time the main menu is loaded\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
Version bump (1.10.1) (#904)
106,046
24.10.2020 17:50:53
-7,200
7bf6796c542045564828c6c384eaf0a0e9bc8954
Add check for availability
[ { "change_type": "MODIFY", "old_path": "resources/lib/kodi/infolabels.py", "new_path": "resources/lib/kodi/infolabels.py", "diff": "@@ -85,6 +85,8 @@ def add_info_dict_item(dict_item, videoid, item, raw_data, is_in_mylist, common_\ndef _add_supplemental_plot_info(infos_copy, item, common_data):\n\"\"\"Add supplemental info to plot description\"\"\"\nsuppl_info = []\n+ if item.get('summary', {}).get('availabilityDateMessaging'):\n+ suppl_info.append(item['summary']['availabilityDateMessaging'])\nif item.get('dpSupplementalMessage'):\n# Short information about future release of tv show season or other\nsuppl_info.append(item['dpSupplementalMessage'])\n" }, { "change_type": "MODIFY", "old_path": "resources/lib/navigation/actions.py", "new_path": "resources/lib/navigation/actions.py", "diff": "@@ -234,6 +234,10 @@ class AddonActionExecutor(object):\npass\ncommon.container_refresh()\n+ def show_availability_message(self, pathitems=None): # pylint: disable=unused-argument\n+ \"\"\"Show a message to the user to show the date of availability of a video\"\"\"\n+ ui.show_ok_dialog(xbmc.getInfoLabel('ListItem.Label'),\n+ xbmc.getInfoLabel('ListItem.Property(nf_availability_message)'))\ndef sync_library(videoid, operation):\nif operation and G.ADDON.getSettingBool('lib_sync_mylist') and G.ADDON.getSettingInt('lib_auto_upd_mode') == 2:\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": "@@ -17,7 +17,8 @@ from resources.lib.globals import G\nfrom resources.lib.kodi.context_menu import generate_context_menu_items, generate_context_menu_profile\nfrom resources.lib.kodi.infolabels import get_color_name, add_info_dict_item, set_watched_status\nfrom resources.lib.services.nfsession.directorybuilder.dir_builder_utils import (get_param_watched_status_by_profile,\n- add_items_previous_next_page)\n+ add_items_previous_next_page,\n+ get_availability_message)\nfrom resources.lib.utils.logging import measure_exec_time_decorator\ntry: # Python 2\n@@ -181,16 +182,22 @@ def build_episode_listing(episodes_list, seasonid, pathitems=None):\ndef _create_episode_item(seasonid, episodeid_value, episode, episodes_list, common_data):\n+ is_playable = episode['summary']['isPlayable']\nepisodeid = seasonid.derive_episode(episodeid_value)\ndict_item = {'video_id': episodeid_value,\n- 'media_type': episodeid.mediatype,\n+ 'media_type': episodeid.mediatype if is_playable else None,\n'label': episode['title'],\n'is_folder': False,\n'properties': {'nf_videoid': episodeid.to_string()}}\nadd_info_dict_item(dict_item, episodeid, episode, episodes_list.data, False, common_data)\nset_watched_status(dict_item, episode, common_data)\n+ if is_playable:\ndict_item['url'] = common.build_url(videoid=episodeid, mode=G.MODE_PLAY, params=common_data['params'])\ndict_item['menu_items'] = generate_context_menu_items(episodeid, False, None)\n+ else:\n+ # The video is not playable, try check if there is a date\n+ dict_item['properties']['nf_availability_message'] = get_availability_message(episode)\n+ dict_item['url'] = common.build_url(['show_availability_message'], mode=G.MODE_ACTION)\nreturn dict_item\n@@ -309,11 +316,12 @@ 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):\n+ is_playable = video['availability']['isPlayable']\nvideoid = common.VideoId.from_videolist_item(video)\nis_folder = videoid.mediatype == common.VideoId.SHOW\nis_in_mylist = videoid in common_data['mylist_items']\ndict_item = {'video_id': videoid_value,\n- 'media_type': videoid.mediatype,\n+ 'media_type': videoid.mediatype if is_playable else None,\n'label': video['title'],\n'is_folder': is_folder,\n'properties': {'nf_videoid': videoid.to_string(),\n@@ -321,11 +329,16 @@ def _create_video_item(videoid_value, video, video_list, perpetual_range_start,\n'nf_perpetual_range_start': perpetual_range_start}}\nadd_info_dict_item(dict_item, videoid, video, video_list.data, is_in_mylist, common_data)\nset_watched_status(dict_item, video, common_data)\n+ if is_playable:\ndict_item['url'] = common.build_url(videoid=videoid,\nmode=G.MODE_DIRECTORY if is_folder else G.MODE_PLAY,\nparams=None if is_folder else common_data['params'])\ndict_item['menu_items'] = generate_context_menu_items(videoid, is_in_mylist, perpetual_range_start,\ncommon_data['ctxmenu_remove_watched_status'])\n+ else:\n+ # The video is not playable, try check if there is a date\n+ dict_item['properties']['nf_availability_message'] = get_availability_message(video)\n+ dict_item['url'] = common.build_url(['show_availability_message'], mode=G.MODE_ACTION)\nreturn dict_item\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": "@@ -56,3 +56,9 @@ def get_param_watched_status_by_profile():\n:return: a dictionary to be add to 'build_url' params\n\"\"\"\nreturn {'profile_guid': G.LOCAL_DB.get_active_profile_guid()}\n+\n+\n+def get_availability_message(video_data):\n+ return (video_data.get('summary', {}).get('availabilityDateMessaging') or\n+ video_data.get('availability', {}).get('availabilityDate') or\n+ common.get_local_string(10005)) # \"Not available\"\n" }, { "change_type": "MODIFY", "old_path": "resources/lib/utils/api_paths.py", "new_path": "resources/lib/utils/api_paths.py", "diff": "@@ -77,7 +77,7 @@ SEASONS_PARTIAL_PATHS = [\nEPISODES_PARTIAL_PATHS = [\n[['requestId', 'summary', 'synopsis', 'title', 'runtime', 'releaseYear', 'queue',\n'info', 'maturity', 'userRating', 'bookmarkPosition', 'creditsOffset',\n- 'watched', 'delivery', 'trackIds']],\n+ 'watched', 'delivery', 'trackIds', 'availability']],\n[['genres', 'tags', 'creators', 'directors', 'cast'],\n{'from': 0, 'to': 10}, ['id', 'name']]\n] + ART_PARTIAL_PATHS\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
Add check for availability
106,046
27.10.2020 15:08:44
-3,600
d9c371ef2844c0b11b4dffbe2220687394773cc3
Add support to MacOS NFAuthenticationKey
[ { "change_type": "MODIFY", "old_path": "resources/lib/common/credentials.py", "new_path": "resources/lib/common/credentials.py", "diff": "@@ -213,4 +213,14 @@ def _prepare_authentication_key_data(data):\ncontinue\nresult_data['cookies'].append(convert_chrome_cookie(cookie))\nreturn result_data\n+ if (data['app_name'] == 'NFAuthenticationKey' and\n+ data['app_system'] == 'MacOS' and\n+ # data['app_version'] == '1.0.0' and\n+ data['app_author'] == 'CastagnaIT'):\n+ result_data = {'cookies': []}\n+ for cookie in data['data']['cookies']:\n+ if 'netflix' not in cookie['domain']:\n+ continue\n+ result_data['cookies'].append(convert_chrome_cookie(cookie))\n+ return result_data\nraise Exception('Authentication key file not supported')\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
Add support to MacOS NFAuthenticationKey
106,046
30.10.2020 14:10:38
-3,600
c5f1642d8cb0bbb0cedb74cbb2a6feaff7443b7f
Add GitHub Rules checker Action
[ { "change_type": "ADD", "old_path": null, "new_path": ".github/workflows/rules-checker.yml", "diff": "+name: 'Rules checker'\n+on:\n+ issues:\n+ types:\n+ - opened\n+jobs:\n+ rules-checker:\n+ runs-on: ubuntu-latest\n+ steps:\n+ - uses: actions/checkout@v2\n+ name: \"Run Rules checker\"\n+ - uses: CastagnaIT/[email protected]\n+ with:\n+ github-token: ${{ secrets.GITHUBTOKEN }}\n+ log-miss-label-text: \"Ignored rules\"\n+ log-section-start-text: \"### Debug log\"\n+ log-section-end-text: \"### Additional context or screenshots (if appropriate)\"\n+ log-miss-comment-text: |\n+ Thank you for your interest in this add-on development,\n+ this is an automatically generated message by our Bot\n+\n+ It seems that you have not full followed the template we provide and require for all bug reports.\n+\n+ Attach the debug log is mandatory for a bug report, _the log rules are explained in the Issue creation page or in the ReadMe_.\n+\n+ Please edit your Issue message to follow our [template](../raw/master/.github/ISSUE_TEMPLATE/bug_report.md). The issue will be closed after about one week has passed without satisfactory follow-up from your side.\n+\n+ If you believe it was sent in error, please say so and a team member will remove the \"Ignored rules\" label.\n+ generic-comment-text: |\n+ Thank you for your interest in this add-on development,\n+ this is an automatically generated message by our Bot\n+\n+ It seems that you have not used any of the templates provided to correctly open an Issue thread.\n+\n+ Using the templates provided is mandatory to provide all necessary information, this helps us to better manage all your requests, optimizing the time needed to deal with the requests of all users and the development.\n+\n+ Please edit your Issue message to follow our [templates](../issues/new/choose) and make sure to fill in all fields appropriately, or close this Issue and create a new one by using the most suitable template.\n+\n+ If you believe it was sent in error, please say so.\n+ triage-needed-label: \"Triage: Needed\"\n+ feature-label-text: \"Enhancement\"\n\\ No newline at end of file\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
Add GitHub Rules checker Action
106,046
31.10.2020 09:51:54
-3,600
430165155f2d39dc74b51a765cb8f6011edd86b9
Use seek time instead offset time
[ { "change_type": "MODIFY", "old_path": "resources/lib/services/playback/action_controller.py", "new_path": "resources/lib/services/playback/action_controller.py", "diff": "@@ -87,7 +87,7 @@ class ActionController(xbmc.Monitor):\nif method == 'Player.OnAVStart':\nself._on_playback_started()\nelif method == 'Player.OnSeek':\n- self._on_playback_seek(json.loads(data)['player']['seekoffset'])\n+ self._on_playback_seek(json.loads(data)['player']['time'])\nelif method == 'Player.OnPause':\nself._is_pause_called = True\nself._on_playback_pause()\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
Use seek time instead offset time
106,046
01.11.2020 11:02:29
-3,600
23593a80057710cd7102a87cab48659fb24c77ed
Use GITHUB_TOKEN secret instead personal secret token sign actions with github user bot
[ { "change_type": "MODIFY", "old_path": ".github/workflows/rules-checker.yml", "new_path": ".github/workflows/rules-checker.yml", "diff": "@@ -11,7 +11,7 @@ jobs:\nname: \"Run Rules checker\"\n- uses: CastagnaIT/[email protected]\nwith:\n- github-token: ${{ secrets.GITHUBTOKEN }}\n+ github-token: ${{ secrets.GITHUB_TOKEN }}\nlog-miss-label-text: \"Ignored rules\"\nlog-section-start-text: \"### Debug log\"\nlog-section-end-text: \"### Additional context or screenshots (if appropriate)\"\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
Use GITHUB_TOKEN secret instead personal secret token sign actions with github user bot
106,046
02.11.2020 14:23:03
-3,600
c8a1fd9786209d0055f785cc6c52e58496356fe4
Fixed "samplerate" KeyError (Kodi 19) The "audiostreams" keys of Player.GetProperties json rpc could change over the time of kodi development (new keys added) and so fail the dict keys comparison because our saved data could not contain the new keys
[ { "change_type": "MODIFY", "old_path": "resources/lib/common/misc_utils.py", "new_path": "resources/lib/common/misc_utils.py", "diff": "@@ -151,11 +151,9 @@ def merge_dicts(dict_to_merge, merged_dict):\nreturn merged_dict\n-def compare_dicts(dict_a, dict_b, excluded_keys=None):\n- \"\"\"Compare two dict with same keys, with optional keys to exclude from compare\"\"\"\n- if excluded_keys is None:\n- excluded_keys = []\n- return all(dict_a[k] == dict_b[k] for k in dict_a if k not in excluded_keys)\n+def compare_dict_keys(dict_a, dict_b, compare_keys):\n+ \"\"\"Compare two dictionaries with the specified keys\"\"\"\n+ return all(dict_a[k] == dict_b[k] for k in dict_a if k in compare_keys)\ndef chunked_list(seq, chunk_len):\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": "@@ -300,7 +300,8 @@ class AMStreamContinuity(ActionManager):\n# Kodi version >= 19, compares stream properties to find the right stream index\n# between episodes with a different numbers of streams\nif isinstance(stream_a, dict):\n- return common.compare_dicts(stream_a, stream_b, ['index'])\n+ return common.compare_dict_keys(stream_a, stream_b,\n+ ['channels', 'codec', 'isdefault', 'isimpaired', 'isoriginal', 'language'])\n# subtitleenabled is boolean and not a dict\nreturn stream_a == stream_b\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
Fixed "samplerate" KeyError (Kodi 19) The "audiostreams" keys of Player.GetProperties json rpc could change over the time of kodi development (new keys added) and so fail the dict keys comparison because our saved data could not contain the new keys
106,046
03.11.2020 11:59:14
-3,600
5782efa46e73675b928436532ed010d4d104e8ba
Prepare for Python v3.9
[ { "change_type": "MODIFY", "old_path": ".github/workflows/ci.yml", "new_path": ".github/workflows/ci.yml", "diff": "@@ -12,7 +12,7 @@ jobs:\nstrategy:\nfail-fast: false\nmatrix:\n- python-version: [2.7, 3.5, 3.6, 3.7, 3.8]\n+ python-version: [2.7, 3.5, 3.6, 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 = py27,py35,py36,py37,py38,flake8\n+envlist = py27,py35,py36,py37,py38,py39,flake8\nskipsdist = True\nskip_missing_interpreters = True\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
Prepare for Python v3.9
106,046
03.11.2020 12:59:38
-3,600
5ddd0d9739c693156e727cee06a2db81b9ed28cc
Fix pylint no-member error for py39
[ { "change_type": "MODIFY", "old_path": "resources/lib/utils/website.py", "new_path": "resources/lib/utils/website.py", "diff": "@@ -345,4 +345,4 @@ def parse_html(html_value):\nreturn unescape(html_value)\nexcept ImportError: # Python <= 3.3\nfrom html.parser import HTMLParser\n- return HTMLParser().unescape(html_value)\n+ return HTMLParser().unescape(html_value) # pylint: disable=no-member\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
Fix pylint no-member error for py39
106,046
09.11.2020 09:27:36
-3,600
d14ce92c52d52784c43bdb451332f0e7a49f81b9
Fix player id as None when has 0 as value
[ { "change_type": "MODIFY", "old_path": "resources/lib/services/playback/action_controller.py", "new_path": "resources/lib/services/playback/action_controller.py", "diff": "@@ -171,7 +171,7 @@ class ActionController(xbmc.Monitor):\ndef _get_player_state(self, player_id=None, time_override=None):\ntry:\nplayer_state = common.json_rpc('Player.GetProperties', {\n- 'playerid': self.active_player_id or player_id,\n+ 'playerid': self.active_player_id if player_id is None else player_id,\n'properties': [\n'audiostreams',\n'currentaudiostream',\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
Fix player id as None when has 0 as value
106,046
09.11.2020 17:50:23
-3,600
0e352c0d4edbd63995be22ce6133f9a715432336
Fixed json parsing error due to return char
[ { "change_type": "MODIFY", "old_path": "resources/lib/utils/website.py", "new_path": "resources/lib/utils/website.py", "diff": "@@ -287,15 +287,17 @@ def extract_json(content, name):\ntry:\njson_array = recompile(JSON_REGEX.format(name), DOTALL).findall(content.decode('utf-8'))\njson_str = json_array[0]\n- json_str_replace = json_str.replace('\\\\\"', '\\\\\\\\\"') # Escape double-quotes\n- json_str_replace = json_str_replace.replace('\\\\s', '\\\\\\\\s') # Escape \\s\n- json_str_replace = json_str_replace.replace('\\\\n', '\\\\\\\\n') # Escape line feed\n- json_str_replace = json_str_replace.replace('\\\\t', '\\\\\\\\t') # Escape tab\n+ json_str_replace = json_str.replace(r'\\\"', r'\\\\\"') # Escape \\\"\n+ json_str_replace = json_str_replace.replace(r'\\s', r'\\\\s') # Escape whitespace\n+ json_str_replace = json_str_replace.replace(r'\\r', r'\\\\r') # Escape return\n+ json_str_replace = json_str_replace.replace(r'\\n', r'\\\\n') # Escape line feed\n+ json_str_replace = json_str_replace.replace(r'\\t', r'\\\\t') # Escape tab\njson_str_replace = json_str_replace.encode().decode('unicode_escape') # Decode the string as unicode\njson_str_replace = sub(r'\\\\(?![\"])', r'\\\\\\\\', json_str_replace) # Escape backslash (only when is not followed by double quotation marks \\\")\nreturn json.loads(json_str_replace)\nexcept Exception as exc: # pylint: disable=broad-except\nif json_str:\n+ # For testing purposes remember to add raw prefix to the string to test: json_str = r'string to test'\nLOG.error('JSON string trying to load: {}', json_str)\nimport traceback\nLOG.error(G.py2_decode(traceback.format_exc(), 'latin-1'))\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
Fixed json parsing error due to return char
106,046
10.11.2020 10:51:20
-3,600
a5f4d130282a6a0a4c6b9a70a02f95986d698b45
Some fixes to update-translations Fix wrong return char on Windows For the changed msgid must not copy the old msgstr
[ { "change_type": "MODIFY", "old_path": "tests/update_translations.py", "new_path": "tests/update_translations.py", "diff": "@@ -12,10 +12,17 @@ for entry in english:\n# Find a translation\ntranslation = translated.find(entry.msgctxt, 'msgctxt')\n- if translation:\n+ if translation and entry.msgid == translation.msgid:\nentry.msgstr = translation.msgstr\nenglish.metadata = translated.metadata\n+if sys.platform.startswith('win'):\n+ # On Windows save the file keeping the Linux return character\n+ with open(sys.argv[1], 'wb') as _file:\n+ content = str(english).encode('utf-8')\n+ content = content.replace(b'\\r\\n', b'\\n')\n+ _file.write(content)\n+else:\n# Save it now over the translation\nenglish.save(sys.argv[1])\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
Some fixes to update-translations -Fix wrong return char on Windows -For the changed msgid must not copy the old msgstr
106,046
12.11.2020 11:55:43
-3,600
918460443cb1818e3a000c520b42311a26d74b66
Workaround to ReadTimeout errors Usually a server should automatically specify a timeout for requests, but lately this doesn't happen anymore. In this way the request remains on hold indefinitely blocking the add-on service. As workaround has been set the timeout manually.
[ { "change_type": "MODIFY", "old_path": "resources/lib/common/exceptions.py", "new_path": "resources/lib/common/exceptions.py", "diff": "@@ -21,6 +21,10 @@ 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": "@@ -15,7 +15,7 @@ from xbmc import getCondVisibility, Monitor, getInfoLabel\nfrom resources.lib.common.exceptions import (HttpError401, InputStreamHelperError, MbrStatusNeverMemberError,\nMbrStatusFormerMemberError, MissingCredentialsError, LoginError,\n- NotLoggedInError, InvalidPathError, BackendNotReady)\n+ NotLoggedInError, InvalidPathError, BackendNotReady, HttpErrorTimeout)\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@@ -40,15 +40,17 @@ def catch_exceptions_decorator(func):\n('The operation has been cancelled.\\r\\n'\n'InputStream Helper has generated an internal error:\\r\\n{}\\r\\n\\r\\n'\n'Please report it to InputStream Helper github.'.format(exc)))\n- except HttpError401: # HTTP error 401 Client Error: Unauthorized for url ...\n- # This is a generic error, can happen when the http request for some reason has failed.\n+ except (HttpError401, HttpErrorTimeout) as exc: # HTTP error 401 Client Error: Unauthorized for url ...\n+ # HttpError401: 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.\\r\\n'\n- 'You can try the operation again or exit.'))\n+ ('There was a communication problem with Netflix.[CR]'\n+ 'You can try the operation again or exit.[CR]'\n+ '(Error code: {})').format(exc.__class__.__name__))\nexcept (MbrStatusNeverMemberError, MbrStatusFormerMemberError):\nfrom resources.lib.kodi.ui import show_error_info\nshow_error_info(get_local_string(30008), get_local_string(30180), False, True)\n" }, { "change_type": "MODIFY", "old_path": "resources/lib/services/msl/events_handler.py", "new_path": "resources/lib/services/msl/events_handler.py", "diff": "@@ -20,15 +20,10 @@ 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.msl import msl_utils\n-from resources.lib.services.msl.msl_utils import EVENT_START, EVENT_STOP, EVENT_ENGAGE, ENDPOINTS\n+from resources.lib.services.msl.msl_utils import EVENT_START, EVENT_STOP, EVENT_ENGAGE, ENDPOINTS, create_req_params\nfrom resources.lib.utils.esn import get_esn\nfrom resources.lib.utils.logging import LOG\n-try: # Python 2\n- from urllib import urlencode\n-except ImportError: # Python 3\n- from urllib.parse import urlencode\n-\ntry:\nimport Queue as queue\nexcept ImportError: # Python 3\n@@ -49,7 +44,6 @@ class Event(object):\nself.event_data = event_data\nself.request_data = request_data\nself.response_data = None\n- self.req_attempt = 0\nLOG.debug('EVENT [{}] - Added to queue', self.event_type)\ndef get_event_id(self):\n@@ -58,18 +52,11 @@ class Event(object):\ndef set_response(self, response):\nself.response_data = response\nLOG.debug('EVENT [{}] - Request response: {}', self.event_type, response)\n- # Seem that malformed requests are ignored without returning errors\n- # self.status = self.STATUS_ERROR\n+ if 'RequestError' in response:\n+ self.status = self.STATUS_ERROR\n+ else:\nself.status = self.STATUS_SUCCESS\n- def is_response_success(self):\n- return self.status == self.STATUS_SUCCESS and self.req_attempt <= 3\n-\n- def is_attempts_granted(self):\n- \"\"\"Returns True if you can make new request attempts\"\"\"\n- self.req_attempt += 1\n- return bool(self.req_attempt <= 3)\n-\ndef get_video_id(self):\nreturn self.request_data['params']['sessionParams']['uiplaycontext']['video_id']\n@@ -119,29 +106,23 @@ class EventsHandler(threading.Thread):\n\"\"\"Do the event post request\"\"\"\nevent.status = Event.STATUS_REQUESTED\n# Request attempts can be made up to a maximum of 3 times per event\n- while event.is_attempts_granted():\n- LOG.info('EVENT [{}] - Executing request (attempt {})', event, event.req_attempt)\n- params = {'reqAttempt': event.req_attempt,\n- 'reqPriority': 20 if event.event_type == EVENT_START else 0,\n- 'reqName': 'events/{}'.format(event)}\n- url = ENDPOINTS['events'] + '?' + urlencode(params).replace('%2F', '/')\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))\ntry:\n- response = self.chunked_request(url, event.request_data, get_esn(), disable_msl_switch=False)\n+ response = self.chunked_request(endpoint_url, event.request_data, get_esn(),\n+ disable_msl_switch=False, retry_all_exceptions=True)\n+ # Malformed/wrong content in requests are ignored without returning error feedback in the response\nevent.set_response(response)\n- break\nexcept Exception as exc: # pylint: disable=broad-except\nLOG.error('EVENT [{}] - The request has failed: {}', event, exc)\n- if event.event_type == EVENT_STOP:\n+ event.set_response('RequestError')\n+ if event.event_type == EVENT_STOP and event.status == Event.STATUS_SUCCESS:\nself.clear_queue()\nif event.event_data['allow_request_update_loco']:\n# Calls to nfsession\ncommon.make_http_call('update_loco_context', {'context_name': 'continueWatching'})\ncommon.make_http_call('update_videoid_bookmark', {'video_id': event.get_video_id()})\n- # Below commented lines: let future requests continue to be sent, unstable connections like wi-fi cause problems\n- # if not event.is_response_success():\n- # The event request is unsuccessful then there is some problem,\n- # no longer make any future requests from this event id\n- # return False\nreturn True\ndef stop_join(self):\n" }, { "change_type": "MODIFY", "old_path": "resources/lib/services/msl/msl_handler.py", "new_path": "resources/lib/services/msl/msl_handler.py", "diff": "@@ -24,7 +24,7 @@ from resources.lib.utils.logging import LOG, measure_exec_time_decorator\nfrom .converter import convert_to_dash\nfrom .events_handler import EventsHandler\nfrom .msl_requests import MSLRequests\n-from .msl_utils import ENDPOINTS, display_error_info, MSL_DATA_FILENAME\n+from .msl_utils import ENDPOINTS, display_error_info, MSL_DATA_FILENAME, create_req_params\nfrom .profiles import enabled_profiles\ntry: # Python 2\n@@ -223,7 +223,7 @@ class MSLHandler(object):\n# then when ISA perform the license callback we replace it with the fresh license challenge data.\nparams['challenge'] = self.manifest_challenge\n- endpoint_url = ENDPOINTS['manifest'] + '?reqAttempt=1&reqPriority=0&reqName=prefetch/manifest'\n+ endpoint_url = ENDPOINTS['manifest'] + create_req_params(0, 'prefetch/manifest')\nmanifest = self.msl_requests.chunked_request(endpoint_url,\nself.msl_requests.build_request_data('/manifest', params),\nesn,\n@@ -257,7 +257,7 @@ class MSLHandler(object):\n'xid': xid\n}]\nself.manifest_challenge = challenge\n- endpoint_url = ENDPOINTS['license'] + '?reqAttempt=1&reqPriority=0&reqName=prefetch/license'\n+ endpoint_url = ENDPOINTS['license'] + create_req_params(0, 'prefetch/license')\nresponse = self.msl_requests.chunked_request(endpoint_url,\nself.msl_requests.build_request_data(self.last_license_url,\nparams,\n@@ -281,7 +281,8 @@ class MSLHandler(object):\n# playback, and only the first time after a switch,\n# in the response you can also understand if the msl switch has worked\nLOG.debug('Requesting bind events')\n- response = self.msl_requests.chunked_request(ENDPOINTS['manifest'],\n+ endpoint_url = ENDPOINTS['manifest'] + create_req_params(20, 'bind')\n+ response = self.msl_requests.chunked_request(endpoint_url,\nself.msl_requests.build_request_data('/bind', {}),\nget_esn(),\ndisable_msl_switch=False)\n@@ -308,7 +309,8 @@ class MSLHandler(object):\n'echo': 'drmSessionId'\n}]\n- response = self.msl_requests.chunked_request(ENDPOINTS['license'],\n+ endpoint_url = ENDPOINTS['license'] + create_req_params(10, 'release/license')\n+ response = self.msl_requests.chunked_request(endpoint_url,\nself.msl_requests.build_request_data('/bundle', params),\nget_esn())\nLOG.debug('License release response: {}', response)\n" }, { "change_type": "MODIFY", "old_path": "resources/lib/services/msl/msl_requests.py", "new_path": "resources/lib/services/msl/msl_requests.py", "diff": "@@ -14,22 +14,19 @@ import base64\nimport json\nimport re\nimport zlib\n+\nfrom future.utils import raise_from\n+from requests import exceptions\nimport resources.lib.common as common\nfrom resources.lib.common.exceptions import MSLError\nfrom resources.lib.globals import G\nfrom resources.lib.services.msl.msl_request_builder import MSLRequestBuilder\n-from resources.lib.services.msl.msl_utils import (display_error_info, generate_logblobs_params, EVENT_BIND, ENDPOINTS,\n- MSL_DATA_FILENAME)\n+from resources.lib.services.msl.msl_utils import (display_error_info, generate_logblobs_params, ENDPOINTS,\n+ MSL_DATA_FILENAME, create_req_params)\nfrom resources.lib.utils.esn import get_esn\nfrom resources.lib.utils.logging import LOG, measure_exec_time_decorator, perf_clock\n-try: # Python 2\n- from urllib import urlencode\n-except ImportError: # Python 3\n- from urllib.parse import urlencode\n-\nclass MSLRequests(MSLRequestBuilder):\n\"\"\"Provides methods to make MSL requests\"\"\"\n@@ -84,11 +81,8 @@ class MSLRequests(MSLRequestBuilder):\n# The only way (found to now) to get it immediately, is send a logblob event request, and save the\n# user id token obtained in the response.\nLOG.debug('Requesting logblog')\n- params = {'reqAttempt': 1,\n- 'reqPriority': 0,\n- 'reqName': EVENT_BIND}\n- url = ENDPOINTS['logblobs'] + '?' + urlencode(params).replace('%2F', '/')\n- response = self.chunked_request(url,\n+ endpoint_url = ENDPOINTS['logblobs'] + create_req_params(0, 'bind')\n+ response = self.chunked_request(endpoint_url,\nself.build_request_data('/logblob', generate_logblobs_params()),\nget_esn(),\nforce_auth_credential=True)\n@@ -158,26 +152,44 @@ 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+ def chunked_request(self, endpoint, request_data, esn, disable_msl_switch=True, force_auth_credential=False,\n+ retry_all_exceptions=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)),\n+ self._post(endpoint, self.msl_request(request_data, esn, auth_data), retry_all_exceptions),\nsave_uid_token_to_owner=auth_data['user_id_token'] is None)\nreturn chunked_response['result']\n- def _post(self, endpoint, request_data):\n+ def _post(self, endpoint, request_data, retry_all_exceptions=False):\n\"\"\"Execute a post request\"\"\"\n- LOG.debug('Executing POST request to {}', endpoint)\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+ else:\n+ _endpoint = endpoint\n+ LOG.debug('Executing POST request to {}', _endpoint)\nstart = perf_clock()\n- response = self.session.post(endpoint, request_data)\n+ try:\n+ response = self.session.post(_endpoint, request_data, timeout=4)\nLOG.debug('Request took {}s', perf_clock() - start)\nLOG.debug('Request returned response with status {}', response.status_code)\nresponse.raise_for_status()\nreturn response\n+ except Exception as exc: # pylint: disable=broad-except\n+ LOG.error('HTTP request error: {}', exc)\n+ if not retry_all_exceptions and not isinstance(exc, exceptions.ReadTimeout):\n+ raise\n+ if retry_attempt >= max_attempts:\n+ raise\n+ retry_attempt += 1\n+ LOG.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)\n" }, { "change_type": "MODIFY", "old_path": "resources/lib/services/msl/msl_utils.py", "new_path": "resources/lib/services/msl/msl_utils.py", "diff": "@@ -28,6 +28,11 @@ try: # Python 2\nexcept NameError: # Python 3\nunicode = str # pylint: disable=redefined-builtin\n+try: # Python 2\n+ from urllib import urlencode\n+except ImportError: # Python 3\n+ from urllib.parse import urlencode\n+\nCHROME_BASE_URL = 'https://www.netflix.com/nq/msl_v1/cadmium/'\n# 16/10/2020 There is a new api endpoint to now used only for events/logblobs\nCHROME_PLAYAPI_URL = 'https://www.netflix.com/msl/playapi/cadmium/'\n@@ -213,3 +218,22 @@ def generate_logblobs_params():\nblobs_dump = json.dumps(blobs_container)\nblobs_dump = blobs_dump.replace('\"', '\\\"').replace(' ', '').replace('#', ' ')\nreturn {'logblobs': blobs_dump}\n+\n+\n+def create_req_params(req_priority, req_name):\n+ \"\"\"Create the params for the POST request\"\"\"\n+ # Used list of tuple in order to preserve the params order\n+ # Will result something like:\n+ # ?reqAttempt=&reqPriority=0&reqName=events/engage&clienttype=akira&uiversion=vdeb953cf&browsername=chrome&browserversion=84.0.4147.136&osname=windows&osversion=10.0\n+ params = [\n+ ('reqAttempt', ''), # Will be populated by _post() in msl_requests.py\n+ ('reqPriority', req_priority),\n+ ('reqName', req_name),\n+ ('clienttype', 'akira'),\n+ ('uiversion', G.LOCAL_DB.get_value('build_identifier', '', table=TABLE_SESSION)),\n+ ('browsername', 'chrome'),\n+ ('browserversion', G.LOCAL_DB.get_value('browser_info_version', '', table=TABLE_SESSION).lower()),\n+ ('osname', G.LOCAL_DB.get_value('browser_info_os_name', '', table=TABLE_SESSION).lower()),\n+ ('osversion', G.LOCAL_DB.get_value('browser_info_os_version', '', table=TABLE_SESSION))\n+ ]\n+ return '?' + urlencode(params)\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": "@@ -17,7 +17,7 @@ from future.utils import raise_from\nimport resources.lib.utils.website as website\nimport resources.lib.common as common\nfrom resources.lib.common.exceptions import (APIError, WebsiteParsingError, MbrStatusError, MbrStatusAnonymousError,\n- HttpError401, NotLoggedInError)\n+ HttpError401, NotLoggedInError, HttpErrorTimeout)\nfrom resources.lib.kodi import ui\nfrom resources.lib.utils import cookies\nfrom resources.lib.database.db_utils import TABLE_SESSION\n@@ -49,6 +49,7 @@ 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@@ -57,12 +58,17 @@ 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 = perf_clock()\n+ try:\nresponse = method(\nurl=url,\nverify=self.verify_ssl,\nheaders=headers,\nparams=params,\n- data=data)\n+ data=data,\n+ timeout=8)\n+ except exceptions.ReadTimeout as exc:\n+ LOG.error('HTTP Request ReadTimeout error: {}', exc)\n+ raise_from(HttpErrorTimeout, exc)\nLOG.debug('Request took {}s', perf_clock() - start)\nLOG.debug('Request returned status code {}', response.status_code)\n# for redirect in response.history:\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
Workaround to ReadTimeout errors Usually a server should automatically specify a timeout for requests, but lately this doesn't happen anymore. In this way the request remains on hold indefinitely blocking the add-on service. As workaround has been set the timeout manually.
106,046
14.11.2020 17:21:45
-3,600
83446129f2f06da12e46a2b7db04d59519cfe0c3
Version bump (1.11.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.10.1\" provider-name=\"libdev + jojo + asciidisco + caphm + castagnait\">\n+<addon id=\"plugin.video.netflix\" name=\"Netflix\" version=\"1.11.0\" provider-name=\"libdev + jojo + asciidisco + caphm + castagnait\">\n<requires>\n<import addon=\"xbmc.python\" version=\"2.26.0\"/>\n<import addon=\"script.module.addon.signals\" version=\"0.0.3\"/>\n<forum>https://forum.kodi.tv/showthread.php?tid=329767</forum>\n<source>https://github.com/CastagnaIT/plugin.video.netflix</source>\n<news>\n-v1.10.1 (2020-10-24)\n-- Improved watched status, now videos will be marked as watched correctly (Kodi 19 all cases/Kodi 18 library only)\n-- Improved loading video lists speed on slow hdd/sdcard\n-- Updated some MSL endpoints\n-- Implemented clean library by directory (Kodi 19)\n-- Fixed problems with skins that cause add-on problems due to extrafanart\n-- Fixed broken profile switch when profile autoselection was enabled\n-- Fixed wrong time position sent to netflix server when player seek\n-- Fixed notification error when playback a video with no subtitles (Kodi 19)\n-- Add Galicial translation\n+v1.11.0 (2020-11-14)\n+- Reworked Audio/Subtitles language features\n+ - Add support to Kodi player audio setting \"Media default\" (use NF profile language)\n+ - Add setting to force the display subtitles only with the audio language set\n+ - Add setting to always show subtitles when the preferred audio language is not available (Kodi 19 only)\n+ - Add setting to prefer audio/subtitles with country code (Kodi 19 only)\n+ - Add setting to prefer stereo audio tracks (instead of multichannels)\n+- Add check for video availability\n+- Add support to NFAuthentication for MacOS\n+- Add workaround to HTTP connection problem blocking the add-on service\n+- Fixed wrong resume time after manual seek (when nf sync enabled)\n+- Fixed login/addon open error due to json parsing error\n+- Updated translations it, jp, kr, tr, gr, ro, fr, hu, pl, de, zh-cn, pt-br\n+- Others minor fixes\n</news>\n</extension>\n</addon>\n" }, { "change_type": "MODIFY", "old_path": "changelog.txt", "new_path": "changelog.txt", "diff": "+v1.11.0 (2020-11-14)\n+- Reworked Audio/Subtitles language features\n+ - Add support to Kodi player audio setting \"Media default\" (use NF profile language)\n+ - Add setting to force the display subtitles only with the audio language set\n+ - Add setting to always show subtitles when the preferred audio language is not available (Kodi 19 only)\n+ - Add setting to prefer audio/subtitles with country code (Kodi 19 only)\n+ - Add setting to prefer stereo audio tracks (instead of multichannels)\n+- Add check for video availability\n+- Add support to NFAuthentication for MacOS\n+- Add workaround to HTTP connection problem blocking the add-on service\n+- Fixed wrong resume time after manual seek (when nf sync enabled)\n+- Fixed login/addon open error due to json parsing error\n+- Updated translations it, jp, kr, tr, gr, ro, fr, hu, pl, de, zh-cn, pt-br\n+- Others minor fixes\n+\nv1.10.1 (2020-10-24)\n- Improved watched status, now videos will be marked as watched correctly (Kodi 19 all cases/Kodi 18 library only)\n- Improved loading video lists speed on slow hdd/sdcard\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
Version bump (1.11.0) (#926)
106,046
17.11.2020 20:05:00
-3,600
370a6dcf70d55bed054c97f14a101d494be303b8
Try get vendor nrdp modelgroup
[ { "change_type": "MODIFY", "old_path": "resources/lib/utils/esn.py", "new_path": "resources/lib/utils/esn.py", "diff": "@@ -49,6 +49,10 @@ def generate_android_esn():\nnrdp_modelgroup = subprocess.check_output(\n['/system/bin/getprop',\n'ro.nrdp.modelgroup']).decode('utf-8').strip(' \\t\\n\\r').upper()\n+ if not nrdp_modelgroup:\n+ nrdp_modelgroup = subprocess.check_output(\n+ ['/system/bin/getprop',\n+ 'ro.vendor.nrdp.modelgroup']).decode('utf-8').strip(' \\t\\n\\r').upper()\ndrm_security_level = G.LOCAL_DB.get_value('drm_security_level', '', table=TABLE_SESSION)\nsystem_id = G.LOCAL_DB.get_value('drm_system_id', table=TABLE_SESSION)\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
Try get vendor nrdp modelgroup
106,046
17.11.2020 20:07:26
-3,600
a507c80abcbef04dcc2fe8a44297d57df35f05d3
Removed unused old code for ro.build.characteristics check
[ { "change_type": "MODIFY", "old_path": "resources/lib/utils/esn.py", "new_path": "resources/lib/utils/esn.py", "diff": "@@ -36,15 +36,6 @@ def generate_android_esn():\n['/system/bin/getprop',\n'ro.product.model']).decode('utf-8').strip(' \\t\\n\\r').upper()\n- # This product_characteristics check seem no longer used, some L1 devices not have the 'tv' value\n- # like Xiaomi Mi Box 3 or SM-T590 devices and is cause of wrong esn generation\n- # product_characteristics = subprocess.check_output(\n- # ['/system/bin/getprop',\n- # 'ro.build.characteristics']).decode('utf-8').strip(' \\t\\n\\r')\n- # Property ro.build.characteristics may also contain more then one value\n- # has_product_characteristics_tv = any(\n- # value.strip(' ') == 'tv' for value in product_characteristics.split(','))\n-\n# Netflix Ready Device Platform (NRDP)\nnrdp_modelgroup = subprocess.check_output(\n['/system/bin/getprop',\n@@ -90,8 +81,6 @@ def generate_android_esn():\n# DEV_TYPE_TABLET \"PRV-T\"\n# DEV_TYPE_PHONE \"PRV-P\"\n- # if has_product_characteristics_tv and \\\n- # G.LOCAL_DB.get_value('drm_security_level', '', table=TABLE_SESSION) == 'L1':\nif drm_security_level == 'L1':\nesn = 'NFANDROID2-PRV-'\nif nrdp_modelgroup:\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
Removed unused old code for ro.build.characteristics check
106,046
23.11.2020 16:33:37
-3,600
d6d9f0a288884a0da9fcbccbd0edaa48b087e9b8
Improved vendor nrdp modelgroup check
[ { "change_type": "MODIFY", "old_path": "resources/lib/utils/esn.py", "new_path": "resources/lib/utils/esn.py", "diff": "@@ -28,6 +28,7 @@ def generate_android_esn():\nif get_system_platform() == 'android':\nimport subprocess\ntry:\n+ sdk_version = int(subprocess.check_output(['/system/bin/getprop', 'ro.build.version.sdk']))\nmanufacturer = subprocess.check_output(\n['/system/bin/getprop',\n'ro.product.manufacturer']).decode('utf-8').strip(' \\t\\n\\r').upper()\n@@ -39,11 +40,8 @@ def generate_android_esn():\n# Netflix Ready Device Platform (NRDP)\nnrdp_modelgroup = subprocess.check_output(\n['/system/bin/getprop',\n- 'ro.nrdp.modelgroup']).decode('utf-8').strip(' \\t\\n\\r').upper()\n- if not nrdp_modelgroup:\n- nrdp_modelgroup = subprocess.check_output(\n- ['/system/bin/getprop',\n- 'ro.vendor.nrdp.modelgroup']).decode('utf-8').strip(' \\t\\n\\r').upper()\n+ 'ro.vendor.nrdp.modelgroup' if sdk_version >= 28 else 'ro.nrdp.modelgroup']\n+ ).decode('utf-8').strip(' \\t\\n\\r').upper()\ndrm_security_level = G.LOCAL_DB.get_value('drm_security_level', '', table=TABLE_SESSION)\nsystem_id = G.LOCAL_DB.get_value('drm_system_id', table=TABLE_SESSION)\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
Improved vendor nrdp modelgroup check
106,046
28.11.2020 14:33:14
-3,600
5ae98094b7ded54789a69e9441d9f43f39cc68eb
Updated some esn info
[ { "change_type": "MODIFY", "old_path": "resources/lib/utils/esn.py", "new_path": "resources/lib/utils/esn.py", "diff": "@@ -16,6 +16,31 @@ from resources.lib.database.db_utils import TABLE_SESSION\nfrom resources.lib.globals import G\nfrom .logging import LOG\n+# 25/11/2020 - Follow Android ESN generator is changed (current method not yet known)\n+# First NF identifies the device in this way and in the following order:\n+# 1) if getPackageManager().hasSystemFeature(\"org.chromium.arc\") == true\n+# the device is : DEV_TYPE_CHROME_OS (Chrome OS)\n+# 2) if getSystemService(Context.DISPLAY_SERVICE)).getDisplay(0) == null\n+# the device is : DEV_TYPE_ANDROID_STB (Set-Top Box)\n+# 3) if getSystemService(Context.UI_MODE_SERVICE)).getCurrentModeType() == UI_MODE_TYPE_TELEVISION\n+# the device is : DEV_TYPE_ANDROID_TV\n+# 4) if 528 is <= of (calculated resolution display):\n+# DisplayMetrics dMetr = new DisplayMetrics();\n+# defaultDisplay.getRealMetrics(displayMetrics);\n+# float disDens = displayMetrics.density;\n+# if 528 <= Math.min((dMetr.widthPixels / disDens, (dMetr.heightPixels / disDens)\n+# the device is : DEV_TYPE_TABLET\n+# 5) if all other cases are not suitable, then the device is : DEV_TYPE_PHONE\n+# Then after identifying the device type, a specific letter will be added after the prefix \"PRV-\"\n+\n+# ESN Device categories (updated 25/11/2020)\n+# Unknown or Phone \"PRV-P\"\n+# Tablet? \"PRV-T\" (should be for tablet)\n+# Tablet \"PRV-C\" (should be for Chrome OS devices only)\n+# Google TV \"PRV-B\" (Set-Top Box)\n+# Smart Display \"PRV-E\"\n+# Android TV \"PRV-\" (without letter specified)\n+\ndef get_esn():\n\"\"\"Get the generated esn or if set get the custom esn\"\"\"\n@@ -55,30 +80,6 @@ def generate_android_esn():\n# but at least for Beelink GT-King (S922X) this is needed\nsystem_id = '4445'\n- # The original android ESN generator is not full replicable\n- # because we can not access easily to android APIs to get system data\n- # First NF identifies the device in this way and in the following order:\n- # 1) if getPackageManager().hasSystemFeature(\"org.chromium.arc\") == true\n- # the device is : DEV_TYPE_CHROME_OS (Chrome OS)\n- # 2) if getSystemService(Context.DISPLAY_SERVICE)).getDisplay(0) == null\n- # the device is : DEV_TYPE_ANDROID_STB (Set-Top Box)\n- # 3) if getSystemService(Context.UI_MODE_SERVICE)).getCurrentModeType() == UI_MODE_TYPE_TELEVISION\n- # the device is : DEV_TYPE_ANDROID_TV\n- # 4) if 528 is <= of (calculated resolution display):\n- # DisplayMetrics dMetr = new DisplayMetrics();\n- # defaultDisplay.getRealMetrics(displayMetrics);\n- # float disDens = displayMetrics.density;\n- # if 528 <= Math.min((dMetr.widthPixels / disDens, (dMetr.heightPixels / disDens)\n- # the device is : DEV_TYPE_TABLET\n- # 5) if all other cases are not suitable, then the device is : DEV_TYPE_PHONE\n-\n- # Then after identifying the device type, a specific letter will be added after the prefix \"PRV-\":\n- # DEV_TYPE_CHROME_OS \"PRV-C\"\n- # DEV_TYPE_ANDROID_STB \"PRV-B\"\n- # DEV_TYPE_ANDROID_TV \"PRV-\" (no letter specified)\n- # DEV_TYPE_TABLET \"PRV-T\"\n- # DEV_TYPE_PHONE \"PRV-P\"\n-\nif drm_security_level == 'L1':\nesn = 'NFANDROID2-PRV-'\nif nrdp_modelgroup:\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
Updated some esn info
106,046
28.11.2020 14:39:11
-3,600
16703027bd24dcbb694fe4b1c4f008692323ce82
Use [CR] for GUI purpose
[ { "change_type": "MODIFY", "old_path": "resources/lib/kodi/ui/dialogs.py", "new_path": "resources/lib/kodi/ui/dialogs.py", "diff": "@@ -102,7 +102,7 @@ def ask_for_resume(resume_position):\ndef show_backend_not_ready(error_details=None):\nmessage = common.get_local_string(30138)\nif error_details:\n- message += '\\r\\n\\r\\nError details:\\r\\n' + error_details\n+ message += '[CR][CR]Error details:[CR]' + error_details\nreturn xbmcgui.Dialog().ok(common.get_local_string(30105), message)\n@@ -117,8 +117,8 @@ def show_yesno_dialog(title, message, yeslabel=None, nolabel=None):\ndef show_error_info(title, message, unknown_error=False, netflix_error=False):\n\"\"\"Show a dialog that displays the error message\"\"\"\nprefix = (30104, 30102, 30101)[unknown_error + netflix_error]\n- return xbmcgui.Dialog().ok(title, (common.get_local_string(prefix) + '\\r\\n' +\n- message + '\\r\\n\\r\\n' +\n+ return xbmcgui.Dialog().ok(title, (common.get_local_string(prefix) + '[CR]' +\n+ message + '[CR][CR]' +\ncommon.get_local_string(30103)))\n@@ -132,7 +132,7 @@ def show_addon_error_info(exc):\ndef show_library_task_errors(notify_errors, errors):\nif notify_errors and errors:\nxbmcgui.Dialog().ok(common.get_local_string(0),\n- '\\n'.join(['{} ({})'.format(err['title'], err['error'])\n+ '[CR]'.join(['{} ({})'.format(err['title'], err['error'])\nfor err in errors]))\n" }, { "change_type": "MODIFY", "old_path": "resources/lib/run_addon.py", "new_path": "resources/lib/run_addon.py", "diff": "@@ -37,10 +37,10 @@ def catch_exceptions_decorator(func):\nexcept InputStreamHelperError as exc:\nfrom resources.lib.kodi.ui import show_ok_dialog\nshow_ok_dialog('InputStream Helper Add-on error',\n- ('The operation has been cancelled.\\r\\n'\n- 'InputStream Helper has generated an internal error:\\r\\n{}\\r\\n\\r\\n'\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: # HTTP error 401 Client Error: Unauthorized for url ...\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# Known causes:\n# - Possible change of data format or wrong data in the http request (also in headers/params)\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
Use [CR] for GUI purpose
106,046
28.11.2020 14:54:36
-3,600
4a680f537c3a4e63814c16be00a0b0b95853425a
Fix borderline case between change profile and HTTP outbound requests
[ { "change_type": "MODIFY", "old_path": "resources/lib/services/nfsession/nfsession_ops.py", "new_path": "resources/lib/services/nfsession/nfsession_ops.py", "diff": "\"\"\"\nfrom __future__ import absolute_import, division, unicode_literals\n+import xbmc\n+\nimport time\nfrom datetime import datetime, timedelta\nfrom future.utils import raise_from\n@@ -92,6 +94,10 @@ class NFSessionOperations(SessionPathRequests):\ndef activate_profile(self, guid):\n\"\"\"Set the profile identified by guid as active\"\"\"\nLOG.debug('Switching to profile {}', guid)\n+ if xbmc.Player().isPlayingVideo():\n+ # Change the current profile while a video is playing can cause problems with outgoing HTTP requests\n+ # (MSL/NFSession) causing a failure in the HTTP request or sending data on the wrong profile\n+ raise Warning('It is not possible select a profile while a video is playing.')\ncurrent_active_guid = G.LOCAL_DB.get_active_profile_guid()\nif guid == current_active_guid:\nLOG.info('The profile guid {} is already set, activation not needed.', guid)\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
Fix borderline case between change profile and HTTP outbound requests
106,046
02.12.2020 17:10:45
-3,600
6e8b754850f1a94feb52d1b39f1d0a2301bf2768
Add missing case for wrong password
[ { "change_type": "MODIFY", "old_path": "resources/lib/services/nfsession/session/access.py", "new_path": "resources/lib/services/nfsession/session/access.py", "diff": "@@ -93,6 +93,7 @@ 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()\n@@ -112,6 +113,7 @@ class SessionAccess(SessionCookie, SessionHTTPRequests):\nif not email:\nraise WebsiteParsingError('E-mail field not found')\n# Verify the password (with parental control api)\n+ try:\nresponse = self.post_safe('profile_hub',\ndata={'destination': 'contentRestrictions',\n'guid': G.LOCAL_DB.get_active_profile_guid(),\n@@ -119,6 +121,11 @@ 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+ if exc.response.status_code == 500:\n+ # This endpoint raise HTTP error 500 when the password is wrong\n+ raise_from(LoginError(common.get_local_string(12344)), exc)\n+ raise\ncommon.set_credentials({'email': email, 'password': password})\nLOG.info('Login successful')\nui.show_notification(common.get_local_string(30109))\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
Add missing case for wrong password
106,046
04.12.2020 10:34:15
-3,600
74999617b979ad2c39ae12ed283216caa2e06ff7
Add more option to force android widevine L3
[ { "change_type": "MODIFY", "old_path": "resources/lib/common/device_utils.py", "new_path": "resources/lib/common/device_utils.py", "diff": "@@ -11,6 +11,7 @@ from __future__ import absolute_import, division, unicode_literals\nimport xbmc\nfrom resources.lib.globals import G\n+from resources.lib.utils.esn import ForceWidevine\nfrom resources.lib.utils.logging import LOG\n@@ -79,7 +80,7 @@ def is_device_4k_capable():\nif get_system_platform() == 'android':\nfrom resources.lib.database.db_utils import TABLE_SESSION\n# Check if the drm has security level L1\n- is_l3_forced = G.ADDON.getSettingBool('force_widevine_l3')\n+ is_l3_forced = G.ADDON.getSettingString('force_widevine') != ForceWidevine.DISABLED\nis_drm_l1_security_level = (G.LOCAL_DB.get_value('drm_security_level', '', table=TABLE_SESSION) == 'L1'\nand not is_l3_forced)\n# Check if HDCP level is 2.2 or up\n" }, { "change_type": "MODIFY", "old_path": "resources/lib/common/exceptions.py", "new_path": "resources/lib/common/exceptions.py", "diff": "@@ -61,6 +61,10 @@ class MetadataNotAvailable(Exception):\nclass MSLError(Exception):\n\"\"\"A specific MSL error\"\"\"\n+ def __init__(self, message, err_number=None):\n+ self.message = message\n+ self.err_number = err_number\n+ super(MSLError, self).__init__(self.message)\nclass LicenseError(MSLError):\n" }, { "change_type": "MODIFY", "old_path": "resources/lib/database/db_utils.py", "new_path": "resources/lib/database/db_utils.py", "diff": "@@ -13,7 +13,6 @@ import os\nimport xbmcvfs\n-from resources.lib.common import folder_exists\nfrom resources.lib.globals import G\ntry: # Kodi >= 19\n@@ -43,6 +42,7 @@ VidLibProp = {\ndef get_local_db_path(db_filename):\n# First ensure database folder exists\n+ from resources.lib.common import folder_exists\ndb_folder = G.py2_decode(translatePath(os.path.join(G.DATA_PATH, 'database')))\nif not folder_exists(db_folder):\nxbmcvfs.mkdirs(db_folder)\n" }, { "change_type": "MODIFY", "old_path": "resources/lib/services/msl/android_crypto.py", "new_path": "resources/lib/services/msl/android_crypto.py", "diff": "@@ -11,6 +11,7 @@ from __future__ import absolute_import, division, unicode_literals\nimport base64\nimport json\n+\nfrom future.utils import raise_from\nimport xbmcdrm\n@@ -18,6 +19,7 @@ import xbmcdrm\nfrom resources.lib.common.exceptions import MSLError\nfrom resources.lib.database.db_utils import TABLE_SESSION\nfrom resources.lib.globals import G\n+from resources.lib.utils.esn import ForceWidevine\nfrom resources.lib.utils.logging import LOG\nfrom .base_crypto import MSLBaseCrypto\n@@ -66,7 +68,7 @@ class AndroidMSLCrypto(MSLBaseCrypto):\nelse:\nLOG.warn('Widevine CryptoSession system id not obtained!')\nLOG.debug('Widevine CryptoSession security level: {}', drm_info['security_level'])\n- if G.ADDON.getSettingBool('force_widevine_l3'):\n+ if G.ADDON.getSettingString('force_widevine') != ForceWidevine.DISABLED:\nLOG.warn('Widevine security level is forced to L3 by user settings!')\nLOG.debug('Widevine CryptoSession current hdcp level: {}', drm_info['hdcp_level'])\nLOG.debug('Widevine CryptoSession max hdcp level supported: {}', drm_info['hdcp_level_max'])\n" }, { "change_type": "MODIFY", "old_path": "resources/lib/services/msl/converter.py", "new_path": "resources/lib/services/msl/converter.py", "diff": "See LICENSES/MIT.md for more information.\n\"\"\"\nfrom __future__ import absolute_import, division, unicode_literals\n+\nimport uuid\nimport xml.etree.ElementTree as ET\n+import resources.lib.common as common\nfrom resources.lib.database.db_utils import TABLE_SESSION\nfrom resources.lib.globals import G\n-import resources.lib.common as common\n+from resources.lib.utils.esn import ForceWidevine\nfrom resources.lib.utils.logging import LOG\n@@ -110,7 +112,7 @@ def _add_protection_info(adaptation_set, pssh, keyid):\n})\n# Add child tags to the DRM system configuration ('widevine:license' is an ISA custom tag)\nif (G.LOCAL_DB.get_value('drm_security_level', '', table=TABLE_SESSION) == 'L1'\n- and not G.ADDON.getSettingBool('force_widevine_l3')):\n+ and G.ADDON.getSettingString('force_widevine') == ForceWidevine.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" }, { "change_type": "MODIFY", "old_path": "resources/lib/services/msl/msl_handler.py", "new_path": "resources/lib/services/msl/msl_handler.py", "diff": "@@ -12,14 +12,16 @@ from __future__ import absolute_import, division, unicode_literals\nimport json\nimport time\n+from future.utils import raise_from\n+\nimport xbmcaddon\nimport resources.lib.common as common\nfrom resources.lib.common.cache_utils import CACHE_MANIFESTS\n+from resources.lib.common.exceptions import CacheMiss, MSLError\nfrom resources.lib.database.db_utils import TABLE_SESSION\nfrom resources.lib.globals import G\nfrom resources.lib.utils.esn import get_esn\n-from resources.lib.common.exceptions import CacheMiss, MSLError\nfrom resources.lib.utils.logging import LOG, measure_exec_time_decorator\nfrom .converter import convert_to_dash\nfrom .events_handler import EventsHandler\n@@ -258,11 +260,19 @@ class MSLHandler(object):\n}]\nself.manifest_challenge = challenge\nendpoint_url = ENDPOINTS['license'] + create_req_params(0, 'prefetch/license')\n+ try:\nresponse = self.msl_requests.chunked_request(endpoint_url,\nself.msl_requests.build_request_data(self.last_license_url,\nparams,\n'drmSessionId'),\nget_esn())\n+ except MSLError as exc:\n+ if exc.err_number == '1044' and common.get_system_platform() == 'android':\n+ msg = ('This title is not available to watch instantly. Please try another title.\\r\\n'\n+ 'To try to solve this problem you can force \"Widevine L3\" from the add-on Expert settings.\\r\\n'\n+ 'More info in the Wiki FAQ on add-on GitHub.')\n+ raise_from(MSLError(msg), exc)\n+ raise\n# This xid must be used also for each future Event request, until playback stops\nG.LOCAL_DB.set_value('xid', xid, TABLE_SESSION)\n" }, { "change_type": "MODIFY", "old_path": "resources/lib/services/msl/msl_requests.py", "new_path": "resources/lib/services/msl/msl_requests.py", "diff": "@@ -60,13 +60,18 @@ class MSLRequests(MSLRequestBuilder):\nif not esn:\nLOG.warn('Cannot perform key handshake, missing ESN')\nreturn False\n-\nLOG.info('Performing key handshake with ESN: {}',\ncommon.censure(esn) if G.ADDON.getSetting('esn') else esn)\n+ try:\nresponse = _process_json_response(self._post(ENDPOINTS['manifest'], self.handshake_request(esn)))\nheader_data = self.decrypt_header_data(response['headerdata'], False)\nself.crypto.parse_key_response(header_data, esn, True)\n-\n+ except MSLError as exc:\n+ if exc.err_number == 207006 and common.get_system_platform() == 'android':\n+ msg = ('Request failed validation during key exchange\\r\\n'\n+ 'To try to solve this problem read the Wiki FAQ on add-on GitHub.')\n+ raise_from(MSLError(msg), exc)\n+ raise\n# Delete all the user id tokens (are correlated to the previous mastertoken)\nself.crypto.clear_user_id_tokens()\nLOG.debug('Key handshake successful')\n@@ -246,24 +251,31 @@ def _raise_if_error(decoded_response):\nif raise_error:\nLOG.error('Full MSL error information:')\nLOG.error(json.dumps(decoded_response))\n- raise MSLError(_get_error_details(decoded_response))\n+ err_message, err_number = _get_error_details(decoded_response)\n+ raise MSLError(err_message, err_number)\nreturn decoded_response\ndef _get_error_details(decoded_response):\n+ err_message = 'Unhandled error check log.'\n+ err_number = None\n# Catch a chunk error\nif 'errordata' in decoded_response:\n- return G.py2_encode(json.loads(base64.standard_b64decode(decoded_response['errordata']))['errormsg'])\n+ err_data = json.loads(base64.standard_b64decode(decoded_response['errordata']))\n+ err_message = err_data['errormsg']\n+ err_number = err_data['internalcode']\n# Catch a manifest error\n- if 'error' in decoded_response:\n+ elif 'error' in decoded_response:\nif decoded_response['error'].get('errorDisplayMessage'):\n- return G.py2_encode(decoded_response['error']['errorDisplayMessage'])\n+ err_message = decoded_response['error']['errorDisplayMessage']\n+ err_number = decoded_response['error'].get('bladeRunnerCode')\n# Catch a license error\n- if 'result' in decoded_response and isinstance(decoded_response.get('result'), list):\n+ elif 'result' in decoded_response and isinstance(decoded_response.get('result'), list):\nif 'error' in decoded_response['result'][0]:\nif decoded_response['result'][0]['error'].get('errorDisplayMessage'):\n- return G.py2_encode(decoded_response['result'][0]['error']['errorDisplayMessage'])\n- return G.py2_encode('Unhandled error check log.')\n+ err_message = decoded_response['result'][0]['error']['errorDisplayMessage']\n+ err_number = decoded_response['result'][0]['error'].get('bladeRunnerCode')\n+ return G.py2_encode(err_message), err_number\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": "@@ -18,7 +18,7 @@ import resources.lib.kodi.ui as ui\nfrom resources.lib.common.cache_utils import CACHE_COMMON, CACHE_MYLIST, CACHE_SEARCH, CACHE_MANIFESTS\nfrom resources.lib.database.db_utils import TABLE_SETTINGS_MONITOR, TABLE_SESSION\nfrom resources.lib.globals import G\n-from resources.lib.utils.esn import generate_android_esn\n+from resources.lib.utils.esn import generate_android_esn, ForceWidevine\nfrom resources.lib.utils.logging import LOG\ntry: # Python 2\n@@ -125,10 +125,10 @@ def _check_esn():\nif not custom_esn:\n# Check if \"Force identification as L3 Widevine device\" is changed (ANDROID ONLY)\n- is_l3_forced = bool(G.ADDON.getSettingBool('force_widevine_l3'))\n- is_l3_forced_old = G.LOCAL_DB.get_value('force_widevine_l3', False, TABLE_SETTINGS_MONITOR)\n- if is_l3_forced != is_l3_forced_old:\n- G.LOCAL_DB.set_value('force_widevine_l3', is_l3_forced, TABLE_SETTINGS_MONITOR)\n+ force_widevine = G.ADDON.getSettingString('force_widevine')\n+ force_widevine_old = G.LOCAL_DB.get_value('force_widevine', ForceWidevine.DISABLED, TABLE_SETTINGS_MONITOR)\n+ if force_widevine != force_widevine_old:\n+ G.LOCAL_DB.set_value('force_widevine', force_widevine, TABLE_SETTINGS_MONITOR)\n# If user has changed setting is needed clear previous ESN and perform a new handshake with the new one\nG.LOCAL_DB.set_value('esn', generate_android_esn() or '', TABLE_SESSION)\ncommon.send_signal(signal=common.Signals.ESN_CHANGED)\n" }, { "change_type": "MODIFY", "old_path": "resources/lib/utils/esn.py", "new_path": "resources/lib/utils/esn.py", "diff": "@@ -11,11 +11,11 @@ from __future__ import absolute_import, division, unicode_literals\nfrom re import sub\n-from resources.lib.common.device_utils import get_system_platform\nfrom resources.lib.database.db_utils import TABLE_SESSION\nfrom resources.lib.globals import G\nfrom .logging import LOG\n+\n# 25/11/2020 - Follow Android ESN generator is changed (current method not yet known)\n# First NF identifies the device in this way and in the following order:\n# 1) if getPackageManager().hasSystemFeature(\"org.chromium.arc\") == true\n@@ -42,6 +42,13 @@ from .logging import LOG\n# Android TV \"PRV-\" (without letter specified)\n+class ForceWidevine: # pylint: disable=no-init, disable=too-few-public-methods\n+ \"\"\"The enum values of 'force_widevine' add-on setting\"\"\"\n+ DISABLED = 'Disabled'\n+ L3 = 'Widevine L3'\n+ L3_4445 = 'Widevine L3 (ID-4445)'\n+\n+\ndef get_esn():\n\"\"\"Get the generated esn or if set get the custom esn\"\"\"\ncustom_esn = G.ADDON.getSetting('esn')\n@@ -50,6 +57,7 @@ def get_esn():\ndef generate_android_esn():\n\"\"\"Generate an ESN if on android or return the one from user_data\"\"\"\n+ from resources.lib.common.device_utils import get_system_platform\nif get_system_platform() == 'android':\nimport subprocess\ntry:\n@@ -73,11 +81,12 @@ def generate_android_esn():\n# Some device with false Widevine certification can be specified as Widevine L1\n# but we do not know how NF original app force the fallback to L3, so we add a manual setting\n- is_l3_forced = bool(G.ADDON.getSettingBool('force_widevine_l3'))\n- if is_l3_forced:\n+ force_widevine = G.ADDON.getSettingString('force_widevine')\n+ if force_widevine == ForceWidevine.L3:\n+ drm_security_level = 'L3'\n+ elif force_widevine == ForceWidevine.L3_4445:\n+ # For some devices the Netflix android app change the DRM System ID to 4445\ndrm_security_level = 'L3'\n- # We do not know if override the DRM System ID to 4445 is a good behaviour for all devices,\n- # but at least for Beelink GT-King (S922X) this is needed\nsystem_id = '4445'\nif drm_security_level == 'L1':\n@@ -95,7 +104,7 @@ def generate_android_esn():\nesn = sub(r'[^A-Za-z0-9=-]', '=', esn)\nif system_id:\nesn += '-' + system_id + '-'\n- LOG.debug('Generated Android ESN: {} is L3 forced: {}', esn, is_l3_forced)\n+ LOG.debug('Generated Android ESN: {} (force widevine is set as \"{}\")', esn, force_widevine)\nreturn esn\nexcept OSError:\npass\n" }, { "change_type": "MODIFY", "old_path": "resources/settings.xml", "new_path": "resources/settings.xml", "diff": "<setting id=\"cdn_server\" type=\"labelenum\" label=\"30241\" values=\"Server 1|Server 2|Server 3\" default=\"Server 1\" />\n<setting id=\"enable_ipc_over_http\" type=\"bool\" label=\"30139\" default=\"false\"/>\n<setting id=\"ssl_verification\" type=\"bool\" label=\"30024\" default=\"true\" visible=\"false\"/> <!-- just for developers -->\n- <setting id=\"force_widevine_l3\" type=\"bool\" label=\"30244\" visible=\"System.Platform.Android\" default=\"false\"/>\n+ <setting id=\"force_widevine\" type=\"labelenum\" label=\"30244\" values=\"Disabled|Widevine L3|Widevine L3 (ID-4445)\" default=\"Disabled\" visible=\"System.Platform.Android\"/>\n<setting id=\"page_results\" type=\"slider\" option=\"int\" range=\"45,45,180\" label=\"30247\" default=\"90\"/>\n<setting label=\"30016\" type=\"lsep\"/><!--ESN-->\n<setting id=\"view_esn\" type=\"action\" label=\"30216\" action=\"RunPlugin(plugin://$ID/action/view_esn/)\"/>\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
Add more option to force android widevine L3
106,046
08.12.2020 18:34:35
-3,600
4f2a1d6cef9329ae9f9291eba84d318eae6930f8
Misc fixes to audio/subtitles language code Details on the pr Restore old behaviour to Kodi 18 Improved the behaviour on Kodi 19
[ { "change_type": "MODIFY", "old_path": "resources/lib/common/kodi_ops.py", "new_path": "resources/lib/common/kodi_ops.py", "diff": "@@ -198,10 +198,52 @@ def fix_locale_languages(data_list):\n# Languages with the country code causes the display of wrong names in Kodi settings like\n# es-ES as 'Spanish-Spanish', pt-BR as 'Portuguese-Breton', nl-BE as 'Dutch-Belarusian', etc\n# and the impossibility to set them as the default audio/subtitle language\n+ # Issue: https://github.com/xbmc/xbmc/issues/15308\n+ if G.KODI_VERSION.is_major_ver('18'):\n+ _fix_locale_languages_kodi18(data_list)\n+ else:\n+ _fix_locale_languages(data_list)\n+\n+\n+def _fix_locale_languages_kodi18(data_list):\n+ # Get all the ISO 639-1 codes (without country)\n+ verify_unofficial_lang = not G.KODI_VERSION.is_less_version('18.7')\n+ locale_list_nocountry = []\n+ for item in data_list:\n+ if item.get('isNoneTrack', False):\n+ continue\n+ if verify_unofficial_lang and item['language'] == 'pt-BR':\n+ # Replace pt-BR with pb, is an unofficial ISO 639-1 Portuguese (Brazil) language code\n+ # has been added to Kodi 18.7 and Kodi 19.x PR: https://github.com/xbmc/xbmc/pull/17689\n+ item['language'] = 'pb'\n+ if len(item['language']) == 2 and not item['language'] in locale_list_nocountry:\n+ locale_list_nocountry.append(item['language'])\n+ # Replace the locale languages with country with a new one\n+ for item in data_list:\n+ if item.get('isNoneTrack', False):\n+ continue\n+ if len(item['language']) == 2:\n+ continue\n+ item['language'] = _adjust_locale(item['language'],\n+ item['language'][0:2] in locale_list_nocountry)\n+\n+\n+def _adjust_locale(locale_code, lang_code_without_country_exists):\n+ \"\"\"Locale conversion helper\"\"\"\n+ language_code = locale_code[0:2]\n+ if not lang_code_without_country_exists:\n+ return language_code\n+ if locale_code in LOCALE_CONV_TABLE:\n+ return LOCALE_CONV_TABLE[locale_code]\n+ LOG.debug('AdjustLocale - missing mapping conversion for locale: {}'.format(locale_code))\n+ return locale_code\n+\n+\n+def _fix_locale_languages(data_list):\nfor item in data_list:\nif item.get('isNoneTrack', False):\ncontinue\n- if item['language'] == 'pt-BR' and not G.KODI_VERSION.is_less_version('18.7'):\n+ if item['language'] == 'pt-BR':\n# Replace pt-BR with pb, is an unofficial ISO 639-1 Portuguese (Brazil) language code\n# has been added to Kodi 18.7 and Kodi 19.x PR: https://github.com/xbmc/xbmc/pull/17689\nitem['language'] = 'pb'\n" }, { "change_type": "MODIFY", "old_path": "resources/lib/services/msl/converter.py", "new_path": "resources/lib/services/msl/converter.py", "diff": "@@ -47,9 +47,9 @@ def convert_to_dash(manifest):\nhas_audio_drm_streams = manifest['audio_tracks'][0].get('hasDrmStreams', False)\n- default_audio_track_id = _get_default_audio_track_id(manifest)\n+ id_default_audio_tracks = _get_id_default_audio_tracks(manifest)\nfor audio_track in manifest['audio_tracks']:\n- is_default = default_audio_track_id == audio_track['id']\n+ is_default = audio_track['id'] in 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@@ -292,7 +292,7 @@ def _convert_text_track(text_track, period, default, cdn_index, isa_version):\n_add_base_url(representation, list(downloadable[content_profile]['downloadUrls'].values())[cdn_index])\n-def _get_default_audio_track_id(manifest):\n+def _get_id_default_audio_tracks(manifest):\n\"\"\"Get the track id of the audio track to be set as default\"\"\"\nchannels_stereo = ['1.0', '2.0']\nchannels_multi = ['5.1', '7.1']\n@@ -306,7 +306,7 @@ def _get_default_audio_track_id(manifest):\naudio_language = profile_language_code[0:2]\nif not audio_language == 'original':\n# If set give priority to the same audio language with different country\n- if G.ADDON.getSettingBool('prefer_alternative_lang'):\n+ if not G.KODI_VERSION.is_major_ver('18') and G.ADDON.getSettingBool('prefer_alternative_lang'):\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@@ -324,14 +324,20 @@ def _get_default_audio_track_id(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- return audio_stream.get('id')\n+ # Try find the default track for impaired\n+ imp_audio_stream = {}\n+ if not is_prefer_stereo:\n+ imp_audio_stream = _find_audio_stream(manifest, 'language', audio_language, channels_multi, True)\n+ if not imp_audio_stream:\n+ imp_audio_stream = _find_audio_stream(manifest, 'language', audio_language, channels_stereo, True)\n+ return audio_stream.get('id'), imp_audio_stream.get('id')\n-def _find_audio_stream(manifest, property_name, property_value, channels_list):\n+def _find_audio_stream(manifest, property_name, property_value, channels_list, is_impaired=False):\nreturn next((audio_track for audio_track in manifest['audio_tracks']\nif audio_track[property_name] == property_value\nand audio_track['channels'] in channels_list\n- and not audio_track['trackType'] == 'ASSISTIVE'), {})\n+ and (audio_track['trackType'] == 'ASSISTIVE') == is_impaired), {})\ndef _is_default_subtitle(manifest, current_text_track):\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": "\"\"\"\nfrom __future__ import absolute_import, division, unicode_literals\n+import copy\n+\nimport xbmc\nimport resources.lib.common as common\n@@ -41,7 +43,14 @@ class AMStreamContinuity(ActionManager):\nDetects changes in audio / subtitle streams during playback and saves them to restore them later,\nChange the default Kodi behavior of subtitles according to user customizations\n\"\"\"\n-\n+ # How test/debug these features:\n+ # First thing (if not needed to your debug) disable \"Remember audio / subtitle preferences\" feature.\n+ # When you play a video, and you try to change audio/subtitles tracks, Kodi may save this change in his database,\n+ # the same thing happen when you use/enable the features of this module.\n+ # So when the next time you play the SAME video may invalidate these features, because Kodi restore saved settings.\n+ # To test multiple times these features on the SAME video, (e.g.),\n+ # you must delete, every time, the file /Kodi/userdata/Database/MyVideosXXX.db, or,\n+ # if you are able you can delete in realtime the data in the 'settings' table of db file.\ndef __init__(self):\nsuper(AMStreamContinuity, self).__init__()\nself.enabled = True # By default we enable this action manager\n@@ -52,6 +61,8 @@ class AMStreamContinuity(ActionManager):\nself.resume = {}\nself.legacy_kodi_version = G.KODI_VERSION.is_major_ver('18')\nself.is_kodi_forced_subtitles_only = None\n+ self.is_prefer_sub_impaired = None\n+ self.is_prefer_audio_impaired = None\ndef __str__(self):\nreturn ('enabled={}, videoid_parent={}'\n@@ -59,6 +70,10 @@ class AMStreamContinuity(ActionManager):\ndef initialize(self, data):\nself.is_kodi_forced_subtitles_only = common.get_kodi_subtitle_language() == 'forced_only'\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@@ -84,6 +99,11 @@ class AMStreamContinuity(ActionManager):\nself.player_state = player_state\n# If the user has not changed the subtitle settings\nif self.sc_settings.get('subtitleenabled') is None:\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 not self.legacy_kodi_version and G.ADDON.getSettingBool('prefer_alternative_lang'):\n+ self._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'):\nif self.legacy_kodi_version:\n@@ -93,6 +113,7 @@ class AMStreamContinuity(ActionManager):\n# Ensure in any case to show the regular subtitles when the preferred audio language is not available\nif not self.legacy_kodi_version and G.ADDON.getSettingBool('show_subtitles_miss_audio'):\nself._ensure_subtitles_no_audio_available()\n+ player_state = _player_state_copy\nfor stype in sorted(STREAMS):\n# Save current stream setting from the Kodi player to the local dict\nself._set_current_stream(stype, player_state)\n@@ -235,6 +256,62 @@ class AMStreamContinuity(ActionManager):\n# if the language is not missing there should be at least one result\nreturn streams[0]['index'] if streams else None\n+ def _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_list = self.player_state.get(STREAMS['audio']['list'])\n+ stream = None\n+ if self.is_prefer_audio_impaired:\n+ stream = next((audio_track for audio_track in audio_list\n+ if audio_track['language'] == audio_language\n+ and audio_track['isimpaired']\n+ and audio_track['isdefault']), # The default track can change is user choose 2ch as def\n+ None)\n+ if not stream:\n+ stream = next((audio_track for audio_track in audio_list\n+ if audio_track['language'] == audio_language\n+ and not audio_track['isimpaired']\n+ and audio_track['isdefault']), # The default track can change is user choose 2ch as def\n+ None)\n+ if stream:\n+ self.sc_settings.update({'audio': stream})\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+ subtitle_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+ return\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+ if stream_sub:\n+ self.sc_settings.update({'subtitleenabled': True})\n+ self.sc_settings.update({'subtitle': stream_sub})\n+ # We update the current player state data to avoid wrong behaviour with features executed after\n+ self.player_state[STREAMS['subtitle']['current']] = stream_sub\n+ else:\n+ self.sc_settings.update({'subtitleenabled': False})\n+\ndef _ensure_forced_subtitle_only_kodi18(self):\n\"\"\"Ensures the display of forced subtitles only with the audio language set [KODI 18]\"\"\"\n# With Kodi 18 it is not possible to read the properties of the player streams,\n@@ -304,33 +381,35 @@ class AMStreamContinuity(ActionManager):\n# Get current audio language\naudio_language = self._get_current_audio_language()\naudio_list = self.player_state.get(STREAMS['audio']['list'])\n+ stream = 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+ # then try find a regular subtitle in the preferred audio language\nstream = self._find_subtitle_stream(audio_language, audio_list)\nif stream:\nself.sc_settings.update({'subtitleenabled': True})\nself.sc_settings.update({'subtitle': stream})\n- def _find_subtitle_stream(self, audio_language, audio_list):\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- # then try find a regular subtitle in the preferred audio language\n- subtitles_list = self.player_state.get(STREAMS['subtitle']['list'])\n+ def _find_subtitle_stream(self, language, is_forced=False):\n# Take in account if a user have enabled Kodi impaired subtitles preference\n- is_prefer_impaired = common.json_rpc('Settings.GetSettingValue',\n- {'setting': 'accessibility.subhearing'}).get('value')\n+ # but only without forced setting (same Kodi player behaviour)\n+ is_prefer_impaired = self.is_prefer_sub_impaired and not is_forced\n+ subtitles_list = self.player_state.get(STREAMS['subtitle']['list'])\n+ stream = None\n+ if is_prefer_impaired:\nstream = next((subtitle_track for subtitle_track in subtitles_list\n- if subtitle_track['language'] == audio_language\n- and not subtitle_track['isforced']\n+ if subtitle_track['language'] == language\n+ and subtitle_track['isforced'] == is_forced\nand subtitle_track['isimpaired']),\n- None) if is_prefer_impaired else None\n+ None)\nif not stream:\nstream = next((subtitle_track for subtitle_track in subtitles_list\n- if subtitle_track['language'] == audio_language\n- and not subtitle_track['isforced']\n+ if subtitle_track['language'] == language\n+ and subtitle_track['isforced'] == is_forced\nand not subtitle_track['isimpaired']),\nNone)\nreturn stream\n- return None\ndef _get_current_audio_language(self):\n# Get current audio language\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
Misc fixes to audio/subtitles language code Details on the pr Restore old behaviour to Kodi 18 Improved the behaviour on Kodi 19
106,046
12.12.2020 10:09:47
-3,600
2bf44d782995b37bdcb99aec23913bf591848ebb
Ignore InvalidVideoListTypeError exception on playback started when the profile is new not have continueWatching list data then we can ignore it
[ { "change_type": "MODIFY", "old_path": "resources/lib/services/playback/am_video_events.py", "new_path": "resources/lib/services/playback/am_video_events.py", "diff": "@@ -11,6 +11,7 @@ from __future__ import absolute_import, division, unicode_literals\nimport resources.lib.common as common\nfrom resources.lib.common.cache_utils import CACHE_BOOKMARKS, CACHE_COMMON\n+from resources.lib.common.exceptions import InvalidVideoListTypeError\nfrom resources.lib.globals import G\nfrom resources.lib.services.msl.msl_utils import EVENT_START, EVENT_ENGAGE, EVENT_STOP, EVENT_KEEP_ALIVE\nfrom resources.lib.utils.logging import LOG\n@@ -45,6 +46,7 @@ class AMVideoEvents(ActionManager):\ndef on_playback_started(self, player_state):\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\n+ try:\nvideoid_exists, list_id = common.make_http_call('get_continuewatching_videoid_exists',\n{'video_id': str(self.videoid_parent.value)})\nif not videoid_exists:\n@@ -53,6 +55,9 @@ class AMVideoEvents(ActionManager):\n# When the continueWatching context is invalidated from a refreshListByContext call\n# the LoCo need to be updated to obtain the new list id, so we delete the cache to get new data\nG.CACHE.delete(CACHE_COMMON, 'loco_list')\n+ except InvalidVideoListTypeError:\n+ # Ignore possible \"No lists with context xxx available\" exception due to a new profile without data\n+ pass\ndef on_tick(self, player_state):\nif self.lock_events:\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
Ignore InvalidVideoListTypeError exception on playback started when the profile is new not have continueWatching list data then we can ignore it
106,046
13.12.2020 15:15:04
-3,600
6802f894b6e874976f8ba957400529c84b0f6c02
Version bump (1.12.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.11.0\" provider-name=\"libdev + jojo + asciidisco + caphm + castagnait\">\n+<addon id=\"plugin.video.netflix\" name=\"Netflix\" version=\"1.12.0\" provider-name=\"libdev + jojo + asciidisco + caphm + castagnait\">\n<requires>\n<import addon=\"xbmc.python\" version=\"2.26.0\"/>\n<import addon=\"script.module.addon.signals\" version=\"0.0.3\"/>\n<forum>https://forum.kodi.tv/showthread.php?tid=329767</forum>\n<source>https://github.com/CastagnaIT/plugin.video.netflix</source>\n<news>\n-v1.11.0 (2020-11-14)\n-- Reworked Audio/Subtitles language features\n- - Add support to Kodi player audio setting \"Media default\" (use NF profile language)\n- - Add setting to force the display subtitles only with the audio language set\n- - Add setting to always show subtitles when the preferred audio language is not available (Kodi 19 only)\n- - Add setting to prefer audio/subtitles with country code (Kodi 19 only)\n- - Add setting to prefer stereo audio tracks (instead of multichannels)\n-- Add check for video availability\n-- Add support to NFAuthentication for MacOS\n-- Add workaround to HTTP connection problem blocking the add-on service\n-- Fixed wrong resume time after manual seek (when nf sync enabled)\n-- Fixed login/addon open error due to json parsing error\n-- Updated translations it, jp, kr, tr, gr, ro, fr, hu, pl, de, zh-cn, pt-br\n-- Others minor fixes\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</news>\n</extension>\n</addon>\n" }, { "change_type": "MODIFY", "old_path": "changelog.txt", "new_path": "changelog.txt", "diff": "+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+\n+\nv1.11.0 (2020-11-14)\n- Reworked Audio/Subtitles language features\n- Add support to Kodi player audio setting \"Media default\" (use NF profile language)\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
Version bump (1.12.0) (#972)
106,046
14.12.2020 15:11:32
-3,600
1b2a80bfffb02392a5dd1a5110e23cf07c687371
Switch addon.xml to Kodi 19
[ { "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\" provider-name=\"libdev + jojo + asciidisco + caphm + castagnait\">\n+<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=\"2.26.0\"/>\n- <import addon=\"script.module.addon.signals\" version=\"0.0.3\"/>\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.future\" version=\"0.17.1\"/>\n- <import addon=\"script.module.inputstreamhelper\" version=\"0.3.3\"/>\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.12.4\"/>\n+ <import addon=\"script.module.requests\" version=\"2.22.0\"/>\n</requires>\n<extension point=\"xbmc.python.pluginsource\" library=\"addon.py\">\n<provides>video</provides>\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
Switch addon.xml to Kodi 19
106,046
14.12.2020 16:45:24
-3,600
090d40bcb1a841cb7c6d1761e6885e9b8d077bd3
Changes to workflows and some cleaning
[ { "change_type": "ADD", "old_path": null, "new_path": ".github/workflows/addon-check-Leia.yml", "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": "MODIFY", "old_path": ".github/workflows/addon-check.yml", "new_path": ".github/workflows/addon-check.yml", "diff": "name: Kodi\non:\n-- pull_request\n-- push\n+ push:\n+ branches:\n+ - master\n+ pull_request:\n+ branches:\n+ - master\njobs:\ntests:\nname: Addon checker\nruns-on: ubuntu-latest\n+ env:\n+ PYTHONIOENCODING: utf-8\nstrategy:\nfail-fast: false\nmatrix:\n- # FIXME: Required dependencies addon.signals and pycryptodome not available on Matrix yet\n- # kodi-branch: [leia, matrix]\n- kodi-branch: [leia]\n+ kodi-branch: [matrix]\nsteps:\n- uses: actions/checkout@v2\nwith:\n@@ -21,19 +25,17 @@ 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: |\n- sudo apt-get install xmlstarlet\n+ sudo apt-get install gettext\npython -m pip install --upgrade pip\n- pip install kodi-addon-checker\n+ pip install git+git://github.com/xbmc/addon-check.git@master\n+ - name: Checking language translations\n+ run: make check-translations\n+ working-directory: ${{ github.repository }}\n- name: Remove unwanted files\nrun: awk '/export-ignore/ { print $1 }' .gitattributes | xargs rm -rf --\nworking-directory: ${{ github.repository }}\n- - name: Rewrite addon.xml for Matrix\n- run: |\n- xmlstarlet ed -L -u '/addon/requires/import[@addon=\"xbmc.python\"]/@version' -v \"3.0.0\" addon.xml\n- version=$(xmlstarlet sel -t -v 'string(/addon/@version)' addon.xml)\n- xmlstarlet ed -L -u '/addon/@version' -v \"${version}+matrix.99\" addon.xml\n- working-directory: ${{ github.repository }}\n- if: matrix.kodi-branch == 'matrix'\n- name: Run kodi-addon-checker\nrun: kodi-addon-checker --branch=${{ matrix.kodi-branch }} ${{ github.repository }}/\n" }, { "change_type": "ADD", "old_path": null, "new_path": ".github/workflows/ci-Leia.yml", "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" }, { "change_type": "MODIFY", "old_path": ".github/workflows/ci.yml", "new_path": ".github/workflows/ci.yml", "diff": "name: CI\n-on:\n-- pull_request\n-- push\n+on: [push, pull_request]\njobs:\ntests:\nname: Add-on testing\n@@ -12,7 +10,7 @@ jobs:\nstrategy:\nfail-fast: false\nmatrix:\n- python-version: [2.7, 3.5, 3.6, 3.7, 3.8, 3.9]\n+ python-version: [3.6, 3.7, 3.8, 3.9]\nsteps:\n- name: Check out ${{ github.sha }} from repository ${{ github.repository }}\nuses: actions/checkout@v2\n@@ -22,7 +20,6 @@ jobs:\npython-version: ${{ matrix.python-version }}\n- name: Install dependencies\nrun: |\n- sudo apt-get install gettext\npython -m pip install --upgrade pip\npip install -r requirements.txt\n- name: Run tox\n@@ -31,9 +28,6 @@ jobs:\n- name: Run pylint\nrun: python -m pylint resources/lib/ tests/\nif: always()\n- - name: Compare translations\n- run: make check-translations\n- if: always()\n- name: Analyze with SonarCloud\nuses: SonarSource/[email protected]\nwith:\n" }, { "change_type": "ADD", "old_path": null, "new_path": ".github/workflows/release-Leia.yml", "diff": "+name: Release Leia\n+on:\n+ push:\n+ branches:\n+ - Leia\n+ tags:\n+ - 'v*'\n+jobs:\n+ build:\n+ name: Publish Leia release\n+ runs-on: ubuntu-latest\n+ steps:\n+ - name: Checkout code\n+ uses: actions/checkout@v2\n+ - name: Build zip files\n+ run: |\n+ sudo apt-get install libxml2-utils\n+ make build release=1\n+ - name: Get zip filename\n+ id: get-zip-filename\n+ run: |\n+ echo ::set-output name=zip-filename::$(cd ..;ls plugin.video.netflix*.zip | head -1)\n+ - name: Get body\n+ id: get-body\n+ run: |\n+ description=$(sed '/v[0-9\\.]*\\s([0-9-]*)/d;/^$/,$d' changelog.txt)\n+ echo $description\n+ description=\"${description//'%'/'%25'}\"\n+ description=\"${description//$'\\n'/'%0A'}\"\n+ description=\"${description//$'\\r'/'%0D'}\"\n+ echo ::set-output name=body::$description\n+ - name: Create GitHub Release\n+ id: create_release\n+ uses: actions/create-release@v1\n+ env:\n+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}\n+ with:\n+ tag_name: ${{ github.ref }}\n+ release_name: ${{ github.ref }}-Leia\n+ body: ${{ steps.get-body.outputs.body }}\n+ draft: false\n+ prerelease: false\n+ - name: Upload zip file\n+ id: upload-zip\n+ uses: actions/upload-release-asset@v1\n+ env:\n+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}\n+ with:\n+ upload_url: ${{ steps.create_release.outputs.upload_url }}\n+ asset_name: ${{ steps.get-zip-filename.outputs.zip-filename }}\n+ asset_path: ../${{ steps.get-zip-filename.outputs.zip-filename }}\n+ asset_content_type: application/zip\n" }, { "change_type": "MODIFY", "old_path": ".github/workflows/release.yml", "new_path": ".github/workflows/release.yml", "diff": "name: Release\non:\npush:\n+ branches:\n+ - master\ntags:\n- 'v*'\njobs:\nbuild:\n- name: Release plugin.video.netflix\n+ name: Publish release\nruns-on: ubuntu-latest\nsteps:\n- name: Checkout code\n@@ -13,15 +15,11 @@ jobs:\n- name: Build zip files\nrun: |\nsudo apt-get install libxml2-utils\n- make multizip release=1\n- - name: Get Leia filename\n- id: get-leia-filename\n+ make build release=1\n+ - name: Get zip filename\n+ id: get-zip-filename\nrun: |\n- echo ::set-output name=leia-filename::$(cd ..;ls plugin.video.netflix*.zip | grep -v '+matrix.' | head -1)\n- - name: Get Matrix filename\n- id: get-matrix-filename\n- run: |\n- echo ::set-output name=matrix-filename::$(cd ..;ls plugin.video.netflix*+matrix.*.zip | head -1)\n+ echo ::set-output name=zip-filename::$(cd ..;ls plugin.video.netflix*.zip | head -1)\n- name: Get body\nid: get-body\nrun: |\n@@ -31,7 +29,7 @@ jobs:\ndescription=\"${description//$'\\n'/'%0A'}\"\ndescription=\"${description//$'\\r'/'%0D'}\"\necho ::set-output name=body::$description\n- - name: Create Release\n+ - name: Create GitHub Release\nid: create_release\nuses: actions/create-release@v1\nenv:\n@@ -42,23 +40,13 @@ jobs:\nbody: ${{ steps.get-body.outputs.body }}\ndraft: false\nprerelease: false\n- - name: Upload Leia zip\n- id: upload-leia-zip\n- uses: actions/upload-release-asset@v1\n- env:\n- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}\n- with:\n- upload_url: ${{ steps.create_release.outputs.upload_url }}\n- asset_name: ${{ steps.get-leia-filename.outputs.leia-filename }}\n- asset_path: ../${{ steps.get-leia-filename.outputs.leia-filename }}\n- asset_content_type: application/zip\n- - name: Upload Matrix zip\n- id: upload-matrix-zip\n+ - name: Upload zip file\n+ id: upload-zip\nuses: actions/upload-release-asset@v1\nenv:\nGITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}\nwith:\nupload_url: ${{ steps.create_release.outputs.upload_url }}\n- asset_name: ${{ steps.get-matrix-filename.outputs.matrix-filename }}\n- asset_path: ../${{ steps.get-matrix-filename.outputs.matrix-filename }}\n+ asset_name: ${{ steps.get-zip-filename.outputs.zip-filename }}\n+ asset_path: ../${{ steps.get-zip-filename.outputs.zip-filename }}\nasset_content_type: application/zip\n" }, { "change_type": "MODIFY", "old_path": "requirements.txt", "new_path": "requirements.txt", "diff": "@@ -4,10 +4,10 @@ kodi-addon-checker\nmysql-connector-python\npolib\npycrypto\n-pycryptodomex==3.4.5\n+pycryptodomex\npydes\npylint\nrequests\n-setuptools >= 41\n+setuptools\ntox\n-xmlschema==1.0.18; python_version == '2.7'\n+xmlschema\n" }, { "change_type": "MODIFY", "old_path": "tox.ini", "new_path": "tox.ini", "diff": "[tox]\n-envlist = py27,py35,py36,py37,py38,py39,flake8\n+envlist = py36,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 = 2.7\n+min-version = 3.6\nexclude = .tox,packages\n[pytest]\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
Changes to workflows and some cleaning
106,046
16.12.2020 11:06:09
-3,600
c747ea436de125d2d5ea66f02e9c9c1075e00090
Drop future iteritems
[ { "change_type": "MODIFY", "old_path": "resources/lib/common/misc_utils.py", "new_path": "resources/lib/common/misc_utils.py", "diff": "See LICENSES/MIT.md for more information.\n\"\"\"\nfrom __future__ import absolute_import, division, unicode_literals\n-from future.utils import iteritems\ntry: # Python 2\nfrom itertools import imap as map # pylint: disable=redefined-builtin\n@@ -54,7 +53,7 @@ def get_class_methods(class_item=None):\n\"\"\"\nfrom types import FunctionType\n_type = FunctionType\n- return [x for x, y in iteritems(class_item.__dict__)\n+ return [x for x, y in class_item.__dict__.items()\nif isinstance(y, _type)]\n@@ -143,7 +142,7 @@ def strf_timestamp(timestamp, form):\ndef merge_dicts(dict_to_merge, merged_dict):\n\"\"\"Recursively merge the contents of dict_to_merge into merged_dict.\nValues that are already present in merged_dict will be overwritten if they are also present in dict_to_merge\"\"\"\n- for key, value in iteritems(dict_to_merge):\n+ for key, value in dict_to_merge.items():\nif isinstance(merged_dict.get(key), dict):\nmerge_dicts(value, merged_dict[key])\nelse:\n" }, { "change_type": "MODIFY", "old_path": "resources/lib/database/db_base_sqlite.py", "new_path": "resources/lib/database/db_base_sqlite.py", "diff": "@@ -12,7 +12,6 @@ from __future__ import absolute_import, division, unicode_literals\nimport sqlite3 as sql\nimport threading\nfrom functools import wraps\n-from future.utils import iteritems\nimport resources.lib.common as common\nimport resources.lib.database.db_base as db_base\n@@ -248,7 +247,7 @@ class SQLiteDatabase(db_base.BaseDatabase):\nquery = 'INSERT OR REPLACE INTO {} ({}, {}) VALUES (?, ?)'.format(table_name,\ntable_columns[0],\ntable_columns[1])\n- records_values = [(key, common.convert_to_string(value)) for key, value in iteritems(dict_values)]\n+ records_values = [(key, common.convert_to_string(value)) for key, value in dict_values.items()]\nelse:\n# sqlite UPSERT clause exists only on sqlite >= 3.24.0\nquery = ('INSERT INTO {tbl_name} ({tbl_col1}, {tbl_col2}) VALUES (?, ?) '\n@@ -257,7 +256,7 @@ class SQLiteDatabase(db_base.BaseDatabase):\ntbl_col1=table_columns[0],\ntbl_col2=table_columns[1])\nrecords_values = []\n- for key, value in iteritems(dict_values):\n+ for key, value in dict_values.items():\nvalue_str = common.convert_to_string(value)\nrecords_values.append((key, value_str, value_str, key))\ncur = self.get_cursor()\n" }, { "change_type": "MODIFY", "old_path": "resources/lib/database/db_local.py", "new_path": "resources/lib/database/db_local.py", "diff": "from __future__ import absolute_import, division, unicode_literals\nfrom datetime import datetime\n-from future.utils import iteritems\nimport resources.lib.common as common\nimport resources.lib.database.db_base_sqlite as db_sqlite\n@@ -92,7 +91,7 @@ class NFLocalDatabase(db_sqlite.SQLiteDatabase):\ncur.execute(\"BEGIN TRANSACTION;\")\nquery = 'DELETE FROM profiles_config WHERE Guid = ?'\nself._execute_non_query(query, (guid,), cur)\n- records_values = [(guid, key, common.convert_to_string(value)) for key, value in iteritems(dict_values)]\n+ records_values = [(guid, key, common.convert_to_string(value)) for key, value in dict_values.items()]\ninsert_query = 'INSERT INTO profiles_config (Guid, Name, Value) VALUES (?, ?, ?)'\nself._executemany_non_query(insert_query, records_values, cur)\ncur.execute(\"COMMIT;\")\n" }, { "change_type": "MODIFY", "old_path": "resources/lib/globals.py", "new_path": "resources/lib/globals.py", "diff": "@@ -23,8 +23,6 @@ except ImportError: # Python 2\nfrom urllib2 import unquote\nfrom urlparse import parse_qsl, urlparse\n-from future.utils import iteritems\n-\nimport xbmcaddon\nfrom xbmcgui import Window\n@@ -353,7 +351,7 @@ class GlobalVariables(object):\ndef is_known_menu_context(self, context):\n\"\"\"Return true if context are one of the menu with loco_known=True\"\"\"\n- for _, data in iteritems(self.MAIN_MENU_ITEMS):\n+ for _, data in self.MAIN_MENU_ITEMS.items():\nif data['loco_known']:\nif data['loco_contexts'][0] == context:\nreturn True\n" }, { "change_type": "MODIFY", "old_path": "resources/lib/kodi/infolabels.py", "new_path": "resources/lib/kodi/infolabels.py", "diff": "@@ -11,7 +11,7 @@ from __future__ import absolute_import, division, unicode_literals\nimport copy\n-from future.utils import iteritems, itervalues\n+from future.utils import itervalues\nimport resources.lib.utils.api_paths as paths\nimport resources.lib.utils.api_requests as api\n@@ -187,7 +187,7 @@ def _parse_referenced_infos(item, raw_data):\nreturn {target: [person['name']\nfor _, person\nin paths.resolve_refs(item.get(source, {}), raw_data)]\n- for target, source in iteritems(paths.REFERENCE_MAPPINGS)}\n+ for target, source in paths.REFERENCE_MAPPINGS.items()}\ndef _parse_tags(item):\n" }, { "change_type": "MODIFY", "old_path": "resources/lib/kodi/library.py", "new_path": "resources/lib/kodi/library.py", "diff": "@@ -13,8 +13,6 @@ from __future__ import absolute_import, division, unicode_literals\nimport os\nfrom datetime import datetime\n-from future.utils import iteritems\n-\nimport resources.lib.utils.api_requests as api\nimport resources.lib.common as common\nimport resources.lib.kodi.nfo as nfo\n@@ -273,7 +271,7 @@ class Library(LibraryTasks):\nexcluded_videoids_values = G.SHARED_DB.get_tvshows_id_list(VidLibProp['exclude_update'], True)\n# Start the update operations\nwith ui.ProgressDialog(show_prg_dialog, max_value=len(videoids_tasks)) as progress_bar:\n- for videoid, task_handler in iteritems(videoids_tasks):\n+ for videoid, task_handler in videoids_tasks.items():\n# Check if current videoid is excluded from updates\nif int(videoid.value) in excluded_videoids_values:\ncontinue\n" }, { "change_type": "MODIFY", "old_path": "resources/lib/navigation/directory_utils.py", "new_path": "resources/lib/navigation/directory_utils.py", "diff": "@@ -11,8 +11,6 @@ from __future__ import absolute_import, division, unicode_literals\nfrom functools import wraps\n-from future.utils import iteritems\n-\nimport xbmc\nimport xbmcgui\nimport xbmcplugin\n@@ -83,7 +81,7 @@ def _convert_dict_to_listitem(dict_item):\n'TotalTime': dict_item.get('TotalTime', ''),\n'ResumeTime': dict_item.get('ResumeTime', '')\n})\n- for stream_type, quality_info in iteritems(dict_item.get('quality_info', {})):\n+ for stream_type, quality_info in dict_item.get('quality_info', {}).items():\nlist_item.addStreamInfo(stream_type, quality_info)\nlist_item.setProperties(properties)\nlist_item.setInfo('video', dict_item.get('info', {}))\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": "\"\"\"\nfrom __future__ import absolute_import, division, unicode_literals\n-from future.utils import iteritems\n-\nfrom resources.lib.utils.data_types import merge_data_type\nfrom resources.lib.common.exceptions import CacheMiss\nfrom resources.lib.common import VideoId\n@@ -156,7 +154,7 @@ class DirectoryBuilder(DirectoryPathRequests):\nvideo_id_list = []\nvideo_id_list_type = []\nif video_list:\n- for video_id, video in iteritems(video_list.videos):\n+ for video_id, video in video_list.videos.items():\nvideo_id_list.append(video_id)\nvideo_id_list_type.append(video['summary']['type'])\nreturn video_id_list, video_id_list_type\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": "\"\"\"\nfrom __future__ import absolute_import, division, unicode_literals\n-from future.utils import iteritems\n-\nimport resources.lib.common as common\nfrom resources.lib.database.db_utils import (TABLE_MENU_DATA)\nfrom resources.lib.globals import G\n@@ -44,7 +42,7 @@ def build_mainmenu_listing(loco_list):\n'profile_language_code': G.LOCAL_DB.get_profile_config('language', ''),\n'supplemental_info_color': get_color_name(G.ADDON.getSettingInt('supplemental_info_color'))\n}\n- for menu_id, data in iteritems(G.MAIN_MENU_ITEMS):\n+ for menu_id, data in G.MAIN_MENU_ITEMS.items():\nif data.get('has_show_setting', True) and not G.ADDON.getSettingBool('_'.join(('show_menu', menu_id))):\ncontinue\nif data['loco_known']:\n@@ -140,7 +138,7 @@ def build_season_listing(season_list, tvshowid, pathitems=None):\n}\ndirectory_items = [_create_season_item(tvshowid, seasonid_value, season, season_list, common_data)\nfor seasonid_value, season\n- in iteritems(season_list.seasons)]\n+ in season_list.seasons.items()]\n# add_items_previous_next_page use the new value of perpetual_range_selector\nadd_items_previous_next_page(directory_items, pathitems, season_list.perpetual_range_selector, tvshowid)\nG.CACHE_MANAGEMENT.execute_pending_db_ops()\n@@ -174,7 +172,7 @@ def build_episode_listing(episodes_list, seasonid, pathitems=None):\n}\ndirectory_items = [_create_episode_item(seasonid, episodeid_value, episode, episodes_list, common_data)\nfor episodeid_value, episode\n- in iteritems(episodes_list.episodes)]\n+ in episodes_list.episodes.items()]\n# add_items_previous_next_page use the new value of perpetual_range_selector\nadd_items_previous_next_page(directory_items, pathitems, episodes_list.perpetual_range_selector)\nG.CACHE_MANAGEMENT.execute_pending_db_ops()\n@@ -212,7 +210,7 @@ def build_loco_listing(loco_list, menu_data, force_use_videolist_id=False, exclu\n'profile_language_code': G.LOCAL_DB.get_profile_config('language', '')\n}\ncontexts = menu_data.get('loco_contexts')\n- items_list = loco_list.lists_by_context(contexts) if contexts else iteritems(loco_list.lists)\n+ items_list = loco_list.lists_by_context(contexts) if contexts else loco_list.lists.items()\ndirectory_items = []\nfor video_list_id, video_list in items_list:\nmenu_parameters = common.MenuIdParameters(video_list_id)\n@@ -287,7 +285,7 @@ def build_video_listing(video_list, menu_data, sub_genre_id=None, pathitems=None\n}\ndirectory_items = [_create_video_item(videoid_value, video, video_list, perpetual_range_start, common_data)\nfor videoid_value, video\n- in iteritems(video_list.videos)]\n+ in video_list.videos.items()]\n# If genre_id exists add possibility to browse LoCo sub-genres\nif sub_genre_id and sub_genre_id != 'None':\n# Create dynamic sub-menu info in MAIN_MENU_ITEMS\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": "\"\"\"\nfrom __future__ import absolute_import, division, unicode_literals\n-from future.utils import iteritems\n-\nfrom resources.lib import common\nfrom resources.lib.utils.data_types import (VideoListSorted, SubgenreList, SeasonList, EpisodeList, LoCo, VideoList,\nSearchVideoList, CustomVideoList)\n@@ -39,7 +37,7 @@ class DirectoryPathRequests(object):\nif video_list:\n# pylint: disable=unused-variable\nitems = [common.VideoId.from_videolist_item(video)\n- for video_id, video in iteritems(video_list.videos)\n+ for video_id, video in video_list.videos.items()\nif video['queue'].get('inQueue', False)]\nreturn items\nexcept InvalidVideoListTypeError:\n" }, { "change_type": "MODIFY", "old_path": "resources/lib/services/settings_monitor.py", "new_path": "resources/lib/services/settings_monitor.py", "diff": "\"\"\"\nfrom __future__ import absolute_import, division, unicode_literals\nimport sys\n-from future.utils import iteritems\nimport xbmc\n@@ -65,7 +64,7 @@ class SettingsMonitor(xbmc.Monitor):\n_check_esn()\n# Check menu settings changes\n- for menu_id, menu_data in iteritems(G.MAIN_MENU_ITEMS):\n+ for menu_id, menu_data in G.MAIN_MENU_ITEMS.items():\n# Check settings changes in show/hide menu\nif menu_data.get('has_show_setting', True):\nshow_menu_new_setting = bool(G.ADDON.getSettingBool('_'.join(('show_menu', menu_id))))\n" }, { "change_type": "MODIFY", "old_path": "resources/lib/utils/api_paths.py", "new_path": "resources/lib/utils/api_paths.py", "diff": "See LICENSES/MIT.md for more information.\n\"\"\"\nfrom __future__ import absolute_import, division, unicode_literals\n-from future.utils import iteritems\nimport resources.lib.common as common\n@@ -167,7 +166,7 @@ def iterate_references(source):\nlist.\nItems with a key that do not represent an integer are ignored.\"\"\"\nfor index, ref in sorted({int(k): v\n- for k, v in iteritems(source)\n+ for k, v in source.items()\nif common.is_numeric(k)}.items()):\npath = reference_path(ref)\nif path is None:\n@@ -181,7 +180,7 @@ def iterate_references(source):\ndef count_references(source):\ncounter = 0\nfor index, ref in sorted({int(k): v # pylint: disable=unused-variable\n- for k, v in iteritems(source)\n+ for k, v in source.items()\nif common.is_numeric(k)}.items()):\npath = reference_path(ref)\n" }, { "change_type": "MODIFY", "old_path": "resources/lib/utils/data_types.py", "new_path": "resources/lib/utils/data_types.py", "diff": "# pylint: disable=too-few-public-methods\nfrom __future__ import absolute_import, division, unicode_literals\nfrom collections import OrderedDict\n-from future.utils import iteritems, itervalues, listvalues\n+from future.utils import itervalues, listvalues\nimport resources.lib.common as common\n@@ -38,7 +38,7 @@ class LoCo(object):\n\"\"\"Get all video lists\"\"\"\n# It is as property to avoid slow down the loading of main menu\nlists = {}\n- for list_id, list_data in iteritems(self.data['lists']): # pylint: disable=unused-variable\n+ for list_id, list_data in self.data['lists'].items(): # pylint: disable=unused-variable\nlists.update({list_id: VideoListLoCo(self.data, list_id)})\nreturn lists\n@@ -48,19 +48,19 @@ class LoCo(object):\n:param contexts: list of context names\n:param break_on_first: stop the research at first match\n- :return iteritems of a dict where key=list id, value=VideoListLoCo object data\n+ :return iterable items of a dict where key=list id, value=VideoListLoCo object data\n\"\"\"\nlists = {}\n- for list_id, list_data in iteritems(self.data['lists']):\n+ for list_id, list_data in self.data['lists'].items():\nif list_data['componentSummary']['context'] in contexts:\nlists.update({list_id: VideoListLoCo(self.data, list_id)})\nif break_on_first:\nbreak\n- return iteritems(lists)\n+ return lists.items()\ndef find_by_context(self, context):\n\"\"\"Return the video list and the id list of a context\"\"\"\n- for list_id, data in iteritems(self.data['lists']):\n+ for list_id, data in self.data['lists'].items():\nif data['componentSummary']['context'] != context:\ncontinue\nreturn list_id, VideoListLoCo(self.data, list_id)\n@@ -257,7 +257,7 @@ class SubgenreList:\ndef merge_data_type(data, data_to_merge):\n- for video_id, video in iteritems(data_to_merge.videos):\n+ for video_id, video in data_to_merge.videos.items():\ndata.videos[video_id] = video\ndata.videoids.extend(data_to_merge.videoids)\ndata.contained_titles.extend(data_to_merge.contained_titles)\n" }, { "change_type": "MODIFY", "old_path": "resources/lib/utils/logging.py", "new_path": "resources/lib/utils/logging.py", "diff": "@@ -13,7 +13,6 @@ from __future__ import absolute_import, division, unicode_literals\nimport sys\nimport time\nfrom functools import wraps\n-from future.utils import iteritems\nimport xbmc\n@@ -138,7 +137,7 @@ def logdetails_decorator(func):\nthat = args[0]\nclass_name = that.__class__.__name__\narguments = [':{} = {}:'.format(key, value)\n- for key, value in iteritems(kwargs)\n+ for key, value in kwargs.items()\nif key not in ['account', 'credentials']]\nif arguments:\nLOG.debug('{cls}::{method} called with arguments {args}',\n" }, { "change_type": "MODIFY", "old_path": "resources/lib/utils/website.py", "new_path": "resources/lib/utils/website.py", "diff": "@@ -12,8 +12,6 @@ from __future__ import absolute_import, division, unicode_literals\nimport json\nfrom re import search, compile as recompile, DOTALL, sub\n-from future.utils import iteritems\n-\nimport xbmc\nimport resources.lib.common as common\n@@ -141,7 +139,7 @@ def parse_profiles(data):\nraise InvalidProfilesError('It has not been possible to obtain the list of profiles.')\nsort_order = 0\ncurrent_guids = []\n- for index, profile_data in iteritems(profiles_list): # pylint: disable=unused-variable\n+ for index, profile_data in profiles_list.items(): # pylint: disable=unused-variable\nsummary = jgraph_get('summary', profile_data)\nguid = summary['guid']\ncurrent_guids.append(guid)\n@@ -153,7 +151,7 @@ def parse_profiles(data):\n# Add profile language description translated from locale\nsummary['language_desc'] = xbmc.convertLanguage(summary['language'][:2], xbmc.ENGLISH_NAME)\nif LOG.level == LOG.LEVEL_VERBOSE:\n- for key, value in iteritems(summary):\n+ for key, value in summary.items():\nif key in PROFILE_DEBUG_INFO:\nLOG.debug('Profile info {}', {key: value})\n# Translate the profile name, is coded as HTML\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
Drop future iteritems
106,046
16.12.2020 11:15:40
-3,600
a1de963a87b74fb6a5e5d4bb063ba67b70673351
Drop future itervalues
[ { "change_type": "MODIFY", "old_path": "resources/lib/kodi/infolabels.py", "new_path": "resources/lib/kodi/infolabels.py", "diff": "@@ -11,8 +11,6 @@ from __future__ import absolute_import, division, unicode_literals\nimport copy\n-from future.utils import itervalues\n-\nimport resources.lib.utils.api_paths as paths\nimport resources.lib.utils.api_requests as api\nimport resources.lib.common as common\n@@ -194,7 +192,7 @@ def _parse_tags(item):\n\"\"\"Parse the tags\"\"\"\nreturn {'tag': [tagdef['name']\nfor tagdef\n- in itervalues(item.get('tags', {}))\n+ in item.get('tags', {}).values()\nif isinstance(tagdef.get('name', {}), unicode)]}\n" }, { "change_type": "MODIFY", "old_path": "resources/lib/utils/api_requests.py", "new_path": "resources/lib/utils/api_requests.py", "diff": "@@ -11,8 +11,6 @@ from __future__ import absolute_import, division, unicode_literals\nfrom functools import wraps\n-from future.utils import itervalues\n-\nimport resources.lib.common as common\nimport resources.lib.kodi.ui as ui\nfrom resources.lib.common import cache_utils\n@@ -233,7 +231,7 @@ def get_available_audio_languages():\n}\nresponse = common.make_call('path_request', call_args)\nlang_list = {}\n- for lang_dict in itervalues(response.get('spokenAudioLanguages', {})):\n+ for lang_dict in response.get('spokenAudioLanguages', {}).values():\nlang_list[lang_dict['id']] = lang_dict['name']\nreturn lang_list\n@@ -245,7 +243,7 @@ def get_available_subtitles_languages():\n}\nresponse = common.make_call('path_request', call_args)\nlang_list = {}\n- for lang_dict in itervalues(response.get('subtitleLanguages', {})):\n+ for lang_dict in response.get('subtitleLanguages', {}).values():\nlang_list[lang_dict['id']] = lang_dict['name']\nreturn lang_list\n" }, { "change_type": "MODIFY", "old_path": "resources/lib/utils/data_types.py", "new_path": "resources/lib/utils/data_types.py", "diff": "# pylint: disable=too-few-public-methods\nfrom __future__ import absolute_import, division, unicode_literals\nfrom collections import OrderedDict\n-from future.utils import itervalues, listvalues\n+from future.utils import listvalues\nimport resources.lib.common as common\n@@ -122,7 +122,7 @@ class VideoList:\nelse next(iter(self.data['lists']))))\nself.videos = OrderedDict(resolve_refs(self.data['lists'][self.videoid.value], self.data))\nif self.videos:\n- # self.artitem = next(itervalues(self.videos))\n+ # self.artitem = next(self.videos.values())\nself.artitem = listvalues(self.videos)[0]\nself.contained_titles = _get_titles(self.videos)\ntry:\n@@ -158,7 +158,7 @@ class VideoListSorted:\nif context_id else path_response[context_name][req_sort_order_type]\nself.videos = OrderedDict(resolve_refs(self.data_lists, self.data))\nif self.videos:\n- # self.artitem = next(itervalues(self.videos))\n+ # self.artitem = next(self.videos.values())\nself.artitem = listvalues(self.videos)[0]\nself.contained_titles = _get_titles(self.videos)\ntry:\n@@ -188,7 +188,7 @@ class SearchVideoList:\nself.title = common.get_local_string(30100).format(list(self.data['search']['byTerm'])[0][1:])\nself.videos = OrderedDict(resolve_refs(list(self.data['search']['byReference'].values())[0], self.data))\nself.videoids = _get_videoids(self.videos)\n- # self.artitem = next(itervalues(self.videos), None)\n+ # self.artitem = next(self.videos.values(), None)\nself.artitem = listvalues(self.videos)[0] if self.videos else None\nself.contained_titles = _get_titles(self.videos)\n@@ -207,7 +207,7 @@ class CustomVideoList:\nself.data = path_response\nself.videos = OrderedDict(self.data.get('videos', {}))\nself.videoids = _get_videoids(self.videos)\n- # self.artitem = next(itervalues(self.videos))\n+ # self.artitem = next(self.videos.values())\nself.artitem = listvalues(self.videos)[0] if self.videos else None\nself.contained_titles = _get_titles(self.videos)\n@@ -277,14 +277,14 @@ def _get_title(video):\ndef _get_titles(videos):\n\"\"\"Return a list of videos' titles\"\"\"\nreturn [_get_title(video)\n- for video in itervalues(videos)\n+ for video in videos.values()\nif _get_title(video)]\ndef _get_videoids(videos):\n\"\"\"Return a list of VideoId s for the videos\"\"\"\nreturn [common.VideoId.from_videolist_item(video)\n- for video in itervalues(videos)]\n+ for video in videos.values()]\ndef _filterout_loco_contexts(root_id, data, contexts):\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
Drop future itervalues
106,046
16.12.2020 11:19:24
-3,600
89a2b21021ffc9e6b5067493e5e49ace96978ee3
Drop future listvalues
[ { "change_type": "MODIFY", "old_path": "resources/lib/utils/data_types.py", "new_path": "resources/lib/utils/data_types.py", "diff": "# pylint: disable=too-few-public-methods\nfrom __future__ import absolute_import, division, unicode_literals\nfrom collections import OrderedDict\n-from future.utils import listvalues\nimport resources.lib.common as common\n@@ -89,7 +88,7 @@ class VideoListLoCo:\n# Set first videos titles (special handling for menus see parse_info in infolabels.py)\nself.contained_titles = _get_titles(self.videos)\n# Set art data of first video (special handling for menus see parse_info in infolabels.py)\n- self.artitem = listvalues(self.videos)[0]\n+ self.artitem = list(self.videos.values())[0]\ntry:\nself.videoids = _get_videoids(self.videos)\nexcept KeyError:\n@@ -123,7 +122,7 @@ class VideoList:\nself.videos = OrderedDict(resolve_refs(self.data['lists'][self.videoid.value], self.data))\nif self.videos:\n# self.artitem = next(self.videos.values())\n- self.artitem = listvalues(self.videos)[0]\n+ self.artitem = list(self.videos.values())[0]\nself.contained_titles = _get_titles(self.videos)\ntry:\nself.videoids = _get_videoids(self.videos)\n@@ -159,7 +158,7 @@ class VideoListSorted:\nself.videos = OrderedDict(resolve_refs(self.data_lists, self.data))\nif self.videos:\n# self.artitem = next(self.videos.values())\n- self.artitem = listvalues(self.videos)[0]\n+ self.artitem = list(self.videos.values())[0]\nself.contained_titles = _get_titles(self.videos)\ntry:\nself.videoids = _get_videoids(self.videos)\n@@ -189,7 +188,7 @@ class SearchVideoList:\nself.videos = OrderedDict(resolve_refs(list(self.data['search']['byReference'].values())[0], self.data))\nself.videoids = _get_videoids(self.videos)\n# self.artitem = next(self.videos.values(), None)\n- self.artitem = listvalues(self.videos)[0] if self.videos else None\n+ self.artitem = list(self.videos.values())[0] if self.videos else None\nself.contained_titles = _get_titles(self.videos)\ndef __getitem__(self, key):\n@@ -208,7 +207,7 @@ class CustomVideoList:\nself.videos = OrderedDict(self.data.get('videos', {}))\nself.videoids = _get_videoids(self.videos)\n# self.artitem = next(self.videos.values())\n- self.artitem = listvalues(self.videos)[0] if self.videos else None\n+ self.artitem = list(self.videos.values())[0] if self.videos else None\nself.contained_titles = _get_titles(self.videos)\ndef __getitem__(self, key):\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
Drop future listvalues
106,046
16.12.2020 11:53:22
-3,600
4dce9d3e0dff648f8075854571a62c583f55ef39
Drop workarounds to Kodi API changes
[ { "change_type": "MODIFY", "old_path": "resources/lib/common/fileops.py", "new_path": "resources/lib/common/fileops.py", "diff": "@@ -16,16 +16,6 @@ import xbmcvfs\nfrom resources.lib.globals import G\nfrom .misc_utils import build_url\n-try: # Kodi >= 19\n- from xbmcvfs import makeLegalFilename # pylint: disable=ungrouped-imports\n-except ImportError: # Kodi 18\n- from xbmc import makeLegalFilename # pylint: disable=ungrouped-imports\n-\n-try: # Kodi >= 19\n- from xbmcvfs import translatePath # pylint: disable=ungrouped-imports\n-except ImportError: # Kodi 18\n- from xbmc import translatePath # pylint: disable=ungrouped-imports\n-\ndef check_folder_path(path):\n\"\"\"\n@@ -64,7 +54,7 @@ def file_exists(file_path):\n:param file_path: File path to check\n:return: True if exists\n\"\"\"\n- return xbmcvfs.exists(translatePath(file_path))\n+ return xbmcvfs.exists(xbmcvfs.translatePath(file_path))\ndef copy_file(from_path, to_path):\n@@ -75,8 +65,8 @@ def copy_file(from_path, to_path):\n:return: True if copied\n\"\"\"\ntry:\n- return xbmcvfs.copy(translatePath(from_path),\n- translatePath(to_path))\n+ return xbmcvfs.copy(xbmcvfs.translatePath(from_path),\n+ xbmcvfs.translatePath(to_path))\nfinally:\npass\n@@ -98,7 +88,7 @@ def save_file(file_path, content, mode='wb'):\n:param content: The content of the file\n:param mode: optional mode options\n\"\"\"\n- file_handle = xbmcvfs.File(translatePath(file_path), mode)\n+ file_handle = xbmcvfs.File(xbmcvfs.translatePath(file_path), mode)\ntry:\nfile_handle.write(bytearray(content))\nfinally:\n@@ -122,7 +112,7 @@ def load_file(file_path, mode='rb'):\n:param mode: optional mode options\n:return: The content of the file\n\"\"\"\n- file_handle = xbmcvfs.File(translatePath(file_path), mode)\n+ file_handle = xbmcvfs.File(xbmcvfs.translatePath(file_path), mode)\ntry:\nreturn file_handle.readBytes().decode('utf-8')\nfinally:\n@@ -138,7 +128,7 @@ def delete_file_safe(file_path):\ndef delete_file(filename):\n- file_path = translatePath(os.path.join(G.DATA_PATH, filename))\n+ file_path = xbmcvfs.translatePath(os.path.join(G.DATA_PATH, filename))\ntry:\nxbmcvfs.delete(file_path)\nfinally:\n@@ -159,7 +149,7 @@ def delete_folder_contents(path, delete_subfolders=False):\n:param path: Path to perform delete contents\n:param delete_subfolders: If True delete also all subfolders\n\"\"\"\n- directories, files = list_dir(translatePath(path))\n+ directories, files = list_dir(xbmcvfs.translatePath(path))\nfor filename in files:\nxbmcvfs.delete(os.path.join(path, filename))\nif not delete_subfolders:\n@@ -176,12 +166,12 @@ def delete_folder(path):\ndelete_folder_contents(path, True)\n# Give time because the system performs previous op. otherwise it can't delete the folder\nxbmc.sleep(80)\n- xbmcvfs.rmdir(translatePath(path))\n+ xbmcvfs.rmdir(xbmcvfs.translatePath(path))\ndef write_strm_file(videoid, file_path):\n\"\"\"Write a playable URL to a STRM file\"\"\"\n- filehandle = xbmcvfs.File(translatePath(file_path), 'wb')\n+ filehandle = xbmcvfs.File(xbmcvfs.translatePath(file_path), 'wb')\ntry:\nfilehandle.write(bytearray(build_url(videoid=videoid,\nmode=G.MODE_PLAY_STRM).encode('utf-8')))\n@@ -191,7 +181,7 @@ def write_strm_file(videoid, file_path):\ndef write_nfo_file(nfo_data, file_path):\n\"\"\"Write a NFO file\"\"\"\n- filehandle = xbmcvfs.File(translatePath(file_path), 'wb')\n+ filehandle = xbmcvfs.File(xbmcvfs.translatePath(file_path), 'wb')\ntry:\nfilehandle.write(bytearray('<?xml version=\\'1.0\\' encoding=\\'UTF-8\\'?>'.encode('utf-8')))\nfilehandle.write(bytearray(ET.tostring(nfo_data, encoding='utf-8', method='xml')))\n@@ -202,4 +192,4 @@ def write_nfo_file(nfo_data, file_path):\ndef join_folders_paths(*args):\n\"\"\"Join multiple folder paths in a safe way\"\"\"\n# Avoid the use of os.path.join, in some cases with special chars like % break the path\n- return makeLegalFilename('/'.join(args))\n+ return xbmcvfs.makeLegalFilename('/'.join(args))\n" }, { "change_type": "MODIFY", "old_path": "resources/lib/common/kodi_library_ops.py", "new_path": "resources/lib/common/kodi_library_ops.py", "diff": "\"\"\"\nimport os\n+import xbmcvfs\n+\nfrom resources.lib.globals import G\nfrom resources.lib.utils.logging import LOG\nfrom .exceptions import ItemNotFound\nfrom .kodi_ops import json_rpc, get_local_string, json_rpc_multi\nfrom .videoid import VideoId\n-try: # Kodi >= 19\n- from xbmcvfs import makeLegalFilename # pylint: disable=ungrouped-imports\n-except ImportError: # Kodi 18\n- from xbmc import makeLegalFilename # pylint: disable=ungrouped-imports\n-\n-try: # Kodi >= 19\n- from xbmcvfs import translatePath # pylint: disable=ungrouped-imports\n-except ImportError: # Kodi 18\n- from xbmc import translatePath # pylint: disable=ungrouped-imports\n-\nLIBRARY_PROPS = {\n'episode': ['title', 'plot', 'writer', 'playcount', 'director', 'season',\n@@ -71,7 +63,7 @@ def scan_library(path=''):\n:param path: Update only the library elements in the specified path (fast processing)\n\"\"\"\nmethod = 'VideoLibrary.Scan'\n- params = {'directory': makeLegalFilename(translatePath(path))}\n+ params = {'directory': xbmcvfs.makeLegalFilename(xbmcvfs.translatePath(path))}\nreturn json_rpc(method, params)\n@@ -85,7 +77,7 @@ def clean_library(show_dialog=True, path=''):\nparams = {'content': 'video',\n'showdialogs': show_dialog}\nif not G.KODI_VERSION.is_major_ver('18') and path:\n- params['directory'] = makeLegalFilename(translatePath(path))\n+ params['directory'] = xbmcvfs.makeLegalFilename(xbmcvfs.translatePath(path))\nreturn json_rpc(method, params)\n@@ -128,9 +120,9 @@ def _get_videoid_file_path(videoid):\ndef _get_item_details_from_kodi(mediatype, file_path):\n\"\"\"Get a Kodi library item with details (from Kodi database) by searching with the file path\"\"\"\n# To ensure compatibility with previously exported items, make the filename legal\n- file_path = makeLegalFilename(file_path)\n- dir_path = os.path.dirname(translatePath(file_path))\n- filename = os.path.basename(translatePath(file_path))\n+ file_path = xbmcvfs.makeLegalFilename(file_path)\n+ dir_path = os.path.dirname(xbmcvfs.translatePath(file_path))\n+ filename = os.path.basename(xbmcvfs.translatePath(file_path))\n# We get the data from Kodi library using filters, this is much faster than loading all episodes in memory.\nif file_path[:10] == 'special://':\n# If the path is special, search with real directory path and also special path\n" }, { "change_type": "MODIFY", "old_path": "resources/lib/database/db_utils.py", "new_path": "resources/lib/database/db_utils.py", "diff": "@@ -13,11 +13,6 @@ import xbmcvfs\nfrom resources.lib.globals import G\n-try: # Kodi >= 19\n- from xbmcvfs import translatePath # pylint: disable=ungrouped-imports\n-except ImportError: # Kodi 18\n- from xbmc import translatePath # pylint: disable=ungrouped-imports\n-\nLOCAL_DB_FILENAME = 'nf_local.sqlite3'\nSHARED_DB_FILENAME = 'nf_shared.sqlite3'\n@@ -41,7 +36,7 @@ VidLibProp = {\ndef get_local_db_path(db_filename):\n# First ensure database folder exists\nfrom resources.lib.common import folder_exists\n- db_folder = translatePath(os.path.join(G.DATA_PATH, 'database'))\n+ db_folder = xbmcvfs.translatePath(os.path.join(G.DATA_PATH, 'database'))\nif not folder_exists(db_folder):\nxbmcvfs.mkdirs(db_folder)\nreturn os.path.join(db_folder, db_filename)\n" }, { "change_type": "MODIFY", "old_path": "resources/lib/globals.py", "new_path": "resources/lib/globals.py", "diff": "@@ -22,12 +22,9 @@ except ImportError: # Python 2\nfrom urlparse import parse_qsl, urlparse\nimport xbmcaddon\n+import xbmcvfs\nfrom xbmcgui import Window\n-try: # Kodi >= 19\n- from xbmcvfs import translatePath # pylint: disable=ungrouped-imports\n-except ImportError: # Kodi 18\n- from xbmc import translatePath # pylint: disable=ungrouped-imports\ntry: # Python 2\nunicode\n@@ -265,7 +262,7 @@ class GlobalVariables(object):\nos.path.join(self.ADDON_DATA_PATH, 'packages', 'mysql-connector-python')\n]\nfor path in packages_paths: # packages_paths has unicode type values\n- path = translatePath(path)\n+ path = xbmcvfs.translatePath(path)\nif path not in sys.path:\n# Add embedded package path to python system directory\nsys.path.insert(0, path)\n" }, { "change_type": "MODIFY", "old_path": "resources/lib/kodi/library.py", "new_path": "resources/lib/kodi/library.py", "diff": "import os\nfrom datetime import datetime\n+import xbmcvfs\n+\nimport resources.lib.utils.api_requests as api\nimport resources.lib.common as common\nimport resources.lib.kodi.nfo as nfo\n@@ -24,11 +26,6 @@ from resources.lib.kodi.library_utils import (request_kodi_library_update, get_l\nget_library_subfolders, delay_anti_ban)\nfrom resources.lib.utils.logging import LOG, measure_exec_time_decorator\n-try: # Kodi >= 19\n- from xbmcvfs import translatePath # pylint: disable=ungrouped-imports\n-except ImportError: # Kodi 18\n- from xbmc import translatePath # pylint: disable=ungrouped-imports\n-\ntry: # Python 2\nunicode\nexcept NameError: # Python 3\n@@ -319,7 +316,7 @@ class Library(LibraryTasks):\nfolders = get_library_subfolders(FOLDER_NAME_MOVIES, path) + get_library_subfolders(FOLDER_NAME_SHOWS, path)\nwith ui.ProgressDialog(True, max_value=len(folders)) as progress_bar:\nfor folder_path in folders:\n- folder_name = os.path.basename(translatePath(folder_path))\n+ folder_name = os.path.basename(xbmcvfs.translatePath(folder_path))\nprogress_bar.set_message(folder_name)\ntry:\nvideoid = self.import_videoid_from_existing_strm(folder_path, folder_name)\n" }, { "change_type": "MODIFY", "old_path": "resources/lib/kodi/library_jobs.py", "new_path": "resources/lib/kodi/library_jobs.py", "diff": "@@ -20,11 +20,6 @@ from resources.lib.globals import G\nfrom resources.lib.kodi.library_utils import remove_videoid_from_db, insert_videoid_to_db\nfrom resources.lib.utils.logging import LOG\n-try: # Kodi >= 19\n- from xbmcvfs import translatePath # pylint: disable=ungrouped-imports\n-except ImportError: # Kodi 18\n- from xbmc import translatePath # pylint: disable=ungrouped-imports\n-\nclass LibraryJobs(object):\n\"\"\"Type of jobs for a task in order to execute library operations\"\"\"\n@@ -67,10 +62,10 @@ class LibraryJobs(object):\nLOG.debug('Removing {} ({}) from add-on library', videoid, job_data['title'])\ntry:\n# Remove the STRM file exported\n- exported_file_path = translatePath(job_data['file_path'])\n+ exported_file_path = xbmcvfs.translatePath(job_data['file_path'])\ncommon.delete_file_safe(exported_file_path)\n- parent_folder = translatePath(os.path.dirname(exported_file_path))\n+ parent_folder = xbmcvfs.translatePath(os.path.dirname(exported_file_path))\n# Remove the NFO file of the related STRM file\nnfo_file = os.path.splitext(exported_file_path)[0] + '.nfo'\n" }, { "change_type": "MODIFY", "old_path": "resources/lib/services/playback/am_playback.py", "new_path": "resources/lib/services/playback/am_playback.py", "diff": "import time\nimport xbmc\n+import xbmcvfs\nimport resources.lib.common as common\nfrom resources.lib.globals import G\nfrom resources.lib.utils.logging import LOG\nfrom .action_manager import ActionManager\n-try: # Kodi >= 19\n- from xbmcvfs import translatePath # pylint: disable=ungrouped-imports\n-except ImportError: # Kodi 18\n- from xbmc import translatePath # pylint: disable=ungrouped-imports\n-\nclass AMPlayback(ActionManager):\n\"\"\"Operations for changing the playback status\"\"\"\n@@ -92,7 +88,7 @@ class AMPlayback(ActionManager):\nself.videoid.tvshowid,\nself.videoid.seasonid,\nself.videoid.episodeid)\n- url = translatePath(file_path)\n+ url = xbmcvfs.translatePath(file_path)\nif G.KODI_VERSION.is_major_ver('18'):\ncommon.json_rpc('Files.SetFileDetails',\n{\"file\": url, \"media\": \"video\", \"resume\": {\"position\": 0, \"total\": 0}, \"playcount\": 1})\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+import xbmcvfs\n+\nimport resources.lib.common as common\nfrom resources.lib.globals import G\nfrom resources.lib.utils.logging import LOG\nfrom .action_manager import ActionManager\n-try: # Kodi >= 19\n- from xbmcvfs import translatePath # pylint: disable=ungrouped-imports\n-except ImportError: # Kodi 18\n- from xbmc import translatePath # pylint: disable=ungrouped-imports\n-\nclass AMUpNextNotifier(ActionManager):\n\"\"\"\n@@ -58,7 +55,7 @@ class AMUpNextNotifier(ActionManager):\nself.videoid_next_episode.tvshowid,\nself.videoid_next_episode.seasonid,\nself.videoid_next_episode.episodeid)\n- url = translatePath(file_path)\n+ url = xbmcvfs.translatePath(file_path)\nelse:\nurl = common.build_url(videoid=self.videoid_next_episode,\nmode=G.MODE_PLAY,\n" }, { "change_type": "MODIFY", "old_path": "resources/lib/upgrade_actions.py", "new_path": "resources/lib/upgrade_actions.py", "diff": "@@ -19,11 +19,6 @@ from resources.lib.kodi import ui\nfrom resources.lib.kodi.library_utils import get_library_subfolders, FOLDER_NAME_MOVIES, FOLDER_NAME_SHOWS\nfrom resources.lib.utils.logging import LOG\n-try: # Kodi >= 19\n- from xbmcvfs import translatePath # pylint: disable=ungrouped-imports\n-except ImportError: # Kodi 18\n- from xbmc import translatePath # pylint: disable=ungrouped-imports\n-\ndef rename_cookie_file():\n# The file \"COOKIE_xxxxxx...\" will be renamed to \"COOKIES\"\n@@ -39,7 +34,7 @@ def rename_cookie_file():\ndef delete_cache_folder():\n# Delete cache folder in the add-on userdata (no more needed with the new cache management)\ncache_path = os.path.join(G.DATA_PATH, 'cache')\n- if not os.path.exists(translatePath(cache_path)):\n+ if not os.path.exists(xbmcvfs.translatePath(cache_path)):\nreturn\nLOG.debug('Deleting the cache folder from add-on userdata folder')\ntry:\n@@ -64,7 +59,7 @@ def migrate_library():\ntitle='Migrating library to new format',\nmax_value=len(folders)) as progress_bar:\nfor folder_path in folders:\n- folder_name = os.path.basename(translatePath(folder_path))\n+ folder_name = os.path.basename(xbmcvfs.translatePath(folder_path))\nprogress_bar.set_message('PLEASE WAIT - Migrating: ' + folder_name)\n_migrate_strm_files(folder_path)\nexcept Exception as exc: # pylint: disable=broad-except\n" }, { "change_type": "MODIFY", "old_path": "resources/lib/utils/cookies.py", "new_path": "resources/lib/utils/cookies.py", "diff": "@@ -20,11 +20,6 @@ try:\nexcept ImportError:\nimport pickle\n-try: # Kodi >= 19\n- from xbmcvfs import translatePath # pylint: disable=ungrouped-imports\n-except ImportError: # Kodi 18\n- from xbmc import translatePath # pylint: disable=ungrouped-imports\n-\ndef save(cookie_jar, log_output=True):\n\"\"\"Save a cookie jar to file and in-memory storage\"\"\"\n@@ -91,7 +86,7 @@ def log_cookie(cookie_jar):\ndef cookie_file_path():\n\"\"\"Return the file path to store cookies\"\"\"\n- return translatePath(G.COOKIES_PATH)\n+ return xbmcvfs.translatePath(G.COOKIES_PATH)\ndef convert_chrome_cookie(cookie):\n" }, { "change_type": "MODIFY", "old_path": "tests/xbmcvfs.py", "new_path": "tests/xbmcvfs.py", "diff": "@@ -93,3 +93,14 @@ def rmdir(path):\ndef makeLegalFilename(filename): # Kodi >= 19 (on xbmc there is the method for Kodi 18)\n\"\"\"A reimplementation of the xbmc makeLegalFilename() function\"\"\"\nreturn os.path.basename(filename)\n+\n+\n+def translatePath(path): # Kodi >= 19 (on xbmc there is the method for Kodi 18)\n+ \"\"\"A stub implementation of the xbmc translatePath() function\"\"\"\n+ if path.startswith('special://home'):\n+ return path.replace('special://home', os.path.join(os.getcwd(), 'test'))\n+ if path.startswith('special://profile'):\n+ return path.replace('special://profile', os.path.join(os.getcwd(), 'tests/usedata'))\n+ if path.startswith('special://userdata'):\n+ return path.replace('special://userdata', os.path.join(os.getcwd(), 'tests/userdata'))\n+ return path\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
Drop workarounds to Kodi API changes
106,046
16.12.2020 12:43:17
-3,600
77f803ccda8cfde72ad4e05ef8febed791d1527b
Drop PY_IS_VER2 code for python 2
[ { "change_type": "MODIFY", "old_path": "resources/lib/common/cache_utils.py", "new_path": "resources/lib/common/cache_utils.py", "diff": "@@ -108,26 +108,13 @@ def _get_identifier(fixed_identifier, identify_from_kwarg_name,\ndef serialize_data(value):\n- if G.PY_IS_VER2:\n- # On python 2 pickle.dumps produces str\n- # Pickle on python 2 use non-standard byte-string seem not possible convert it in to byte in a easy way\n- # then serialize it with base64\n- from base64 import standard_b64encode\n- return standard_b64encode(pickle.dumps(value, protocol=pickle.HIGHEST_PROTOCOL))\n- # On python 3 pickle.dumps produces byte\nreturn pickle.dumps(value, protocol=pickle.HIGHEST_PROTOCOL)\ndef deserialize_data(value):\ntry:\n- if G.PY_IS_VER2:\n- # On python 2 pickle.loads wants str\n- from base64 import standard_b64decode\n- return pickle.loads(standard_b64decode(value))\n- # On python 3 pickle.loads wants byte\nreturn pickle.loads(value)\nexcept (pickle.UnpicklingError, TypeError, EOFError) as exc:\n# TypeError/EOFError happen when standard_b64decode fails\n- # This should happen only if manually mixing the database data\nLOG.error('It was not possible to deserialize the cache data, try purge cache from expert settings menu')\nraise CacheMiss from exc\n" }, { "change_type": "MODIFY", "old_path": "resources/lib/globals.py", "new_path": "resources/lib/globals.py", "diff": "@@ -206,7 +206,6 @@ class GlobalVariables(object):\n# The class initialization (GlobalVariables) will only take place at the first initialization of this module\n# on subsequent add-on invocations (invoked by reuseLanguageInvoker) will have no effect.\n# Define here also any other variables necessary for the correct loading of the other project modules\n- self.PY_IS_VER2 = sys.version_info.major == 2\nself.WND_KODI_HOME = Window(10000) # Kodi home window\nself.IS_ADDON_FIRSTRUN = None\nself.ADDON = None\n" }, { "change_type": "MODIFY", "old_path": "resources/lib/utils/cookies.py", "new_path": "resources/lib/utils/cookies.py", "diff": "@@ -52,10 +52,6 @@ def load():\nLOG.debug('Loading cookies from {}', file_path)\ncookie_file = xbmcvfs.File(file_path, 'rb')\ntry:\n- if G.PY_IS_VER2:\n- # pickle.loads on py2 wants string\n- cookie_jar = pickle.loads(cookie_file.read())\n- else:\ncookie_jar = pickle.loads(cookie_file.readBytes())\n# Clear flwssn cookie if present, as it is trouble with early expiration\nif 'flwssn' in cookie_jar:\n" }, { "change_type": "MODIFY", "old_path": "resources/lib/utils/logging.py", "new_path": "resources/lib/utils/logging.py", "diff": "SPDX-License-Identifier: MIT\nSee LICENSES/MIT.md for more information.\n\"\"\"\n-import sys\nimport time\nfrom functools import wraps\n@@ -32,7 +31,6 @@ class Logging(object):\nLEVEL_NOTSET = None\ndef __init__(self):\n- self.PY_IS_VER2 = sys.version_info.major == 2\nself.level = self.LEVEL_NOTSET\nself.__addon_id = None\nself.__plugin_handle = None\n@@ -72,8 +70,6 @@ class Logging(object):\nidentifier=self.__addon_id,\nhandle=self.__plugin_handle,\nmsg=msg)\n- if self.PY_IS_VER2:\n- message = message.encode('utf-8')\nxbmc.log(message, log_level)\ndef _debug(self, msg, *args, **kwargs):\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
Drop PY_IS_VER2 code for python 2
106,046
16.12.2020 13:04:56
-3,600
800faad7c8b5d1b987392219132ddb41d4c973ac
Drop pylint redefined-builtin and related py2 code
[ { "change_type": "MODIFY", "old_path": "resources/lib/common/__init__.py", "new_path": "resources/lib/common/__init__.py", "diff": "SPDX-License-Identifier: MIT\nSee LICENSES/MIT.md for more information.\n\"\"\"\n-from .ipc import * # pylint: disable=redefined-builtin\n-from .videoid import * # pylint: disable=redefined-builtin\n+from .ipc import *\n+from .videoid import *\nfrom .credentials import *\nfrom .fileops import *\n-from .kodi_ops import * # pylint: disable=redefined-builtin\n+from .kodi_ops import *\nfrom .kodi_library_ops import *\nfrom .pathops import *\n-from .device_utils import * # pylint: disable=redefined-builtin\n-from .misc_utils import * # pylint: disable=redefined-builtin\n-from .data_conversion import * # pylint: disable=redefined-builtin\n-from .uuid_device import * # pylint: disable=redefined-builtin\n+from .device_utils import *\n+from .misc_utils import *\n+from .data_conversion import *\n+from .uuid_device import *\n" }, { "change_type": "MODIFY", "old_path": "resources/lib/common/data_conversion.py", "new_path": "resources/lib/common/data_conversion.py", "diff": "@@ -15,12 +15,6 @@ from collections import OrderedDict\nfrom resources.lib.utils.logging import LOG\n-try: # Python 2\n- basestring\n-except NameError: # Python 3\n- basestring = str # pylint: disable=redefined-builtin\n-\n-\nclass DataTypeNotMapped(Exception):\n\"\"\"Data type not mapped\"\"\"\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-try: # Python 2\n- from itertools import imap as map # pylint: disable=redefined-builtin\n-except ImportError:\n- pass\n-\n# try: # Python 3\n# from io import StringIO\n# except ImportError: # Python 2\n" }, { "change_type": "MODIFY", "old_path": "resources/lib/database/db_base_sqlite.py", "new_path": "resources/lib/database/db_base_sqlite.py", "diff": "@@ -18,11 +18,6 @@ import resources.lib.database.db_utils as db_utils\nfrom resources.lib.common.exceptions import DBSQLiteConnectionError, DBSQLiteError\nfrom resources.lib.utils.logging import LOG\n-try: # Python 2\n- from itertools import izip as zip # pylint: disable=redefined-builtin\n-except ImportError:\n- pass\n-\nCONN_ISOLATION_LEVEL = None # Autocommit mode\n" }, { "change_type": "MODIFY", "old_path": "resources/lib/kodi/ui/__init__.py", "new_path": "resources/lib/kodi/ui/__init__.py", "diff": "See LICENSES/MIT.md for more information.\n\"\"\"\n# pylint: disable=wildcard-import\n-from .dialogs import * # pylint: disable=redefined-builtin\n+from .dialogs import *\nfrom .xmldialogs import *\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
Drop pylint redefined-builtin and related py2 code
106,046
16.12.2020 14:19:04
-3,600
01025e20d335bbaa59e2229c8b90c0ba6e44a513
Removed double code oversight as result of removed py2 workaround
[ { "change_type": "MODIFY", "old_path": "resources/lib/services/msl/msl_utils.py", "new_path": "resources/lib/services/msl/msl_utils.py", "diff": "@@ -54,9 +54,6 @@ def display_error_info(func):\ntry:\nreturn func(*args, **kwargs)\nexcept Exception as exc:\n- if isinstance(exc, MSLError):\n- message = exc.__class__.__name__ + ': ' + str(exc)\n- else:\nmessage = exc.__class__.__name__ + ': ' + str(exc)\nui.show_error_info(common.get_local_string(30028), message,\nunknown_error=not message,\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
Removed double code oversight as result of removed py2 workaround
106,046
16.12.2020 17:16:49
-3,600
d54c33cb5af1001a271f8c228b2e5429b12658e3
Drop remaining specific code for Kodi 18
[ { "change_type": "MODIFY", "old_path": "resources/lib/common/kodi_library_ops.py", "new_path": "resources/lib/common/kodi_library_ops.py", "diff": "@@ -76,7 +76,7 @@ def clean_library(show_dialog=True, path=''):\nmethod = 'VideoLibrary.Clean'\nparams = {'content': 'video',\n'showdialogs': show_dialog}\n- if not G.KODI_VERSION.is_major_ver('18') and path:\n+ if path:\nparams['directory'] = xbmcvfs.makeLegalFilename(xbmcvfs.translatePath(path))\nreturn json_rpc(method, params)\n" }, { "change_type": "MODIFY", "old_path": "resources/lib/common/kodi_ops.py", "new_path": "resources/lib/common/kodi_ops.py", "diff": "@@ -195,47 +195,6 @@ def fix_locale_languages(data_list):\n# es-ES as 'Spanish-Spanish', pt-BR as 'Portuguese-Breton', nl-BE as 'Dutch-Belarusian', etc\n# and the impossibility to set them as the default audio/subtitle language\n# Issue: https://github.com/xbmc/xbmc/issues/15308\n- if G.KODI_VERSION.is_major_ver('18'):\n- _fix_locale_languages_kodi18(data_list)\n- else:\n- _fix_locale_languages(data_list)\n-\n-\n-def _fix_locale_languages_kodi18(data_list):\n- # Get all the ISO 639-1 codes (without country)\n- verify_unofficial_lang = not G.KODI_VERSION.is_less_version('18.7')\n- locale_list_nocountry = []\n- for item in data_list:\n- if item.get('isNoneTrack', False):\n- continue\n- if verify_unofficial_lang and item['language'] == 'pt-BR':\n- # Replace pt-BR with pb, is an unofficial ISO 639-1 Portuguese (Brazil) language code\n- # has been added to Kodi 18.7 and Kodi 19.x PR: https://github.com/xbmc/xbmc/pull/17689\n- item['language'] = 'pb'\n- if len(item['language']) == 2 and not item['language'] in locale_list_nocountry:\n- locale_list_nocountry.append(item['language'])\n- # Replace the locale languages with country with a new one\n- for item in data_list:\n- if item.get('isNoneTrack', False):\n- continue\n- if len(item['language']) == 2:\n- continue\n- item['language'] = _adjust_locale(item['language'],\n- item['language'][0:2] in locale_list_nocountry)\n-\n-\n-def _adjust_locale(locale_code, lang_code_without_country_exists):\n- \"\"\"Locale conversion helper\"\"\"\n- language_code = locale_code[0:2]\n- if not lang_code_without_country_exists:\n- return language_code\n- if locale_code in LOCALE_CONV_TABLE:\n- return LOCALE_CONV_TABLE[locale_code]\n- LOG.debug('AdjustLocale - missing mapping conversion for locale: {}'.format(locale_code))\n- return locale_code\n-\n-\n-def _fix_locale_languages(data_list):\nfor item in data_list:\nif item.get('isNoneTrack', False):\ncontinue\n" }, { "change_type": "MODIFY", "old_path": "resources/lib/kodi/ui/dialogs.py", "new_path": "resources/lib/kodi/ui/dialogs.py", "diff": "@@ -58,9 +58,8 @@ def show_dlg_input_numeric(message, mask_input=True):\n\"\"\"Ask the user to enter numbers\"\"\"\nargs = {'heading': message,\n'type': 0,\n- 'defaultt': ''}\n- if not G.KODI_VERSION.is_major_ver('18'): # Kodi => 19.x support mask input\n- args['bHiddenInput'] = mask_input\n+ 'defaultt': '',\n+ 'bHiddenInput': mask_input}\nreturn xbmcgui.Dialog().numeric(**args) or None\n@@ -86,7 +85,7 @@ def ask_for_resume(resume_position):\nreturn xbmcgui.Dialog().contextmenu(\n[\ncommon.get_local_string(12022).format(common.convert_seconds_to_hms_str(resume_position)),\n- common.get_local_string(12023 if G.KODI_VERSION.is_major_ver('18') else 12021)\n+ common.get_local_string(12021)\n])\n" }, { "change_type": "MODIFY", "old_path": "resources/lib/navigation/directory_utils.py", "new_path": "resources/lib/navigation/directory_utils.py", "diff": "@@ -192,11 +192,6 @@ def auto_scroll(list_data):\ndef _auto_scroll_init_checks():\n- if G.KODI_VERSION.is_major_ver('18'):\n- # Check if a selection is already done\n- if xbmc.getInfoLabel('ListItem.Label') != '..':\n- return False\n- else: # These infoLabel not works on Kodi 18.x\n# Check if view sort method is \"Episode\" (ID 23 = SortByEpisodeNumber)\nif not xbmc.getCondVisibility('Container.SortMethod(23)'):\nreturn False\n" }, { "change_type": "MODIFY", "old_path": "resources/lib/navigation/player.py", "new_path": "resources/lib/navigation/player.py", "diff": "@@ -120,9 +120,6 @@ def _play(videoid, is_played_from_strm=False):\nevent_data['videoid'] = videoid.to_dict()\nevent_data['is_played_by_library'] = is_played_from_strm\n- if 'raspberrypi' in common.get_system_platform():\n- _raspberry_disable_omxplayer()\n-\n# Start and initialize the action controller (see action_controller.py)\nLOG.debug('Sending initialization signal')\ncommon.send_signal(common.Signals.PLAYBACK_INITIATED, {\n@@ -169,7 +166,7 @@ def get_inputstream_listitem(videoid):\nkey=is_helper.inputstream_addon + '.server_certificate',\nvalue=INPUTSTREAM_SERVER_CERTIFICATE)\nlist_item.setProperty(\n- key='inputstreamaddon' if G.KODI_VERSION.is_major_ver('18') else 'inputstream',\n+ key='inputstream',\nvalue=is_helper.inputstream_addon)\nreturn list_item\nexcept Exception as exc: # pylint: disable=broad-except\n@@ -287,13 +284,3 @@ def _find_next_episode(videoid, metadata):\nreturn common.VideoId(tvshowid=videoid.tvshowid,\nseasonid=next_season['id'],\nepisodeid=episode['id'])\n-\n-\n-def _raspberry_disable_omxplayer():\n- \"\"\"Check and disable OMXPlayer (not compatible with Netflix video streams)\"\"\"\n- # Only Kodi 18 has this property, from Kodi 19 OMXPlayer has been removed\n- if not G.KODI_VERSION.is_major_ver('18'):\n- return\n- value = common.json_rpc('Settings.GetSettingValue', {'setting': 'videoplayer.useomxplayer'})\n- if value.get('value'):\n- common.json_rpc('Settings.SetSettingValue', {'setting': 'videoplayer.useomxplayer', 'value': False})\n" }, { "change_type": "MODIFY", "old_path": "resources/lib/services/msl/converter.py", "new_path": "resources/lib/services/msl/converter.py", "diff": "@@ -19,9 +19,6 @@ from resources.lib.utils.logging import LOG\ndef convert_to_dash(manifest):\n\"\"\"Convert a Netflix style manifest to MPEG-DASH manifest\"\"\"\n- from xbmcaddon import Addon\n- isa_version = G.remove_ver_suffix(Addon('inputstream.adaptive').getAddonInfo('version'))\n-\n# If a CDN server has stability problems it may cause errors with streaming,\n# we allow users to select a different CDN server\n# (should be managed by ISA but is currently is not implemented)\n@@ -54,7 +51,7 @@ def convert_to_dash(manifest):\nif text_track['isNoneTrack']:\ncontinue\nis_default = _is_default_subtitle(manifest, text_track)\n- _convert_text_track(text_track, period, is_default, cdn_index, isa_version)\n+ _convert_text_track(text_track, period, is_default, cdn_index)\nxml = ET.tostring(root, encoding='utf-8', method='xml')\nif LOG.level == LOG.LEVEL_VERBOSE:\n@@ -245,18 +242,16 @@ def _convert_audio_downloadable(downloadable, adaptation_set, init_length, chann\n_add_segment_base(representation, init_length)\n-def _convert_text_track(text_track, period, default, cdn_index, isa_version):\n+def _convert_text_track(text_track, period, default, cdn_index):\n# Only one subtitle representation per adaptationset\ndownloadable = text_track.get('ttDownloadables')\nif not text_track:\nreturn\n-\ncontent_profile = list(downloadable)[0]\nis_ios8 = content_profile == 'webvtt-lssdh-ios8'\nimpaired = 'true' if text_track['trackType'] == 'ASSISTIVE' else 'false'\nforced = 'true' if text_track['isForcedNarrative'] else 'false'\ndefault = 'true' if default else 'false'\n-\nadaptation_set = ET.SubElement(\nperiod, # Parent\n'AdaptationSet', # Tag\n@@ -268,21 +263,10 @@ def _convert_text_track(text_track, period, default, cdn_index, isa_version):\nadaptation_set, # Parent\n'Role', # Tag\nschemeIdUri='urn:mpeg:dash:role:2011')\n- # In the future version of InputStream Adaptive, you can set the stream parameters\n- # in the same way as the video stream\n- if common.is_less_version(isa_version, '2.4.3'):\n- # To be removed when the new version is released\n- if forced == 'true':\n- role.set('value', 'forced')\n- else:\n- if default == 'true':\n- role.set('value', 'main')\n- else:\nadaptation_set.set('impaired', impaired)\nadaptation_set.set('forced', forced)\nadaptation_set.set('default', default)\nrole.set('value', 'subtitle')\n-\nrepresentation = ET.SubElement(\nadaptation_set, # Parent\n'Representation', # Tag\n@@ -304,7 +288,7 @@ def _get_id_default_audio_tracks(manifest):\naudio_language = profile_language_code[0:2]\nif not audio_language == 'original':\n# If set give priority to the same audio language with different country\n- if not G.KODI_VERSION.is_major_ver('18') and G.ADDON.getSettingBool('prefer_alternative_lang'):\n+ if G.ADDON.getSettingBool('prefer_alternative_lang'):\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" }, { "change_type": "MODIFY", "old_path": "resources/lib/services/msl/msl_utils.py", "new_path": "resources/lib/services/msl/msl_utils.py", "diff": "@@ -88,11 +88,7 @@ def build_media_tag(player_state, manifest):\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- # Warning 'currentsubtitle' value in player_state on Kodi 18\n- # do not have proprieties like isdefault, isforced, isimpaired\n- # if in the future the implementation will be done it should be available only on Kodi 19\n- # then for now we leave the subtitles as disabled\n-\n+ # Todo: subtitles data set always as disabled, could be added in future\ntext_track_id = 'T:1:1;1;NONE;0;1;'\nplay_times = {\n" }, { "change_type": "MODIFY", "old_path": "resources/lib/services/msl/profiles.py", "new_path": "resources/lib/services/msl/profiles.py", "diff": "@@ -86,11 +86,8 @@ def enabled_profiles():\ndef _subtitle_profiles():\n- from xbmcaddon import Addon\n- isa_version = G.remove_ver_suffix(Addon('inputstream.adaptive').getAddonInfo('version'))\nsubtitle_profile = ['webvtt-lssdh-ios8']\n- if G.ADDON.getSettingBool('disable_webvtt_subtitle') \\\n- or not common.is_minimum_version(isa_version, '2.3.8'):\n+ if G.ADDON.getSettingBool('disable_webvtt_subtitle'):\nsubtitle_profile = ['simplesdh']\nreturn subtitle_profile\n" }, { "change_type": "MODIFY", "old_path": "resources/lib/services/playback/am_playback.py", "new_path": "resources/lib/services/playback/am_playback.py", "diff": "@@ -89,18 +89,9 @@ class AMPlayback(ActionManager):\nself.videoid.seasonid,\nself.videoid.episodeid)\nurl = xbmcvfs.translatePath(file_path)\n- if G.KODI_VERSION.is_major_ver('18'):\n- common.json_rpc('Files.SetFileDetails',\n- {\"file\": url, \"media\": \"video\", \"resume\": {\"position\": 0, \"total\": 0}, \"playcount\": 1})\n- # After apply the change Kodi 18 not update the library directory item\n- common.container_refresh()\n- else:\ncommon.json_rpc('Files.SetFileDetails',\n{\"file\": url, \"media\": \"video\", \"resume\": None, \"playcount\": 1})\nelse:\n- if G.KODI_VERSION.is_major_ver('18'):\n- # \"Files.SetFileDetails\" on Kodi 18 not support \"plugin://\" path\n- return\nurl = common.build_url(videoid=self.videoid,\nmode=G.MODE_PLAY,\nparams={'profile_guid': G.LOCAL_DB.get_active_profile_guid()})\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": "@@ -57,7 +57,6 @@ class AMStreamContinuity(ActionManager):\nself.player = xbmc.Player()\nself.player_state = {}\nself.resume = {}\n- self.legacy_kodi_version = G.KODI_VERSION.is_major_ver('18')\nself.is_kodi_forced_subtitles_only = None\nself.is_prefer_sub_impaired = None\nself.is_prefer_audio_impaired = None\n@@ -82,8 +81,7 @@ class AMStreamContinuity(ActionManager):\nelse:\n# Disable on_tick activity to check changes of settings\nself.enabled = False\n- if (not self.legacy_kodi_version and\n- player_state.get(STREAMS['subtitle']['current']) is None and\n+ if (player_state.get(STREAMS['subtitle']['current']) is None and\nplayer_state.get('currentvideostream') is None):\n# Kodi 19 BUG JSON RPC: \"Player.GetProperties\" is broken: https://github.com/xbmc/xbmc/issues/17915\n# The first call return wrong data the following calls return OSError, and then _notify_all will be blocked\n@@ -100,16 +98,13 @@ 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 not self.legacy_kodi_version and G.ADDON.getSettingBool('prefer_alternative_lang'):\n+ if G.ADDON.getSettingBool('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- if self.legacy_kodi_version:\n- self._ensure_forced_subtitle_only_kodi18()\n- else:\nself._ensure_forced_subtitle_only()\n# Ensure in any case to show the regular subtitles when the preferred audio language is not available\n- if not self.legacy_kodi_version and G.ADDON.getSettingBool('show_subtitles_miss_audio'):\n+ if G.ADDON.getSettingBool('show_subtitles_miss_audio'):\nself._ensure_subtitles_no_audio_available()\nplayer_state = _player_state_copy\nfor stype in sorted(STREAMS):\n@@ -174,19 +169,7 @@ class AMStreamContinuity(ActionManager):\nreturn\nLOG.debug('Trying to restore {} with stored data {}', stype, stored_stream)\ndata_type_dict = isinstance(stored_stream, dict)\n- if self.legacy_kodi_version:\n- # Kodi version 18, this is the old method that have a unresolvable bug:\n- # in cases where between episodes there are a number of different streams the\n- # audio/subtitle selection fails by setting a wrong language,\n- # there is no way with Kodi 18 to compare the streams.\n- # will be removed when Kodi 18 is deprecated\n- if not self._is_stream_value_equal(self.current_streams[stype], stored_stream):\n- # subtitleenabled is boolean and not a dict\n- set_stream(self.player, (stored_stream['index']\n- if data_type_dict\n- else stored_stream))\n- else:\n- # Kodi version >= 19, compares stream properties to find the right stream index\n+ # Compares stream properties to find the right stream index\n# between episodes with a different numbers of streams\nif not self._is_stream_value_equal(self.current_streams[stype], stored_stream):\nif data_type_dict:\n@@ -214,7 +197,6 @@ class AMStreamContinuity(ActionManager):\ndef _find_stream_index(self, streams, stored_stream):\n\"\"\"\nFind the right stream index\n- --- THIS WORKS ONLY WITH KODI VERSION 19 AND UP\nin the case of episodes, it is possible that between different episodes some languages are\nnot present, so the indexes are changed, then you have to rely on the streams properties\n\"\"\"\n@@ -310,36 +292,6 @@ class AMStreamContinuity(ActionManager):\nelse:\nself.sc_settings.update({'subtitleenabled': False})\n- def _ensure_forced_subtitle_only_kodi18(self):\n- \"\"\"Ensures the display of forced subtitles only with the audio language set [KODI 18]\"\"\"\n- # With Kodi 18 it is not possible to read the properties of the player streams,\n- # so the only possible way is to read the data from the manifest file\n- from resources.lib.common.cache_utils import CACHE_MANIFESTS\n- from resources.lib.utils.esn import get_esn\n- # Get the manifest\n- cache_identifier = get_esn() + '_' + self.videoid.value\n- manifest = G.CACHE.get(CACHE_MANIFESTS, cache_identifier)\n- common.fix_locale_languages(manifest['timedtexttracks'])\n- # Get the language\n- audio_language = common.get_kodi_audio_language()\n- if 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.\n- profile_language_code = G.LOCAL_DB.get_profile_config('language')\n- audio_language = profile_language_code[0:2]\n- if audio_language == 'original':\n- # Find the language of the original audio track\n- stream = next((audio_track for audio_track in manifest['audio_tracks']\n- if audio_track['isNative']), None)\n- if not stream:\n- return\n- audio_language = stream['language']\n- # Check in the manifest if there is a forced subtitle in the specified language\n- if not any(text_track.get('isForcedNarrative', False)\n- and text_track['language'] == audio_language\n- for text_track in manifest['timedtexttracks']):\n- self.sc_settings.update({'subtitleenabled': False})\n-\ndef _ensure_forced_subtitle_only(self):\n\"\"\"Ensures the display of forced subtitles only with the 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@@ -435,14 +387,6 @@ class AMStreamContinuity(ActionManager):\nreturn audio_language\ndef _is_stream_value_equal(self, stream_a, stream_b):\n- if self.legacy_kodi_version:\n- # Kodi version 18, compare dict values directly, this will always fails when\n- # between episodes the number of streams change,\n- # there is no way with Kodi 18 to compare the streams\n- # will be removed when Kodi 18 is deprecated\n- return stream_a == stream_b\n- # Kodi version >= 19, compares stream properties to find the right stream index\n- # between episodes with a different numbers of streams\nif isinstance(stream_a, dict):\nreturn common.compare_dict_keys(stream_a, stream_b,\n['channels', 'codec', 'isdefault', 'isimpaired', 'isoriginal', 'language'])\n" }, { "change_type": "MODIFY", "old_path": "resources/lib/utils/api_paths.py", "new_path": "resources/lib/utils/api_paths.py", "diff": "@@ -97,7 +97,7 @@ SUPPLEMENTAL_TYPE_TRAILERS = 'trailers'\nINFO_MAPPINGS = [\n('Title', 'title'), # Title is needed only for UpNext metadata on play method\n('Year', 'releaseYear'),\n- ('Plot', 'regularSynopsis'), # Complete plot (Kodi 18 original skins do not use plotoutline)\n+ ('Plot', 'regularSynopsis'), # Complete plot\n('PlotOutline', 'synopsis'), # Small plot\n('Season', 'seasonCount'), # Path used with videolist data for 'tvshow' ListItems (get total seasons)\n('Season', ['summary', 'shortName']), # Path used with season list data for 'season' ListItems (get current season)\n" }, { "change_type": "MODIFY", "old_path": "tests/xbmc.py", "new_path": "tests/xbmc.py", "diff": "@@ -177,13 +177,6 @@ def log(msg, level):\nprint('\u001b[32;1m%s: \u001b[32;0m%s\u001b[0m' % (level, msg))\n-def makeLegalFilename(filename, fatX=None): # Kodi 18\n- \"\"\"A reimplementation of the xbmc makeLegalFilename() function\"\"\"\n- if fatX:\n- return filename\n- return os.path.basename(filename)\n-\n-\ndef setContent(self, content):\n\"\"\"A stub implementation of the xbmc setContent() function\"\"\"\nreturn\n" }, { "change_type": "MODIFY", "old_path": "tests/xbmcgui.py", "new_path": "tests/xbmcgui.py", "diff": "@@ -100,7 +100,6 @@ class Dialog:\nprint('\\033[37;100mNOTIFICATION:\\033[35;0m [%s] \\033[35;0m%s\\033[39;0m' % (heading, message))\n@staticmethod\n- # ok(heading, line1, line2=None, line3=None): # Kodi 18\ndef ok(heading, message):\n\"\"\"A stub implementation for the xbmcgui Dialog class ok() method\"\"\"\nheading = kodi_to_ansi(heading)\n@@ -108,7 +107,6 @@ class Dialog:\nprint('\\033[37;100mOK:\\033[35;0m [%s] \\033[35;0m%s\\033[39;0m' % (heading, message))\n@staticmethod\n- # def yesno(heading, line1, line2=None, line3=None, nolabel=None, yeslabel=None, autoclose=0): # Kodi 18\ndef yesno(heading, message, nolabel=None, yeslabel=None, customlabel=None, autoclose=0):\n\"\"\"A stub implementation for the xbmcgui Dialog class yesno() method\"\"\"\nheading = kodi_to_ansi(heading)\n@@ -143,7 +141,6 @@ class Dialog:\nreturn ''\n@staticmethod\n- # def numeric(type, heading, defaultt=''): # Kodi 18\ndef numeric(type, heading, defaultt='', bHiddenInput=False): # pylint: disable=redefined-builtin\n\"\"\"A stub implementation for the xbmcgui Dialog class numeric() method\"\"\"\nreturn\n@@ -167,7 +164,6 @@ class DialogProgress:\nreturn\n@staticmethod\n- # def create(heading, line1=None, line2=None, line3=None): # Kodi 18\ndef create(heading, message=None):\n\"\"\"A stub implementation for the xbmcgui DialogProgress class create() method\"\"\"\nheading = kodi_to_ansi(heading)\n@@ -181,7 +177,6 @@ class DialogProgress:\ndef iscanceled():\n\"\"\"A stub implementation for the xbmcgui DialogProgress class iscanceled() method\"\"\"\n- # def update(self, percent, line1=None, line2=None, line3=None): # Kodi 18\ndef update(self, percent, message=None):\n\"\"\"A stub implementation for the xbmcgui DialogProgress class update() method\"\"\"\nif (percent - 5) < self.percent:\n@@ -207,7 +202,6 @@ class DialogProgressBG:\nreturn\n@staticmethod\n- # def create(heading, line1=None, line2=None, line3=None): # Kodi 18\ndef create(heading, message=None):\n\"\"\"A stub implementation for the xbmcgui DialogProgressBG class create() method\"\"\"\nheading = kodi_to_ansi(heading)\n@@ -222,7 +216,6 @@ class DialogProgressBG:\n\"\"\"A stub implementation for the xbmcgui DialogProgressBG class isFinished() method\"\"\"\nreturn True\n- # def update(self, percent, line1=None, line2=None, line3=None): # Kodi 18\ndef update(self, percent=None, heading=None, message=None):\n\"\"\"A stub implementation for the xbmcgui DialogProgressBG class update() method\"\"\"\nif (percent - 5) < self.percent:\n@@ -253,7 +246,6 @@ class DialogBusy:\nclass ListItem:\n\"\"\"A reimplementation of the xbmcgui ListItem class\"\"\"\n- # def __init__(self, label='', label2='', iconImage='', thumbnailImage='', path='', offscreen=False): # Kodi 18\ndef __init__(self, label='', label2='', path='', offscreen=False):\n\"\"\"A stub constructor for the xbmcgui ListItem class\"\"\"\nself.label = kodi_to_ansi(label)\n" }, { "change_type": "MODIFY", "old_path": "tests/xbmcvfs.py", "new_path": "tests/xbmcvfs.py", "diff": "@@ -87,12 +87,12 @@ def rmdir(path):\nreturn os.rmdir(path)\n-def makeLegalFilename(filename): # Kodi >= 19 (on xbmc there is the method for Kodi 18)\n+def makeLegalFilename(filename):\n\"\"\"A reimplementation of the xbmc makeLegalFilename() function\"\"\"\nreturn os.path.basename(filename)\n-def translatePath(path): # Kodi >= 19 (on xbmc there is the method for Kodi 18)\n+def translatePath(path):\n\"\"\"A stub implementation of the xbmc translatePath() function\"\"\"\nif path.startswith('special://home'):\nreturn path.replace('special://home', os.path.join(os.getcwd(), 'test'))\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
Drop remaining specific code for Kodi 18
106,046
18.12.2020 08:33:50
-3,600
a3766f8ab1c0c795773cea2fe4c0faf3fe7337bb
Add Kodi MySQL Connector/Python module
[ { "change_type": "MODIFY", "old_path": "addon.xml", "new_path": "addon.xml", "diff": "<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+ <import addon=\"script.module.myconnpy\" version=\"8.0.18\"/> <!--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
Add Kodi MySQL Connector/Python module
106,046
20.12.2020 16:44:29
-3,600
2dcbfd42b61752b9c7aafe2b12400239d9d26efc
Add with statement to xbmcvfs.File
[ { "change_type": "MODIFY", "old_path": "resources/lib/common/fileops.py", "new_path": "resources/lib/common/fileops.py", "diff": "@@ -88,11 +88,8 @@ def save_file(file_path, content, mode='wb'):\n:param content: The content of the file\n:param mode: optional mode options\n\"\"\"\n- file_handle = xbmcvfs.File(xbmcvfs.translatePath(file_path), mode)\n- try:\n+ with xbmcvfs.File(xbmcvfs.translatePath(file_path), mode) as file_handle:\nfile_handle.write(bytearray(content))\n- finally:\n- file_handle.close()\ndef load_file_def(filename, mode='rb'):\n@@ -112,11 +109,8 @@ def load_file(file_path, mode='rb'):\n:param mode: optional mode options\n:return: The content of the file\n\"\"\"\n- file_handle = xbmcvfs.File(xbmcvfs.translatePath(file_path), mode)\n- try:\n+ with xbmcvfs.File(xbmcvfs.translatePath(file_path), mode) as file_handle:\nreturn file_handle.readBytes().decode('utf-8')\n- finally:\n- file_handle.close()\ndef delete_file_safe(file_path):\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
Add with statement to xbmcvfs.File
106,046
20.12.2020 17:08:11
-3,600
d7773776cf61c48154c476f376315ab4eb04aa9c
Add arg to set port setting name
[ { "change_type": "MODIFY", "old_path": "resources/lib/common/ipc.py", "new_path": "resources/lib/common/ipc.py", "diff": "@@ -74,21 +74,21 @@ def _send_signal(signal, data):\n@measure_exec_time_decorator()\n-def make_call(callname, data=None):\n+def make_call(callname, data=None, port_setting_name='ns_service_port'):\n# Note: IPC over HTTP handle FULL objects serialization, AddonSignals NOT HANDLE the serialization of objects\nif G.IPC_OVER_HTTP:\n- return make_http_call(callname, data)\n+ return make_http_call(callname, data, port_setting_name)\nreturn make_addonsignals_call(callname, data)\n-def make_http_call(callname, data):\n+def make_http_call(callname, data, port_setting_name='ns_service_port'):\n\"\"\"Make 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.\"\"\"\nfrom collections import OrderedDict\nfrom urllib.request import build_opener, install_opener, ProxyHandler, HTTPError, URLError, urlopen\nLOG.debug('Handling HTTP IPC call to {}'.format(callname))\n# Note: On python 3, using 'localhost' slowdown the call (Windows OS is affected) not sure if it is an urllib issue\n- url = 'http://127.0.0.1:{}/{}'.format(G.LOCAL_DB.get_value('ns_service_port', 8001), callname)\n+ url = 'http://127.0.0.1:{}/{}'.format(G.LOCAL_DB.get_value(port_setting_name), callname)\ninstall_opener(build_opener(ProxyHandler({}))) # don't use proxy for localhost\ntry:\nresult = json.loads(\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
Add arg to set port setting name
106,046
20.12.2020 16:49:41
-3,600
ee998d6abece9a4f14fe45ff6cb35b4978466901
Add show busy dialog
[ { "change_type": "MODIFY", "old_path": "resources/lib/common/kodi_ops.py", "new_path": "resources/lib/common/kodi_ops.py", "diff": "See LICENSES/MIT.md for more information.\n\"\"\"\nimport json\n+from contextlib import contextmanager\nimport xbmc\n@@ -88,6 +89,16 @@ def container_update(url, reset_history=False):\nxbmc.executebuiltin(func_str.format(url))\n+@contextmanager\n+def show_busy_dialog():\n+ \"\"\"Context to show the busy dialog on the screen\"\"\"\n+ xbmc.executebuiltin('ActivateWindow(busydialognocancel)')\n+ try:\n+ yield\n+ finally:\n+ xbmc.executebuiltin('Dialog.Close(busydialognocancel)')\n+\n+\ndef get_local_string(string_id):\n\"\"\"Retrieve a localized string by its id\"\"\"\nsrc = xbmc if string_id < 30000 else G.ADDON\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
Add show busy dialog
106,046
20.12.2020 16:50:28
-3,600
ea771704e139373f536b7eb1a4c768c5ed10b3cf
Make ask_for_input public
[ { "change_type": "MODIFY", "old_path": "resources/lib/kodi/ui/dialogs.py", "new_path": "resources/lib/kodi/ui/dialogs.py", "diff": "@@ -65,10 +65,10 @@ def show_dlg_input_numeric(message, mask_input=True):\ndef ask_for_search_term(default_text=None):\n\"\"\"Ask the user for a search term\"\"\"\n- return _ask_for_input(common.get_local_string(30402), default_text)\n+ return ask_for_input(common.get_local_string(30402), default_text)\n-def _ask_for_input(heading, default_text=None):\n+def ask_for_input(heading, default_text=None):\nreturn xbmcgui.Dialog().input(\ndefaultt=default_text,\nheading=heading,\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
Make ask_for_input public
106,046
20.12.2020 17:10:10
-3,600
dcc2a9890e1b2ed3db2756ad473bddf6a929a3af
Add to MSL support to IPC data/error callback
[ { "change_type": "MODIFY", "old_path": "resources/lib/services/msl/http_server.py", "new_path": "resources/lib/services/msl/http_server.py", "diff": "See LICENSES/MIT.md for more information.\n\"\"\"\nimport base64\n+import json\nfrom http.server import BaseHTTPRequestHandler\nfrom socketserver import TCPServer\nfrom urllib.parse import parse_qs, urlparse\n+from resources.lib import common\nfrom resources.lib.common.exceptions import MSLError\nfrom resources.lib.utils.logging import LOG\nfrom .msl_handler import MSLHandler\n@@ -29,10 +31,7 @@ class MSLHttpRequestHandler(BaseHTTPRequestHandler):\ntry:\nurl_parse = urlparse(self.path)\nLOG.debug('Handling HTTP POST IPC call to {}', url_parse.path)\n- if '/license' not in url_parse:\n- self.send_response(404)\n- self.end_headers()\n- return\n+ if '/license' in url_parse:\nlength = int(self.headers.get('content-length', 0))\ndata = self.rfile.read(length).decode('utf-8').split('!')\nb64license = self.server.msl_handler.get_license(\n@@ -40,6 +39,25 @@ class MSLHttpRequestHandler(BaseHTTPRequestHandler):\nself.send_response(200)\nself.end_headers()\nself.wfile.write(base64.standard_b64decode(b64license))\n+ else:\n+ func_name = self.path[1:]\n+ length = int(self.headers.get('content-length', 0))\n+ data = json.loads(self.rfile.read(length)) or None\n+ try:\n+ result = self.server.msl_handler.http_ipc_slots[func_name](data)\n+ if isinstance(result, dict) and common.IPC_EXCEPTION_PLACEHOLDER in result:\n+ self.send_response(500, json.dumps(result))\n+ self.end_headers()\n+ return\n+ self.send_response(200)\n+ self.end_headers()\n+ self.wfile.write(json.dumps(result).encode('utf-8'))\n+ except KeyError:\n+ self.send_response(500, json.dumps(\n+ common.ipc_convert_exc_to_json(class_name='SlotNotImplemented',\n+ message='The specified slot {} does not exist'.format(func_name))\n+ ))\n+ self.end_headers()\nexcept Exception as exc:\nimport traceback\nLOG.error(traceback.format_exc())\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
Add to MSL support to IPC data/error callback
106,046
20.12.2020 16:58:35
-3,600
4153696bdd1508368444b06e82801be31671cf7b
Add refresh_session_data to IPC
[ { "change_type": "MODIFY", "old_path": "resources/lib/services/nfsession/nfsession_ops.py", "new_path": "resources/lib/services/nfsession/nfsession_ops.py", "diff": "@@ -41,6 +41,7 @@ class NFSessionOperations(SessionPathRequests):\nself.perpetual_path_request,\nself.callpath_request,\nself.fetch_initial_page,\n+ self.refresh_session_data,\nself.activate_profile,\nself.parental_control_data,\nself.get_metadata,\n@@ -77,9 +78,7 @@ class NFSessionOperations(SessionPathRequests):\nLOG.debug('Fetch initial page')\nfrom requests import exceptions\ntry:\n- response = self.get_safe('browse')\n- api_data = self.website_extract_session_data(response, update_profiles=True)\n- self.auth_url = api_data['auth_url']\n+ self.refresh_session_data(True)\nexcept exceptions.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@@ -87,6 +86,11 @@ class NFSessionOperations(SessionPathRequests):\nself.session.cookies.clear()\nself.login()\n+ def refresh_session_data(self, update_profiles):\n+ response = self.get_safe('browse')\n+ api_data = self.website_extract_session_data(response, update_profiles=update_profiles)\n+ self.auth_url = api_data['auth_url']\n+\n@measure_exec_time_decorator(is_immediate=True)\ndef activate_profile(self, guid):\n\"\"\"Set the profile identified by guid as active\"\"\"\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
Add refresh_session_data to IPC
106,046
22.12.2020 10:53:28
-3,600
02e3489a2be4a0a2ab8003a076508238be5682ef
Removed raspberrypi case on get_system_platform no more needed and is not full working on Kodi 19
[ { "change_type": "MODIFY", "old_path": "resources/lib/common/device_utils.py", "new_path": "resources/lib/common/device_utils.py", "diff": "@@ -41,9 +41,6 @@ def get_system_platform():\nif not hasattr(get_system_platform, 'cached'):\nplatform = \"unknown\"\nif xbmc.getCondVisibility('system.platform.linux') and not xbmc.getCondVisibility('system.platform.android'):\n- if xbmc.getCondVisibility('system.platform.linux.raspberrypi'):\n- platform = \"linux raspberrypi\"\n- else:\nplatform = \"linux\"\nelif xbmc.getCondVisibility('system.platform.linux') and xbmc.getCondVisibility('system.platform.android'):\nplatform = \"android\"\n@@ -55,7 +52,7 @@ def get_system_platform():\nplatform = \"osx\"\nelif xbmc.getCondVisibility('system.platform.ios'):\nplatform = \"ios\"\n- elif xbmc.getCondVisibility('system.platform.tvos'): # Supported only on Kodi 19.x\n+ elif xbmc.getCondVisibility('system.platform.tvos'):\nplatform = \"tvos\"\nget_system_platform.cached = platform\nreturn get_system_platform.cached\n" }, { "change_type": "MODIFY", "old_path": "resources/lib/common/uuid_device.py", "new_path": "resources/lib/common/uuid_device.py", "diff": "@@ -54,7 +54,7 @@ def _get_system_uuid():\nuuid_value = _get_windows_uuid()\nelif system == 'android':\nuuid_value = _get_android_uuid()\n- elif system in ['linux', 'linux raspberrypi']:\n+ elif system == 'linux':\nuuid_value = _get_linux_uuid()\nelif system == 'osx':\n# Due to OS restrictions on 'ios' and 'tvos' is not possible to use _get_macos_uuid()\n@@ -62,7 +62,7 @@ def _get_system_uuid():\nuuid_value = _get_macos_uuid()\nif not uuid_value:\nLOG.debug('It is not possible to get a system UUID creating a new UUID')\n- uuid_value = _get_fake_uuid(system not in ['android', 'linux', 'linux raspberrypi'])\n+ uuid_value = _get_fake_uuid(system not in ['android', 'linux'])\nreturn get_namespace_uuid(str(uuid_value)).bytes\n" }, { "change_type": "MODIFY", "old_path": "resources/lib/config_wizard.py", "new_path": "resources/lib/config_wizard.py", "diff": "@@ -76,7 +76,7 @@ def _set_profiles(system, is_4k_capable):\n# By default we do not enable VP9 because on some devices do not fully support it\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 in ['linux', 'linux raspberrypi']:\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" }, { "change_type": "MODIFY", "old_path": "resources/lib/kodi/ui/xmldialog_esnwidevine.py", "new_path": "resources/lib/kodi/ui/xmldialog_esnwidevine.py", "diff": "@@ -258,7 +258,7 @@ def _save_system_info():\ndef _get_cdm_file_path():\n- if common.get_system_platform() in ['linux', 'linux raspberrypi']:\n+ if common.get_system_platform() == 'linux':\nlib_filename = 'libwidevinecdm.so'\nelif common.get_system_platform() in ['windows', 'uwp']:\nlib_filename = 'widevinecdm.dll'\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
Removed raspberrypi case on get_system_platform no more needed and is not full working on Kodi 19
106,046
22.12.2020 10:59:09
-3,600
940281fe93652abeac76179a8354d1c5298b1155
Removed __CRYPT_KEY__ global statement
[ { "change_type": "MODIFY", "old_path": "resources/lib/common/uuid_device.py", "new_path": "resources/lib/common/uuid_device.py", "diff": "@@ -11,18 +11,13 @@ from resources.lib.utils.logging import LOG\nfrom .device_utils import get_system_platform\n-__CRYPT_KEY__ = None\n-\n-\ndef get_crypt_key():\n\"\"\"\nLazily generate the crypt key and return it\n\"\"\"\n- # pylint: disable=global-statement\n- global __CRYPT_KEY__\n- if not __CRYPT_KEY__:\n- __CRYPT_KEY__ = _get_system_uuid()\n- return __CRYPT_KEY__\n+ if not hasattr(get_crypt_key, 'cached'):\n+ get_crypt_key.cached = _get_system_uuid()\n+ return get_crypt_key.cached\ndef get_random_uuid():\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
Removed __CRYPT_KEY__ global statement
106,046
22.12.2020 11:01:00
-3,600
f9d683eaacc3299e667ce11099af2169a7f8b755
Do not deny profile switch when will not performed
[ { "change_type": "MODIFY", "old_path": "resources/lib/services/nfsession/nfsession_ops.py", "new_path": "resources/lib/services/nfsession/nfsession_ops.py", "diff": "@@ -95,14 +95,14 @@ class NFSessionOperations(SessionPathRequests):\ndef activate_profile(self, guid):\n\"\"\"Set the profile identified by guid as active\"\"\"\nLOG.debug('Switching to profile {}', guid)\n- if xbmc.Player().isPlayingVideo():\n- # Change the current profile while a video is playing can cause problems with outgoing HTTP requests\n- # (MSL/NFSession) causing a failure in the HTTP request or sending data on the wrong profile\n- raise Warning('It is not possible select a profile while a video is playing.')\ncurrent_active_guid = G.LOCAL_DB.get_active_profile_guid()\nif guid == current_active_guid:\nLOG.info('The profile guid {} is already set, activation not needed.', guid)\nreturn\n+ if xbmc.Player().isPlayingVideo():\n+ # Change the current profile while a video is playing can cause problems with outgoing HTTP requests\n+ # (MSL/NFSession) causing a failure in the HTTP request or sending data on the wrong profile\n+ raise Warning('It is not possible select a profile while a video is playing.')\ntimestamp = time.time()\nLOG.info('Activating profile {}', guid)\n# 20/05/2020 - The method 1 not more working for switching PIN locked profiles\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
Do not deny profile switch when will not performed