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 | 20.06.2020 17:24:00 | -7,200 | aa71c672f8e2c453bed929dcb867eaaceb81ef52 | Updated art partial paths | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/api/paths.py",
"new_path": "resources/lib/api/paths.py",
"diff": "@@ -21,7 +21,7 @@ RANGE_SELECTOR = 'RANGE_SELECTOR'\nART_SIZE_POSTER = '_342x684'\nART_SIZE_FHD = '_1920x1080'\n-# ART_SIZE_HD = '_1280x720'\n+ART_SIZE_HD = '_1280x720'\nART_SIZE_SD = '_665x375'\nLENGTH_ATTRIBUTES = {\n@@ -35,12 +35,14 @@ LENGTH_ATTRIBUTES = {\nART_PARTIAL_PATHS = [\n['boxarts', [ART_SIZE_SD, ART_SIZE_FHD, ART_SIZE_POSTER], 'jpg'],\n['interestingMoment', [ART_SIZE_SD, ART_SIZE_FHD], 'jpg'],\n- ['bb2OGLogo', '_550x124', 'png'],\n- ['BGImages', '720', 'jpg']\n+ ['artWorkByType', 'LOGO_BRANDED_HORIZONTAL', '_550x124', 'png'], # 11/05/2020 same img of bb2OGLogo\n+ ['storyArt', ART_SIZE_SD, 'jpg'] # 11/05/2020 same img of BGImages\n]\n-# Others image paths for reference\n-# ['artWorkByType', 'LOGO_BRANDED_HORIZONTAL', ['_550x124', ART_SIZE_HD], 'jpg'], 11/05/2020 image is same of bb2OGLogo\n-# ['storyArt', ART_SIZE_SD, 'jpg'], 11/05/2020 image is same of BGImages\n+\n+# Old image paths for reference\n+# ['bb2OGLogo', '_550x124', 'png']\n+# ['BGImages', '720', 'jpg']\n+\nVIDEO_LIST_PARTIAL_PATHS = [\n[['requestId', 'summary', 'title', 'synopsis', 'regularSynopsis', 'evidence', 'queue',\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Updated art partial paths |
106,046 | 20.06.2020 17:26:07 | -7,200 | 738c92b225c866948422fc7ecc97f4841fd93f4c | Timestamp format fixes | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/api/api_requests.py",
"new_path": "resources/lib/api/api_requests.py",
"diff": "@@ -271,7 +271,7 @@ def _metadata(video_id):\n{\n'endpoint': 'metadata',\n'params': {'movieid': video_id.value,\n- '_': int(time.time())}\n+ '_': int(time.time() * 1000)}\n})\nif not metadata_data:\n# This return empty\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/nfsession/nfsession.py",
"new_path": "resources/lib/services/nfsession/nfsession.py",
"diff": "@@ -110,7 +110,7 @@ class NetflixSession(NFSessionAccess, DirectoryBuilder):\nimport time\nself._get(endpoint='activate_profile',\nparams={'switchProfileGuid': guid,\n- '_': int(time.time()),\n+ '_': int(time.time() * 1000),\n'authURL': self.auth_url})\n# Retrieve browse page to update authURL\nresponse = self._get('browse')\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Timestamp format fixes |
106,046 | 20.06.2020 17:27:30 | -7,200 | 6a35e48b65deeec0ed85e9a9f23648369f2bfd7c | Misc changes to nfsession | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/common/cookies.py",
"new_path": "resources/lib/common/cookies.py",
"diff": "@@ -30,15 +30,16 @@ class CookiesExpiredError(Exception):\n\"\"\"Stored cookies are expired\"\"\"\n-def save(account_hash, cookie_jar):\n+def save(account_hash, cookie_jar, log_output=True):\n\"\"\"Save a cookie jar to file and in-memory storage\"\"\"\n- # pylint: disable=broad-except\n+ if log_output:\n+ log_cookie(cookie_jar)\ng.COOKIES[account_hash] = cookie_jar\ncookie_file = xbmcvfs.File(cookie_filename(account_hash), 'wb')\ntry:\n# pickle.dump(cookie_jar, cookie_file)\ncookie_file.write(bytearray(pickle.dumps(cookie_jar)))\n- except Exception as exc:\n+ except Exception as exc: # pylint: disable=broad-except\ncommon.error('Failed to save cookies to file: {exc}', exc=exc)\nfinally:\ncookie_file.close()\n@@ -46,12 +47,11 @@ def save(account_hash, cookie_jar):\ndef delete(account_hash):\n\"\"\"Delete cookies for an account from in-memory storage and the disk\"\"\"\n- # pylint: disable=broad-except\nif g.COOKIES.get(account_hash):\ndel g.COOKIES[account_hash]\ntry:\nxbmcvfs.delete(cookie_filename(account_hash))\n- except Exception as exc:\n+ except Exception as exc: # pylint: disable=broad-except\ncommon.error('Failed to delete cookies on disk: {exc}', exc=exc)\n@@ -69,7 +69,7 @@ def load(account_hash):\ncookie_jar = pickle.loads(cookie_file.read())\nelse:\ncookie_jar = pickle.loads(cookie_file.readBytes())\n- except Exception as exc:\n+ except Exception as exc: # pylint: disable=broad-except\nimport traceback\ncommon.error('Failed to load cookies from file: {exc}', exc=exc)\ncommon.error(g.py2_decode(traceback.format_exc(), 'latin-1'))\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/nfsession/nfsession.py",
"new_path": "resources/lib/services/nfsession/nfsession.py",
"diff": "@@ -14,6 +14,7 @@ import json\nimport resources.lib.common as common\nimport resources.lib.api.paths as apipaths\nimport resources.lib.api.website as website\n+from resources.lib.common import cookies\nfrom resources.lib.globals import g\nfrom resources.lib.services.directorybuilder.dir_builder import DirectoryBuilder\nfrom resources.lib.services.nfsession.nfsession_access import NFSessionAccess\n@@ -98,8 +99,8 @@ class NetflixSession(NFSessionAccess, DirectoryBuilder):\ncurrent_active_guid = g.LOCAL_DB.get_active_profile_guid()\nif self.is_profile_session_active and guid == current_active_guid:\ncommon.info('The profile session of guid {} is still active, activation not needed.', guid)\n- if not self.is_profile_session_active or (self.is_profile_session_active and\n- guid != current_active_guid):\n+ import time\n+ timestamp = time.time()\ncommon.info('Activating profile {}', guid)\n# 20/05/2020 - The method 1 not more working for switching PIN locked profiles\n# INIT Method 1 - HTTP mode\n@@ -107,19 +108,22 @@ class NetflixSession(NFSessionAccess, DirectoryBuilder):\n# self.auth_url = self.website_extract_session_data(response)['auth_url']\n# END Method 1\n# INIT Method 2 - API mode\n- import time\nself._get(endpoint='activate_profile',\nparams={'switchProfileGuid': guid,\n- '_': int(time.time() * 1000),\n+ '_': int(timestamp * 1000),\n'authURL': self.auth_url})\n# Retrieve browse page to update authURL\nresponse = self._get('browse')\nself.auth_url = website.extract_session_data(response)['auth_url']\n# END Method 2\n+\nself.is_profile_session_active = True\n+ # Update the session profile cookie (only a test, see 'Profile idle timeout' in website.py)\n+ # expires = int(timestamp) + (g.LOCAL_DB.get_value('profile_gate_idle_timer', 30, TABLE_SESSION) * 60)\n+ # self.session.cookies.set('profilesNewSession', '0', domain='.netflix.com', path='/', expires=expires)\ng.LOCAL_DB.switch_active_profile(guid)\ng.CACHE_MANAGEMENT.identifier_prefix = guid\n- self.update_session_data()\n+ cookies.save(self.account_hash, self.session.cookies)\n@needs_login\ndef _perpetual_path_request_switch_profiles(self, paths, length_params,\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/nfsession/nfsession_access.py",
"new_path": "resources/lib/services/nfsession/nfsession_access.py",
"diff": "@@ -61,8 +61,6 @@ class NFSessionAccess(NFSessionRequests, NFSessionCookie):\nvalid_login = self._load_cookies() and \\\nself._verify_session_cookies() and \\\nself._verify_esn_existence()\n- if valid_login and not self.is_prefetch_login:\n- self.set_session_header_data()\nreturn valid_login\ndef _verify_esn_existence(self):\n@@ -91,7 +89,7 @@ class NFSessionAccess(NFSessionRequests, NFSessionCookie):\nwebsite.extract_session_data(login_response, validate=True, update_profiles=True)\ncommon.info('Login successful')\nui.show_notification(common.get_local_string(30109))\n- self.update_session_data()\n+ cookies.save(self.account_hash, self.session.cookies)\nreturn True\nexcept (LoginValidateError, LoginValidateErrorIncorrectPassword) as exc:\nself.session.cookies.clear()\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/nfsession/nfsession_base.py",
"new_path": "resources/lib/services/nfsession/nfsession_base.py",
"diff": "@@ -13,8 +13,6 @@ from __future__ import absolute_import, division, unicode_literals\nfrom functools import wraps\nimport resources.lib.common as common\n-import resources.lib.common.cookies as cookies\n-from resources.lib.database.db_exceptions import ProfilesMissing\nfrom resources.lib.globals import g\nfrom resources.lib.database.db_utils import (TABLE_SESSION)\nfrom resources.lib.api.exceptions import (NotLoggedInError, NotConnected)\n@@ -67,25 +65,10 @@ class NFSessionBase(object):\nself.session = session()\nself.session.headers.update({\n'User-Agent': common.get_user_agent(enable_android_mediaflag_fix=True),\n- 'Accept-Encoding': 'gzip'\n+ 'Accept-Encoding': 'gzip, deflate, br'\n})\ncommon.info('Initialized new session')\n- def update_session_data(self):\n- self.set_session_header_data()\n- cookies.save(self.account_hash, self.session.cookies)\n- cookies.log_cookie(self.session.cookies)\n-\n- def set_session_header_data(self):\n- try:\n- # When the addon is installed from scratch there is no profiles in the database\n- self.session.headers.update({\n- 'x-netflix.nq.stack': 'prod',\n- 'x-netflix.request.client.user.guid': g.LOCAL_DB.get_active_profile_guid()\n- })\n- except ProfilesMissing:\n- pass\n-\n@property\ndef account_hash(self):\n\"\"\"The unique hash of the current account\"\"\"\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/nfsession/nfsession_endpoints.py",
"new_path": "resources/lib/services/nfsession/nfsession_endpoints.py",
"diff": "@@ -43,13 +43,13 @@ ENDPOINTS = {\n# instead we use 'application/json' for simplicity of data conversion\n# if in the future login raise InvalidMembershipStatusAnonymous can means that json is no more accepted\n'content_type': 'application/json',\n- 'accept': '*/*'},\n+ 'accept': 'text/html,application/xhtml+xml,application/xml'},\n'logout':\n{'address': '/SignOut',\n'is_api_call': False,\n'use_default_params': False,\n'add_auth_url': None,\n- 'accept': '*/*'},\n+ 'accept': 'text/html,application/xhtml+xml,application/xml'},\n'shakti':\n{'address': '/pathEvaluator',\n'is_api_call': True,\n@@ -61,7 +61,7 @@ ENDPOINTS = {\n'is_api_call': False,\n'use_default_params': False,\n'add_auth_url': None,\n- 'accept': '*/*'},\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/nfsession_requests.py",
"new_path": "resources/lib/services/nfsession/nfsession_requests.py",
"diff": "@@ -14,6 +14,7 @@ import json\nimport resources.lib.common as common\nimport resources.lib.api.website as website\n+from resources.lib.common import cookies\nfrom resources.lib.globals import g\nfrom resources.lib.services.nfsession.nfsession_base import NFSessionBase, needs_login\nfrom resources.lib.database.db_utils import TABLE_SESSION\n@@ -99,7 +100,7 @@ class NFSessionRequests(NFSessionBase):\nfrom requests import exceptions\ntry:\nself.auth_url = website.extract_session_data(self._get('browse'))['auth_url']\n- self.update_session_data()\n+ cookies.save(self.account_hash, self.session.cookies)\ncommon.debug('Successfully refreshed session data')\nreturn True\nexcept InvalidMembershipStatusError:\n@@ -139,6 +140,9 @@ class NFSessionRequests(NFSessionBase):\nparams = {}\nheaders = {'Accept': endpoint_conf.get('accept', '*/*')}\n+ if endpoint_conf['address'] not in ['/login', '/browse', '/SignOut']:\n+ headers['x-netflix.nq.stack'] = 'prod'\n+ headers['x-netflix.request.client.user.guid'] = g.LOCAL_DB.get_active_profile_guid()\nif endpoint_conf.get('content_type'):\nheaders['Content-Type'] = endpoint_conf['content_type']\nheaders.update(custom_headers) # If needed override headers\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Misc changes to nfsession |
106,046 | 20.06.2020 18:21:09 | -7,200 | a3dc20688d8413227decf1c613819924c9922a16 | Changed definitions to loco and some fixes | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/api/api_requests.py",
"new_path": "resources/lib/api/api_requests.py",
"diff": "@@ -65,13 +65,13 @@ def update_loco_context(context_name):\ncommon.warn('Update loco context {} skipped due to missing loco index', context_name)\nreturn\npath = [['locos', loco_root, 'refreshListByContext']]\n+ # After the introduction of LoCo, the following notes are to be reviewed (refers to old LoLoMo):\n# The fourth parameter is like a request-id, but it doesn't seem to match to\n# serverDefs/date/requestId of reactContext (g.LOCAL_DB.get_value('request_id', table=TABLE_SESSION))\n- # nor to request_id of the video event request\n- # has a kind of relationship with renoMessageId suspect with the logblob but i'm not sure because my debug crashed,\n+ # nor to request_id of the video event request,\n+ # has a kind of relationship with renoMessageId suspect with the logblob but i'm not sure because my debug crashed\n# and i am no longer able to trace the source.\n- # I noticed also that this request can also be made with the fourth parameter empty,\n- # but it still doesn't update the continueWatching list of lolomo, that is strange because of no error\n+ # I noticed also that this request can also be made with the fourth parameter empty.\nparams = [common.enclose_quotes(context_id),\ncontext_index,\ncommon.enclose_quotes(context_name),\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/api/website.py",
"new_path": "resources/lib/api/website.py",
"diff": "@@ -170,12 +170,12 @@ def extract_session_data(content, validate=False, update_profiles=False):\n# cur_profile = jgraph_get_path(['profilesList', 'current'], falcor_cache)\n# common.warn('Context continueWatching not found in locos for profile guid {}.',\n# jgraph_get('summary', cur_profile)['guid'])\n- # g.LOCAL_DB.set_value('lolomo_continuewatching_index', '', TABLE_SESSION)\n- # g.LOCAL_DB.set_value('lolomo_continuewatching_id', '', TABLE_SESSION)\n+ # g.LOCAL_DB.set_value('loco_continuewatching_index', '', TABLE_SESSION)\n+ # g.LOCAL_DB.set_value('loco_continuewatching_id', '', TABLE_SESSION)\n# else:\n# common.warn('Is not possible to find the context continueWatching, the profile session is no more active')\n- # g.LOCAL_DB.set_value('lolomo_continuewatching_index', '', TABLE_SESSION)\n- # g.LOCAL_DB.set_value('lolomo_continuewatching_id', '', TABLE_SESSION)\n+ # g.LOCAL_DB.set_value('loco_continuewatching_index', '', TABLE_SESSION)\n+ # g.LOCAL_DB.set_value('loco_continuewatching_id', '', TABLE_SESSION)\n# -- END --\n# Save only some info of the current profile from user data\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/globals.py",
"new_path": "resources/lib/globals.py",
"diff": "@@ -65,8 +65,8 @@ class GlobalVariables(object):\n'''\n--Main Menu key infos--\npath : passes information to the called method generally structured as follows: [func. name, menu id, context id]\n- lolomo_contexts : contexts used to obtain the list of contents (use only one context when lolomo_known = True)\n- lolomo_known : if True, keys label_id/description_id/icon are ignored, the values are obtained from lolomo list\n+ loco_contexts : contexts used to obtain the list of contents (use only one context when loco_known = True)\n+ loco_known : if True, keys label_id/description_id/icon are ignored, these values are obtained from LoCo list\nlabel_id : menu title\ndescription_id : description info text\nicon : set a default image\n@@ -74,109 +74,109 @@ class GlobalVariables(object):\ncontent_type : override the default content type (CONTENT_SHOW)\nExplanation of function names in the 'path' key:\n- video_list: automatically gets the list_id by making a lolomo request,\n- the list_id search is made using the value specified on the lolomo_contexts key\n+ video_list: automatically gets the list_id by making a loco request,\n+ the list_id search is made using the value specified on the loco_contexts key\nvideo_list_sorted: to work must have a third argument on the path that is the context_id\nor instead specified the key request_context_name\n'''\nMAIN_MENU_ITEMS = collections.OrderedDict([\n('myList', {'path': ['video_list_sorted', 'myList'],\n- 'lolomo_contexts': ['queue'],\n- 'lolomo_known': True,\n+ 'loco_contexts': ['queue'],\n+ 'loco_known': True,\n'request_context_name': 'mylist',\n'view': VIEW_MYLIST}),\n('continueWatching', {'path': ['video_list', 'continueWatching'],\n- 'lolomo_contexts': ['continueWatching'],\n- 'lolomo_known': True}),\n+ 'loco_contexts': ['continueWatching'],\n+ 'loco_known': True}),\n('chosenForYou', {'path': ['video_list', 'chosenForYou'],\n- 'lolomo_contexts': ['topTen'],\n- 'lolomo_known': True}),\n+ 'loco_contexts': ['topTen'],\n+ 'loco_known': True}),\n('recentlyAdded', {'path': ['video_list_sorted', 'recentlyAdded', '1592210'],\n- 'lolomo_contexts': None,\n- 'lolomo_known': False,\n+ 'loco_contexts': None,\n+ 'loco_known': False,\n'request_context_name': 'genres',\n'label_id': 30145,\n'description_id': 30146,\n'icon': 'DefaultRecentlyAddedMovies.png'}),\n('newRelease', {'path': ['video_list_sorted', 'newRelease'],\n- 'lolomo_contexts': ['newRelease'],\n- 'lolomo_known': True,\n+ 'loco_contexts': ['newRelease'],\n+ 'loco_known': True,\n'request_context_name': 'newrelease'}),\n('currentTitles', {'path': ['video_list', 'currentTitles'],\n- 'lolomo_contexts': ['trendingNow'],\n- 'lolomo_known': True}),\n+ 'loco_contexts': ['trendingNow'],\n+ 'loco_known': True}),\n('mostWatched', {'path': ['video_list', 'mostWatched'], # Top 10 menu\n- 'lolomo_contexts': ['mostWatched'],\n- 'lolomo_known': True}),\n+ 'loco_contexts': ['mostWatched'],\n+ 'loco_known': True}),\n('mostViewed', {'path': ['video_list', 'mostViewed'],\n- 'lolomo_contexts': ['popularTitles'],\n- 'lolomo_known': True}),\n+ 'loco_contexts': ['popularTitles'],\n+ 'loco_known': True}),\n('netflixOriginals', {'path': ['video_list_sorted', 'netflixOriginals', '839338'],\n- 'lolomo_contexts': ['netflixOriginals'],\n- 'lolomo_known': True,\n+ 'loco_contexts': ['netflixOriginals'],\n+ 'loco_known': True,\n'request_context_name': 'genres'}),\n('assistiveAudio', {'path': ['video_list_sorted', 'assistiveAudio', 'None'],\n- 'lolomo_contexts': None,\n- 'lolomo_known': False,\n+ 'loco_contexts': None,\n+ 'loco_known': False,\n'request_context_name': 'assistiveAudio',\n'label_id': 30163,\n'description_id': 30164,\n'icon': 'DefaultTVShows.png'}),\n('recommendations', {'path': ['recommendations', 'recommendations'],\n- 'lolomo_contexts': ['similars', 'becauseYouAdded', 'becauseYouLiked', 'watchAgain',\n+ 'loco_contexts': ['similars', 'becauseYouAdded', 'becauseYouLiked', 'watchAgain',\n'bigRow'],\n- 'lolomo_known': False,\n+ 'loco_known': False,\n'label_id': 30001,\n'description_id': 30094,\n'icon': 'DefaultUser.png'}),\n('tvshowsGenres', {'path': ['subgenres', 'tvshowsGenres', '83'],\n- 'lolomo_contexts': None,\n- 'lolomo_known': False,\n+ 'loco_contexts': None,\n+ 'loco_known': False,\n'request_context_name': 'genres', # Used for sub-menus\n'label_id': 30174,\n'description_id': None,\n'icon': 'DefaultTVShows.png'}),\n('moviesGenres', {'path': ['subgenres', 'moviesGenres', '34399'],\n- 'lolomo_contexts': None,\n- 'lolomo_known': False,\n+ 'loco_contexts': None,\n+ 'loco_known': False,\n'request_context_name': 'genres', # Used for sub-menus\n'label_id': 30175,\n'description_id': None,\n'icon': 'DefaultMovies.png',\n'content_type': CONTENT_MOVIE}),\n- # Todo: Disabled All tv shows/All movies lolomo menu due to website changes\n+ # Todo: Disabled All tv shows/All movies loco menu due to website changes\n# ('tvshows', {'path': ['genres', 'tvshows', '83'],\n- # 'lolomo_contexts': None,\n- # 'lolomo_known': False,\n+ # 'loco_contexts': None,\n+ # 'loco_known': False,\n# 'request_context_name': 'genres', # Used for sub-menus\n# 'label_id': 30095,\n# 'description_id': None,\n# 'icon': 'DefaultTVShows.png'}),\n# ('movies', {'path': ['genres', 'movies', '34399'],\n- # 'lolomo_contexts': None,\n- # 'lolomo_known': False,\n+ # 'loco_contexts': None,\n+ # 'loco_known': False,\n# 'request_context_name': 'genres', # Used for sub-menus\n# 'label_id': 30096,\n# 'description_id': None,\n# 'icon': 'DefaultMovies.png',\n# 'content_type': CONTENT_MOVIE}),\n('genres', {'path': ['genres', 'genres'],\n- 'lolomo_contexts': ['genre'],\n- 'lolomo_known': False,\n+ 'loco_contexts': ['genre'],\n+ 'loco_known': False,\n'request_context_name': 'genres', # Used for sub-menus\n'label_id': 30010,\n'description_id': 30093,\n'icon': 'DefaultGenre.png'}),\n('search', {'path': ['search', 'search'],\n- 'lolomo_contexts': None,\n- 'lolomo_known': False,\n+ 'loco_contexts': None,\n+ 'loco_known': False,\n'label_id': 30011,\n'description_id': 30092,\n'icon': None,\n'view': VIEW_SEARCH}),\n('exported', {'path': ['exported', 'exported'],\n- 'lolomo_contexts': None,\n- 'lolomo_known': False,\n+ 'loco_contexts': None,\n+ 'loco_known': False,\n'label_id': 30048,\n'description_id': 30091,\n'icon': 'DefaultHardDisk.png',\n@@ -337,10 +337,10 @@ class GlobalVariables(object):\nreturn custom_esn if custom_esn else g.LOCAL_DB.get_value('esn', '', table=TABLE_SESSION)\ndef is_known_menu_context(self, context):\n- \"\"\"Return true if context are one of the menu with lolomo_known=True\"\"\"\n+ \"\"\"Return true if context are one of the menu with loco_known=True\"\"\"\nfor menu_id, data in iteritems(self.MAIN_MENU_ITEMS): # pylint: disable=unused-variable\n- if data['lolomo_known']:\n- if data['lolomo_contexts'][0] == context:\n+ if data['loco_known']:\n+ if data['loco_contexts'][0] == context:\nreturn True\nreturn False\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/navigation/actions.py",
"new_path": "resources/lib/navigation/actions.py",
"diff": "@@ -157,8 +157,8 @@ class AddonActionExecutor(object):\nif list_id:\ng.CACHE.delete(CACHE_COMMON, list_id, including_suffixes=True)\n# When the continueWatching context is invalidated from a refreshListByContext call\n- # the lolomo need to be updated to obtain the new list id, so we delete the cache to get new data\n- g.CACHE.delete(CACHE_COMMON, 'lolomo_list')\n+ # the LoCo need to be updated to obtain the new list id, so we delete the cache to get new data\n+ g.CACHE.delete(CACHE_COMMON, 'loco_list')\ndef view_esn(self, pathitems=None): # pylint: disable=unused-argument\n\"\"\"Show the ESN in use\"\"\"\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/navigation/directory.py",
"new_path": "resources/lib/navigation/directory.py",
"diff": "@@ -21,7 +21,7 @@ from resources.lib.navigation.directory_utils import (finalize_directory, conver\nend_of_directory, get_title, activate_profile, auto_scroll)\n# What means dynamic menus (and dynamic id):\n-# Are considered dynamic menus all menus which context name do not exists in the 'lolomo_contexts' of\n+# Are considered dynamic menus all menus which context name do not exists in the 'loco_contexts' of\n# MAIN_MENU_ITEMS items in globals.py.\n# These menus are generated on the fly (they are not hardcoded) and their data references are saved in TABLE_MENU_DATA\n# as menu item (with same structure of MAIN_MENU_ITEMS items in globals.py)\n@@ -222,13 +222,13 @@ class Directory(object):\[email protected]_execution(immediate=False)\n@custom_viewmode(g.VIEW_FOLDER)\ndef genres(self, pathitems):\n- \"\"\"Show lolomo list of a genre or from lolomo root the list of contexts specified in the menu data\"\"\"\n+ \"\"\"Show loco list of a genre or from loco root the list of contexts specified in the menu data\"\"\"\nmenu_data = g.MAIN_MENU_ITEMS.get(pathitems[1])\nif not menu_data: # Dynamic menus\nmenu_data = g.LOCAL_DB.get_value(pathitems[1], table=TABLE_MENU_DATA, data_type=dict)\ncall_args = {\n'menu_data': menu_data,\n- # When genre_id is None is loaded the lolomo root the list of contexts specified in the menu data\n+ # When genre_id is None is loaded the loco root the list of contexts specified in the menu data\n'genre_id': None if len(pathitems) < 3 else int(pathitems[2]),\n'force_use_videolist_id': False,\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/directorybuilder/dir_builder.py",
"new_path": "resources/lib/services/directorybuilder/dir_builder.py",
"diff": "@@ -18,7 +18,7 @@ from resources.lib.common import VideoId\nfrom resources.lib.globals import g\nfrom resources.lib.services.directorybuilder.dir_builder_items import (build_video_listing, build_subgenres_listing,\nbuild_season_listing, build_episode_listing,\n- build_lolomo_listing, build_mainmenu_listing,\n+ build_loco_listing, build_mainmenu_listing,\nbuild_profiles_listing)\nfrom resources.lib.services.directorybuilder.dir_builder_requests import DirectoryRequests\n@@ -85,7 +85,7 @@ class DirectoryBuilder(DirectoryRequests):\[email protected]_return_call\ndef get_video_list(self, list_id, menu_data, is_dynamic_id):\nif not is_dynamic_id:\n- list_id = self.get_lolomo_list_id_by_context(menu_data['lolomo_contexts'][0])\n+ list_id = self.get_loco_list_id_by_context(menu_data['loco_contexts'][0])\nreturn build_video_listing(self.req_video_list(list_id), menu_data, mylist_items=self.req_mylist_items())\[email protected]_execution(immediate=True)\n@@ -95,7 +95,7 @@ class DirectoryBuilder(DirectoryRequests):\nif is_dynamic_id and pathitems[2] != 'None':\n# Dynamic IDs for common video lists\n# The context_id can be:\n- # -In the lolomo list: 'video list id'\n+ # -In the loco list: 'video list id'\n# -In the video list: 'sub-genre id'\n# -In the list of genres: 'sub-genre id'\ncontext_id = pathitems[2]\n@@ -129,14 +129,15 @@ class DirectoryBuilder(DirectoryRequests):\[email protected]_return_call\ndef get_genres(self, menu_data, genre_id, force_use_videolist_id):\nif genre_id:\n- # Load the LoLoMo list of the specified genre\n- lolomo_list = self.req_lolomo_list_genre(genre_id)\n- exclude_lolomo_known = True\n+ # Load the LoCo list of the specified genre\n+ # Todo\n+ loco_list = self.req_lolomo_list_genre(genre_id)\n+ exclude_loco_known = True\nelse:\n- # Load the LoLoMo root list filtered by 'lolomo_contexts' specified in the menu_data\n- lolomo_list = self.req_lolomo_list_root()\n- exclude_lolomo_known = False\n- return build_lolomo_listing(lolomo_list, menu_data, force_use_videolist_id, exclude_lolomo_known)\n+ # Load the LoCo root list filtered by 'loco_contexts' specified in the menu_data\n+ loco_list = self.req_loco_list_root()\n+ exclude_loco_known = False\n+ return build_loco_listing(loco_list, menu_data, force_use_videolist_id, exclude_loco_known)\[email protected]_execution(immediate=True)\[email protected]_return_call\n@@ -167,11 +168,11 @@ class DirectoryBuilder(DirectoryRequests):\[email protected]_return_call\ndef get_continuewatching_videoid_exists(self, video_id):\n\"\"\"\n- Special method used to know if a video id exists in lolomo continue watching list\n+ Special method used to know if a video id exists in loco continue watching list\n:param video_id: videoid as [string] value\n- :return: a tuple ([bool] true if videoid exists, [string] the current list id, that depends from lolomo id)\n+ :return: a tuple ([bool] true if videoid exists, [string] the current list id, that depends from loco id)\n\"\"\"\n- list_id = self.get_lolomo_list_id_by_context('continueWatching')\n+ list_id = self.get_loco_list_id_by_context('continueWatching')\nvideo_list = self.req_video_list(list_id).videos if video_id else []\nreturn video_id in video_list, list_id\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/directorybuilder/dir_builder_items.py",
"new_path": "resources/lib/services/directorybuilder/dir_builder_items.py",
"diff": "@@ -34,7 +34,7 @@ except NameError: # Python 3\[email protected]_execution(immediate=True)\n-def build_mainmenu_listing(lolomo_list):\n+def build_mainmenu_listing(loco_list):\n\"\"\"Builds the main menu listing (my list, continue watching, etc.)\"\"\"\nfrom resources.lib.kodi.context_menu import generate_context_menu_mainmenu\ndirectory_items = []\n@@ -45,8 +45,8 @@ def build_mainmenu_listing(lolomo_list):\nfor menu_id, data in iteritems(g.MAIN_MENU_ITEMS):\nif not g.ADDON.getSettingBool('_'.join(('show_menu', menu_id))):\ncontinue\n- if data['lolomo_known']:\n- list_id, video_list = lolomo_list.find_by_context(data['lolomo_contexts'][0])\n+ if data['loco_known']:\n+ list_id, video_list = loco_list.find_by_context(data['loco_contexts'][0])\nif not list_id:\ncontinue\nmenu_title = video_list['displayName']\n@@ -173,23 +173,23 @@ def _create_episode_item(seasonid, episodeid_value, episode, episodes_list, comm\[email protected]_execution(immediate=True)\n-def build_lolomo_listing(lolomo_list, menu_data, force_use_videolist_id=False, exclude_lolomo_known=False):\n- \"\"\"Build a listing of video lists (LoLoMo)\"\"\"\n- # If contexts are specified (lolomo_contexts in the menu_data), then the lolomo_list data will be filtered by\n- # the specified contexts, otherwise all LoLoMo items will be added\n+def build_loco_listing(loco_list, menu_data, force_use_videolist_id=False, exclude_loco_known=False):\n+ \"\"\"Build a listing of video lists (LoCo)\"\"\"\n+ # If contexts are specified (loco_contexts in the menu_data), then the loco_list data will be filtered by\n+ # the specified contexts, otherwise all LoCo items will be added\ncommon_data = {\n'menu_data': menu_data,\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}\n- contexts = menu_data.get('lolomo_contexts')\n- items_list = lolomo_list.lists_by_context(contexts) if contexts else iteritems(lolomo_list.lists)\n+ contexts = menu_data.get('loco_contexts')\n+ items_list = loco_list.lists_by_context(contexts) if contexts else iteritems(loco_list.lists)\ndirectory_items = []\nfor video_list_id, video_list in items_list:\nmenu_parameters = common.MenuIdParameters(video_list_id)\nif not menu_parameters.is_menu_id:\ncontinue\n- if exclude_lolomo_known and menu_parameters.type_id != '28':\n+ if exclude_loco_known and menu_parameters.type_id != '28':\n# Keep only the menus genre\ncontinue\nlist_id = (menu_parameters.context_id\n@@ -198,8 +198,8 @@ def build_lolomo_listing(lolomo_list, menu_data, force_use_videolist_id=False, e\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- sub_menu_data['lolomo_known'] = False\n- sub_menu_data['lolomo_contexts'] = None\n+ sub_menu_data['loco_known'] = False\n+ sub_menu_data['loco_contexts'] = None\nsub_menu_data['content_type'] = menu_data.get('content_type', g.CONTENT_SHOW)\nsub_menu_data['force_use_videolist_id'] = force_use_videolist_id\nsub_menu_data['title'] = video_list['displayName']\n@@ -250,14 +250,14 @@ def build_video_listing(video_list, menu_data, sub_genre_id=None, pathitems=None\ndirectory_items = [_create_video_item(videoid_value, video, video_list, perpetual_range_start, common_data)\nfor videoid_value, video\nin iteritems(video_list.videos)]\n- # If genre_id exists add possibility to browse LoLoMo sub-genres\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\nmenu_id = 'subgenre_' + sub_genre_id\nsub_menu_data = menu_data.copy()\nsub_menu_data['path'] = [menu_data['path'][0], menu_id, sub_genre_id]\n- sub_menu_data['lolomo_known'] = False\n- sub_menu_data['lolomo_contexts'] = None\n+ sub_menu_data['loco_known'] = False\n+ sub_menu_data['loco_contexts'] = None\nsub_menu_data['content_type'] = menu_data.get('content_type', g.CONTENT_SHOW)\nsub_menu_data.update({'title': common.get_local_string(30089)})\nsub_menu_data['initial_menu_id'] = menu_data.get('initial_menu_id', menu_data['path'][1])\n@@ -303,8 +303,8 @@ def build_subgenres_listing(subgenre_list, menu_data):\nsel_video_list_id = unicode(subgenre_data['id'])\nsub_menu_data = menu_data.copy()\nsub_menu_data['path'] = [menu_data['path'][0], sel_video_list_id, sel_video_list_id]\n- sub_menu_data['lolomo_known'] = False\n- sub_menu_data['lolomo_contexts'] = None\n+ sub_menu_data['loco_known'] = False\n+ sub_menu_data['loco_contexts'] = None\nsub_menu_data['content_type'] = menu_data.get('content_type', g.CONTENT_SHOW)\nsub_menu_data['title'] = subgenre_data['name']\nsub_menu_data['initial_menu_id'] = menu_data.get('initial_menu_id', menu_data['path'][1])\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/directorybuilder/dir_builder_requests.py",
"new_path": "resources/lib/services/directorybuilder/dir_builder_requests.py",
"diff": "@@ -64,8 +64,8 @@ class DirectoryRequests(object):\n\"\"\"Retrieve root LoCo list\"\"\"\n# It is used to following cases:\n# - To get items for the main menu\n- # (when 'lolomo_known'==True and lolomo_contexts is set, see MAIN_MENU_ITEMS in globals.py)\n- # - To get list items for menus that have multiple contexts set to 'lolomo_contexts' like 'recommendations' menu\n+ # (when 'loco_known'==True and loco_contexts is set, see MAIN_MENU_ITEMS in globals.py)\n+ # - To get list items for menus that have multiple contexts set to 'loco_contexts' like 'recommendations' menu\ncommon.debug('Requesting LoCo root lists')\npaths = ([['loco', {'from': 0, 'to': 50}, \"componentSummary\"]] +\n# Titles of first 4 videos in each video list (needed only to show titles in the plot description)\n@@ -98,6 +98,14 @@ class DirectoryRequests(object):\nraise InvalidVideoListTypeError('No lists with context {} available'.format(context))\nreturn list_id\n+ def get_loco_list_id_by_context(self, context):\n+ \"\"\"Return the dynamic video list ID for a LoCo context\"\"\"\n+ try:\n+ list_id = next(iter(self.req_loco_list_root().lists_by_context([context], True)))[0]\n+ except StopIteration:\n+ raise InvalidVideoListTypeError('No lists with context {} available'.format(context))\n+ return list_id\n+\n@cache_utils.cache_output(cache_utils.CACHE_COMMON, fixed_identifier='profiles_raw_data',\nttl=300, ignore_self_class=True)\ndef req_profiles_info(self, update_database=True):\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/msl/events_handler.py",
"new_path": "resources/lib/services/msl/events_handler.py",
"diff": "@@ -132,7 +132,7 @@ class EventsHandler(threading.Thread):\ncommon.error('EVENT [{}] - The request has failed: {}', event, exc)\nif event.event_type == EVENT_STOP:\nself.clear_queue()\n- if event.event_data['allow_request_update_lolomo']:\n+ if event.event_data['allow_request_update_loco']:\n# if event.event_data['is_in_mylist']:\n# # If video is in my list, invalidate the continueWatching list (update loco context data)\n# api.update_loco_context('continueWatching')\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": "@@ -32,7 +32,7 @@ class AMVideoEvents(ActionManager):\nself.tick_elapsed = 0\nself.is_player_in_pause = False\nself.lock_events = False\n- self.allow_request_update_lolomo = False\n+ self.allow_request_update_loco = False\nself.window_cls = Window(10000) # Kodi home window\ndef __str__(self):\n@@ -58,8 +58,8 @@ class AMVideoEvents(ActionManager):\n# Delete the cache of continueWatching list\ng.CACHE.delete(CACHE_COMMON, list_id, including_suffixes=True)\n# When the continueWatching context is invalidated from a refreshListByContext call\n- # the lolomo need to be updated to obtain the new list id, so we delete the cache to get new data\n- g.CACHE.delete(CACHE_COMMON, 'lolomo_list')\n+ # the LoCo need to be updated to obtain the new list id, so we delete the cache to get new data\n+ g.CACHE.delete(CACHE_COMMON, 'loco_list')\ndef on_tick(self, player_state):\nif self.lock_events:\n@@ -87,9 +87,9 @@ class AMVideoEvents(ActionManager):\nself._send_event(EVENT_KEEP_ALIVE, self.event_data, player_state)\nself._save_resume_time(player_state['elapsed_seconds'])\nself.last_tick_count = self.tick_elapsed\n- # Allow request of lolomo update (for continueWatching and bookmark) only after the first minute\n+ # Allow request of loco update (for continueWatching and bookmark) only after the first minute\n# it seems that most of the time if sent earlier returns error\n- self.allow_request_update_lolomo = True\n+ self.allow_request_update_loco = True\nself.tick_elapsed += 1 # One tick almost always represents one second\ndef on_playback_pause(self, player_state):\n@@ -111,7 +111,7 @@ class AMVideoEvents(ActionManager):\nself._reset_tick_count()\nself._send_event(EVENT_ENGAGE, self.event_data, player_state)\nself._save_resume_time(player_state['elapsed_seconds'])\n- self.allow_request_update_lolomo = True\n+ self.allow_request_update_loco = True\ndef on_playback_stopped(self, player_state):\nif not self.is_event_start_sent or self.lock_events:\n@@ -138,7 +138,7 @@ class AMVideoEvents(ActionManager):\nif not player_state:\ncommon.warn('AMVideoEvents: the event [{}] cannot be sent, missing player_state data', event_type)\nreturn\n- event_data['allow_request_update_lolomo'] = self.allow_request_update_lolomo\n+ event_data['allow_request_update_loco'] = self.allow_request_update_loco\ncommon.send_signal(common.Signals.QUEUE_VIDEO_EVENT, {\n'event_type': event_type,\n'event_data': event_data,\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Changed definitions to loco and some fixes |
106,046 | 20.06.2020 18:44:33 | -7,200 | b17663b37ec561d69d7f427da48859903152daf1 | Removed wrong 'call' method param from path_request | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/nfsession/nfsession.py",
"new_path": "resources/lib/services/nfsession/nfsession.py",
"diff": "@@ -221,7 +221,7 @@ class NetflixSession(NFSessionAccess, DirectoryBuilder):\ndef _path_request(self, paths, use_jsongraph=False):\n\"\"\"Execute a path request with static paths\"\"\"\ncommon.debug('Executing path request: {}', json.dumps(paths))\n- custom_params = {'method': 'call'}\n+ custom_params = {}\nif use_jsongraph:\ncustom_params['falcor_server'] = '0.1.0'\n# Use separators with dumps because Netflix rejects spaces\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Removed wrong 'call' method param from path_request |
106,046 | 20.06.2020 19:27:26 | -7,200 | b3f0cab7090743b97505aa676b93cd48eb0c5aeb | Add support for possible re-implement of browsing lists of genres | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/directorybuilder/dir_builder.py",
"new_path": "resources/lib/services/directorybuilder/dir_builder.py",
"diff": "@@ -131,9 +131,10 @@ class DirectoryBuilder(DirectoryRequests):\nif genre_id:\n# Load the LoCo list of the specified genre\n# Todo\n- loco_list = self.req_lolomo_list_genre(genre_id)\n- exclude_loco_known = True\n- else:\n+ raise NotImplementedError()\n+ # loco_list = self.req_loco_list_genre(genre_id)\n+ # exclude_loco_known = True\n+ # else:\n# Load the LoCo root list filtered by 'loco_contexts' specified in the menu_data\nloco_list = self.req_loco_list_root()\nexclude_loco_known = False\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/directorybuilder/dir_builder_requests.py",
"new_path": "resources/lib/services/directorybuilder/dir_builder_requests.py",
"diff": "@@ -76,6 +76,31 @@ class DirectoryRequests(object):\npath_response = self.netflix_session._path_request(**call_args)\nreturn LoCo(path_response)\n+ @cache_utils.cache_output(cache_utils.CACHE_GENRES, identify_from_kwarg_name='genre_id', ignore_self_class=True)\n+ def req_loco_list_genre(self, genre_id):\n+ \"\"\"Retrieve LoCo for the given genre\"\"\"\n+ common.debug('Requesting LoCo for genre {}', genre_id)\n+ # Todo: 20/06/2020 Currently make requests for genres raise this exception from netflix server\n+ # (errors visible only with jsonGraph enabled on path request):\n+ # Msg: No signature of method: api.Lolomo.getLolomoRequest() is applicable for argument types:\n+ # (java.util.ArrayList, null, java.lang.Boolean) values: [[jaw, jawEpisode, jawTrailer], null, false]\n+ # ErrCause: groovy.lang.MissingMethodException: No signature of method: api.Lolomo.getLolomoRequest()\n+ # is applicable for argument types: (java.util.ArrayList, null, java.lang.Boolean)\n+ # values: [[jaw, jawEpisode, jawTrailer], null, false]\n+ # For reference the PR to restore the functionality: https://github.com/CastagnaIT/plugin.video.netflix/pull/685\n+ paths = ([['genres', genre_id, 'name'] +\n+ ['genres', genre_id, 'rw', 'componentSummary'] +\n+ # Titles of first 4 videos in each video list (needed only to show titles in the plot description)\n+ ['genres', genre_id, 'rw',\n+ {'from': 0, 'to': 48}, {'from': 0, 'to': 3}, 'reference', ['title', 'summary']]] +\n+ # Art for the first video of each context list (needed only to add art to the menu item)\n+ build_paths(['genres', genre_id, 'rw', {'from': 0, 'to': 48}, 0, 'reference'], ART_PARTIAL_PATHS) +\n+ # IDs and names of sub-genres\n+ [['genres', 34399, 'subgenres', {'from': 0, 'to': 30}, ['id', 'name']]])\n+ call_args = {'paths': paths}\n+ path_response = self.netflix_session._path_request(**call_args)\n+ return LoCo(path_response)\n+\n@cache_utils.cache_output(cache_utils.CACHE_GENRES, identify_from_kwarg_name='genre_id', ignore_self_class=True)\ndef req_lolomo_list_genre(self, genre_id):\n\"\"\"Retrieve LoLoMos for the given genre\"\"\"\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Add support for possible re-implement of browsing lists of genres |
106,046 | 21.06.2020 09:37:33 | -7,200 | 187c4b6a4aeda0f76e7cf32bfcb5d267059f7b55 | Remove whitespaces from credentials
some users inadvertently insert spaces,
and this cause issue with MSL side by raising error:
Email or password is incorrect | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/common/credentials.py",
"new_path": "resources/lib/common/credentials.py",
"diff": "@@ -110,8 +110,8 @@ def set_credentials(email, password):\nDoes nothing if either email or password are not supplied.\n\"\"\"\nif email and password:\n- g.LOCAL_DB.set_value('account_email', encrypt_credential(email))\n- g.LOCAL_DB.set_value('account_password', encrypt_credential(password))\n+ g.LOCAL_DB.set_value('account_email', encrypt_credential(email.strip()))\n+ g.LOCAL_DB.set_value('account_password', encrypt_credential(password.strip()))\ndef purge_credentials():\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Remove whitespaces from credentials
some users inadvertently insert spaces,
and this cause issue with MSL side by raising error:
Email or password is incorrect |
106,046 | 21.06.2020 09:43:50 | -7,200 | 278453cdf6ea4a9bef216f5282a5afc75c941d8a | Removed return not needed | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/kodi/ui/dialogs.py",
"new_path": "resources/lib/kodi/ui/dialogs.py",
"diff": "@@ -39,10 +39,6 @@ def ask_credentials():\npassword = ask_for_password()\ncommon.verify_credentials(password)\ncommon.set_credentials(email, password)\n- return {\n- 'email': email,\n- 'password': password\n- }\ndef ask_for_password():\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Removed return not needed |
106,046 | 21.06.2020 09:45:29 | -7,200 | 4a09a819d75de0be945f83cfc3fabac63a594964 | Add search icon to search menu | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/globals.py",
"new_path": "resources/lib/globals.py",
"diff": "@@ -172,7 +172,7 @@ class GlobalVariables(object):\n'loco_known': False,\n'label_id': 30011,\n'description_id': 30092,\n- 'icon': None,\n+ 'icon': 'DefaultAddonsSearch.png',\n'view': VIEW_SEARCH}),\n('exported', {'path': ['exported', 'exported'],\n'loco_contexts': None,\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Add search icon to search menu |
106,046 | 21.06.2020 15:00:02 | -7,200 | f615d0c3b521bd45593b95917fb5054d2d39bb31 | Version bump (1.5.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.4.1\" provider-name=\"libdev + jojo + asciidisco + caphm + castagnait\">\n+<addon id=\"plugin.video.netflix\" name=\"Netflix\" version=\"1.5.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.4.1 (2020-06-13)\n--Disabled menus: All tv shows, All movies, Browse sub-genres sub-menus due to nf changes\n--Add auto-selection of episode to play (only with sync watched status)\n--Add option to force Widevine security level L3 (only android)\n--Fixed a bug that could prevent library sync\n--Updated logo\n--Updated translations it, sv_se, pr_br, ro, de, nl, po, es\n+v1.5.0 (2020-06-21)\n+-Add support to the new LoCo Netflix pages\n+-Fixed KeyError 'lolomo' (LoLoMo seem now deprecated)\n+-Fixed incorrect user/password issue when spaces are inserted unintentionally to credentials\n+-New attempt to fix http error 401\n+-Updated translations fr\n-Minor changes/fixes\n</news>\n</extension>\n"
},
{
"change_type": "MODIFY",
"old_path": "changelog.txt",
"new_path": "changelog.txt",
"diff": "-v1.4.1 (2020-06-13)\n--Disabled menus: All tv shows, All movies, Browse sub-genres sub-menus due to nf changes\n--Add auto-selection of episode to play (only with sync watched status)\n--Add option to force Widevine security level L3 (only android)\n--Fixed a bug that could prevent library sync\n--Updated logo\n--Updated translations it, sv_se, pr_br, ro, de, nl, po, es\n+v1.5.0 (2020-06-21)\n+-Add support to the new LoCo Netflix pages\n+-Fixed KeyError 'lolomo' (LoLoMo seem now deprecated)\n+-Fixed incorrect user/password issue when spaces are inserted unintentionally to credentials\n+-New attempt to fix http error 401\n+-Updated translations fr\n-Minor changes/fixes\nv1.4.0 (2020-05-30)\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Version bump (1.5.0) (#709) |
106,046 | 24.06.2020 20:08:00 | -7,200 | 8d63f93999eb3a7d58bc1ab232f193cbc8d3d56a | Update automatically ui/client version | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/api/website.py",
"new_path": "resources/lib/api/website.py",
"diff": "from __future__ import absolute_import, division, unicode_literals\nimport json\n-from re import compile as recompile, DOTALL, sub\n+from re import search, compile as recompile, DOTALL, sub\nfrom future.utils import iteritems\n@@ -183,6 +183,13 @@ def extract_session_data(content, validate=False, update_profiles=False):\nif not g.LOCAL_DB.get_value('esn', table=TABLE_SESSION):\ng.LOCAL_DB.set_value('esn', common.generate_android_esn() or user_data['esn'], TABLE_SESSION)\ng.LOCAL_DB.set_value('locale_id', user_data.get('preferredLocale').get('id', 'en-US'))\n+ # Extract the client version from assets core\n+ result = search(r'-([0-9\\.]+)\\.js$', api_data.pop('asset_core'))\n+ if not result:\n+ common.error('It was not possible to extract the client version!')\n+ api_data['client_version'] = '6.0023.976.011'\n+ else:\n+ api_data['client_version'] = result.groups()[0]\n# Save api urls\nfor key, path in list(api_data.items()):\ng.LOCAL_DB.set_value(key, path, TABLE_SESSION)\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/msl/msl_handler.py",
"new_path": "resources/lib/services/msl/msl_handler.py",
"diff": "@@ -183,9 +183,9 @@ class MSLHandler(object):\n'isUIAutoPlay': False,\n'useHttpsStreams': True,\n'imageSubtitleHeight': 1080,\n- 'uiVersion': 'shakti-v1b8c742f',\n+ 'uiVersion': g.LOCAL_DB.get_value('ui_version', '', table=TABLE_SESSION),\n'uiPlatform': 'SHAKTI',\n- 'clientVersion': '6.0023.473.011',\n+ 'clientVersion': g.LOCAL_DB.get_value('client_version', '', table=TABLE_SESSION),\n'desiredVmaf': 'plus_lts', # phone_plus_exp can be used to mobile, not tested\n'supportsPreReleasePin': True,\n'supportsWatermark': True,\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/msl/msl_utils.py",
"new_path": "resources/lib/services/msl/msl_utils.py",
"diff": "@@ -11,7 +11,6 @@ from __future__ import absolute_import, division, unicode_literals\nimport json\nimport random\n-import re\nimport time\nfrom functools import wraps\n@@ -160,11 +159,7 @@ def generate_logblobs_params():\nscreen_size = str(xbmcgui.getScreenWidth()) + 'x' + str(xbmcgui.getScreenHeight())\ntimestamp_utc = time.time()\ntimestamp = int(timestamp_utc * 1000)\n- client_ver = g.LOCAL_DB.get_value('asset_core', '', table=TABLE_SESSION)\napp_id = int(time.time()) * 10000 + random.randint(1, 10001) # Should be used with all log requests\n- if client_ver:\n- result = re.search(r'-([0-9\\.]+)\\.js$', client_ver)\n- client_ver = result.groups()[0]\n# Here you have to enter only the real data, falsifying the data would cause repercussions in netflix server logs\n# therefore since it is possible to exclude data, we avoid entering data that we do not have\n@@ -190,7 +185,7 @@ def generate_logblobs_params():\n'type': 'startup',\n'sev': 'info',\n'devmod': 'chrome-cadmium',\n- 'clver': client_ver, # e.g. '6.0021.220.051'\n+ 'clver': g.LOCAL_DB.get_value('client_version', '', table=TABLE_SESSION), # e.g. '6.0021.220.051'\n'osplatform': g.LOCAL_DB.get_value('browser_info_os_name', '', table=TABLE_SESSION),\n'osver': g.LOCAL_DB.get_value('browser_info_os_version', '', table=TABLE_SESSION),\n'browsername': 'Chrome',\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Update automatically ui/client version |
106,046 | 24.06.2020 20:09:48 | -7,200 | b5bbd5b962c5267dc4b7e862f9aa36c6e291abaf | Changed key pair id | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/msl/default_crypto.py",
"new_path": "resources/lib/services/msl/default_crypto.py",
"diff": "@@ -67,7 +67,7 @@ class DefaultMSLCrypto(MSLBaseCrypto):\n'keydata': {\n'publickey': public_key.decode('utf-8'),\n'mechanism': 'JWK_RSA',\n- 'keypairid': 'superKeyPair'\n+ 'keypairid': 'rsaKeypairId'\n}}]\ndef encrypt(self, plaintext, esn):\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Changed key pair id |
106,046 | 24.06.2020 20:14:42 | -7,200 | 037549e11999440ef50a6a62906314a2962f6690 | Improved some data | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/msl/msl_handler.py",
"new_path": "resources/lib/services/msl/msl_handler.py",
"diff": "@@ -192,7 +192,7 @@ class MSLHandler(object):\n'supportsUnequalizedDownloadables': True,\n'showAllSubDubTracks': False,\n'titleSpecificData': {\n- viewable_id: {\n+ unicode(viewable_id): {\n'unletterboxed': True\n}\n},\n@@ -205,7 +205,8 @@ class MSLHandler(object):\n'preferAssistiveAudio': False\n}\n- manifest = self.msl_requests.chunked_request(ENDPOINTS['manifest'],\n+ endpoint_url = ENDPOINTS['manifest'] + '?reqAttempt=1&reqPriority=0&reqName=prefetch/manifest'\n+ manifest = self.msl_requests.chunked_request(endpoint_url,\nself.msl_requests.build_request_data('/manifest', params),\nesn,\ndisable_msl_switch=False)\n@@ -239,7 +240,8 @@ class MSLHandler(object):\n'challengeBase64': challenge,\n'xid': xid\n}]\n- response = self.msl_requests.chunked_request(ENDPOINTS['license'],\n+ endpoint_url = ENDPOINTS['license'] + '?reqAttempt=1&reqPriority=0&reqName=prefetch/license'\n+ response = self.msl_requests.chunked_request(endpoint_url,\nself.msl_requests.build_request_data(self.last_license_url,\nparams,\n'drmSessionId'),\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Improved some data |
106,046 | 24.06.2020 20:15:51 | -7,200 | 45d2b260bd17af3b93d1d2def036a909aa4e1d4d | Add challenge data to manifest request (only ARM devices) | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/msl/android_crypto.py",
"new_path": "resources/lib/services/msl/android_crypto.py",
"diff": "@@ -92,10 +92,16 @@ class AndroidMSLCrypto(MSLBaseCrypto):\nraise MSLError('Widevine CryptoSession getKeyRequest failed!')\ncommon.debug('Widevine CryptoSession getKeyRequest successful. Size: {}', len(key_request))\n+\n+ # Save the key request (challenge data) required for manifest requests\n+ # Todo: to be implemented if/when it becomes mandatory\n+ key_request = base64.standard_b64encode(key_request).decode('utf-8')\n+ # g.LOCAL_DB.set_value('drm_session_challenge', key_request, TABLE_SESSION)\n+\nreturn [{\n'scheme': 'WIDEVINE',\n'keydata': {\n- 'keyrequest': base64.standard_b64encode(key_request).decode('utf-8')\n+ 'keyrequest': key_request\n}\n}]\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/msl/msl_handler.py",
"new_path": "resources/lib/services/msl/msl_handler.py",
"diff": "@@ -38,6 +38,34 @@ class MSLHandler(object):\nlicenses_session_id = []\nlicenses_xid = []\nlicenses_release_url = []\n+ manifest_challenge = ('CAESwQsKhgsIARLsCQqvAggCEhGN3Th6q2GhvXw9bD+X9aW2ChjQ8PLmBSKOAjCCAQoCggEBANsVUL5yI9K'\n+ 'UG1TPpb1A0bzk6df3YwbpDEkh+IOj52RfnKyspASRN1JQvCRrKwiq433M9BV+8ZkzkheYEPZ9X5rl5Ydkwp'\n+ 'qedzdZRAiuaVp/mMA5zUM3I3fZogVxGnVzh4mB2URg+g7TFwbPWz2x1uzPumO+2ImOPIUyR7auoOKrZml30'\n+ '8w8Edwdd1HwFyrJEZHLDN2P51PJhVrUBWUlxebY05NhfIUvWQ/pyXAa6AahTf7PTVow/uu1d0vc6gHSxmj0'\n+ 'hodvaxrkDcBY9NoOH2XCW7LNJnKC487CVwCHOJC9+6fakaHnjHepayeGEp2JL2AaCrGGqAOZdG8F11Pa0H8'\n+ 'CAwEAASirbxKAAmFqOFvUp7caxO5/q2QK5yQ8/AA5E1KOQJxZrqwREPbGUX3670XGw9bamA0bxc37DUi6Dw'\n+ 'rOyWKWSaW/qVNie86mW/7KdVSpZPGcF/TxO+kd4iXMIjH0REZst/mMJhv5UMMO9dDFGR3RBqkPbDTdzvX1u'\n+ 'E/loVPDH8QEfDACzDkeCA1P0zAcjWKGPzaeUrogsnBEQN4wCVRQqufDXkgImhDUCUkmyQDJXQkhgMMWtbbC'\n+ 'HMa/DMGEZAhu4I8G32m8XxU3NoK1kDsb+s5VUgOdkX3ZnFw1uf3niQ9FCTYlzv4SIBJGEokJjkHagT6kVWf'\n+ 'hsvSHMHzayKb00OwIn/6NsNEatAUKrgIIARIQiX9ghrmqxsdcq/w8cprG8Bj46/LmBSKOAjCCAQoCggEBAL'\n+ 'udF8e+FexCGnOsPQCNtaIvTRW8XsqiTxdo5vElAnGMoOZn6Roy2jwDkc1Gy2ucybY926xk0ZP2Xt5Uy/atI'\n+ '5yAvn7WZGWzbR5BbMbXIxaCyDysm7L+X6Fid55YbJ8GLl2/ToOY2CVYT+EciaTj56OjcyBJLDW/0Zqp25gn'\n+ 'da61HwomZOVLoFmLbeZtC5DjvEv8c2NIDXXketqd/vj0I1nWKtEy8nKIPw/2nhitR6QFUnfEb8hJgPgdTAp'\n+ 'TkxWm4hSpWsM0j8CQOYNzDL2/kfP1cYw0Fh7oJMSEt2H6AUjC4lIkp54rPHAhLYE+tmwKSYfrmjEoTVErcI'\n+ 'jl6jEvwtsCAwEAASirbxKAA0OHZIfwXbTghTVi4awHyXje/8D5fdtggtTa0Edec0KmZbHwBbLJ9OCBc9RrR'\n+ 'L8O4WgQPG/5RVLc9IsR9x/Gw1vg/X+MmWEBnY62XNdVAUjbYGwRQuHQFMkwEQdzxfcH9oWoJtOZdLEN2X/p'\n+ 'Ws7MeM4KZc8gTUqcDHekq1QqKNs+Voc8Q5hIX7fims9llY/RUHNatDPFVuEyJ0Vqx5l+Rrrdqk+b1fXuVR6'\n+ 'yxP1h4S/C/UtedUyZxZgc/1OJ0mLr5x1tkRbFVyzA8Z/qfZeYq3HV4pAGg7nLg0JRBTbjiZH8eUhr1JtwLi'\n+ 'udU9vLvDnv1Y6bsfaT62vfLOttozSZVIeWo7acZHICduOL/tH1Kx7f6e7ierwQYAOng1LGs/PLofQ874C1A'\n+ 'tNkN0tVe6cSSAvN+Vl33GbICXpX6Rq8LBPqqhzGMGBMiybnmXqOaXz8ngSQCiXqp/ImaOKfx8OE6qH92rUV'\n+ 'Wgw68qBy9ExEOl95SSEx9A/B4vEYFHaHwzqh2BoYChFhcmNoaXRlY3R1cmVfbmFtZRIDYXJtGhYKDGNvbXB'\n+ 'hbnlfbmFtZRIGR29vZ2xlGhcKCm1vZGVsX25hbWUSCUNocm9tZUNETRoZCg1wbGF0Zm9ybV9uYW1lEghDaH'\n+ 'JvbWVPUxojChR3aWRldmluZV9jZG1fdmVyc2lvbhILNC4xMC4xNjEwLjYyCAgBEAAYACABEiwKKgoUCAESE'\n+ 'AAAAAAD0mdJAAAAAAAAAAAQARoQA5cwqbEo4TSV6p1qQZy26BgBIOSrw/cFMBUagAIp7zGUC9p3XZ9sp0w+'\n+ 'yd6/wyRa1V22NyPF4BsNivSEkMtcEaQiUOW+LrGhHO+RrukWeJlzVbtpai5/vjOAbsaouQ0yMp8yfpquZcV'\n+ 'kpPugSOPKu1A0W5w5Ou9NOGsMaJi6+LicGxhS+7xAp/lv/9LATCcQJXS2elBCz6f6VUQyMOPyjQYBrH3h27'\n+ 'tVRcsnTRQATcogwCytXohKroBGvODIYcpVFsy2saOCyh4HTezzXJvgogx2f15ViyF5rDqho4YsW0z4it9TF'\n+ 'BT0OOLkk0fQ6a1LSqA49eN3RufKYq4LT+G+ffdgoDmKpIWS3bp7xQ6GeYtDAUh0D8Ipwc8aKzP2')\ndef __init__(self):\nsuper(MSLHandler, self).__init__()\n@@ -205,6 +233,16 @@ class MSLHandler(object):\n'preferAssistiveAudio': False\n}\n+ if 'linux' in common.get_system_platform() and 'arm' in common.get_machine():\n+ # 24/06/2020 To get until to 1080P resolutions under arm devices (ChromeOS), android excluded,\n+ # is mandatory to add the widevine challenge data (key request) to the manifest request.\n+ # Is not possible get the key request from the default_crypto, is needed to implement\n+ # the wv crypto (used for android) but currently InputStreamAdaptive support this interface only\n+ # under android OS.\n+ # As workaround: Initially we pass an hardcoded challenge data needed to play the first video,\n+ # then when ISA perform the license callback we replace it with the fresh license challenge data.\n+ params['challenge'] = self.manifest_challenge\n+\nendpoint_url = ENDPOINTS['manifest'] + '?reqAttempt=1&reqPriority=0&reqName=prefetch/manifest'\nmanifest = self.msl_requests.chunked_request(endpoint_url,\nself.msl_requests.build_request_data('/manifest', params),\n@@ -240,6 +278,7 @@ class MSLHandler(object):\n'challengeBase64': challenge,\n'xid': xid\n}]\n+ self.manifest_challenge = challenge\nendpoint_url = ENDPOINTS['license'] + '?reqAttempt=1&reqPriority=0&reqName=prefetch/license'\nresponse = self.msl_requests.chunked_request(endpoint_url,\nself.msl_requests.build_request_data(self.last_license_url,\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Add challenge data to manifest request (only ARM devices) |
106,046 | 26.06.2020 10:00:03 | -7,200 | e79ecae3e07f7907bc5b0f3e8f5b2a25d30a63fc | Use a single loop | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/directorybuilder/dir_builder.py",
"new_path": "resources/lib/services/directorybuilder/dir_builder.py",
"diff": "@@ -151,8 +151,11 @@ class DirectoryBuilder(DirectoryRequests):\ndef get_mylist_videoids_profile_switch(self):\n# Special method used for library sync with my list\nvideo_list = self.req_datatype_video_list_full('mylist', True)\n- video_id_list = [video_id for video_id, video in iteritems(video_list.videos)]\n- video_id_list_type = [video['summary']['type'] for video_id, video in iteritems(video_list.videos)]\n+ video_id_list = []\n+ video_id_list_type = []\n+ for video_id, video in iteritems(video_list.videos):\n+ video_id_list.append(video_id)\n+ video_id_list_type.append(video['summary']['type'])\nreturn video_id_list, video_id_list_type\[email protected]_execution(immediate=True)\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Use a single loop |
106,046 | 27.06.2020 09:48:53 | -7,200 | 857fca91ba4a3f00a0e708e0175dd0be17627dc1 | Simplified get_metadata and VideoId derive_parent | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/api/api_requests.py",
"new_path": "resources/lib/api/api_requests.py",
"diff": "@@ -220,39 +220,33 @@ def _update_mylist_cache(videoid, operation, params):\ndef get_metadata(videoid, refresh=False):\n\"\"\"Retrieve additional metadata for the given VideoId\"\"\"\nmetadata_data = {}, None\n+ # Get the parent VideoId (when the 'videoid' is a type of EPISODE/SEASON)\n+ parent_videoid = videoid.derive_parent(common.VideoId.SHOW)\n# Delete the cache if we need to refresh the all metadata\nif refresh:\n- videoid_cache = (videoid.derive_parent(0)\n- if videoid.mediatype in [common.VideoId.EPISODE, common.VideoId.SEASON]\n- else videoid)\n- g.CACHE.delete(cache_utils.CACHE_METADATA, str(videoid_cache))\n- if videoid.mediatype not in [common.VideoId.EPISODE, common.VideoId.SEASON]:\n- # videoid of type tvshow, movie, supplemental\n- metadata_data = _metadata(video_id=videoid), None\n- elif videoid.mediatype == common.VideoId.SEASON:\n- metadata_data = _metadata(video_id=videoid.derive_parent(None)), None\n- else: # it is an episode\n+ g.CACHE.delete(cache_utils.CACHE_METADATA, str(parent_videoid))\n+ if videoid.mediatype == common.VideoId.EPISODE:\ntry:\n- metadata_data = _episode_metadata(videoid)\n+ metadata_data = _episode_metadata(videoid, parent_videoid)\nexcept KeyError as exc:\n- # Episode metadata may not exist if its a new episode and cached\n- # data is outdated. In this case, delete the cache entry and\n- # try again safely (if it doesn't exist this time, there is no\n- # metadata for the episode, so we assign an empty dict).\n+ # The episode metadata not exist (case of new episode and cached data outdated)\n+ # In this case, delete the cache entry and try again safely\ncommon.debug('find_episode_metadata raised an error: {}, refreshing cache', exc)\ntry:\n- metadata_data = _episode_metadata(videoid, refresh_cache=True)\n+ metadata_data = _episode_metadata(videoid, parent_videoid, refresh_cache=True)\nexcept KeyError as exc:\n+ # The new metadata does not contain the episode\ncommon.error('Episode metadata not found, find_episode_metadata raised an error: {}', exc)\n+ else:\n+ metadata_data = _metadata(video_id=parent_videoid), None\nreturn metadata_data\n-def _episode_metadata(videoid, refresh_cache=False):\n- tvshow_videoid = videoid.derive_parent(0)\n+def _episode_metadata(episode_videoid, tvshow_videoid, refresh_cache=False):\nif refresh_cache:\ng.CACHE.delete(cache_utils.CACHE_METADATA, str(tvshow_videoid))\nshow_metadata = _metadata(video_id=tvshow_videoid)\n- episode_metadata, season_metadata = common.find_episode_metadata(videoid, show_metadata)\n+ episode_metadata, season_metadata = common.find_episode_metadata(episode_videoid, show_metadata)\nreturn episode_metadata, season_metadata, show_metadata\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/common/misc_utils.py",
"new_path": "resources/lib/common/misc_utils.py",
"diff": "@@ -37,11 +37,11 @@ def find(value_to_find, attribute, search_space):\nraise KeyError('Metadata for {} does not exist'.format(value_to_find))\n-def find_episode_metadata(videoid, metadata):\n+def find_episode_metadata(episode_videoid, metadata):\n\"\"\"Find metadata for a specific episode within a show metadata dict\"\"\"\n- season = find(int(videoid.seasonid), 'id', metadata['seasons'])\n- return (find(int(videoid.episodeid), 'id', season.get('episodes', {})),\n- season)\n+ season = find(int(episode_videoid.seasonid), 'id', metadata['seasons'])\n+ episode = find(int(episode_videoid.episodeid), 'id', season.get('episodes', {}))\n+ return episode, season\ndef get_class_methods(class_item=None):\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/common/videoid.py",
"new_path": "resources/lib/common/videoid.py",
"diff": "@@ -22,8 +22,7 @@ class InvalidVideoId(Exception):\nclass VideoId(object):\n- \"\"\"Universal representation of a video id. Video IDs can be of multiple\n- types:\n+ \"\"\"Universal representation of a video id. Video IDs can be of multiple types:\n- supplemental: a single identifier only for supplementalid, all other values must be None\n- movie: a single identifier only for movieid, all other values must be None\n- show: a single identifier only for tvshowid, all other values must be None\n@@ -207,8 +206,7 @@ class VideoId(object):\nof this show. Raises InvalidVideoId is this instance does not\nrepresent a show.\"\"\"\nif self.mediatype != VideoId.SHOW:\n- raise InvalidVideoId('Cannot derive season VideoId from {}'\n- .format(self))\n+ raise InvalidVideoId('Cannot derive season VideoId from {}'.format(self))\nreturn type(self)(tvshowid=self.tvshowid, seasonid=unicode(seasonid))\ndef derive_episode(self, episodeid):\n@@ -216,24 +214,30 @@ class VideoId(object):\nof this season. Raises InvalidVideoId is this instance does not\nrepresent a season.\"\"\"\nif self.mediatype != VideoId.SEASON:\n- raise InvalidVideoId('Cannot derive episode VideoId from {}'\n- .format(self))\n+ raise InvalidVideoId('Cannot derive episode VideoId from {}'.format(self))\nreturn type(self)(tvshowid=self.tvshowid, seasonid=self.seasonid,\nepisodeid=unicode(episodeid))\n- def derive_parent(self, depth):\n- \"\"\"Returns a new videoid for the parent mediatype (season for episodes,\n- show for seasons) that is at the depth's level of the mediatype\n- hierarchy or this instance if there is no parent mediatype.\"\"\"\n- if self.mediatype == VideoId.SEASON:\n- return type(self)(tvshowid=self.tvshowid)\n- if self.mediatype == VideoId.EPISODE:\n- if depth == 0:\n+ def derive_parent(self, videoid_type):\n+ \"\"\"\n+ Derive a parent VideoId, you can obtain:\n+ [tvshow] from season, episode\n+ [season] from episode\n+ When it is not possible get a derived VideoId, it is returned the same VideoId instance.\n+\n+ :param videoid_type: The type of VideoId to be derived\n+ :return: The parent VideoId of specified type, or when not match the same VideoId instance.\n+ \"\"\"\n+ if videoid_type == VideoId.SHOW:\n+ if self.mediatype not in [VideoId.SEASON, VideoId.EPISODE]:\n+ return self\nreturn type(self)(tvshowid=self.tvshowid)\n- if depth == 1:\n+ if videoid_type == VideoId.SEASON:\n+ if self.mediatype != VideoId.SEASON:\n+ return self\nreturn type(self)(tvshowid=self.tvshowid,\nseasonid=self.seasonid)\n- return self\n+ raise InvalidVideoId('VideoId type {} not valid'.format(videoid_type))\ndef _assigned_id_values(self):\n\"\"\"Return a list of all id_values that are not None\"\"\"\n@@ -258,7 +262,7 @@ class VideoId(object):\ndef _get_unicode_kwargs(kwargs):\n- # Example of return value: (None, None, '70084801', None, None, None, None) this is a movieid\n+ # Example of return value: (None, None, '70084801', None, None, None) this is a movieid\nreturn tuple((unicode(kwargs[idpart])\nif kwargs.get(idpart)\nelse None)\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/navigation/player.py",
"new_path": "resources/lib/navigation/player.py",
"diff": "@@ -250,7 +250,7 @@ def _get_event_data(videoid):\nreq_videoids = [videoid]\nif is_episode:\n# Get also the tvshow data\n- req_videoids.append(videoid.derive_parent(0))\n+ req_videoids.append(videoid.derive_parent(common.VideoId.SHOW))\nraw_data = api.get_video_raw_data(req_videoids, EVENT_PATHS)\nif not raw_data:\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": "@@ -63,9 +63,7 @@ class AMStreamContinuity(ActionManager):\nif self.videoid.mediatype not in [common.VideoId.MOVIE, common.VideoId.EPISODE]:\nself.enabled = False\nreturn\n- self.current_videoid = self.videoid \\\n- if self.videoid.mediatype == common.VideoId.MOVIE \\\n- else self.videoid.derive_parent(0)\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(),\nself.current_videoid.value, {})\nself.kodi_only_forced_subtitles = common.get_kodi_subtitle_language() == 'forced_only'\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": "@@ -50,8 +50,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- current_videoid = (self.videoid if self.videoid.mediatype == common.VideoId.MOVIE\n- else self.videoid.derive_parent(0))\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)})\nif not videoid_exists:\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Simplified get_metadata and VideoId derive_parent |
106,046 | 27.06.2020 11:06:14 | -7,200 | 5b6a3b3c96e289ab3528a3e1b9618cae09f7883f | Version bump (1.5.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.5.0\" provider-name=\"libdev + jojo + asciidisco + caphm + castagnait\">\n+<addon id=\"plugin.video.netflix\" name=\"Netflix\" version=\"1.5.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.5.0 (2020-06-21)\n--Add support to the new LoCo Netflix pages\n--Fixed KeyError 'lolomo' (LoLoMo seem now deprecated)\n--Fixed incorrect user/password issue when spaces are inserted unintentionally to credentials\n--New attempt to fix http error 401\n--Updated translations fr\n--Minor changes/fixes\n+v1.5.1 (2020-06-27)\n+-Implemented fix/workaround to get resolutions until to 1080p with ARM devices\n+-Updated translations tr\n</news>\n</extension>\n</addon>\n"
},
{
"change_type": "MODIFY",
"old_path": "changelog.txt",
"new_path": "changelog.txt",
"diff": "+v1.5.1 (2020-06-27)\n+-Implemented fix/workaround to get resolutions until to 1080p with ARM devices\n+-Updated translations tr\n+\nv1.5.0 (2020-06-21)\n-Add support to the new LoCo Netflix pages\n-Fixed KeyError 'lolomo' (LoLoMo seem now deprecated)\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Version bump (1.5.1) (#715) |
106,046 | 27.06.2020 15:22:33 | -7,200 | b9a0ea60c8e4cb55e6680ce347f1207603605d20 | Oversight missed return | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/nfsession/nfsession.py",
"new_path": "resources/lib/services/nfsession/nfsession.py",
"diff": "@@ -99,6 +99,7 @@ class NetflixSession(NFSessionAccess, DirectoryBuilder):\ncurrent_active_guid = g.LOCAL_DB.get_active_profile_guid()\nif self.is_profile_session_active and guid == current_active_guid:\ncommon.info('The profile session of guid {} is still active, activation not needed.', guid)\n+ return\nimport time\ntimestamp = time.time()\ncommon.info('Activating profile {}', guid)\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Oversight missed return |
106,046 | 30.06.2020 14:13:18 | -7,200 | d86c4309ea873f6a89f19252171bf449d85f1333 | Renamed ask_for_pin | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/kodi/ui/dialogs.py",
"new_path": "resources/lib/kodi/ui/dialogs.py",
"diff": "@@ -60,13 +60,13 @@ def ask_for_rating():\nreturn None\n-def ask_for_pin(message):\n- \"\"\"Ask the user for the adult pin\"\"\"\n+def show_dlg_input_numeric(message, mask_input=True):\n+ \"\"\"Ask the user to enter numbers\"\"\"\nargs = {'heading': message,\n'type': 0,\n'defaultt': ''}\nif not g.KODI_VERSION.is_major_ver('18'): # Kodi => 19.x support mask input\n- args['bHiddenInput'] = True\n+ args['bHiddenInput'] = mask_input\nreturn xbmcgui.Dialog().numeric(**args) or None\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/navigation/directory_utils.py",
"new_path": "resources/lib/navigation/directory_utils.py",
"diff": "@@ -153,7 +153,7 @@ def verify_profile_pin(guid):\n\"\"\"Verify if the profile is locked by a PIN and ask the PIN\"\"\"\nif not g.LOCAL_DB.get_profile_config('isPinLocked', False, guid=guid):\nreturn True\n- pin = ui.ask_for_pin(common.get_local_string(30006))\n+ pin = ui.show_dlg_input_numeric(common.get_local_string(30006))\nreturn None if not pin else verify_profile_lock(guid, pin)\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/navigation/player.py",
"new_path": "resources/lib/navigation/player.py",
"diff": "@@ -224,7 +224,7 @@ def _profile_switch():\ndef _verify_pin(pin_required):\nif not pin_required:\nreturn True\n- pin = ui.ask_for_pin(common.get_local_string(30002))\n+ pin = ui.show_dlg_input_numeric(common.get_local_string(30002))\nreturn None if not pin else api.verify_pin(pin)\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Renamed ask_for_pin |
106,046 | 30.06.2020 14:20:38 | -7,200 | 026db4b5b3a36d4936b3babe36d558c7df1e856f | Implemented select dialog | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/kodi/ui/dialogs.py",
"new_path": "resources/lib/kodi/ui/dialogs.py",
"diff": "@@ -134,3 +134,12 @@ def show_library_task_errors(notify_errors, errors):\nxbmcgui.Dialog().ok(common.get_local_string(0),\n'\\n'.join(['{} ({})'.format(err['task_title'], err['error'])\nfor err in errors]))\n+\n+\n+def show_dlg_select(title, item_list):\n+ \"\"\"\n+ Show a select dialog for a list of objects\n+\n+ :return index of selected item, or -1 when cancelled\n+ \"\"\"\n+ return xbmcgui.Dialog().select(title, item_list)\n"
},
{
"change_type": "MODIFY",
"old_path": "tests/xbmcgui.py",
"new_path": "tests/xbmcgui.py",
"diff": "@@ -135,6 +135,10 @@ class Dialog:\nreturn 'Family'\nreturn 'Foobar'\n+ def select(self, heading, autoclose=None, preselect=None, useDetails=False):\n+ \"\"\"A stub implementation for the xbmcgui Dialog class select() method\"\"\"\n+ return -1\n+\n@staticmethod\n# def numeric(type, heading, defaultt=''): # Kodi 18\ndef numeric(type, heading, defaultt='', bHiddenInput=False): # pylint: disable=redefined-builtin\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Implemented select dialog |
106,046 | 30.06.2020 17:42:46 | -7,200 | f6ba117debbade1b7cef83f40631f0e450385aba | Database update for search table | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/database/db_update.py",
"new_path": "resources/lib/database/db_update.py",
"diff": "@@ -17,7 +17,25 @@ def run_local_db_updates(current_version, upgrade_to_version): # pylint: disabl\n\"\"\"Perform database actions for a db version change\"\"\"\n# The changes must be left in sequence to allow cascade operations on non-updated databases\nif common.is_less_version(current_version, '0.2'):\n- pass\n+ # Changes: added table 'search'\n+ import sqlite3 as sql\n+ from resources.lib.database.db_base_sqlite import CONN_ISOLATION_LEVEL\n+ from resources.lib.database import db_utils\n+\n+ shared_db_conn = sql.connect(db_utils.get_local_db_path(db_utils.LOCAL_DB_FILENAME),\n+ isolation_level=CONN_ISOLATION_LEVEL)\n+ cur = shared_db_conn.cursor()\n+\n+ table = str('CREATE TABLE search ('\n+ 'ID INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,'\n+ 'Guid TEXT NOT NULL REFERENCES profiles (Guid) ON DELETE CASCADE ON UPDATE CASCADE,'\n+ 'Type TEXT NOT NULL,'\n+ 'Value TEXT NOT NULL,'\n+ 'Parameters TEXT,'\n+ 'LastAccess TEXT);')\n+ cur.execute(table)\n+ shared_db_conn.close()\n+\nif common.is_less_version(current_version, '0.3'):\npass\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/upgrade_controller.py",
"new_path": "resources/lib/upgrade_controller.py",
"diff": "@@ -34,7 +34,7 @@ def check_service_upgrade():\n# Upgrades to be performed before starting the service\n# Upgrade the local database\ncurrent_local_db_version = g.LOCAL_DB.get_value('local_db_version', None)\n- upgrade_to_local_db_version = '0.1'\n+ upgrade_to_local_db_version = '0.2'\nif current_local_db_version != upgrade_to_local_db_version:\n_perform_local_db_changes(current_local_db_version, upgrade_to_local_db_version)\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Database update for search table |
106,046 | 01.07.2020 10:01:48 | -7,200 | 16775efc9300ccdfac8c0beb694cbc4a991fe36a | Add has_show_setting/has_sort_setting to menu options | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/globals.py",
"new_path": "resources/lib/globals.py",
"diff": "@@ -64,19 +64,22 @@ class GlobalVariables(object):\n'''\n--Main Menu key infos--\n- path : passes information to the called method generally structured as follows: [func. name, menu id, context id]\n- loco_contexts : contexts used to obtain the list of contents (use only one context when loco_known = True)\n- loco_known : if True, keys label_id/description_id/icon are ignored, these values are obtained from LoCo list\n- label_id : menu title\n- description_id : description info text\n- icon : set a default image\n- view : override the default \"partial menu id\" of view\n- content_type : override the default content type (CONTENT_SHOW)\n+ path Passes information to the called method\n+ generally structured as follows: [func. name, menu id, context id]\n+ loco_contexts Contexts used to obtain the list of contents (use only one context when loco_known = True)\n+ loco_known If True, keys label_id/description_id/icon are ignored, these values are obtained from LoCo list\n+ label_id The ID for the menu title\n+ description_id Description info text\n+ icon Set a default image\n+ view Override the default \"partial menu id\" of view\n+ content_type Override the default content type (CONTENT_SHOW)\n+ has_show_setting Means that the menu has the show/hide settings, by default is True\n+ has_sort_setting Means that the menu has the sort settings, by default is False\nExplanation of function names in the 'path' key:\n- video_list: automatically gets the list_id by making a loco request,\n+ video_list Automatically gets the list_id by making a loco request,\nthe list_id search is made using the value specified on the loco_contexts key\n- video_list_sorted: to work must have a third argument on the path that is the context_id\n+ video_list_sorted To work must have a third argument on the path that is the context_id\nor instead specified the key request_context_name\n'''\nMAIN_MENU_ITEMS = collections.OrderedDict([\n@@ -84,7 +87,8 @@ class GlobalVariables(object):\n'loco_contexts': ['queue'],\n'loco_known': True,\n'request_context_name': 'mylist',\n- 'view': VIEW_MYLIST}),\n+ 'view': VIEW_MYLIST,\n+ 'has_sort_setting': True}),\n('continueWatching', {'path': ['video_list', 'continueWatching'],\n'loco_contexts': ['continueWatching'],\n'loco_known': True}),\n@@ -97,11 +101,13 @@ class GlobalVariables(object):\n'request_context_name': 'genres',\n'label_id': 30145,\n'description_id': 30146,\n- 'icon': 'DefaultRecentlyAddedMovies.png'}),\n+ 'icon': 'DefaultRecentlyAddedMovies.png',\n+ 'has_sort_setting': True}),\n('newRelease', {'path': ['video_list_sorted', 'newRelease'],\n'loco_contexts': ['newRelease'],\n'loco_known': True,\n- 'request_context_name': 'newrelease'}),\n+ 'request_context_name': 'newrelease',\n+ 'has_sort_setting': True}),\n('currentTitles', {'path': ['video_list', 'currentTitles'],\n'loco_contexts': ['trendingNow'],\n'loco_known': True}),\n@@ -114,14 +120,16 @@ class GlobalVariables(object):\n('netflixOriginals', {'path': ['video_list_sorted', 'netflixOriginals', '839338'],\n'loco_contexts': ['netflixOriginals'],\n'loco_known': True,\n- 'request_context_name': 'genres'}),\n+ 'request_context_name': 'genres',\n+ 'has_sort_setting': True}),\n('assistiveAudio', {'path': ['video_list_sorted', 'assistiveAudio', 'None'],\n'loco_contexts': None,\n'loco_known': False,\n'request_context_name': 'assistiveAudio',\n'label_id': 30163,\n'description_id': 30164,\n- 'icon': 'DefaultTVShows.png'}),\n+ 'icon': 'DefaultTVShows.png',\n+ 'has_sort_setting': True}),\n('recommendations', {'path': ['recommendations', 'recommendations'],\n'loco_contexts': ['similars', 'becauseYouAdded', 'becauseYouLiked', 'watchAgain',\n'bigRow'],\n@@ -135,7 +143,8 @@ class GlobalVariables(object):\n'request_context_name': 'genres', # Used for sub-menus\n'label_id': 30174,\n'description_id': None,\n- 'icon': 'DefaultTVShows.png'}),\n+ 'icon': 'DefaultTVShows.png',\n+ 'has_sort_setting': True}),\n('moviesGenres', {'path': ['subgenres', 'moviesGenres', '34399'],\n'loco_contexts': None,\n'loco_known': False,\n@@ -143,7 +152,8 @@ class GlobalVariables(object):\n'label_id': 30175,\n'description_id': None,\n'icon': 'DefaultMovies.png',\n- 'content_type': CONTENT_MOVIE}),\n+ 'content_type': CONTENT_MOVIE,\n+ 'has_sort_setting': True}),\n# Todo: Disabled All tv shows/All movies loco menu due to website changes\n# ('tvshows', {'path': ['genres', 'tvshows', '83'],\n# 'loco_contexts': None,\n@@ -151,7 +161,8 @@ class GlobalVariables(object):\n# 'request_context_name': 'genres', # Used for sub-menus\n# 'label_id': 30095,\n# 'description_id': None,\n- # 'icon': 'DefaultTVShows.png'}),\n+ # 'icon': 'DefaultTVShows.png',\n+ # 'has_sort_setting': True}),\n# ('movies', {'path': ['genres', 'movies', '34399'],\n# 'loco_contexts': None,\n# 'loco_known': False,\n@@ -159,21 +170,24 @@ class GlobalVariables(object):\n# 'label_id': 30096,\n# 'description_id': None,\n# 'icon': 'DefaultMovies.png',\n- # 'content_type': CONTENT_MOVIE}),\n+ # 'content_type': CONTENT_MOVIE,\n+ # 'has_sort_setting': True}),\n('genres', {'path': ['genres', 'genres'],\n'loco_contexts': ['genre'],\n'loco_known': False,\n'request_context_name': 'genres', # Used for sub-menus\n'label_id': 30010,\n'description_id': 30093,\n- 'icon': 'DefaultGenre.png'}),\n+ 'icon': 'DefaultGenre.png',\n+ 'has_sort_setting': True}),\n('search', {'path': ['search', 'search'],\n'loco_contexts': None,\n'loco_known': False,\n'label_id': 30400,\n'description_id': 30092,\n'icon': 'DefaultAddonsSearch.png',\n- 'view': VIEW_SEARCH}),\n+ 'view': VIEW_SEARCH,\n+ 'has_sort_setting': True}),\n('exported', {'path': ['exported', 'exported'],\n'loco_contexts': None,\n'loco_known': False,\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/directorybuilder/dir_builder_items.py",
"new_path": "resources/lib/services/directorybuilder/dir_builder_items.py",
"diff": "@@ -43,7 +43,7 @@ def build_mainmenu_listing(loco_list):\n'supplemental_info_color': get_color_name(g.ADDON.getSettingInt('supplemental_info_color'))\n}\nfor menu_id, data in iteritems(g.MAIN_MENU_ITEMS):\n- if not g.ADDON.getSettingBool('_'.join(('show_menu', menu_id))):\n+ if data.get('has_show_setting', True) and not g.ADDON.getSettingBool('_'.join(('show_menu', menu_id))):\ncontinue\nif data['loco_known']:\nlist_id, video_list = loco_list.find_by_context(data['loco_contexts'][0])\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/settings_monitor.py",
"new_path": "resources/lib/services/settings_monitor.py",
"diff": "@@ -65,7 +65,8 @@ class SettingsMonitor(xbmc.Monitor):\n# Check menu settings changes\nfor menu_id, menu_data in iteritems(g.MAIN_MENU_ITEMS):\n- # Check settings changes in show menu\n+ # Check settings changes in show/hide menu\n+ if menu_data.get('has_show_setting', True):\nshow_menu_new_setting = bool(g.ADDON.getSettingBool('_'.join(('show_menu', menu_id))))\nshow_menu_old_setting = g.LOCAL_DB.get_value('menu_{}_show'.format(menu_id),\nTrue,\n@@ -77,7 +78,7 @@ class SettingsMonitor(xbmc.Monitor):\nreboot_addon = True\n# Check settings changes in sort order of menu\n- if menu_data.get('request_context_name'):\n+ if menu_data.get('has_sort_setting'):\nmenu_sortorder_new_setting = int(g.ADDON.getSettingInt('menu_sortorder_' + menu_data['path'][1]))\nmenu_sortorder_old_setting = g.LOCAL_DB.get_value('menu_{}_sortorder'.format(menu_id),\n0,\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Add has_show_setting/has_sort_setting to menu options |
106,046 | 01.07.2020 18:28:07 | -7,200 | edb87359b7f039af08e1fd7235bc18855500f84e | Add update_container | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/common/kodiops.py",
"new_path": "resources/lib/common/kodiops.py",
"diff": "@@ -120,6 +120,12 @@ def refresh_container(use_delay=False):\nxbmc.executebuiltin('Container.Refresh')\n+def container_update(url, reset_history=False):\n+ \"\"\"Update the current container\"\"\"\n+ func_str = 'Container.Update({},replace)' if reset_history else 'Container.Update({})'\n+ xbmc.executebuiltin(func_str.format(url))\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 update_container |
106,046 | 01.07.2020 18:52:27 | -7,200 | 5b997f369eee9e13bed6b8980f7928b21552c9f1 | Implemented context menu edit | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/database/db_local.py",
"new_path": "resources/lib/database/db_local.py",
"diff": "@@ -163,3 +163,10 @@ class NFLocalDatabase(db_sqlite.SQLiteDatabase):\nupdate_query = 'UPDATE search SET LastAccess = ? WHERE ID = ?'\ndate_last_access = common.convert_to_string(datetime.now())\nself._execute_non_query(update_query, (date_last_access, row_id))\n+\n+ @db_sqlite.handle_connection\n+ def update_search_item_value(self, row_id, value):\n+ \"\"\"Update the 'value' data to a search item\"\"\"\n+ update_query = 'UPDATE search SET Value = ?, LastAccess = ? WHERE ID = ?'\n+ date_last_access = common.convert_to_string(datetime.now())\n+ self._execute_non_query(update_query, (value, date_last_access, row_id))\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/kodi/context_menu.py",
"new_path": "resources/lib/kodi/context_menu.py",
"diff": "@@ -23,9 +23,12 @@ def generate_context_menu_mainmenu(menu_id):\nreturn items\n-def generate_context_menu_searchitem(row_id):\n+def generate_context_menu_searchitem(row_id, search_type):\n\"\"\"Generate context menu items for a listitem of the search menu\"\"\"\n- items = [_ctx_item('search_remove', None, {'row_id': row_id})]\n+ items = []\n+ if search_type == 'text':\n+ items.append(_ctx_item('search_edit', None, {'row_id': row_id}))\n+ items.append(_ctx_item('search_remove', None, {'row_id': row_id}))\nreturn items\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/kodi/context_menu_utils.py",
"new_path": "resources/lib/kodi/context_menu_utils.py",
"diff": "@@ -69,5 +69,8 @@ CONTEXT_MENU_ACTIONS = {\n'url': ctx_item_url(['change_watched_status'])},\n'search_remove': {\n'label': common.get_local_string(15015),\n- 'url': ctx_item_url(['search', 'search', 'remove'], g.MODE_DIRECTORY)}\n+ 'url': ctx_item_url(['search', 'search', 'remove'], g.MODE_DIRECTORY)},\n+ 'search_edit': {\n+ 'label': common.get_local_string(21450),\n+ 'url': ctx_item_url(['search', 'search', 'edit'], g.MODE_DIRECTORY)}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/kodi/ui/dialogs.py",
"new_path": "resources/lib/kodi/ui/dialogs.py",
"diff": "@@ -70,13 +70,14 @@ def show_dlg_input_numeric(message, mask_input=True):\nreturn xbmcgui.Dialog().numeric(**args) or None\n-def ask_for_search_term():\n+def 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))\n+ return _ask_for_input(common.get_local_string(30402), default_text)\n-def _ask_for_input(heading):\n+def _ask_for_input(heading, default_text=None):\nreturn g.py2_decode(xbmcgui.Dialog().input(\n+ defaultt=default_text,\nheading=heading,\ntype=xbmcgui.INPUT_ALPHANUM)) or None\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/navigation/directory_search.py",
"new_path": "resources/lib/navigation/directory_search.py",
"diff": "@@ -38,6 +38,8 @@ def route_search_nav(pathitems, perpetual_range_start, dir_update_listing, param\nsearch_list()\nelif path == 'add':\nret = search_add()\n+ elif path == 'edit':\n+ search_edit(params['row_id'])\nelif path == 'remove':\nsearch_remove(params['row_id'])\nelif path == 'clear':\n@@ -105,6 +107,21 @@ def _search_add_bylang(search_type, dict_languages):\nreturn row_id\n+def search_edit(row_id):\n+ \"\"\"Edit a search item\"\"\"\n+ search_item = g.LOCAL_DB.get_search_item(row_id)\n+ search_type = search_item['Type']\n+ ret = False\n+ if search_type == 'text':\n+ search_term = ui.ask_for_search_term(search_item['Value'])\n+ if search_term and search_term.strip():\n+ g.LOCAL_DB.update_search_item_value(row_id, search_term.strip())\n+ ret = True\n+ if not ret:\n+ return\n+ common.container_update(common.build_url(['search', 'search', row_id], mode=g.MODE_DIRECTORY))\n+\n+\ndef search_remove(row_id):\n\"\"\"Remove a search item\"\"\"\ncommon.debug('Removing search item with ID {}', row_id)\n@@ -208,6 +225,6 @@ def _create_dictitem_from_row(row):\n'url': common.build_url(['search', 'search', row_id], mode=g.MODE_DIRECTORY),\n'label': row['Value'],\n'info': {'plot': search_desc}, # The description\n- 'menu_items': generate_context_menu_searchitem(row_id),\n+ 'menu_items': generate_context_menu_searchitem(row_id, row['Type']),\n'is_folder': True\n}\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Implemented context menu edit |
106,046 | 02.07.2020 12:00:18 | -7,200 | 37b344fe5788bd5ea6b1fb1dd4c50faacb27d986 | Removed not needed check | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/msl/msl_handler.py",
"new_path": "resources/lib/services/msl/msl_handler.py",
"diff": "@@ -180,7 +180,7 @@ class MSLHandler(object):\npass\nisa_addon = xbmcaddon.Addon('inputstream.adaptive')\n- hdcp_override = isa_addon is not None and isa_addon.getSettingBool('HDCPOVERRIDE')\n+ hdcp_override = isa_addon.getSettingBool('HDCPOVERRIDE')\nhdcp_4k_capable = common.is_device_4k_capable() or g.ADDON.getSettingBool('enable_force_hdcp')\nhdcp_version = []\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Removed not needed check |
106,046 | 02.07.2020 12:02:19 | -7,200 | 2a15bedb2793e7e76c11191ee1b994f907c8a9d3 | Container update func improvements | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/api/api_requests.py",
"new_path": "resources/lib/api/api_requests.py",
"diff": "@@ -36,7 +36,7 @@ def catch_api_errors(func):\ndef logout():\n\"\"\"Logout of the current account\"\"\"\n- common.make_call('logout', g.BASE_URL)\n+ common.make_call('logout')\ndef login(ask_credentials=True):\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/navigation/actions.py",
"new_path": "resources/lib/navigation/actions.py",
"diff": "@@ -136,7 +136,7 @@ class AddonActionExecutor(object):\nparams={'video_id_dict': dumps(video_id_dict),\n'supplemental_type': SUPPLEMENTAL_TYPE_TRAILERS},\nmode=g.MODE_DIRECTORY)\n- xbmc.executebuiltin('Container.Update({})'.format(url))\n+ common.container_update(url)\nelse:\nui.show_notification(common.get_local_string(30111))\n@@ -180,9 +180,8 @@ class AddonActionExecutor(object):\n# Perform a new login to get/generate a new ESN\napi.login(ask_credentials=False)\n# Warning after login netflix switch to the main profile! so return to the main screen\n- url = 'plugin://plugin.video.netflix'\n# Open root page\n- xbmc.executebuiltin('Container.Update({},replace)'.format(url)) # replace=reset history\n+ common.container_update(g.BASE_URL, True)\[email protected]_video_id(path_offset=1)\ndef change_watched_status(self, videoid):\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/nfsession/nfsession_access.py",
"new_path": "resources/lib/services/nfsession/nfsession_access.py",
"diff": "\"\"\"\nfrom __future__ import absolute_import, division, unicode_literals\n-import xbmc\n-\nimport resources.lib.common as common\nimport resources.lib.common.cookies as cookies\nimport resources.lib.api.website as website\n@@ -110,7 +108,7 @@ class NFSessionAccess(NFSessionRequests, NFSessionCookie):\[email protected]_return_call\[email protected]_execution(immediate=True)\n- def logout(self, url):\n+ def logout(self):\n\"\"\"Logout of the current account and reset the session\"\"\"\ncommon.debug('Logging out of current account')\n@@ -151,9 +149,9 @@ class NFSessionAccess(NFSessionRequests, NFSessionCookie):\ncommon.info('Logout successful')\nui.show_notification(common.get_local_string(30113))\nself._init_session()\n- xbmc.executebuiltin('Container.Update(path,replace)') # Go to a fake page to clear screen\n+ common.container_update('path', True) # Go to a fake page to clear screen\n# Open root page\n- xbmc.executebuiltin('Container.Update({},replace)'.format(url)) # replace=reset history\n+ common.container_update(g.BASE_URL, True)\ndef _login_payload(credentials, auth_url):\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/settings_monitor.py",
"new_path": "resources/lib/services/settings_monitor.py",
"diff": "@@ -117,9 +117,8 @@ class SettingsMonitor(xbmc.Monitor):\nif reboot_addon:\ncommon.debug('SettingsMonitor: addon will be rebooted')\n- url = 'plugin://plugin.video.netflix/directory/root'\n# Open root page\n- xbmc.executebuiltin('Container.Update({})'.format(url)) # replace=reset history\n+ common.container_update(common.build_url(['root'], mode=g.MODE_DIRECTORY))\ndef _esn_checks():\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Container update func improvements |
106,046 | 02.07.2020 14:26:34 | -7,200 | fd409164fd5488136f4cf0867f7f697ea1c450c2 | Renamed refresh_container | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/common/kodiops.py",
"new_path": "resources/lib/common/kodiops.py",
"diff": "@@ -109,7 +109,7 @@ def scan_library(path=\"\"):\nreturn json_rpc(method, params)\n-def refresh_container(use_delay=False):\n+def container_refresh(use_delay=False):\n\"\"\"Refresh the current container\"\"\"\nif use_delay:\n# When operations are performed in the Kodi library before call this method\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/navigation/actions.py",
"new_path": "resources/lib/navigation/actions.py",
"diff": "@@ -115,7 +115,7 @@ class AddonActionExecutor(object):\noperation = pathitems[1]\napi.update_my_list(videoid, operation, self.params)\n_sync_library(videoid, operation)\n- common.refresh_container()\n+ common.container_refresh()\[email protected]_video_id(path_offset=1)\[email protected]_execution(immediate=False)\n@@ -200,7 +200,7 @@ class AddonActionExecutor(object):\ntxt_index = 0\ng.SHARED_DB.set_watched_status(profile_guid, videoid.value, True)\nui.show_notification(common.get_local_string(30237).split('|')[txt_index])\n- common.refresh_container()\n+ common.container_refresh()\ndef configuration_wizard(self, pathitems=None): # pylint: disable=unused-argument\n\"\"\"Run the add-on configuration wizard\"\"\"\n@@ -228,7 +228,7 @@ class AddonActionExecutor(object):\ncommon.json_rpc('Input.Down') # Avoids selection back to the top\nexcept CacheMiss:\npass\n- common.refresh_container()\n+ common.container_refresh()\ndef _sync_library(videoid, operation):\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/navigation/directory_search.py",
"new_path": "resources/lib/navigation/directory_search.py",
"diff": "@@ -127,7 +127,7 @@ def search_remove(row_id):\ncommon.debug('Removing search item with ID {}', row_id)\ng.LOCAL_DB.delete_search_item(row_id)\ncommon.json_rpc('Input.Down') # Avoids selection back to the top\n- common.refresh_container()\n+ common.container_refresh()\ndef search_clear():\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/navigation/library.py",
"new_path": "resources/lib/navigation/library.py",
"diff": "@@ -42,7 +42,7 @@ class LibraryActionExecutor(object):\nlibrary.execute_library_tasks(videoid,\n[library.remove_item],\ncommon.get_local_string(30030))\n- common.refresh_container(use_delay=True)\n+ common.container_refresh(use_delay=True)\[email protected]_video_id(path_offset=1)\ndef update(self, videoid):\n@@ -53,7 +53,7 @@ class LibraryActionExecutor(object):\n[library.remove_item, library.export_item],\ncommon.get_local_string(30061),\nnfo_settings=nfo_settings)\n- common.refresh_container()\n+ common.container_refresh()\[email protected]_video_id(path_offset=1)\ndef export_silent(self, videoid):\n@@ -144,12 +144,12 @@ class LibraryActionExecutor(object):\[email protected]_video_id(path_offset=1)\ndef exclude_from_auto_update(self, videoid):\nlibrary_au.exclude_show_from_auto_update(videoid, True)\n- common.refresh_container()\n+ common.container_refresh()\[email protected]_video_id(path_offset=1)\ndef include_in_auto_update(self, videoid):\nlibrary_au.exclude_show_from_auto_update(videoid, False)\n- common.refresh_container()\n+ common.container_refresh()\ndef mysql_test(self, pathitems):\n\"\"\"Perform a MySQL database connection test\"\"\"\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Renamed refresh_container |
106,046 | 02.07.2020 16:54:08 | -7,200 | 2a83d686f00f046e6ac3ccede90c0e192f80b10d | Removed ProfileGateState and Profile timeout (was test purpose) | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/api/website.py",
"new_path": "resources/lib/api/website.py",
"diff": "@@ -44,7 +44,6 @@ PAGE_ITEMS_INFO = [\n'models/serverDefs/data/BUILD_IDENTIFIER',\n'models/esnGeneratorModel/data/esn',\n'models/memberContext/data/geo/preferredLocale'\n- # 'models/profilesGate/data/idle_timer' # Time in minutes of the profile session\n]\nPAGE_ITEMS_API_URL = {\n@@ -67,25 +66,6 @@ JSON_REGEX = r'netflix\\.{}\\s*=\\s*(.*?);\\s*</script>'\nAVATAR_SUBPATH = ['images', 'byWidth', '320']\nPROFILE_DEBUG_INFO = ['profileName', 'isAccountOwner', 'isActive', 'isKids', 'maturityLevel', 'language']\n-PROFILE_GATE_STATES = {\n- 0: 'CLOSED',\n- 1: 'LIST',\n- 2: 'LOAD_PROFILE',\n- 3: 'LOAD_PROFILE_ERROR',\n- 4: 'CREATE_PROFILE',\n- 5: 'CREATE_PROFILE_ERROR',\n- 6: 'UPDATE_PROFILE',\n- 7: 'UPDATE_PROFILE_ERROR',\n- 8: 'DELETE_PROFILE',\n- 9: 'DELETE_PROFILE_ERROR',\n- 10: 'RELOADING_PROFILES',\n- 11: 'MANAGE_PROFILES',\n- 12: 'MANAGE_PROFILES_ERROR',\n- 13: 'SELECT_AVATAR',\n- 14: 'SELECT_AVATAR_ERROR',\n- 15: 'PROMPT_PROFILE_PIN',\n- 16: 'PROMPT_PROFILE_PIN_ERROR'\n-}\[email protected]_execution(immediate=True)\n@@ -120,22 +100,6 @@ def extract_session_data(content, validate=False, update_profiles=False):\nif update_profiles:\nparse_profiles(falcor_cache)\n- if common.is_debug_verbose():\n- # Only for debug purpose not sure if can be useful\n- try:\n- common.debug('ReactContext profileGateState {} ({})',\n- PROFILE_GATE_STATES[react_context['models']['profileGateState']['data']],\n- react_context['models']['profileGateState']['data'])\n- except KeyError:\n- common.error('ReactContext unknown profileGateState {}',\n- react_context['models']['profileGateState']['data'])\n-\n- # Profile idle timeout (not sure if will be useful, to now for documentation purpose)\n- # NOTE: On the website this value is used to update the profilesNewSession cookie expiration after a profile switch\n- # and also to update the expiration of this cookie on each website interaction.\n- # When the session is expired the 'profileGateState' will be 0 and the website return auto. to profiles page\n- # g.LOCAL_DB.set_value('profile_gate_idle_timer', user_data.get('idle_timer', 30), TABLE_SESSION)\n-\n# 21/05/2020 - Netflix has introduced a new paging type called \"loco\" similar to the old \"lolomo\"\n# Extract loco root id\nloco_root = falcor_cache['loco']['value'][1]\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/nfsession/nfsession.py",
"new_path": "resources/lib/services/nfsession/nfsession.py",
"diff": "@@ -119,9 +119,6 @@ class NetflixSession(NFSessionAccess, DirectoryBuilder):\n# END Method 2\nself.is_profile_session_active = True\n- # Update the session profile cookie (only a test, see 'Profile idle timeout' in website.py)\n- # expires = int(timestamp) + (g.LOCAL_DB.get_value('profile_gate_idle_timer', 30, TABLE_SESSION) * 60)\n- # self.session.cookies.set('profilesNewSession', '0', domain='.netflix.com', path='/', expires=expires)\ng.LOCAL_DB.switch_active_profile(guid)\ng.CACHE_MANAGEMENT.identifier_prefix = guid\ncookies.save(self.account_hash, self.session.cookies)\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Removed ProfileGateState and Profile timeout (was test purpose) |
106,046 | 04.07.2020 18:06:16 | -7,200 | 1a33430f74cd6b90166a8ccc489cc6e7b3e81587 | Version bump (1.6.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.5.1\" provider-name=\"libdev + jojo + asciidisco + caphm + castagnait\">\n+<addon id=\"plugin.video.netflix\" name=\"Netflix\" version=\"1.6.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.5.1 (2020-06-27)\n--Implemented fix/workaround to get resolutions until to 1080p with ARM devices\n--Updated translations tr\n+v1.6.0 (2020-07-04)\n+-New search menu\n+-New search types (by term, by audio lang, by subtitles lang)\n+-Implemented option to remove titles from Continue watching list\n+-Updated translations it, de, hu, tr, ro, jk, kr, pt-br, sv-se, fr, el-gr\n</news>\n</extension>\n</addon>\n"
},
{
"change_type": "MODIFY",
"old_path": "changelog.txt",
"new_path": "changelog.txt",
"diff": "+v1.6.0 (2020-07-04)\n+-New search menu\n+-New search types (by term, by audio lang, by subtitles lang)\n+-Implemented option to remove titles from Continue watching list\n+-Updated translations it, de, hu, tr, ro, jk, kr, pt-br, sv-se, fr, el-gr\n+\nv1.5.1 (2020-06-27)\n-Implemented fix/workaround to get resolutions until to 1080p with ARM devices\n-Updated translations tr\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Version bump (1.6.0) (#732) |
106,046 | 06.07.2020 20:06:14 | -7,200 | b594fde0afbb6b1a7b99139ca52e9ac093ee0b83 | Update README.md
Copied log rules also here | [
{
"change_type": "MODIFY",
"old_path": "README.md",
"new_path": "README.md",
"diff": "@@ -109,7 +109,12 @@ If something doesn't work for you:\n4. Open a new github issue (of type *Problem report*) by following the instructions in the report\nWe can't help you if you don't provide detailed information (i.e. explanation and full debug log) on your issue.\n-Please also use a service like pastebin or better [Kodi paste](http://paste.kodi.tv) to provide logs and refrain from uploading them to where they'll be hidden behind an ad-wall or any other sketchy services.\n+\n+Rules for the log:\n+- Use a service like [Kodi paste](http://paste.kodi.tv) to copy the log content\n+- Do not paste the content of the log directly into a GH message\n+- Do not cut, edit or remove parts of the log (there are no sensitive data)\n+- If the log file is really huge (more 1Mb) in Kodi settings disable 'Component-specific logging'\nWhen the problem will be solved, remember to disable the debug logging, to avoid unnecessary slowing down in your device.\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Update README.md
Copied log rules also here |
106,031 | 07.07.2020 22:08:00 | -7,200 | c8347996e032013a15b88280919de2f3fa0e33d6 | fix: Add search table on to sqlite db on fresh installs | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/database/db_create_sqlite.py",
"new_path": "resources/lib/database/db_create_sqlite.py",
"diff": "@@ -65,6 +65,15 @@ def _create_local_database(db_file_path):\n'Value TEXT);')\ncur.execute(table)\n+ table = str('CREATE TABLE search ('\n+ 'ID INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,'\n+ 'Guid TEXT NOT NULL REFERENCES profiles (Guid) ON DELETE CASCADE ON UPDATE CASCADE,'\n+ 'Type TEXT NOT NULL,'\n+ 'Value TEXT NOT NULL,'\n+ 'Parameters TEXT,'\n+ 'LastAccess TEXT);')\n+ cur.execute(table)\n+\nif conn:\nconn.close()\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | fix: Add search table on to sqlite db on fresh installs |
106,046 | 07.07.2020 18:29:28 | -7,200 | 8fb3984377416d9b6806b3a8432a1b374c9b9013 | Removed not more needed condition | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/msl/msl_handler.py",
"new_path": "resources/lib/services/msl/msl_handler.py",
"diff": "@@ -254,8 +254,6 @@ class MSLHandler(object):\n# Save the manifest to the cache to retrieve it during its validity\nexpiration = int(manifest['expiration'] / 1000)\ng.CACHE.add(CACHE_MANIFESTS, cache_identifier, manifest, expires=expiration)\n- if 'result' in manifest:\n- return manifest['result']\nreturn manifest\n@display_error_info\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Removed not more needed condition |
106,046 | 07.07.2020 18:30:21 | -7,200 | 284df750ad5cf59d47aba90553f3902941ced086 | Removed profile name from debug info | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/api/website.py",
"new_path": "resources/lib/api/website.py",
"diff": "@@ -65,7 +65,7 @@ PAGE_ITEM_ERROR_CODE_LIST = 'models\\\\i18nStrings\\\\data\\\\login/login'\nJSON_REGEX = r'netflix\\.{}\\s*=\\s*(.*?);\\s*</script>'\nAVATAR_SUBPATH = ['images', 'byWidth', '320']\n-PROFILE_DEBUG_INFO = ['profileName', 'isAccountOwner', 'isActive', 'isKids', 'maturityLevel', 'language']\n+PROFILE_DEBUG_INFO = ['isAccountOwner', 'isActive', 'isKids', 'maturityLevel', 'language']\[email protected]_execution(immediate=True)\n@@ -183,7 +183,7 @@ def parse_profiles(data):\n# Add profile language description translated from locale\nsummary['language_desc'] = g.py2_decode(xbmc.convertLanguage(summary['language'][:2], xbmc.ENGLISH_NAME))\nfor key, value in iteritems(summary):\n- if key in PROFILE_DEBUG_INFO:\n+ if common.is_debug_verbose() and key in PROFILE_DEBUG_INFO:\ncommon.debug('Profile info {}', {key: value})\nif key == 'profileName': # The profile name is coded as HTML\nvalue = parse_html(value)\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Removed profile name from debug info |
106,046 | 08.07.2020 08:15:40 | -7,200 | 30a807b2a393b9947627e5005e4f328b3290b5cc | Version bump (1.6.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.6.0\" provider-name=\"libdev + jojo + asciidisco + caphm + castagnait\">\n+<addon id=\"plugin.video.netflix\" name=\"Netflix\" version=\"1.6.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.6.0 (2020-07-04)\n--New search menu\n--New search types (by term, by audio lang, by subtitles lang)\n--Implemented option to remove titles from Continue watching list\n--Updated translations it, de, hu, tr, ro, jk, kr, pt-br, sv-se, fr, el-gr\n+v1.6.1 (2020-07-08)\n+-Fixed broken search menu on fresh installations\n+-Updated el-gr translation\n</news>\n</extension>\n</addon>\n"
},
{
"change_type": "MODIFY",
"old_path": "changelog.txt",
"new_path": "changelog.txt",
"diff": "+v1.6.1 (2020-07-08)\n+-Fixed broken search menu on fresh installations\n+-Updated el-gr translation\n+\nv1.6.0 (2020-07-04)\n-New search menu\n-New search types (by term, by audio lang, by subtitles lang)\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Version bump (1.6.1) (#745) |
106,046 | 07.07.2020 18:24:16 | -7,200 | 70100891ea7d09014932e3a81accffa214e56609 | Optimized request for internal my list data | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/api/paths.py",
"new_path": "resources/lib/api/paths.py",
"diff": "@@ -15,9 +15,13 @@ import resources.lib.common as common\nfrom resources.lib.globals import g\nfrom .exceptions import InvalidReferenceError\n-MAX_PATH_REQUEST_SIZE = 47 # Stands for 48 results, is the default value defined by netflix for a single request\n+# Limit size for the path request\n+# The requests to sorted lists can get more then 48 results,\n+# but the nf server blocks request if the response will result in too much data\n+PATH_REQUEST_SIZE_STD = 47 # Standard limit defined by netflix (48 results)\n+PATH_REQUEST_SIZE_MAX = 199\n-RANGE_SELECTOR = 'RANGE_SELECTOR'\n+RANGE_PLACEHOLDER = 'RANGE_PLACEHOLDER'\nART_SIZE_POSTER = '_342x684'\nART_SIZE_FHD = '_1920x1080'\n@@ -65,7 +69,7 @@ GENRE_PARTIAL_PATHS = [\n]\nSEASONS_PARTIAL_PATHS = [\n- ['seasonList', RANGE_SELECTOR, 'summary'],\n+ ['seasonList', RANGE_PLACEHOLDER, 'summary'],\n['title']\n] + ART_PARTIAL_PATHS\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/kodi/library.py",
"new_path": "resources/lib/kodi/library.py",
"diff": "@@ -18,7 +18,7 @@ import xbmc\nimport resources.lib.common as common\nimport resources.lib.kodi.nfo as nfo\nimport resources.lib.kodi.ui as ui\n-from resources.lib.api.paths import MAX_PATH_REQUEST_SIZE\n+from resources.lib.api.paths import PATH_REQUEST_SIZE_STD\nfrom resources.lib.globals import g\nfrom resources.lib.kodi.library_items import (export_item, remove_item, export_new_item, get_item,\nItemNotFound, FOLDER_MOVIES, FOLDER_TV, library_path)\n@@ -59,7 +59,7 @@ def list_contents(perpetual_range_start):\nchunked_video_list = []\nperpetual_range_selector = {}\n- for index, chunk in enumerate(common.chunked_list(video_id_list, MAX_PATH_REQUEST_SIZE)):\n+ for index, chunk in enumerate(common.chunked_list(video_id_list, PATH_REQUEST_SIZE_STD)):\nif index >= perpetual_range_start:\nif number_of_requests == 0:\nif len(video_id_list) > count:\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/directorybuilder/dir_builder_requests.py",
"new_path": "resources/lib/services/directorybuilder/dir_builder_requests.py",
"diff": "@@ -15,9 +15,10 @@ from resources.lib import common\nfrom resources.lib.api.data_types import (VideoListSorted, SubgenreList, SeasonList, EpisodeList, LoLoMo, LoCo,\nVideoList, SearchVideoList, CustomVideoList)\nfrom resources.lib.api.exceptions import InvalidVideoListTypeError\n-from resources.lib.api.paths import (VIDEO_LIST_PARTIAL_PATHS, RANGE_SELECTOR, VIDEO_LIST_BASIC_PARTIAL_PATHS,\n+from resources.lib.api.paths import (VIDEO_LIST_PARTIAL_PATHS, RANGE_PLACEHOLDER, VIDEO_LIST_BASIC_PARTIAL_PATHS,\nSEASONS_PARTIAL_PATHS, EPISODES_PARTIAL_PATHS, ART_PARTIAL_PATHS,\n- GENRE_PARTIAL_PATHS, TRAILER_PARTIAL_PATHS, MAX_PATH_REQUEST_SIZE, build_paths)\n+ GENRE_PARTIAL_PATHS, TRAILER_PARTIAL_PATHS, PATH_REQUEST_SIZE_STD, build_paths,\n+ PATH_REQUEST_SIZE_MAX)\nfrom resources.lib.common import cache_utils\nfrom resources.lib.globals import g\n@@ -168,7 +169,7 @@ class DirectoryRequests(object):\nraise common.InvalidVideoId('Cannot request episode list for {}'.format(videoid))\ncommon.debug('Requesting episode list for {}', videoid)\npaths = ([['seasons', videoid.seasonid, 'summary']] +\n- build_paths(['seasons', videoid.seasonid, 'episodes', RANGE_SELECTOR], EPISODES_PARTIAL_PATHS) +\n+ build_paths(['seasons', videoid.seasonid, 'episodes', RANGE_PLACEHOLDER], EPISODES_PARTIAL_PATHS) +\nbuild_paths(['videos', videoid.tvshowid], ART_PARTIAL_PATHS + [['title']]))\ncall_args = {\n'paths': paths,\n@@ -185,7 +186,7 @@ class DirectoryRequests(object):\n# Some of this type of request have results fixed at ~40 from netflix\n# The 'length' tag never return to the actual total count of the elements\ncommon.debug('Requesting video list {}', list_id)\n- paths = build_paths(['lists', list_id, RANGE_SELECTOR, 'reference'], VIDEO_LIST_PARTIAL_PATHS)\n+ paths = build_paths(['lists', list_id, RANGE_PLACEHOLDER, 'reference'], VIDEO_LIST_PARTIAL_PATHS)\ncall_args = {\n'paths': paths,\n'length_params': ['stdlist', ['lists', list_id]],\n@@ -214,7 +215,7 @@ class DirectoryRequests(object):\nint(g.ADDON.getSettingInt('menu_sortorder_' + menu_data.get('initial_menu_id', menu_data['path'][1])))\n]\nbase_path.append(req_sort_order_type)\n- paths = build_paths(base_path + [RANGE_SELECTOR], VIDEO_LIST_PARTIAL_PATHS)\n+ paths = build_paths(base_path + [RANGE_PLACEHOLDER], VIDEO_LIST_PARTIAL_PATHS)\npath_response = self.netflix_session._perpetual_path_request(paths,\n[response_type, base_path],\n@@ -255,9 +256,9 @@ class DirectoryRequests(object):\ndef req_video_list_search(self, search_term, perpetual_range_start=None):\n\"\"\"Retrieve a video list by search term\"\"\"\ncommon.debug('Requesting video list by search term \"{}\"', search_term)\n- base_path = ['search', 'byTerm', '|' + search_term, 'titles', MAX_PATH_REQUEST_SIZE]\n+ base_path = ['search', 'byTerm', '|' + search_term, 'titles', PATH_REQUEST_SIZE_STD]\npaths = ([base_path + [['id', 'name', 'requestId']]] +\n- build_paths(base_path + [RANGE_SELECTOR, 'reference'], VIDEO_LIST_PARTIAL_PATHS))\n+ build_paths(base_path + [RANGE_PLACEHOLDER, 'reference'], VIDEO_LIST_PARTIAL_PATHS))\ncall_args = {\n'paths': paths,\n'length_params': ['searchlist', ['search', 'byReference']],\n@@ -279,11 +280,12 @@ class DirectoryRequests(object):\ncontains only minimal video info\n\"\"\"\ncommon.debug('Requesting the full video list for {}', context_name)\n- paths = build_paths([context_name, 'az', RANGE_SELECTOR], VIDEO_LIST_BASIC_PARTIAL_PATHS)\n+ paths = build_paths([context_name, 'az', RANGE_PLACEHOLDER], VIDEO_LIST_BASIC_PARTIAL_PATHS)\ncall_args = {\n'paths': paths,\n'length_params': ['stdlist', [context_name, 'az']],\n'perpetual_range_start': None,\n+ 'request_size': PATH_REQUEST_SIZE_MAX,\n'no_limit_req': True\n}\nif switch_profiles:\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/nfsession/nfsession.py",
"new_path": "resources/lib/services/nfsession/nfsession.py",
"diff": "@@ -152,24 +152,21 @@ class NetflixSession(NFSessionAccess, DirectoryBuilder):\[email protected]_return_call\ndef perpetual_path_request(self, paths, length_params, perpetual_range_start=None,\n- no_limit_req=False):\n+ no_limit_req=False, request_size=apipaths.PATH_REQUEST_SIZE_STD):\nreturn self._perpetual_path_request(paths, length_params, perpetual_range_start,\n- no_limit_req)\n+ no_limit_req, request_size)\[email protected]_execution(immediate=True)\n@needs_login\ndef _perpetual_path_request(self, paths, length_params, perpetual_range_start=None,\n- no_limit_req=False):\n- \"\"\"Perform a perpetual path request against the Shakti API to retrieve\n- a possibly large video list. If the requested video list's size is\n- larger than MAX_PATH_REQUEST_SIZE, multiple path requests will be\n- executed with forward shifting range selectors and the results will\n- be combined into one path response.\"\"\"\n+ no_limit_req=False, request_size=apipaths.PATH_REQUEST_SIZE_STD):\n+ \"\"\"Perform a perpetual path request against the Shakti API to retrieve a possibly large video list.\n+ If the requested video list's size is larger than 'request_size', multiple path requests will be\n+ executed with forward shifting range selectors and the results will be combined into one path response.\"\"\"\nresponse_type, length_args = length_params\ncontext_name = length_args[0]\nresponse_length = apipaths.LENGTH_ATTRIBUTES[response_type]\n- request_size = apipaths.MAX_PATH_REQUEST_SIZE\nresponse_size = request_size + 1\n# Note: when the request is made with 'genres' or 'seasons' context,\n# the response strangely does not respect the number of objects\n@@ -283,16 +280,16 @@ class NetflixSession(NFSessionAccess, DirectoryBuilder):\ndef _set_range_selector(paths, range_start, range_end):\n- \"\"\"Replace the RANGE_SELECTOR placeholder with an actual dict:\n- {'from': range_start, 'to': range_end}\"\"\"\n- import copy\n- # Make a deepcopy because we don't want to lose the original paths\n- # with the placeholder\n- ranged_paths = copy.deepcopy(paths)\n+ \"\"\"\n+ Replace the RANGE_PLACEHOLDER with an actual dict:\n+ {'from': range_start, 'to': range_end}\n+ \"\"\"\n+ from copy import deepcopy\n+ # Make a deepcopy because we don't want to lose the original paths with the placeholder\n+ ranged_paths = deepcopy(paths)\nfor path in ranged_paths:\ntry:\n- path[path.index(apipaths.RANGE_SELECTOR)] = (\n- {'from': range_start, 'to': range_end})\n+ path[path.index(apipaths.RANGE_PLACEHOLDER)] = {'from': range_start, 'to': range_end}\nexcept ValueError:\npass\nreturn ranged_paths\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Optimized request for internal my list data |
106,046 | 18.07.2020 08:35:06 | -7,200 | 24c896f3f2dac239a45ab7da9c1474064b1c5c89 | Add missing request size argument | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/directorybuilder/dir_builder_requests.py",
"new_path": "resources/lib/services/directorybuilder/dir_builder_requests.py",
"diff": "@@ -285,8 +285,8 @@ class DirectoryRequests(object):\n'paths': paths,\n'length_params': ['stdlist', [context_name, 'az']],\n'perpetual_range_start': None,\n- 'request_size': PATH_REQUEST_SIZE_MAX,\n- 'no_limit_req': True\n+ 'no_limit_req': True,\n+ 'request_size': PATH_REQUEST_SIZE_MAX\n}\nif switch_profiles:\n# Used only with library auto-update with the sync with Netflix \"My List\" enabled.\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/nfsession/nfsession.py",
"new_path": "resources/lib/services/nfsession/nfsession.py",
"diff": "@@ -124,8 +124,8 @@ class NetflixSession(NFSessionAccess, DirectoryBuilder):\ncookies.save(self.account_hash, self.session.cookies)\n@needs_login\n- def _perpetual_path_request_switch_profiles(self, paths, length_params,\n- perpetual_range_start=None, no_limit_req=False):\n+ def _perpetual_path_request_switch_profiles(self, paths, length_params, perpetual_range_start=None,\n+ no_limit_req=False, request_size=apipaths.PATH_REQUEST_SIZE_STD):\n\"\"\"\nPerform a perpetual path request,\nUsed exclusively to get My List of a profile other than the current one\n@@ -138,8 +138,8 @@ class NetflixSession(NFSessionAccess, DirectoryBuilder):\n# Switch profile (only if necessary) in order to get My List videos\nself._activate_profile(mylist_profile_guid)\n# Get the My List data\n- path_response = self._perpetual_path_request(paths, length_params, perpetual_range_start,\n- no_limit_req)\n+ path_response = self._perpetual_path_request(paths, length_params, perpetual_range_start, no_limit_req,\n+ request_size)\nif mylist_profile_guid != current_profile_guid:\n# Reactive again the previous profile\nself._activate_profile(current_profile_guid)\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Add missing request size argument |
106,046 | 21.07.2020 18:24:31 | -7,200 | b21f074b72a5c0c05ed97867c8e04dd2949cfede | Improved import unescape cases | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/api/website.py",
"new_path": "resources/lib/api/website.py",
"diff": "@@ -368,6 +368,11 @@ def parse_html(html_value):\n\"\"\"Parse HTML entities\"\"\"\ntry: # Python 2\nfrom HTMLParser import HTMLParser\n- except ImportError: # Python 3\n+ return HTMLParser().unescape(html_value)\n+ except ImportError:\n+ try: # Python >= 3.4\n+ from html import unescape\n+ return unescape(html_value)\n+ except ImportError: # Python <= 3.3\nfrom html.parser import HTMLParser\nreturn HTMLParser().unescape(html_value)\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Improved import unescape cases |
106,046 | 23.07.2020 09:55:48 | -7,200 | 127b2dfb3c5c39a3f7eda9afa6ef5591ac07b5b6 | Avoid add guid parameter to folders
Not used in folder case | [
{
"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": "@@ -290,7 +290,7 @@ def _create_video_item(videoid_value, video, video_list, perpetual_range_start,\ndict_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,\n- params=common_data['params'])\n+ params=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'])\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": "@@ -50,8 +50,8 @@ def add_items_previous_next_page(directory_items, pathitems, perpetual_range_sel\ndef get_param_watched_status_by_profile():\n\"\"\"\n- Get a value used as parameter in the ListItem (of videos),\n- in order to differentiate the watched status and other Kodi data by profiles\n+ Get a the current profile guid, will be used as parameter in the ListItem's (of videos),\n+ so that Kodi database can distinguish the data (like watched status) according to each Netflix profile\n:return: a dictionary to be add to 'build_url' params\n\"\"\"\nreturn {'profile_guid': g.LOCAL_DB.get_active_profile_guid()}\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Avoid add guid parameter to folders
Not used in folder case |
106,046 | 23.07.2020 09:59:23 | -7,200 | c96ee636ef280e512300b742f449d2b4f0b20485 | Initial changes to different path for STRM files | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/navigation/player.py",
"new_path": "resources/lib/navigation/player.py",
"diff": "@@ -14,7 +14,6 @@ import xbmcgui\nfrom resources.lib.api.exceptions import MetadataNotAvailable, InputStreamHelperError\nfrom resources.lib.api.paths import EVENT_PATHS\n-from resources.lib.database.db_utils import TABLE_SESSION\nfrom resources.lib.globals import g\nimport resources.lib.common as common\nimport resources.lib.api.api_requests as api\n@@ -46,25 +45,26 @@ INPUTSTREAM_SERVER_CERTIFICATE = (\[email protected]_video_id(path_offset=0, pathitems_arg='videoid', inject_full_pathitems=True)\[email protected]_execution(immediate=False)\n+def play_strm(videoid):\n+ _play(videoid, True)\n+\n+\[email protected]_video_id(path_offset=0, pathitems_arg='videoid', inject_full_pathitems=True)\ndef play(videoid):\n+ _play(videoid, False)\n+\n+\[email protected]_execution(immediate=False)\n+def _play(videoid, is_played_from_strm=False):\n\"\"\"Play an episode or movie as specified by the path\"\"\"\nis_upnext_enabled = g.ADDON.getSettingBool('UpNextNotifier_enabled')\n- # For db settings 'upnext_play_callback_received' and 'upnext_play_callback_file_type' see action_controller.py\n- is_upnext_callback_received = g.LOCAL_DB.get_value('upnext_play_callback_received', False)\n- is_upnext_callback_file_type_strm = g.LOCAL_DB.get_value('upnext_play_callback_file_type', '') == 'strm'\n- # This is the only way found to know if the played item come from the add-on itself or from Kodi library\n- # also when Up Next Add-on is used\n- is_played_from_addon = not g.IS_ADDON_EXTERNAL_CALL or (g.IS_ADDON_EXTERNAL_CALL and\n- is_upnext_callback_received and\n- not is_upnext_callback_file_type_strm)\n- common.info('Playing {} from {} (Is Up Next Add-on call: {})',\n+ common.info('Playing {}{}{}',\nvideoid,\n- 'add-on' if is_played_from_addon else 'external call',\n- is_upnext_callback_received)\n+ ' [STRM file]' if is_played_from_strm else '',\n+ ' [external call]' if g.IS_ADDON_EXTERNAL_CALL else '')\n- # Profile switch when playing from Kodi library\n- if not is_played_from_addon:\n+ # Profile switch when playing from a STRM file (library)\n+ if is_played_from_strm:\nif not _profile_switch():\nxbmcplugin.endOfDirectory(g.PLUGIN_HANDLE, succeeded=False)\nreturn\n@@ -89,7 +89,7 @@ def play(videoid):\nlist_item = get_inputstream_listitem(videoid)\n# STRM file resume workaround (Kodi library)\n- resume_position = _strm_resume_workaroud(is_played_from_addon, videoid)\n+ resume_position = _strm_resume_workaroud(is_played_from_strm, videoid)\nif resume_position == '':\nxbmcplugin.setResolvedUrl(handle=g.PLUGIN_HANDLE, succeeded=False, listitem=list_item)\nreturn\n@@ -99,7 +99,7 @@ def play(videoid):\nvideoid_next_episode = None\n# Get Infolabels and Arts for the videoid to be played, and for the next video if it is an episode (for UpNext)\n- if not is_played_from_addon or is_upnext_enabled:\n+ if is_played_from_strm or is_upnext_enabled or g.IS_ADDON_EXTERNAL_CALL:\nif is_upnext_enabled and videoid.mediatype == common.VideoId.EPISODE:\n# When UpNext is enabled, get the next episode to play\nvideoid_next_episode = _upnext_get_next_episode_videoid(videoid, metadata)\n@@ -113,7 +113,7 @@ def play(videoid):\n# Get event data for videoid to be played (needed for sync of watched status with Netflix)\nif (g.ADDON.getSettingBool('ProgressManager_enabled') and\nvideoid.mediatype in [common.VideoId.MOVIE, common.VideoId.EPISODE] and\n- is_played_from_addon):\n+ not is_played_from_strm):\n# Enable the progress manager only when:\n# - It is not an add-on external call\n# - It is an external call, but the played item is not a STRM file\n@@ -123,15 +123,11 @@ def play(videoid):\n# that can be used only on Kodi 19.x\nevent_data = _get_event_data(videoid)\nevent_data['videoid'] = videoid.to_dict()\n- event_data['is_played_by_library'] = not is_played_from_addon\n+ event_data['is_played_by_library'] = is_played_from_strm\nif 'raspberrypi' in common.get_system_platform():\n_raspberry_disable_omxplayer()\n- xbmcplugin.setResolvedUrl(handle=g.PLUGIN_HANDLE, succeeded=True, listitem=list_item)\n-\n- g.LOCAL_DB.set_value('last_videoid_played', videoid.to_dict(), table=TABLE_SESSION)\n-\n# Start and initialize the action controller (see action_controller.py)\ncommon.debug('Sending initialization signal')\ncommon.send_signal(common.Signals.PLAYBACK_INITIATED, {\n@@ -139,10 +135,12 @@ def play(videoid):\n'videoid_next_episode': videoid_next_episode.to_dict() if videoid_next_episode else None,\n'metadata': metadata,\n'info_data': info_data,\n- 'is_played_from_addon': is_played_from_addon,\n+ 'is_played_from_strm': is_played_from_strm,\n'resume_position': resume_position,\n- 'event_data': event_data,\n- 'is_upnext_callback_received': is_upnext_callback_received}, non_blocking=True)\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)\n+ xbmcplugin.setResolvedUrl(handle=g.PLUGIN_HANDLE, succeeded=True, listitem=list_item)\ndef get_inputstream_listitem(videoid):\n@@ -228,9 +226,9 @@ def _verify_pin(pin_required):\nreturn None if not pin else api.verify_pin(pin)\n-def _strm_resume_workaroud(is_played_from_addon, videoid):\n+def _strm_resume_workaroud(is_played_from_strm, videoid):\n\"\"\"Workaround for resuming STRM files from library\"\"\"\n- if is_played_from_addon or not g.ADDON.getSettingBool('ResumeManager_enabled'):\n+ if not is_played_from_strm or not g.ADDON.getSettingBool('ResumeManager_enabled'):\nreturn None\nresume_position = infolabels.get_resume_info_from_library(videoid).get('position')\nif resume_position:\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/playback/action_controller.py",
"new_path": "resources/lib/services/playback/action_controller.py",
"diff": "@@ -30,24 +30,36 @@ class ActionController(xbmc.Monitor):\n\"\"\"\ndef __init__(self):\nxbmc.Monitor.__init__(self)\n+ self._init_data = None\nself.tracking = False\n+ self.events_workaround = False\nself.active_player_id = None\nself.action_managers = None\nself._last_player_state = {}\ncommon.register_slot(self.initialize_playback, common.Signals.PLAYBACK_INITIATED)\n- # UpNext Add-on - play call back method\n- common.register_slot(self._play_callback, signal=g.ADDON_ID + '_play_action', source_id='upnextprovider')\n- # Safe measure for when Kodi interrupt the play action due to an error/problem or Kodi crash\n- _reset_upnext_callback_state()\ndef initialize_playback(self, data):\n\"\"\"\nCallback for AddonSignal when this add-on has initiated a playback\n\"\"\"\n- if data['is_upnext_callback_received']:\n- _reset_upnext_callback_state()\n- self._last_player_state = {}\n+ self._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+ self._initialize_am()\n+\n+ def _initialize_am(self):\n+ self._last_player_state = {}\nself.action_managers = [\nAMPlayback(),\nAMSectionSkipper(),\n@@ -55,17 +67,21 @@ class ActionController(xbmc.Monitor):\nAMVideoEvents(),\nAMUpNextNotifier()\n]\n- self._notify_all(ActionManager.call_initialize, data)\n+ self._notify_all(ActionManager.call_initialize, self._init_data)\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:\n+ if not self.tracking or 'Player.' not in method:\nreturn\ntry:\n- if method == 'Player.OnAVStart':\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@@ -75,10 +91,22 @@ class ActionController(xbmc.Monitor):\nelif method == 'Player.OnPause':\nself._on_playback_pause()\nelif method == 'Player.OnResume':\n+ if self.events_workaround:\n+ common.debug('ActionController: Player.OnResume event has been ignored')\n+ return\nself._on_playback_resume()\nelif method == 'Player.OnStop':\n- # When Up Next add-on starts the next video, the 'Player.OnStop' notification WILL BE NOT PERFORMED\n- # then is manually generated by _play_callback method\n+ # When an error occurs before the video can be played,\n+ # Kodi send a Stop event and here the active_player_id is None, then ignore this event\n+ if self.active_player_id is None:\n+ common.debug('ActionController: Player.OnStop event has been ignored')\n+ common.warn('ActionController: Possible problem with video playback, action managers disabled.')\n+ self.tracking = False\n+ self.action_managers = None\n+ self.events_workaround = False\n+ return\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@@ -129,6 +157,7 @@ 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):\ncommon.debug('Notifying all action managers of {} (data={})', notification.__name__, data)\n@@ -159,9 +188,8 @@ class ActionController(xbmc.Monitor):\nplayer_state['time']['seconds'])\n# Sometimes may happen that when you stop playback the player status is partial,\n- # this is because the Kodi player stop immediatel but the stop notification\n- # (from the Monitor) arrives late, meanwhile in this interval of time a service\n- # tick may occur.\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.\nif ((player_state['audiostreams'] and player_state['elapsed_seconds']) or\n(player_state['audiostreams'] and not player_state['elapsed_seconds'] and not self._last_player_state)):\n# save player state\n@@ -172,24 +200,6 @@ class ActionController(xbmc.Monitor):\nreturn player_state\n- def _play_callback(self, data):\n- \"\"\"Callback function used for Up Next add-on integration\"\"\"\n- common.info('Received play signal from UpNext add-on. Playing next episode...')\n- # This information are necessary to be able to understand if when play the next episode is done by\n- # the add-on itself or from external call (Kodi library)\n- g.LOCAL_DB.set_value('upnext_play_callback_received', True)\n- g.LOCAL_DB.set_value('upnext_play_callback_file_type', 'strm' if '.strm' in data['play_path'] else 'plugin')\n- # Manually generates the OnStop notification\n- self.onNotification('_play_callback', 'Player.OnStop', None)\n- # Todo: Seem a bug of Kodi, when play next video and stop the video,\n- # the previous videos marked as watched lost his checks\n- # but if you return to previous folder and open again the video list, the lost checks are restored.\n- # This happen when play videos inside add-on with \"Sync of watched status with Netflix\" feature disabled.\n- common.play_media(data['play_path'])\n- # Alternative way\n- # common.stop_playback()\n- # common.json_rpc('Player.Open', {'item': {'file': data['play_path']}})\n-\ndef _notify_managers(manager, notification, data):\nnotify_method = getattr(manager, notification.__name__)\n@@ -219,9 +229,3 @@ def _get_player_id():\nexcept IOError:\ncommon.error('Player ID not obtained, fallback to ID 1')\nreturn 1\n-\n-\n-def _reset_upnext_callback_state():\n- if g.LOCAL_DB.get_value('upnext_play_callback_received', False):\n- g.LOCAL_DB.set_value('upnext_play_callback_received', False)\n- g.LOCAL_DB.set_value('upnext_play_callback_file_type', '')\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": "@@ -37,7 +37,7 @@ class AMUpNextNotifier(ActionManager):\nvideoid = common.VideoId.from_dict(data['videoid'])\nvideoid_next_episode = common.VideoId.from_dict(data['videoid_next_episode'])\nself.upnext_info = get_upnext_info(videoid, videoid_next_episode, data['info_data'], data['metadata'],\n- data['is_played_from_addon'])\n+ data['is_played_from_strm'])\ndef on_playback_started(self, player_state): # pylint: disable=unused-argument\ncommon.debug('Sending initialization signal to Up Next Add-on')\n@@ -47,25 +47,25 @@ class AMUpNextNotifier(ActionManager):\npass\n-def get_upnext_info(videoid, videoid_next_episode, info_data, metadata, is_played_from_addon):\n+def get_upnext_info(videoid, videoid_next_episode, 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}\n- if is_played_from_addon:\n- url = common.build_url(videoid=videoid_next_episode,\n- mode=g.MODE_PLAY,\n- params={'profile_guid': g.LOCAL_DB.get_active_profile_guid()})\n- else:\n- # Played from Kodi library get the strm file path\n+ if 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(\nvideoid_next_episode.tvshowid,\nvideoid_next_episode.seasonid,\nvideoid_next_episode.episodeid)\nurl = g.py2_decode(xbmc.translatePath(file_path))\n- upnext_info['play_info'] = {'play_path': url}\n+ else:\n+ url = common.build_url(videoid=videoid_next_episode,\n+ mode=g.MODE_PLAY,\n+ params={'profile_guid': g.LOCAL_DB.get_active_profile_guid()})\n+ upnext_info['play_url'] = url\nif 'creditsOffset' in metadata[0]:\nupnext_info['notification_offset'] = metadata[0]['creditsOffset']\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Initial changes to different path for STRM files |
106,046 | 23.07.2020 10:02:26 | -7,200 | 5057837c2876cb2b19999284b4140d8a86b369fc | Fixed limit case of TypeError | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/library_updater.py",
"new_path": "resources/lib/services/library_updater.py",
"diff": "@@ -67,8 +67,12 @@ class LibraryUpdateService(xbmc.Monitor):\n\"\"\"\nCheck if Kodi has been idle for 5 minutes\n\"\"\"\n+ try:\nif not g.ADDON.getSettingBool('lib_auto_upd_wait_idle'):\nreturn True\n+ except TypeError:\n+ # Could happen when the service tick is executed at the same time when the settings are written\n+ return False\nlastidle = xbmc.getGlobalIdleTime()\nif xbmc.Player().isPlaying():\nself.startidle = lastidle\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Fixed limit case of TypeError |
106,046 | 24.07.2020 11:22:01 | -7,200 | 9eea683647da6d814b6a2155842488a293b575b3 | Add load/save a file on a different path | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/common/fileops.py",
"new_path": "resources/lib/common/fileops.py",
"diff": "@@ -78,28 +78,48 @@ def copy_file(from_path, to_path):\npass\n-def save_file(filename, content, mode='wb'):\n+def save_file_def(filename, content, mode='wb'):\n\"\"\"\n- Saves the given content under given filename\n+ Saves the given content under given filename, in the default add-on data folder\n:param filename: The filename\n:param content: The content of the file\n+ :param mode: optional mode options\n\"\"\"\n- file_handle = xbmcvfs.File(\n- xbmc.translatePath(os.path.join(g.DATA_PATH, filename)), mode)\n+ save_file(os.path.join(g.DATA_PATH, filename), content, mode)\n+\n+\n+def save_file(file_path, content, mode='wb'):\n+ \"\"\"\n+ Saves the given content under given filename path\n+ :param file_path: The filename path\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)\ntry:\nfile_handle.write(bytearray(content))\nfinally:\nfile_handle.close()\n-def load_file(filename, mode='rb'):\n+def load_file_def(filename, mode='rb'):\n\"\"\"\n- Loads the content of a given filename\n+ Loads the content of a given filename, from the default add-on data folder\n:param filename: The file to load\n+ :param mode: optional mode options\n+ :return: The content of the file\n+ \"\"\"\n+ return load_file(os.path.join(g.DATA_PATH, filename), mode)\n+\n+\n+def load_file(file_path, mode='rb'):\n+ \"\"\"\n+ Loads the content of a given filename\n+ :param file_path: The file path to load\n+ :param mode: optional mode options\n:return: The content of the file\n\"\"\"\n- file_handle = xbmcvfs.File(\n- xbmc.translatePath(os.path.join(g.DATA_PATH, filename)), mode)\n+ file_handle = xbmcvfs.File(xbmc.translatePath(file_path), mode)\ntry:\nreturn file_handle.readBytes().decode('utf-8')\nfinally:\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/msl/base_crypto.py",
"new_path": "resources/lib/services/msl/base_crypto.py",
"diff": "@@ -83,7 +83,7 @@ class MSLBaseCrypto(object):\nself._msl_data['tokens'] = {'mastertoken': self.mastertoken}\nself._msl_data.update(self._export_keys())\nself._msl_data['bound_esn'] = self.bound_esn\n- common.save_file(MSL_DATA_FILENAME, json.dumps(self._msl_data).encode('utf-8'))\n+ common.save_file_def(MSL_DATA_FILENAME, json.dumps(self._msl_data).encode('utf-8'))\ncommon.debug('Successfully saved MSL data to disk')\ndef _init_keys(self, key_response_data):\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/msl/converter.py",
"new_path": "resources/lib/services/msl/converter.py",
"diff": "@@ -57,7 +57,7 @@ def convert_to_dash(manifest):\nxml = ET.tostring(root, encoding='utf-8', method='xml')\nif common.is_debug_verbose():\n- common.save_file('manifest.mpd', xml)\n+ common.save_file_def('manifest.mpd', xml)\nreturn xml.decode('utf-8').replace('\\n', '').replace('\\r', '').encode('utf-8')\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/msl/msl_handler.py",
"new_path": "resources/lib/services/msl/msl_handler.py",
"diff": "@@ -90,7 +90,7 @@ class MSLHandler(object):\ndef _init_msl_handler(self):\nself.msl_requests = None\ntry:\n- msl_data = json.loads(common.load_file(MSL_DATA_FILENAME))\n+ msl_data = json.loads(common.load_file_def(MSL_DATA_FILENAME))\ncommon.info('Loaded MSL data from disk')\nexcept Exception: # pylint: disable=broad-except\nmsl_data = None\n@@ -174,7 +174,7 @@ class MSLHandler(object):\nif common.is_debug_verbose():\ncommon.debug('Manifest for {} obtained from the cache', viewable_id)\n# Save the manifest to disk as reference\n- common.save_file('manifest.json', json.dumps(manifest).encode('utf-8'))\n+ common.save_file_def('manifest.json', json.dumps(manifest).encode('utf-8'))\nreturn manifest\nexcept CacheMiss:\npass\n@@ -250,7 +250,7 @@ class MSLHandler(object):\ndisable_msl_switch=False)\nif common.is_debug_verbose():\n# Save the manifest to disk as reference\n- common.save_file('manifest.json', json.dumps(manifest).encode('utf-8'))\n+ common.save_file_def('manifest.json', json.dumps(manifest).encode('utf-8'))\n# Save the manifest to the cache to retrieve it during its validity\nexpiration = int(manifest['expiration'] / 1000)\ng.CACHE.add(CACHE_MANIFESTS, cache_identifier, manifest, expires=expiration)\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/msl/msl_requests.py",
"new_path": "resources/lib/services/msl/msl_requests.py",
"diff": "@@ -108,7 +108,7 @@ class MSLRequests(MSLRequestBuilder):\nis_handshake_required = True\nif is_handshake_required:\nif self.perform_key_handshake():\n- msl_data = json.loads(common.load_file(MSL_DATA_FILENAME))\n+ msl_data = json.loads(common.load_file_def(MSL_DATA_FILENAME))\nself.crypto.load_msl_data(msl_data)\nself.crypto.load_crypto_session(msl_data)\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Add load/save a file on a different path |
106,046 | 24.07.2020 11:22:37 | -7,200 | 747d4cbc2d487df8fedb580121fe1428172e9a1c | Add delete folder method | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/common/fileops.py",
"new_path": "resources/lib/common/fileops.py",
"diff": "@@ -168,6 +168,14 @@ def delete_folder_contents(path, delete_subfolders=False):\nxbmcvfs.rmdir(os.path.join(path, directory))\n+def delete_folder(path):\n+ \"\"\"Delete a folder with all his contents\"\"\"\n+ delete_folder_contents(path, True)\n+ # Give time because the system performs previous op. otherwise it can't delete the folder\n+ xbmc.sleep(80)\n+ xbmcvfs.rmdir(xbmc.translatePath(path))\n+\n+\ndef delete_ndb_files(data_path=g.DATA_PATH):\n\"\"\"Delete all .ndb files in a folder\"\"\"\nfor filename in list_dir(xbmc.translatePath(data_path))[1]:\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Add delete folder method |
106,046 | 23.07.2020 11:58:43 | -7,200 | 6472a97f944f0d46ce9b63eb13a02c6069a85d51 | Raise MetadataNotAvailable instead return empty value | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/nfsession/nfsession_ops.py",
"new_path": "resources/lib/services/nfsession/nfsession_ops.py",
"diff": "@@ -132,7 +132,6 @@ class NFSessionOperations(SessionPathRequests):\n\"\"\"Retrieve additional metadata for the given VideoId\"\"\"\nif isinstance(videoid, list): # IPC call send the videoid as \"path\" list\nvideoid = common.VideoId.from_path(videoid)\n- metadata_data = {}, None\n# Get the parent VideoId (when the 'videoid' is a type of EPISODE/SEASON)\nparent_videoid = videoid.derive_parent(common.VideoId.SHOW)\n# Delete the cache if we need to refresh the all metadata\n@@ -150,6 +149,7 @@ class NFSessionOperations(SessionPathRequests):\nexcept KeyError as exc:\n# The new metadata does not contain the episode\ncommon.error('Episode metadata not found, find_episode_metadata raised an error: {}', exc)\n+ raise MetadataNotAvailable\nelse:\nmetadata_data = self._metadata(video_id=parent_videoid), None\nreturn metadata_data\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Raise MetadataNotAvailable instead return empty value |
106,046 | 24.07.2020 08:46:55 | -7,200 | 3d0dff6e7c9392eb579bf3437f736c8ed1226602 | Use the new path to playing STRM files | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/common/fileops.py",
"new_path": "resources/lib/common/fileops.py",
"diff": "@@ -188,7 +188,7 @@ def write_strm_file(videoid, file_path):\nfilehandle = xbmcvfs.File(xbmc.translatePath(file_path), 'wb')\ntry:\nfilehandle.write(bytearray(build_url(videoid=videoid,\n- mode=g.MODE_PLAY).encode('utf-8')))\n+ mode=g.MODE_PLAY_STRM).encode('utf-8')))\nfinally:\nfilehandle.close()\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/globals.py",
"new_path": "resources/lib/globals.py",
"diff": "@@ -201,6 +201,7 @@ class GlobalVariables(object):\nMODE_HUB = 'hub'\nMODE_ACTION = 'action'\nMODE_PLAY = 'play'\n+ MODE_PLAY_STRM = 'play_strm'\nMODE_LIBRARY = 'library'\ndef __init__(self):\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/run_addon.py",
"new_path": "resources/lib/run_addon.py",
"diff": "@@ -61,6 +61,10 @@ def route(pathitems):\nfrom resources.lib.navigation.player import play\nplay(videoid=pathitems[1:])\nreturn\n+ if root_handler == g.MODE_PLAY_STRM:\n+ from resources.lib.navigation.player import play_strm\n+ play_strm(videoid=pathitems[1:])\n+ return\nif root_handler == 'extrafanart':\nwarn('Route: ignoring extrafanart invocation')\n_handle_endofdirectory()\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Use the new path to playing STRM files |
106,046 | 24.07.2020 11:43:41 | -7,200 | c93c831a8d0cfced50c6d1da3d673902f1e7bdee | New import existing library feature | [
{
"change_type": "MODIFY",
"old_path": "resources/language/resource.language.en_gb/strings.po",
"new_path": "resources/language/resource.language.en_gb/strings.po",
"diff": "@@ -561,7 +561,7 @@ msgid \"Enable IPC over HTTP (use when Addon Signals timeout messages appear)\"\nmsgstr \"\"\nmsgctxt \"#30140\"\n-msgid \"Migrate Library to new format\"\n+msgid \"Import existing library\"\nmsgstr \"\"\nmsgctxt \"#30141\"\n@@ -976,7 +976,11 @@ msgctxt \"#30245\"\nmsgid \"Deleting files exported to the library\"\nmsgstr \"\"\n-# Unused 30246 to 30299\n+msgctxt \"#30246\"\n+msgid \"There are {} titles that cannot be imported.[CR]Do you want to delete these files?\"\n+msgstr \"\"\n+\n+# Unused 30247 to 30299\nmsgctxt \"#30300\"\nmsgid \"Do you want to remove watched status of '{}'?[CR][CR]The operation could take up to 24h, therefore the title may still appear in the list.\"\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/kodi/library.py",
"new_path": "resources/lib/kodi/library.py",
"diff": "\"\"\"\nfrom __future__ import absolute_import, division, unicode_literals\n+import os\nfrom datetime import datetime\nfrom future.utils import iteritems\n+import xbmc\n+\nimport resources.lib.api.api_requests as api\nimport resources.lib.common as common\nimport resources.lib.kodi.nfo as nfo\n@@ -23,7 +26,8 @@ from resources.lib.globals import g\nfrom resources.lib.kodi.library_tasks import LibraryTasks\nfrom resources.lib.kodi.library_utils import (request_kodi_library_update, get_library_path,\nFOLDER_NAME_MOVIES, FOLDER_NAME_SHOWS,\n- is_auto_update_library_running, request_kodi_library_scan_decorator)\n+ is_auto_update_library_running, request_kodi_library_scan_decorator,\n+ get_library_subfolders)\nfrom resources.lib.navigation.directory_utils import delay_anti_ban\ntry: # Python 2\n@@ -300,28 +304,33 @@ class Library(LibraryTasks):\ncommon.clean_library(show_prg_dialog)\nreturn True\n- @request_kodi_library_scan_decorator\n- def import_library(self, is_old_format):\n+ def import_library(self):\n\"\"\"\n- Imports an already existing library into the add-on library database (and also update seasons/episodes),\n- allows you to restore an existing library, avoiding to recreate it from scratch.\n- :param is_old_format: if True, imports library items with old format version (add-on version 13.x)\n+ Imports an already existing exported STRM library into the add-on library database,\n+ allows you to restore an existing library, by avoiding to recreate it from scratch.\n+ This operations also update the missing tv shows seasons and episodes, and automatically\n+ converts old STRM format type from add-on version 0.13.x or before 1.7.0 to new format.\n\"\"\"\n# If set ask to user if want to export NFO files\nnfo_settings = nfo.NFOSettings()\nnfo_settings.show_export_dialog()\n- # Choose the format type func to import\n- if is_old_format:\n- common.info('Start importing Kodi library (old format type)')\n- import_videoids_func = self.imports_videoids_from_existing_old_library\n- else:\n- raise NotImplementedError\n- # Start importing files to add-on library database\n- with ui.ProgressDialog(True) as progress_bar:\n- videoids = import_videoids_func()\n- progress_bar.max_value = len(videoids)\n- for videoid in videoids:\n- # Execute the task\n+ common.info('Start importing Kodi library')\n+ remove_folders = [] # List of failed imports paths to be optionally removed\n+ remove_titles = [] # List of failed imports titles to be optionally removed\n+ # Start importing STRM files\n+ folders = get_library_subfolders(FOLDER_NAME_MOVIES) + get_library_subfolders(FOLDER_NAME_SHOWS)\n+ with ui.ProgressDialog(True, max_value=len(folders)) as progress_bar:\n+ for folder_path in folders:\n+ folder_name = os.path.basename(g.py2_decode(xbmc.translatePath(folder_path)))\n+ progress_bar.set_message(folder_name)\n+ try:\n+ videoid = self.import_videoid_from_existing_strm(folder_path, folder_name)\n+ if videoid is None:\n+ # Failed to import, add folder to remove list\n+ remove_folders.append(folder_path)\n+ remove_titles.append(folder_name)\n+ continue\n+ # Successfully imported, Execute the task\nfor index, total_tasks, title in self.execute_library_task(videoid,\nself.export_item,\nnfo_settings=nfo_settings,\n@@ -330,10 +339,36 @@ class Library(LibraryTasks):\nprogress_bar.set_message(title + label_partial_op)\nif progress_bar.is_cancelled():\ncommon.warn('Import library interrupted by User')\n- break\n+ return\nif self.monitor.abortRequested():\ncommon.warn('Import library interrupted by Kodi')\n- break\n+ return\n+ except ImportWarning:\n+ # Ignore it, something was wrong in STRM file (see _import_videoid in library_jobs.py)\n+ pass\nprogress_bar.perform_step()\nprogress_bar.set_wait_message()\ndelay_anti_ban()\n+ ret = self._import_library_remove(remove_titles, remove_folders)\n+ request_kodi_library_update(scan=True, clean=ret)\n+\n+ def _import_library_remove(self, remove_titles, remove_folders):\n+ if not remove_folders:\n+ return False\n+ # If there are STRM files that it was not possible to import them,\n+ # we will ask to user if you want to delete them\n+ tot_folders = len(remove_folders)\n+ if tot_folders > 50:\n+ remove_titles = remove_titles[:50] + ['...']\n+ message = common.get_local_string(30246).format(tot_folders) + '[CR][CR]' + ', '.join(remove_titles)\n+ if not ui.ask_for_confirmation(common.get_local_string(30140), message):\n+ return False\n+ # Delete all folders\n+ common.info('Start deleting folders')\n+ with ui.ProgressDialog(True, max_value=tot_folders) as progress_bar:\n+ for file_path in remove_folders:\n+ progress_bar.set_message('{}/{}'.format(progress_bar.value, tot_folders))\n+ common.debug('Deleting folder: {}', file_path)\n+ common.delete_folder(file_path)\n+ progress_bar.perform_step()\n+ return True\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/kodi/library_jobs.py",
"new_path": "resources/lib/kodi/library_jobs.py",
"diff": "@@ -19,8 +19,7 @@ import resources.lib.common as common\nimport resources.lib.kodi.ui as ui\nfrom resources.lib.api.exceptions import MetadataNotAvailable\nfrom resources.lib.globals import g\n-from resources.lib.kodi.library_utils import (get_library_subfolders, FOLDER_NAME_MOVIES, FOLDER_NAME_SHOWS,\n- remove_videoid_from_db, insert_videoid_to_db)\n+from resources.lib.kodi.library_utils import remove_videoid_from_db, insert_videoid_to_db\nclass LibraryJobs(object):\n@@ -99,35 +98,75 @@ class LibraryJobs(object):\n# -------------------------- The follow functions not concern jobs for tasks\n- def imports_videoids_from_existing_old_library(self):\n+ def import_videoid_from_existing_strm(self, folder_path, folder_name):\n\"\"\"\n- Gets a list of VideoId of type movie and show from STRM files that were exported,\n- from the old add-on version 13.x\n+ Get a VideoId from an existing STRM file that was exported\n\"\"\"\n- videoid_pattern = re.compile('video_id=(\\\\d+)')\n- for folder in get_library_subfolders(FOLDER_NAME_MOVIES) + get_library_subfolders(FOLDER_NAME_SHOWS):\n- for filename in common.list_dir(folder)[1]:\n- file_path = common.join_folders_paths(folder, filename)\n- if file_path.endswith('.strm'):\n- common.debug('Trying to migrate {}', file_path)\n- try:\n+ for filename in common.list_dir(folder_path)[1]:\n+ if not filename.endswith('.strm'):\n+ continue\n+ file_path = common.join_folders_paths(folder_path, filename)\n# Only get a VideoId from the first file in each folder.\n- # For shows, all episodes will result in the same VideoId\n- # and movies only contain one file\n- yield self._get_root_videoid(file_path, videoid_pattern)\n+ # For tv shows all episodes will result in the same VideoId, the movies only contain one file.\n+ file_content = common.load_file(file_path)\n+ if not file_content:\n+ common.warn('Import error: folder \"{}\" skipped, STRM file empty or corrupted', folder_name)\n+ return None\n+ if 'action=play_video' in file_content:\n+ common.debug('Trying to import (v0.13.x): {}', file_path)\n+ return self._import_videoid_old(file_content, folder_name)\n+ common.debug('Trying to import: {}', file_path)\n+ return self._import_videoid(file_content, folder_name)\n+\n+ def _import_videoid_old(self, file_content, folder_name):\n+ try:\n+ # The STRM file in add-on v13.x is different and can contains two lines, example:\n+ # #EXTINF:-1,Tv show title - \"meta data ...\"\n+ # plugin://plugin.video.netflix/?video_id=12345678&action=play_video\n+ # Get last line and extract the videoid value\n+ match = re.search(r'video_id=(\\d+)', file_content.split('\\n')[-1])\n+ # Create a videoid of UNSPECIFIED type (we do not know the real type of videoid)\n+ videoid = common.VideoId(videoid=match.groups()[0])\n+ # Try to get the videoid metadata:\n+ # - To know if the videoid still exists on netflix\n+ # - To get the videoid type\n+ # - To get the Tv show videoid, in the case of STRM of an episode\n+ metadata = self.ext_func_get_metadata(videoid)[0] # pylint: disable=not-callable\n+ # Generate the a good videoid\n+ if metadata['type'] == 'show':\n+ return common.VideoId(tvshowid=metadata['id'])\n+ return common.VideoId(movieid=metadata['id'])\nexcept MetadataNotAvailable:\n- common.warn('Metadata not available, item skipped')\n+ common.warn('Import error: folder {} skipped, metadata not available', folder_name)\n+ return None\nexcept (AttributeError, IndexError):\n- common.warn('Item does not conform to old format')\n- break\n-\n- def _get_root_videoid(self, filename, pattern):\n- match = re.search(pattern,\n- xbmcvfs.File(filename, 'r').read().decode('utf-8').split('\\n')[-1])\n- # pylint: disable=not-callable\n- metadata = self.ext_func_get_metadata(\n- common.VideoId(videoid=match.groups()[0])\n- )[0]\n- if metadata['type'] == 'show':\n- return common.VideoId(tvshowid=metadata['id']), metadata.get('title', 'Tv show')\n- return common.VideoId(movieid=metadata['id']), metadata.get('title', 'Movie')\n+ common.warn('Import error: folder {} skipped, STRM not conform to v0.13.x format', folder_name)\n+ return None\n+\n+ def _import_videoid(self, file_content, folder_name):\n+ file_content = file_content.strip('\\t\\n\\r')\n+ if g.BASE_URL not in file_content:\n+ common.warn('Import error: folder \"{}\" skipped, unrecognized plugin name in STRM file', folder_name)\n+ raise ImportWarning\n+ file_content = file_content.replace(g.BASE_URL, '')\n+ # file_content should result as, example:\n+ # - Old STRM path: '/play/show/xxxxxxxx/season/xxxxxxxx/episode/xxxxxxxx/' (used before ver 1.7.0)\n+ # - New STRM path: '/play_strm/show/xxxxxxxx/season/xxxxxxxx/episode/xxxxxxxx/' (used from ver 1.7.0)\n+ pathitems = file_content.strip('/').split('/')\n+ if g.MODE_PLAY not in pathitems and g.MODE_PLAY_STRM not in pathitems:\n+ common.warn('Import error: folder \"{}\" skipped, unsupported play path in STRM file', folder_name)\n+ raise ImportWarning\n+ pathitems = pathitems[1:]\n+ try:\n+ if pathitems[0] == common.VideoId.SHOW:\n+ # Get always VideoId of tvshow type (not season or episode)\n+ videoid = common.VideoId.from_path(pathitems[:2])\n+ else:\n+ videoid = common.VideoId.from_path(pathitems)\n+ # Try to get the videoid metadata, to know if the videoid still exists on netflix\n+ self.ext_func_get_metadata(videoid) # pylint: disable=not-callable\n+ return videoid\n+ except MetadataNotAvailable:\n+ common.warn('Import error: folder {} skipped, metadata not available for videoid {}',\n+ folder_name, pathitems[1])\n+ return None\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/navigation/library.py",
"new_path": "resources/lib/navigation/library.py",
"diff": "@@ -82,9 +82,12 @@ class LibraryActionExecutor(object):\nreturn\nget_library_cls().clear_library()\n- def migrate(self, pathitems): # pylint: disable=unused-argument\n- \"\"\"Migrate exported items from old library format (add-on version 13.x) to the new format\"\"\"\n- get_library_cls().import_library(is_old_format=True)\n+ def import_library(self, pathitems): # pylint: disable=unused-argument\n+ \"\"\"Import previous exported STRM files to add-on and/or convert them to the current STRM format type\"\"\"\n+ if not ui.ask_for_confirmation(common.get_local_string(30140),\n+ common.get_local_string(20135)):\n+ return\n+ get_library_cls().import_library()\[email protected]_video_id(path_offset=1)\ndef export_new_episodes(self, videoid):\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/settings.xml",
"new_path": "resources/settings.xml",
"diff": "<setting id=\"enablelibraryfolder\" type=\"bool\" label=\"30026\" default=\"false\"/>\n<setting id=\"customlibraryfolder\" type=\"folder\" label=\"30027\" enable=\"eq(-1,true)\" default=\"special://profile/addon_data/plugin.video.netflix\" source=\"auto\" option=\"writeable\" subsetting=\"true\"/>\n<setting id=\"purge_library\" type=\"action\" label=\"30125\" action=\"RunPlugin(plugin://plugin.video.netflix/library/purge/)\"/>\n- <setting id=\"migrate_library\" type=\"action\" label=\"30140\" action=\"RunPlugin(plugin://plugin.video.netflix/library/migrate/)\"/>\n+ <setting id=\"import_library\" type=\"action\" label=\"30140\" action=\"RunPlugin(plugin://plugin.video.netflix/library/import_library/)\"/>\n<setting label=\"30199\" type=\"lsep\"/><!--Shared library-->\n<setting id=\"use_mysql\" type=\"bool\" label=\"30200\" default=\"false\"/>\n<setting id=\"mysql_username\" type=\"text\" label=\"30201\" default=\"kodi\" visible=\"eq(-1,true)\" subsetting=\"true\"/>\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | New import existing library feature |
106,046 | 24.07.2020 11:52:46 | -7,200 | 82134a3844460d710334b3b295e7944c94bde184 | Move delay_anti_ban to right place | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/kodi/library.py",
"new_path": "resources/lib/kodi/library.py",
"diff": "@@ -27,8 +27,7 @@ from resources.lib.kodi.library_tasks import LibraryTasks\nfrom resources.lib.kodi.library_utils import (request_kodi_library_update, get_library_path,\nFOLDER_NAME_MOVIES, FOLDER_NAME_SHOWS,\nis_auto_update_library_running, request_kodi_library_scan_decorator,\n- get_library_subfolders)\n-from resources.lib.navigation.directory_utils import delay_anti_ban\n+ get_library_subfolders, delay_anti_ban)\ntry: # Python 2\nunicode\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/kodi/library_utils.py",
"new_path": "resources/lib/kodi/library_utils.py",
"diff": "from __future__ import absolute_import, division, unicode_literals\nimport os\n+import random\nfrom datetime import datetime, timedelta\nfrom functools import wraps\n+import xbmc\n+\nfrom resources.lib import common\nfrom resources.lib.api.paths import PATH_REQUEST_SIZE_STD\nfrom resources.lib.database.db_utils import VidLibProp\n@@ -159,3 +162,10 @@ def list_contents(perpetual_range_start):\nelse:\nperpetual_range_selector['_perpetual_range_selector'] = {'previous_start': previous_start}\nreturn chunked_video_list, perpetual_range_selector\n+\n+\n+def delay_anti_ban():\n+ \"\"\"Adds some random delay between operations to limit servers load and ban risks\"\"\"\n+ # Not so reliable workaround NF has strict control over the number/type of requests in a short space of time\n+ # More than 100~ of requests could still cause HTTP errors by blocking requests to the server\n+ xbmc.sleep(random.randint(1000, 4001))\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/navigation/directory_utils.py",
"new_path": "resources/lib/navigation/directory_utils.py",
"diff": "\"\"\"\nfrom __future__ import absolute_import, division, unicode_literals\n-import random\nfrom functools import wraps\nfrom future.utils import iteritems\n@@ -214,10 +213,3 @@ def _find_index_last_watched(total_items, list_data):\n# Last partial watched item\nreturn index\nreturn 0\n-\n-\n-def delay_anti_ban():\n- \"\"\"Adds some random delay between operations to limit servers load and ban risks\"\"\"\n- # Not so reliable workaround NF has strict control over the number/type of requests in a short space of time\n- # More than 100~ of requests could still cause HTTP errors by blocking requests to the server\n- xbmc.sleep(random.randint(1000, 4001))\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Move delay_anti_ban to right place |
106,046 | 24.07.2020 14:02:11 | -7,200 | 16170a916d27e79216e2395a4086d6a22c069186 | Migrate library to new format on upgrade | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/upgrade_actions.py",
"new_path": "resources/lib/upgrade_actions.py",
"diff": "@@ -14,9 +14,11 @@ import os\nimport xbmc\nimport xbmcvfs\n-from resources.lib.common.fileops import delete_folder_contents\n-from resources.lib.common.logging import debug, error\n+from resources.lib.common.fileops import delete_folder_contents, list_dir, join_folders_paths, load_file, save_file\n+from resources.lib.common.logging import debug, error, warn\nfrom resources.lib.globals import g\n+from resources.lib.kodi import ui\n+from resources.lib.kodi.library_utils import get_library_subfolders, FOLDER_NAME_MOVIES, FOLDER_NAME_SHOWS\ndef delete_cache_folder():\n@@ -32,3 +34,47 @@ def delete_cache_folder():\nexcept Exception: # pylint: disable=broad-except\nimport traceback\nerror(g.py2_decode(traceback.format_exc(), 'latin-1'))\n+\n+\n+def migrate_library():\n+ # Migrate the Kodi library to the new format of STRM path\n+ # - Old STRM: '/play/show/xxxxxxxx/season/xxxxxxxx/episode/xxxxxxxx/' (used before ver 1.7.0)\n+ # - New STRM: '/play_strm/show/xxxxxxxx/season/xxxxxxxx/episode/xxxxxxxx/' (used from ver 1.7.0)\n+ folders = get_library_subfolders(FOLDER_NAME_MOVIES) + get_library_subfolders(FOLDER_NAME_SHOWS)\n+ if not folders:\n+ return\n+ debug('Start migrating STRM files')\n+ try:\n+ with ui.ProgressDialog(True,\n+ title='Migrating library to new format',\n+ max_value=len(folders)) as progress_bar:\n+ for folder_path in folders:\n+ folder_name = os.path.basename(g.py2_decode(xbmc.translatePath(folder_path)))\n+ progress_bar.set_message('PLEASE WAIT - Migrating: ' + folder_name)\n+ _migrate_strm_files(folder_path)\n+ except Exception as exc: # pylint: disable=broad-except\n+ error('Migrating failed: {}', exc)\n+ import traceback\n+ error(g.py2_decode(traceback.format_exc(), 'latin-1'))\n+ ui.show_ok_dialog('Migrating library to new format',\n+ ('Library migration has failed.[CR]'\n+ 'Before try play a Netflix video from library, you must run manually the library migration, '\n+ 'otherwise you will have add-on malfunctions.[CR][CR]'\n+ 'Open add-on settings on \"Library\" section, and select \"Import existing library\".'))\n+\n+\n+def _migrate_strm_files(folder_path):\n+ # Change path in STRM files\n+ for filename in list_dir(folder_path)[1]:\n+ if not filename.endswith('.strm'):\n+ continue\n+ file_path = join_folders_paths(folder_path, filename)\n+ file_content = load_file(file_path)\n+ if not file_content:\n+ warn('Migrate error: \"{}\" skipped, STRM file empty or corrupted', file_path)\n+ continue\n+ if 'action=play_video' in file_content:\n+ warn('Migrate error: \"{}\" skipped, STRM file type of v0.13.x', file_path)\n+ continue\n+ file_content = file_content.strip('\\t\\n\\r').replace('/play/', '/play_strm/')\n+ save_file(file_path, file_content.encode('utf-8'))\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/upgrade_controller.py",
"new_path": "resources/lib/upgrade_controller.py",
"diff": "@@ -59,6 +59,9 @@ def _perform_addon_changes(previous_ver, current_ver):\nmsg = ('This update resets the settings to auto-update library.\\r\\n'\n'Therefore only in case you are using auto-update must be reconfigured.')\nui.show_ok_dialog('Netflix upgrade', msg)\n+ if previous_ver and is_less_version(previous_ver, '1.7.0'):\n+ from resources.lib.upgrade_actions import migrate_library\n+ migrate_library()\n# Always leave this to last - After the operations set current version\ng.LOCAL_DB.set_value('addon_previous_version', current_ver)\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Migrate library to new format on upgrade |
106,046 | 24.07.2020 14:45:23 | -7,200 | ac51812c6346f8d67ab1ed4aa608c11a8da16400 | Avoid video playback from library after STRM migration | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/run_addon.py",
"new_path": "resources/lib/run_addon.py",
"diff": "@@ -204,11 +204,21 @@ def run(argv):\nif success:\ntry:\nif _check_valid_credentials():\n+ cancel_playback = False\n+ pathitems = [part for part in g.PATH.split('/') if part]\nif g.IS_ADDON_FIRSTRUN:\n- if check_addon_upgrade():\n+ is_first_run_install, cancel_playback = check_addon_upgrade()\n+ if is_first_run_install:\nfrom resources.lib.config_wizard import run_addon_configuration\nrun_addon_configuration()\n- route([part for part in g.PATH.split('/') if part])\n+ if cancel_playback and g.MODE_PLAY in pathitems[:1]:\n+ # Temporary for migration library STRM to new format. todo: to be removed in future releases\n+ # When a user do the add-on upgrade, the first time that the add-on will be opened will be executed\n+ # the library migration. But if a user instead to open the add-on, try to play a video from Kodi\n+ # library, Kodi will open the old STRM file because the migration is executed after.\n+ success = False\n+ else:\n+ route(pathitems)\nelse:\nsuccess = False\nexcept BackendNotReady as exc_bnr:\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/upgrade_controller.py",
"new_path": "resources/lib/upgrade_controller.py",
"diff": "@@ -19,14 +19,17 @@ def check_addon_upgrade():\n\"\"\"\nCheck addon upgrade and perform necessary update operations\n- :return True if this is the first run of the add-on after an installation from scratch\n+ :return tuple boolean 1: True if this is the first run of the add-on after an installation from scratch\n+ boolean 2: True to cancel a playback after upgrade\n+ (if user was trying to playback from kodi library so without open the add-on interface)\n\"\"\"\n# Upgrades that require user interaction or to be performed outside of the service\n+ cancel_playback = False\naddon_previous_ver = g.LOCAL_DB.get_value('addon_previous_version', None)\naddon_current_ver = g.VERSION\nif addon_previous_ver is None or is_less_version(addon_previous_ver, addon_current_ver):\n- _perform_addon_changes(addon_previous_ver, addon_current_ver)\n- return addon_previous_ver is None\n+ cancel_playback = _perform_addon_changes(addon_previous_ver, addon_current_ver)\n+ return addon_previous_ver is None, cancel_playback\ndef check_service_upgrade():\n@@ -53,6 +56,7 @@ def check_service_upgrade():\ndef _perform_addon_changes(previous_ver, current_ver):\n\"\"\"Perform actions for an version bump\"\"\"\n+ cancel_playback = False\ndebug('Initialize addon upgrade operations, from version {} to {})', previous_ver, current_ver)\nif previous_ver and is_less_version(previous_ver, '0.15.9'):\nimport resources.lib.kodi.ui as ui\n@@ -62,8 +66,10 @@ def _perform_addon_changes(previous_ver, current_ver):\nif previous_ver and is_less_version(previous_ver, '1.7.0'):\nfrom resources.lib.upgrade_actions import migrate_library\nmigrate_library()\n+ cancel_playback = True\n# Always leave this to last - After the operations set current version\ng.LOCAL_DB.set_value('addon_previous_version', current_ver)\n+ return cancel_playback\ndef _perform_service_changes(previous_ver, current_ver):\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Avoid video playback from library after STRM migration |
106,046 | 24.07.2020 15:39:01 | -7,200 | e721a072e918902c505c6ae00a453d8565fd01b3 | Fixed unicodedecode errors on py2 | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/common/fileops.py",
"new_path": "resources/lib/common/fileops.py",
"diff": "@@ -158,14 +158,14 @@ def delete_folder_contents(path, delete_subfolders=False):\n\"\"\"\ndirectories, files = list_dir(xbmc.translatePath(path))\nfor filename in files:\n- xbmcvfs.delete(os.path.join(path, filename))\n+ xbmcvfs.delete(os.path.join(path, g.py2_decode(filename)))\nif not delete_subfolders:\nreturn\nfor directory in directories:\n- delete_folder_contents(os.path.join(path, directory), True)\n+ delete_folder_contents(os.path.join(path, g.py2_decode(directory)), True)\n# Give time because the system performs previous op. otherwise it can't delete the folder\nxbmc.sleep(80)\n- xbmcvfs.rmdir(os.path.join(path, directory))\n+ xbmcvfs.rmdir(os.path.join(path, g.py2_decode(directory)))\ndef delete_folder(path):\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/kodi/library_jobs.py",
"new_path": "resources/lib/kodi/library_jobs.py",
"diff": "@@ -103,6 +103,7 @@ class LibraryJobs(object):\nGet a VideoId from an existing STRM file that was exported\n\"\"\"\nfor filename in common.list_dir(folder_path)[1]:\n+ filename = g.py2_decode(filename)\nif not filename.endswith('.strm'):\ncontinue\nfile_path = common.join_folders_paths(folder_path, filename)\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/upgrade_actions.py",
"new_path": "resources/lib/upgrade_actions.py",
"diff": "@@ -66,6 +66,7 @@ def migrate_library():\ndef _migrate_strm_files(folder_path):\n# Change path in STRM files\nfor filename in list_dir(folder_path)[1]:\n+ filename = g.py2_decode(filename)\nif not filename.endswith('.strm'):\ncontinue\nfile_path = join_folders_paths(folder_path, filename)\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Fixed unicodedecode errors on py2 |
106,046 | 24.07.2020 15:44:20 | -7,200 | c2aae0032673cbbfedbd7932f9d178538fdf1a25 | Removed delete_ndb_files | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/common/fileops.py",
"new_path": "resources/lib/common/fileops.py",
"diff": "@@ -176,13 +176,6 @@ def delete_folder(path):\nxbmcvfs.rmdir(xbmc.translatePath(path))\n-def delete_ndb_files(data_path=g.DATA_PATH):\n- \"\"\"Delete all .ndb files in a folder\"\"\"\n- for filename in list_dir(xbmc.translatePath(data_path))[1]:\n- if filename.endswith('.ndb'):\n- xbmcvfs.delete(os.path.join(g.DATA_PATH, filename))\n-\n-\ndef write_strm_file(videoid, file_path):\n\"\"\"Write a playable URL to a STRM file\"\"\"\nfilehandle = xbmcvfs.File(xbmc.translatePath(file_path), 'wb')\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Removed delete_ndb_files |
106,046 | 24.07.2020 17:15:36 | -7,200 | 7f6fb27117bea4e2b45df5e11d957ce999241784 | Update README.md
Shortened feature list some complain is too long | [
{
"change_type": "MODIFY",
"old_path": "README.md",
"new_path": "README.md",
"diff": "This plugin is not officially commissioned/supported by Netflix.\nThe trademark \"Netflix\" is registered by \"Netflix, Inc.\"\n-## Features\n-\n-- Access to multiple profiles\n-- Search Netflix including suggestions\n-- Netflix categories, recommendations, My List, continue watching and more\n-- Browse all movies and all TV shows Netflix style includes genres\n-- Browse trailers & more of TV shows and movies (by context menu)\n-- Can synchronize the watched status with Netflix service - [How works and limitations](https://github.com/CastagnaIT/plugin.video.netflix/wiki/Sync-of-watched-status-with-Netflix)\n-- Rate TV shows and movies\n-- Add or remove to/from My List\n-- Export of TV shows & movies in Kodi local library\n-- Keep Netflix My List and Kodi local library in sync\n-- Automatic export of new seasons/episodes to Kodi local library when they become available on Netflix\n-- Share/Sync the Kodi local library with multiple devices that running Kodi with the same account (requires a MySQL server)\n-- Possibility of playback at 1080P and 4K (see high resolutions table)\n-- Support of hi-res audio Dolby Digital Plus and Dolby Digital Atmos (requires a premium account)\n-- Support of HDR / HDR10 only on capable android devices (requires a premium account)\n-- Support of Dolby Vision only on capable android devices (requires a premium account)\n+## Main features\n+\n+- Access to all profiles and relative My list management\n+- Show the most used lists such as New releases, Recently added, Netflix originals, ...\n+- Show trailers lists (by context menu)\n+- Synchronize the watched status with Netflix service - [How works and limitations](https://github.com/CastagnaIT/plugin.video.netflix/wiki/Sync-of-watched-status-with-Netflix)\n+- Export and synchronize Kodi library with Netflix\n+- Share/Sync a Kodi library with multiple devices that using Kodi (requires a MySQL server)\n+- Capability of 1080P and 4K resolutions (see high resolutions table)\n+- Dolby Digital Plus and Dolby Digital Atmos (requires a premium account)\n+- HDR / HDR10 / Dolby Vision only on capable Android devices (requires a premium account)\n- Support integration with Up Next add-on (proposes to play the next episode automatically)\n## Installation & Updates\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Update README.md
Shortened feature list some complain is too long |
106,046 | 25.07.2020 09:59:43 | -7,200 | 460238390f402114d0367ca51fef2e41c2ee6e5a | Show also the class name when an error occurs | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/msl/msl_utils.py",
"new_path": "resources/lib/services/msl/msl_utils.py",
"diff": "@@ -50,6 +50,7 @@ AUDIO_CHANNELS_CONV = {1: '1.0', 2: '2.0', 6: '5.1', 8: '7.1'}\ndef display_error_info(func):\n\"\"\"Decorator that catches errors raise by the decorated function,\ndisplays an error info dialog in the UI and re-raises the error\"\"\"\n+ # (Show the error to the user before canceling the response to InputStream Adaptive callback)\n# pylint: disable=missing-docstring\n@wraps(func)\ndef error_catching_wrapper(*args, **kwargs):\n@@ -57,9 +58,9 @@ def display_error_info(func):\nreturn func(*args, **kwargs)\nexcept Exception as exc:\nif isinstance(exc, MSLError):\n- message = g.py2_decode(str(exc))\n+ message = exc.__class__.__name__ + ': ' + g.py2_decode(str(exc))\nelse:\n- message = str(exc)\n+ message = exc.__class__.__name__ + ': ' + str(exc)\nui.show_error_info(common.get_local_string(30028), message,\nunknown_error=not message,\nnetflix_error=isinstance(exc, MSLError))\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Show also the class name when an error occurs |
106,046 | 26.07.2020 01:25:41 | -7,200 | 5e6e2a4ccbf52b9b33d579b900cf2ac96f4bc18a | Moved sync nf watched status setting on top | [
{
"change_type": "MODIFY",
"old_path": "resources/settings.xml",
"new_path": "resources/settings.xml",
"diff": "<setting id=\"viewmodeexportedid\" type=\"number\" label=\"30143\" visible=\"eq(-1,1) + eq(-20,true)\" enable=\"eq(-20,true)\" subsetting=\"true\"/>\n</category>\n<category label=\"30078\"><!--Playback-->\n+ <setting id=\"ProgressManager_enabled\" type=\"bool\" label=\"30235\" default=\"false\"/>\n+ <setting id=\"select_first_unwatched\" type=\"bool\" label=\"30243\" default=\"false\" visible=\"eq(-1,true)\" subsetting=\"true\"/>\n<setting id=\"BookmarkManager_enabled\" type=\"bool\" label=\"30083\" visible=\"false\" default=\"true\"/>\n<setting id=\"StreamContinuityManager_enabled\" type=\"bool\" label=\"30082\" default=\"true\"/>\n<setting id=\"SectionSkipper_enabled\" type=\"bool\" label=\"30075\" default=\"true\"/>\n<setting id=\"auto_skip_credits\" type=\"bool\" label=\"30079\" default=\"false\" visible=\"eq(-1,true)\" subsetting=\"true\"/>\n<setting id=\"pause_on_skip\" type=\"bool\" label=\"30080\" default=\"false\" visible=\"eq(-1,true)\" subsetting=\"true\"/>\n<setting id=\"forced_subtitle_workaround\" type=\"bool\" label=\"30181\" default=\"true\" />\n- <setting id=\"ProgressManager_enabled\" type=\"bool\" label=\"30235\" default=\"false\"/>\n- <setting id=\"select_first_unwatched\" type=\"bool\" label=\"30243\" default=\"false\" visible=\"eq(-1,true)\" subsetting=\"true\"/>\n<setting label=\"30049\" type=\"lsep\"/><!--Library-->\n<setting id=\"library_playback_ask_profile\" type=\"bool\" label=\"30051\" default=\"true\"/>\n<setting id=\"library_playback_profile\" type=\"action\" label=\"30050\" default=\"\" action=\"RunPlugin(plugin://plugin.video.netflix/action/library_playback_profile/)\" visible=\"eq(-1,false)\" subsetting=\"true\" option=\"close\"/>\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Moved sync nf watched status setting on top |
106,046 | 26.07.2020 02:31:06 | -7,200 | d9fb4ba80899198794dd4945bda0e960c7e46ed0 | Fixed possible error when there are no subtitles | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/playback/am_stream_continuity.py",
"new_path": "resources/lib/services/playback/am_stream_continuity.py",
"diff": "@@ -103,7 +103,7 @@ class AMStreamContinuity(ActionManager):\ncurrent_stream = self.current_streams['subtitle']\nplayer_stream = player_state.get(STREAMS['subtitle']['current'])\nif not player_stream:\n- # I don't know the cause:\n+ # Manage case of no subtitles, and an issue:\n# Very rarely can happen that Kodi starts the playback with the subtitles enabled,\n# but after some seconds subtitles become disabled, and 'currentsubtitle' of player_state data become 'None'\n# Then _is_stream_value_equal() throw error. We do not handle it as a setting change from the user.\n@@ -270,6 +270,8 @@ 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+ return\nif audio_language == 'original':\n# Do nothing\nis_language_appropriate = True\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Fixed possible error when there are no subtitles |
106,046 | 26.07.2020 02:32:43 | -7,200 | 836eb90578d782a71cba8d5d8ced25df627aa306 | Avoid crash due to Kodi 19 JSON-RPC Player.GetProperties bug | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/playback/action_controller.py",
"new_path": "resources/lib/services/playback/action_controller.py",
"diff": "@@ -178,7 +178,8 @@ class ActionController(xbmc.Monitor):\n'percentage',\n'time']\n})\n- except IOError:\n+ except IOError as exc:\n+ common.warn('_get_player_state: {}', exc)\nreturn {}\n# convert time dict to elapsed seconds\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": "@@ -14,6 +14,7 @@ import xbmc\nimport resources.lib.common as common\nfrom resources.lib.common.cache_utils import CACHE_MANIFESTS\nfrom resources.lib.globals import g\n+from resources.lib.kodi import ui\nfrom .action_manager import ActionManager\nSTREAMS = {\n@@ -69,6 +70,17 @@ class AMStreamContinuity(ActionManager):\nself.kodi_only_forced_subtitles = common.get_kodi_subtitle_language() == 'forced_only'\ndef on_playback_started(self, player_state):\n+ if (not self.legacy_kodi_version and\n+ player_state.get(STREAMS['subtitle']['current']) is None and\n+ player_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+ self.enabled = False\n+ common.error('Due of Kodi 19 bug has been disabled: '\n+ 'Ask to skip dialog, remember audio/subtitles preferences and other features')\n+ ui.show_notification(title=common.get_local_string(30105),\n+ msg='Due to Kodi bug has been disabled all Netflix features')\n+ return\nxbmc.sleep(500) # Wait for slower systems\nself.player_state = player_state\nif self.kodi_only_forced_subtitles and g.ADDON.getSettingBool('forced_subtitle_workaround')\\\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Avoid crash due to Kodi 19 JSON-RPC Player.GetProperties bug |
106,046 | 28.07.2020 20:29:07 | -7,200 | 315958b1a1843cf16f2cea5e4aaadbd29e63ec47 | Version bump (1.7.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.6.1\" provider-name=\"libdev + jojo + asciidisco + caphm + castagnait\">\n+<addon id=\"plugin.video.netflix\" name=\"Netflix\" version=\"1.7.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.6.1 (2020-07-08)\n--Fixed broken search menu on fresh installations\n--Updated el-gr translation\n+v1.7.0 (2020-07-28)\n+-Big improvement in loading lists when you have many titles to My list\n+-Refactor of nfsession\n+-Refactor/improved library code:\n+ -Improved speed and cpu use in autoupdate/sync in background\n+ -Suppressed continuous appearance of loading screen when autoupdate/sync in background\n+ -Widgets/Favourites managed without profile selection\n+ -New Import existing library feature\n+ -Play From Here context menu is fixed\n+ -Reintroduced UpNext fast video playback feature\n+ -Very long list of improvements/fixes full list on GitHub PR-756, PR-761\n+-Managed error to account not reactivacted\n+-New Chinese (simple) language translation\n+-Updated translations it, sv-se, fr, de, jp, kr, hu, pl, es, pt-br, ru\n+-Many other changes\n</news>\n</extension>\n</addon>\n"
},
{
"change_type": "MODIFY",
"old_path": "changelog.txt",
"new_path": "changelog.txt",
"diff": "+v1.7.0 (2020-07-28)\n+-Big improvement in loading lists when you have many titles to My list\n+-Refactor of nfsession\n+-Refactor/improved library code:\n+ -Improved speed and cpu use in autoupdate/sync in background\n+ -Suppressed continuous appearance of loading screen when autoupdate/sync in background\n+ -Widgets/Favourites managed without profile selection\n+ -New Import existing library feature\n+ -Play From Here context menu is fixed\n+ -Reintroduced UpNext fast video playback feature\n+ -Very long list of improvements/fixes full list on GitHub PR-756, PR-761\n+-Managed error to account not reactivacted\n+-New Chinese (simple) language translation\n+-Updated translations it, sv-se, fr, de, jp, kr, hu, pl, es, pt-br, ru\n+-Many other changes\n+\nv1.6.1 (2020-07-08)\n-Fixed broken search menu on fresh installations\n-Updated el-gr translation\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Version bump (1.7.0) (#769) |
106,046 | 30.07.2020 15:30:51 | -7,200 | c4615efd8fe5bafae291a6ef4943d3fa5e84d6dc | Deleted unused global COOKIES | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/common/cookies.py",
"new_path": "resources/lib/common/cookies.py",
"diff": "@@ -34,7 +34,6 @@ def save(account_hash, cookie_jar, log_output=True):\n\"\"\"Save a cookie jar to file and in-memory storage\"\"\"\nif log_output:\nlog_cookie(cookie_jar)\n- g.COOKIES[account_hash] = cookie_jar\ncookie_file = xbmcvfs.File(cookie_filename(account_hash), 'wb')\ntry:\n# pickle.dump(cookie_jar, cookie_file)\n@@ -46,9 +45,7 @@ def save(account_hash, cookie_jar, log_output=True):\ndef delete(account_hash):\n- \"\"\"Delete cookies for an account from in-memory storage and the disk\"\"\"\n- if g.COOKIES.get(account_hash):\n- del g.COOKIES[account_hash]\n+ \"\"\"Delete cookies for an account from the disk\"\"\"\ntry:\nxbmcvfs.delete(cookie_filename(account_hash))\nexcept Exception as exc: # pylint: disable=broad-except\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/globals.py",
"new_path": "resources/lib/globals.py",
"diff": "@@ -226,7 +226,6 @@ class GlobalVariables(object):\nself.IS_ADDON_FIRSTRUN = self.IS_ADDON_FIRSTRUN is None\nself.IS_ADDON_EXTERNAL_CALL = False\nself.PY_IS_VER2 = sys.version_info.major == 2\n- self.COOKIES = {}\nself.ADDON = xbmcaddon.Addon()\nself.ADDON_ID = self.py2_decode(self.ADDON.getAddonInfo('id'))\nself.PLUGIN = self.py2_decode(self.ADDON.getAddonInfo('name'))\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Deleted unused global COOKIES |
106,046 | 30.07.2020 16:11:09 | -7,200 | 36bf31657b67e6c1b26d8c082b0f6f4ecc902c0f | Improved speed of add-on sequential executions
Saved about 250ms in add-on sequential executions
(e.g. when browsing lists) | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/globals.py",
"new_path": "resources/lib/globals.py",
"diff": "@@ -217,30 +217,49 @@ class GlobalVariables(object):\nself.CACHE_MYLIST_TTL = None\nself.CACHE_METADATA_TTL = None\n- def init_globals(self, argv, reinitialize_database=False):\n- \"\"\"Initialized globally used module variables.\n- Needs to be called at start of each plugin instance!\n- This is an ugly hack because Kodi doesn't execute statements defined on\n- module level if reusing a language invoker.\"\"\"\n+ def init_globals(self, argv, reinitialize_database=False, reload_settings=False):\n+ \"\"\"\n+ Initialized globally used module variables. Needs to be called at start of each plugin instance!\n+ This is an ugly hack because Kodi does not execute statements\n+ defined on module level if reusing a language invoker.\n+ \"\"\"\n# IS_ADDON_FIRSTRUN specifies when the addon is at its first run (reuse language invoker is not yet used)\nself.IS_ADDON_FIRSTRUN = self.IS_ADDON_FIRSTRUN is None\nself.IS_ADDON_EXTERNAL_CALL = False\nself.PY_IS_VER2 = sys.version_info.major == 2\nself.ADDON = xbmcaddon.Addon()\n+ self.URL = urlparse(argv[0])\n+ self.REQUEST_PATH = g.py2_decode(unquote(self.URL[2][1:]))\n+ try:\n+ self.PARAM_STRING = argv[2][1:]\n+ except IndexError:\n+ self.PARAM_STRING = ''\n+ self.REQUEST_PARAMS = dict(parse_qsl(self.PARAM_STRING))\n+ if self.IS_ADDON_FIRSTRUN:\nself.ADDON_ID = self.py2_decode(self.ADDON.getAddonInfo('id'))\nself.PLUGIN = self.py2_decode(self.ADDON.getAddonInfo('name'))\nself.VERSION_RAW = self.py2_decode(self.ADDON.getAddonInfo('version'))\nself.VERSION = self.remove_ver_suffix(self.VERSION_RAW)\n- self.DEFAULT_FANART = self.py2_decode(self.ADDON.getAddonInfo('fanart'))\nself.ICON = self.py2_decode(self.ADDON.getAddonInfo('icon'))\n- self.ADDON_DATA_PATH = self.py2_decode(self.ADDON.getAddonInfo('path')) # Addon folder\n- self.DATA_PATH = self.py2_decode(self.ADDON.getAddonInfo('profile')) # Addon user data folder\n-\n+ self.DEFAULT_FANART = self.py2_decode(self.ADDON.getAddonInfo('fanart'))\n+ self.ADDON_DATA_PATH = self.py2_decode(self.ADDON.getAddonInfo('path')) # Add-on folder\n+ self.DATA_PATH = self.py2_decode(self.ADDON.getAddonInfo('profile')) # Add-on user data folder\n+ self.CACHE_PATH = os.path.join(self.DATA_PATH, 'cache')\n+ self.COOKIE_PATH = os.path.join(self.DATA_PATH, 'COOKIE')\n+ try:\n+ self.PLUGIN_HANDLE = int(argv[1])\n+ self.IS_SERVICE = False\n+ self.BASE_URL = '{scheme}://{netloc}'.format(scheme=self.URL[0],\n+ netloc=self.URL[1])\n+ except IndexError:\n+ self.PLUGIN_HANDLE = 0\n+ self.IS_SERVICE = True\n+ self.BASE_URL = '{scheme}://{netloc}'.format(scheme='plugin',\n+ netloc=self.ADDON_ID)\n# Add absolute paths of embedded py modules to python system directory\nmodule_paths = [\nos.path.join(self.ADDON_DATA_PATH, 'modules', 'mysql-connector-python')\n]\n-\n# On PY2 sys.path list can contains values as unicode type and string type at same time,\n# here we will add only unicode type so filter values by unicode.\n# This fix comparing issues with use of \"if path not in sys.path:\"\n@@ -249,40 +268,18 @@ class GlobalVariables(object):\nfor path in module_paths: # module_paths has unicode type values\npath = g.py2_decode(xbmc.translatePath(path))\nif path not in sys_path_filtered:\n- sys.path.insert(0, path) # This add an unicode string type\n+ sys.path.insert(0, path) # This add an unicode type\n- self.CACHE_PATH = os.path.join(self.DATA_PATH, 'cache')\n- self.COOKIE_PATH = os.path.join(self.DATA_PATH, 'COOKIE')\n- self.URL = urlparse(argv[0])\n- try:\n- self.PLUGIN_HANDLE = int(argv[1])\n- self.IS_SERVICE = False\n- self.BASE_URL = '{scheme}://{netloc}'.format(scheme=self.URL[0],\n- netloc=self.URL[1])\n- except IndexError:\n- self.PLUGIN_HANDLE = 0\n- self.IS_SERVICE = True\n- self.BASE_URL = '{scheme}://{netloc}'.format(scheme='plugin',\n- netloc=self.ADDON_ID)\n- self.PATH = g.py2_decode(unquote(self.URL[2][1:]))\n- try:\n- self.PARAM_STRING = argv[2][1:]\n- except IndexError:\n- self.PARAM_STRING = ''\n- self.REQUEST_PARAMS = dict(parse_qsl(self.PARAM_STRING))\nself.reset_time_trace()\n- self.TIME_TRACE_ENABLED = self.ADDON.getSettingBool('enable_timing')\n- self.IPC_OVER_HTTP = self.ADDON.getSettingBool('enable_ipc_over_http')\n-\nself._init_database(self.IS_ADDON_FIRSTRUN or reinitialize_database)\n- self.settings_monitor_suspend(False) # Reset the value in case of addon crash\n-\n+ if self.IS_ADDON_FIRSTRUN or reload_settings:\n+ self.TIME_TRACE_ENABLED = self.ADDON.getSettingBool('enable_timing')\n+ self.IPC_OVER_HTTP = self.ADDON.getSettingBool('enable_ipc_over_http')\n# Initialize the cache\nself.CACHE_TTL = self.ADDON.getSettingInt('cache_ttl') * 60\nself.CACHE_MYLIST_TTL = self.ADDON.getSettingInt('cache_mylist_ttl') * 60\nself.CACHE_METADATA_TTL = self.ADDON.getSettingInt('cache_metadata_ttl') * 24 * 60 * 60\n- if self.IS_ADDON_FIRSTRUN:\nif self.IS_SERVICE:\nfrom resources.lib.services.cache.cache_management import CacheManagement\nself.CACHE_MANAGEMENT = CacheManagement()\n@@ -290,6 +287,7 @@ class GlobalVariables(object):\nself.CACHE = Cache()\nfrom resources.lib.common.kodi_ops import GetKodiVersion\nself.KODI_VERSION = GetKodiVersion()\n+ self.settings_monitor_suspend(False) # Reset the value in case of addon crash\ndef _init_database(self, initialize):\n# Initialize local database\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/run_addon.py",
"new_path": "resources/lib/run_addon.py",
"diff": "@@ -194,7 +194,7 @@ def run(argv):\nif success:\ntry:\ncancel_playback = False\n- pathitems = [part for part in g.PATH.split('/') if part]\n+ pathitems = [part for part in g.REQUEST_PATH.split('/') if part]\nif g.IS_ADDON_FIRSTRUN:\nis_first_run_install, cancel_playback = check_addon_upgrade()\nif is_first_run_install:\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/settings_monitor.py",
"new_path": "resources/lib/services/settings_monitor.py",
"diff": "@@ -50,8 +50,8 @@ class SettingsMonitor(xbmc.Monitor):\nuse_mysql_old = g.LOCAL_DB.get_value('use_mysql', False, TABLE_SETTINGS_MONITOR)\nuse_mysql_turned_on = use_mysql and not use_mysql_old\n- common.debug('SettingsMonitor: Reinitialization of service global settings')\n- g.init_globals(sys.argv, use_mysql != use_mysql_old)\n+ common.debug('SettingsMonitor: Reloading global settings')\n+ g.init_globals(sys.argv, reinitialize_database=use_mysql != use_mysql_old, reload_settings=True)\n# Check the MySQL connection status after reinitialization of service global settings\nuse_mysql_after = g.ADDON.getSettingBool('use_mysql')\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Improved speed of add-on sequential executions
Saved about 250ms in add-on sequential executions
(e.g. when browsing lists) |
106,046 | 31.07.2020 09:31:45 | -7,200 | 48e9b927398c9c44e6c0343f4655de7a0e8382ec | Removed is_profile_session_active not working anymore | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/api/website.py",
"new_path": "resources/lib/api/website.py",
"diff": "@@ -94,43 +94,6 @@ def extract_session_data(content, validate=False, update_profiles=False):\nloco_root = falcor_cache['loco']['value'][1]\ng.LOCAL_DB.set_value('loco_root_id', loco_root, TABLE_SESSION)\n- # Check if the profile session is still active\n- # (when a session expire in the website, the screen return automatically to the profiles page)\n- is_profile_session_active = 'componentSummary' in falcor_cache['locos'][loco_root]\n-\n- # Extract loco root request id\n- if is_profile_session_active:\n- component_summary = falcor_cache['locos'][loco_root]['componentSummary']['value']\n- # Note: 18/06/2020 now the request id is the equal to reactContext models/serverDefs/data/requestId\n- g.LOCAL_DB.set_value('loco_root_requestid', component_summary['requestId'], TABLE_SESSION)\n- else:\n- g.LOCAL_DB.set_value('loco_root_requestid', '', TABLE_SESSION)\n-\n- # Extract loco continueWatching id and index\n- # The following commented code was needed for update_loco_context in api_requests.py, but currently\n- # seem not more required to update the continueWatching list then we keep this in case of future nf changes\n- # -- INIT --\n- # cw_list_data = jgraph_get('continueWatching', falcor_cache['locos'][loco_root], falcor_cache)\n- # if cw_list_data:\n- # context_index = falcor_cache['locos'][loco_root]['continueWatching']['value'][2]\n- # g.LOCAL_DB.set_value('loco_continuewatching_index', context_index, TABLE_SESSION)\n- # g.LOCAL_DB.set_value('loco_continuewatching_id',\n- # jgraph_get('componentSummary', cw_list_data)['id'], TABLE_SESSION)\n- # elif is_profile_session_active:\n- # # Todo: In the new profiles, there is no 'continueWatching' context\n- # # How get or generate the continueWatching context?\n- # # NOTE: it was needed for update_loco_context in api_requests.py\n- # cur_profile = jgraph_get_path(['profilesList', 'current'], falcor_cache)\n- # common.warn('Context continueWatching not found in locos for profile guid {}.',\n- # jgraph_get('summary', cur_profile)['guid'])\n- # g.LOCAL_DB.set_value('loco_continuewatching_index', '', TABLE_SESSION)\n- # g.LOCAL_DB.set_value('loco_continuewatching_id', '', TABLE_SESSION)\n- # else:\n- # common.warn('Is not possible to find the context continueWatching, the profile session is no more active')\n- # g.LOCAL_DB.set_value('loco_continuewatching_index', '', TABLE_SESSION)\n- # g.LOCAL_DB.set_value('loco_continuewatching_id', '', TABLE_SESSION)\n- # -- END --\n-\n# Save only some info of the current profile from user data\ng.LOCAL_DB.set_value('build_identifier', user_data.get('BUILD_IDENTIFIER'), TABLE_SESSION)\nif not g.LOCAL_DB.get_value('esn', table=TABLE_SESSION):\n@@ -146,8 +109,6 @@ def extract_session_data(content, validate=False, update_profiles=False):\n# Save api urls\nfor key, path in list(api_data.items()):\ng.LOCAL_DB.set_value(key, path, TABLE_SESSION)\n-\n- api_data['is_profile_session_active'] = is_profile_session_active\nreturn api_data\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/msl/events_handler.py",
"new_path": "resources/lib/services/msl/events_handler.py",
"diff": "@@ -237,8 +237,7 @@ class EventsHandler(threading.Thread):\n'lolomo_id': g.LOCAL_DB.get_value('loco_root_id', '', TABLE_SESSION),\n'location': play_ctx_location,\n'rank': 0, # Perhaps this is a reference of cdn rank used in the manifest? (we use always 0)\n- # request_id: use requestId of loco root\n- 'request_id': g.LOCAL_DB.get_value('loco_root_requestid', '', TABLE_SESSION),\n+ 'request_id': event_data['request_id'],\n'row': 0, # Purpose not known\n'track_id': event_data['track_id'],\n'video_id': videoid.value\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/nfsession/nfsession_ops.py",
"new_path": "resources/lib/services/nfsession/nfsession_ops.py",
"diff": "@@ -39,7 +39,6 @@ class NFSessionOperations(SessionPathRequests):\nself.parental_control_data,\nself.get_metadata\n]\n- self.is_profile_session_active = False\n# Share the activate profile function to SessionBase class\nself.external_func_activate_profile = self.activate_profile\n@@ -51,16 +50,14 @@ class NFSessionOperations(SessionPathRequests):\n# Update the session data, the profiles data to the database, and update the authURL\napi_data = self.website_extract_session_data(response, update_profiles=True)\nself.auth_url = api_data['auth_url']\n- # Check if the profile session is still active, used only to activate_profile\n- self.is_profile_session_active = api_data['is_profile_session_active']\[email protected]_execution(immediate=True)\ndef activate_profile(self, guid):\n\"\"\"Set the profile identified by guid as active\"\"\"\ncommon.debug('Switching to profile {}', guid)\ncurrent_active_guid = g.LOCAL_DB.get_active_profile_guid()\n- if self.is_profile_session_active and guid == current_active_guid:\n- common.info('The profile session of guid {} is still active, activation not needed.', guid)\n+ if guid == current_active_guid:\n+ common.info('The profile guid {} is already set, activation not needed.', guid)\nreturn\ntimestamp = time.time()\ncommon.info('Activating profile {}', guid)\n@@ -79,7 +76,6 @@ class NFSessionOperations(SessionPathRequests):\nself.auth_url = website.extract_session_data(response)['auth_url']\n# END Method 2\n- self.is_profile_session_active = True\ng.LOCAL_DB.switch_active_profile(guid)\ng.CACHE_MANAGEMENT.identifier_prefix = guid\ncookies.save(self.account_hash, self.session.cookies)\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Removed is_profile_session_active not working anymore |
106,046 | 31.07.2020 17:11:26 | -7,200 | 5bb06b11c2fd018ce9e5eaf759d9b6c8455a8bf1 | Improved initial fetch data and better managed profile issues | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/run_addon.py",
"new_path": "resources/lib/run_addon.py",
"diff": "@@ -219,10 +219,11 @@ def run(argv):\n'InputStream Helper has generated an internal error:\\r\\n{}\\r\\n\\r\\n'\n'Please report it to InputStream Helper github.'.format(exc)))\nsuccess = False\n- except HttpError401:\n- # The service has raised http error 401 Client Error: Unauthorized for url ...\n- # Can happen when the http request for some reason has failed\n- # for example for possible change of data format or malformed data in the http request\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+ # 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/...)\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"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/nfsession/nfsession.py",
"new_path": "resources/lib/services/nfsession/nfsession.py",
"diff": "@@ -34,8 +34,6 @@ class NetflixSession(object):\nself.http_ipc_slots[func_name] = enveloped_func\n# For AddonSignals IPC\ncommon.register_slot(enveloped_func, func_name)\n- # Silent login\n- self.nfsession.prefetch_login()\ndef library_auto_update(self):\n\"\"\"Run the library auto update\"\"\"\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/nfsession/nfsession_ops.py",
"new_path": "resources/lib/services/nfsession/nfsession_ops.py",
"diff": "from __future__ import absolute_import, division, unicode_literals\nimport time\n+from datetime import datetime, timedelta\nimport resources.lib.api.website as website\nimport resources.lib.common as common\nfrom resources.lib.api.exceptions import (NotLoggedInError, MissingCredentialsError, WebsiteParsingError,\n- MbrStatusAnonymousError, MetadataNotAvailable, LoginValidateError)\n+ MbrStatusAnonymousError, MetadataNotAvailable, LoginValidateError,\n+ HttpError401, InvalidProfilesError)\nfrom resources.lib.common import cookies, cache_utils\nfrom resources.lib.globals import g\nfrom resources.lib.services.nfsession.session.path_requests import SessionPathRequests\n@@ -41,15 +43,43 @@ class NFSessionOperations(SessionPathRequests):\n]\n# Share the activate profile function to SessionBase class\nself.external_func_activate_profile = self.activate_profile\n+ self.dt_initial_page_prefetch = None\n+ # Try prefetch login\n+ if self.prefetch_login():\n+ try:\n+ # Try prefetch initial page\n+ response = self.get_safe('browse')\n+ api_data = website.extract_session_data(response, update_profiles=True)\n+ self.auth_url = api_data['auth_url']\n+ self.dt_initial_page_prefetch = datetime.now()\n+ except Exception as exc: # pylint: disable=broad-except\n+ common.warn('Prefetch initial page failed: {}', exc)\[email protected]_execution(immediate=True)\ndef fetch_initial_page(self):\n\"\"\"Fetch initial page\"\"\"\n+ # It is mandatory fetch initial page data at every add-on startup to prevent/check possible side effects:\n+ # - Check if the account subscription is regular\n+ # - Avoid TooManyRedirects error, can happen when the profile used in nf session actually no longer exists\n+ # - Refresh the session data\n+ # - Update the profiles (and sanitize related features) without submitting another request\n+ if self.dt_initial_page_prefetch and datetime.now() <= self.dt_initial_page_prefetch + timedelta(minutes=30):\n+ # We do not know if/when the user will open the add-on, some users leave the device turned on more than 24h\n+ # then we limit the prefetch validity to 30 minutes\n+ self.dt_initial_page_prefetch = None\n+ return\ncommon.debug('Fetch initial page')\n+ from requests import exceptions\n+ try:\nresponse = self.get_safe('browse')\n- # Update the session data, the profiles data to the database, and update the authURL\napi_data = self.website_extract_session_data(response, update_profiles=True)\nself.auth_url = api_data['auth_url']\n+ except 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+ # (CastagnaIT: i don't know the best way to handle this borderline case, but login again works)\n+ self.session.cookies.clear()\n+ self.login()\[email protected]_execution(immediate=True)\ndef activate_profile(self, guid):\n@@ -67,10 +97,14 @@ class NFSessionOperations(SessionPathRequests):\n# self.nfsession.auth_url = self.website_extract_session_data(response)['auth_url']\n# END Method 1\n# INIT Method 2 - API mode\n+ try:\nself.get_safe(endpoint='activate_profile',\nparams={'switchProfileGuid': guid,\n'_': int(timestamp * 1000),\n'authURL': self.auth_url})\n+ except HttpError401:\n+ # Profile guid not more valid\n+ raise InvalidProfilesError('Unable to access to the selected profile.')\n# Retrieve browse page to update authURL\nresponse = self.get_safe('browse')\nself.auth_url = website.extract_session_data(response)['auth_url']\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/nfsession/session/access.py",
"new_path": "resources/lib/services/nfsession/session/access.py",
"diff": "@@ -44,6 +44,7 @@ class SessionAccess(SessionCookie, SessionHTTPRequests):\ncommon.get_credentials()\nif not self.is_logged_in():\nself.login(modal_error_message=False)\n+ return True\nexcept exceptions.RequestException as exc:\n# It was not possible to connect to the web service, no connection, network problem, etc\nimport traceback\n@@ -51,6 +52,7 @@ class SessionAccess(SessionCookie, SessionHTTPRequests):\ncommon.debug(g.py2_decode(traceback.format_exc(), 'latin-1'))\nexcept Exception as exc: # pylint: disable=broad-except\ncommon.warn('Login prefetch: failed {}', exc)\n+ return False\ndef assert_logged_in(self):\n\"\"\"Raise an exception when login cannot be established or maintained\"\"\"\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/nfsession/session/base.py",
"new_path": "resources/lib/services/nfsession/session/base.py",
"diff": "@@ -41,6 +41,7 @@ class SessionBase(object):\npass\nfrom requests import session\nself.session = session()\n+ self.session.max_redirects = 10 # Too much redirects should means some problem\nself.session.headers.update({\n'User-Agent': common.get_user_agent(enable_android_mediaflag_fix=True),\n'Accept-Encoding': 'gzip, deflate, br'\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Improved initial fetch data and better managed profile issues |
106,046 | 01.08.2020 10:50:46 | -7,200 | e85258d634f105a55088c878a2d1a05631d2b0da | Removed cookie check fallback
Long forgotten, the old system used on v0.14
referred to this: | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/nfsession/session/cookie.py",
"new_path": "resources/lib/services/nfsession/session/cookie.py",
"diff": "@@ -47,11 +47,9 @@ class SessionCookie(SessionBase):\nreturn False\nfor cookie_name in LOGIN_COOKIES:\nif cookie_name not in list(self.session.cookies.keys()):\n- common.error(\n- 'The cookie \"{}\" do not exist. It is not possible to check expiration. '\n- 'Fallback to old validate method.',\n+ common.error('The cookie \"{}\" do not exist, it is not possible to check the expiration',\ncookie_name)\n- break\n+ return False\nfor cookie in list(self.session.cookies):\nif cookie.name != cookie_name:\ncontinue\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Removed cookie check fallback
Long forgotten, the old system used on v0.14
referred to this: https://github.com/CastagnaIT/plugin.video.netflix/commit/ac939c83f94aacd9a0a44f61bf21234c10df341c#diff-d9b1c04f1ba34affea80b51845c48a27 |
106,046 | 02.08.2020 09:45:35 | -7,200 | 5eceefd25d955640fc97855d923c9ee6729bf03b | Fixed select first unwatched issue on Kodi 18.x | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/navigation/directory_utils.py",
"new_path": "resources/lib/navigation/directory_utils.py",
"diff": "@@ -169,7 +169,11 @@ def auto_scroll(list_data):\nif total_items:\n# Delay a bit to wait for the completion of the screen update\nxbmc.sleep(100)\n- if not g.KODI_VERSION.is_major_ver('18'): # These infoLabel not works on Kodi 18.x\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\n+ else: # These infoLabel not works on Kodi 18.x\n# Check if view sort method is \"Episode\" (ID 23 = SortByEpisodeNumber)\nis_sort_method_episode = xbmc.getCondVisibility('Container.SortMethod(23)')\nif not is_sort_method_episode:\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Fixed select first unwatched issue on Kodi 18.x |
106,046 | 02.08.2020 15:59:17 | -7,200 | d97f98c3a3b6417eeed155d336c8dead34ee568f | Removed double translatePath | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/common/cookies.py",
"new_path": "resources/lib/common/cookies.py",
"diff": "@@ -55,7 +55,7 @@ def delete(account_hash):\ndef load(account_hash):\n\"\"\"Load cookies for a given account and check them for validity\"\"\"\nfilename = cookie_filename(account_hash)\n- if not xbmcvfs.exists(xbmc.translatePath(filename)):\n+ if not xbmcvfs.exists(filename):\ncommon.debug('Cookies file does not exist')\nraise MissingCookiesError()\ncommon.debug('Loading cookies from {}', G.py2_decode(filename))\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Removed double translatePath |
106,046 | 02.08.2020 16:34:30 | -7,200 | a3063a5a91776990efe8264c67354671938f7580 | Avoid exception in cookie clear | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/common/cookies.py",
"new_path": "resources/lib/common/cookies.py",
"diff": "@@ -74,10 +74,8 @@ def load(account_hash):\nfinally:\ncookie_file.close()\n# Clear flwssn cookie if present, as it is trouble with early expiration\n- try:\n+ if 'flwssn' in cookie_jar:\ncookie_jar.clear(domain='.netflix.com', path='/', name='flwssn')\n- except KeyError:\n- pass\nlog_cookie(cookie_jar)\nreturn cookie_jar\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Avoid exception in cookie clear |
106,046 | 02.08.2020 16:50:45 | -7,200 | bc27b48e12f5b3ffd73f3cacc34cf2deec840258 | Set crypto handler in a better way | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/msl/msl_request_builder.py",
"new_path": "resources/lib/services/msl/msl_request_builder.py",
"diff": "@@ -12,26 +12,11 @@ from __future__ import absolute_import, division, unicode_literals\nimport json\nimport base64\nimport random\n-import subprocess\nimport time\nfrom resources.lib.globals import G\nimport resources.lib.common as common\n-# check if we are on Android\n-try:\n- SDKVERSION = int(subprocess.check_output(\n- ['/system/bin/getprop', 'ro.build.version.sdk']))\n-except (OSError, subprocess.CalledProcessError, AttributeError):\n- # Due to OS restrictions on 'ios' and 'tvos' this give AttributeError\n- # See python limits in the wiki development page\n- SDKVERSION = 0\n-\n-if SDKVERSION >= 18:\n- from .android_crypto import AndroidMSLCrypto as MSLCrypto\n-else:\n- from .default_crypto import DefaultMSLCrypto as MSLCrypto\n-\nclass MSLRequestBuilder(object):\n\"\"\"Provides mechanisms to create MSL requests\"\"\"\n@@ -39,6 +24,11 @@ class MSLRequestBuilder(object):\ndef __init__(self):\nself.current_message_id = None\nself.rndm = random.SystemRandom()\n+ # Set the Crypto handler\n+ if common.get_system_platform() == 'android':\n+ from .android_crypto import AndroidMSLCrypto as MSLCrypto\n+ else:\n+ from .default_crypto import DefaultMSLCrypto as MSLCrypto\nself.crypto = MSLCrypto()\n@staticmethod\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Set crypto handler in a better way |
106,046 | 02.08.2020 17:20:20 | -7,200 | 9e3859ad36e9d86d2f45589f386faaaf16170e68 | Moved imports out | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/common/credentials.py",
"new_path": "resources/lib/common/credentials.py",
"diff": "\"\"\"\nfrom __future__ import absolute_import, division, unicode_literals\n+import base64\n+\nfrom resources.lib.globals import G\nfrom resources.lib.api.exceptions import MissingCredentialsError\nfrom .logging import error\nfrom .uuid_device import get_crypt_key\n-__BLOCK_SIZE__ = 32\n-\n-\n-def encrypt_credential(raw):\n- \"\"\"\n- Encodes data\n-\n- :param data: Data to be encoded\n- :type data: str\n- :returns: string -- Encoded data\n- \"\"\"\n- # pylint: disable=invalid-name,import-error\n- import base64\ntry: # The crypto package depends on the library installed (see Wiki)\nfrom Crypto import Random\nfrom Crypto.Cipher import AES\n@@ -37,31 +26,33 @@ def encrypt_credential(raw):\nfrom Cryptodome import Random\nfrom Cryptodome.Cipher import AES\nfrom Cryptodome.Util import Padding\n+\n+__BLOCK_SIZE__ = 32\n+\n+\n+def encrypt_credential(raw):\n+ \"\"\"\n+ Encodes data\n+ :param raw: Data to be encoded\n+ :type raw: str\n+ :returns: string -- Encoded data\n+ \"\"\"\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)\nreturn base64.b64encode(iv + cipher.encrypt(raw)).decode('utf-8')\n-def decrypt_credential(enc, secret=None):\n+def decrypt_credential(enc):\n\"\"\"\nDecodes data\n-\n- :param data: Data to be decoded\n- :type data: str\n+ :param enc: Data to be decoded\n+ :type enc: str\n:returns: string -- Decoded data\n\"\"\"\n- # pylint: disable=invalid-name,import-error\n- import base64\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]\n- cipher = AES.new(secret or get_crypt_key(), AES.MODE_CBC, iv)\n+ cipher = AES.new(get_crypt_key(), AES.MODE_CBC, iv)\ndecoded = Padding.unpad(\npadded_data=cipher.decrypt(enc[AES.block_size:]),\nblock_size=__BLOCK_SIZE__)\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Moved imports out |
106,046 | 03.08.2020 10:28:42 | -7,200 | 07b9d58222ddcb6ff9d784a52782555fedba4c01 | Small fix and improved comments | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/msl/msl_requests.py",
"new_path": "resources/lib/services/msl/msl_requests.py",
"diff": "@@ -130,21 +130,23 @@ class MSLRequests(MSLRequestBuilder):\nif not force_auth_credential:\nif current_profile_guid == owner_profile_guid:\n- # It is not necessary to get a token id because by default MSL it is associated to the main profile\n- # So you do not even need to run the MSL profile switch\n+ # The request will be executed from the owner profile\n+ # By default MSL is associated to the owner profile, then is not necessary get the owner token id\n+ # and it is not necessary use the MSL profile switch\nuser_id_token = self.crypto.get_user_id_token(current_profile_guid)\n- # user_id_token can return None when the add-on is installed from scratch, in this case will be used\n- # the authentication with the user credentials\n+ # The user_id_token can return None when the add-on is installed from scratch,\n+ # in this case will be used the authentication with the user credentials\nelse:\n- # The request must be executed from a non-owner profile\n- # Check if the token for the profile exist and valid\n+ # The request will be executed from a non-owner profile\n+ # Get the non-owner profile token id, by checking that exists and it is valid\nuser_id_token = self.crypto.get_user_id_token(current_profile_guid)\nif not user_id_token and not disable_msl_switch:\n- # If it is not there, first check if the main profile token exist and valid\n+ # The token does not exist/valid, you must set the MSL profile switch\nuse_switch_profile = True\n+ # First check if the owner profile token exist and it is valid\nuser_id_token = self.crypto.get_user_id_token(owner_profile_guid)\n- # If it is not there, you must obtain it before making the MSL switch\nif not user_id_token:\n+ # The owner profile token id does not exist/valid, then get it\nself._get_owner_user_id_token()\nuser_id_token = self.crypto.get_user_id_token(owner_profile_guid)\n# Mark msl_switch_requested as True in order to make a bind event request\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Small fix and improved comments |
106,046 | 04.08.2020 14:00:40 | -7,200 | 8de0465baa07ff56c95065d799c360e520ee4927 | Moved update_loco_context and update_videoid_bookmark to nfsession | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/api/api_requests.py",
"new_path": "resources/lib/api/api_requests.py",
"diff": "@@ -16,7 +16,6 @@ from future.utils import itervalues\nimport resources.lib.common as common\nimport resources.lib.kodi.ui as ui\nfrom resources.lib.common import cache_utils\n-from resources.lib.database.db_utils import TABLE_SESSION\nfrom resources.lib.globals import G\nfrom .exceptions import APIError, MissingCredentialsError, CacheMiss\nfrom .paths import EPISODES_PARTIAL_PATHS, ART_PARTIAL_PATHS, build_paths\n@@ -55,69 +54,6 @@ def login(ask_credentials=True):\nraise\n-def update_loco_context(context_name):\n- \"\"\"Update a loco list by context\"\"\"\n- # This api seem no more needed to update the continueWatching loco list\n- loco_root = G.LOCAL_DB.get_value('loco_root_id', '', TABLE_SESSION)\n-\n- context_index = G.LOCAL_DB.get_value('loco_{}_index'.format(context_name.lower()), '', TABLE_SESSION)\n- context_id = G.LOCAL_DB.get_value('loco_{}_id'.format(context_name.lower()), '', TABLE_SESSION)\n-\n- if not context_index:\n- common.warn('Update loco context {} skipped due to missing loco index', context_name)\n- return\n- path = [['locos', loco_root, 'refreshListByContext']]\n- # After the introduction of LoCo, the following notes are to be reviewed (refers to old LoLoMo):\n- # The fourth parameter is like a request-id, but it doesn't seem to match to\n- # serverDefs/date/requestId of reactContext (G.LOCAL_DB.get_value('request_id', table=TABLE_SESSION))\n- # nor to request_id of the video event request,\n- # has a kind of relationship with renoMessageId suspect with the logblob but i'm not sure because my debug crashed\n- # and i am no longer able to trace the source.\n- # I noticed also that this request can also be made with the fourth parameter empty.\n- params = [common.enclose_quotes(context_id),\n- context_index,\n- common.enclose_quotes(context_name),\n- '']\n- # path_suffixs = [\n- # [{'from': 0, 'to': 100}, 'itemSummary'],\n- # [['componentSummary']]\n- # ]\n- callargs = {\n- 'callpaths': path,\n- 'params': params,\n- # 'path_suffixs': path_suffixs\n- }\n- try:\n- response = common.make_http_call('callpath_request', callargs)\n- common.debug('refreshListByContext response: {}', response)\n- # The call response return the new context id of the previous invalidated loco context_id\n- # and if path_suffixs is added return also the new video list data\n- except Exception: # pylint: disable=broad-except\n- if not common.is_debug_verbose():\n- return\n- ui.show_notification(title=common.get_local_string(30105),\n- msg='An error prevented the update the loco context on netflix',\n- time=10000)\n-\n-\n-def update_videoid_bookmark(video_id):\n- \"\"\"Update the videoid bookmark position\"\"\"\n- # You can check if this function works through the official android app\n- # by checking if the red status bar of watched time position appears and will be updated,\n- # or also if continueWatching list will be updated (e.g. try to play a new tvshow not contained in the \"my list\")\n- callargs = {\n- 'callpaths': [['refreshVideoCurrentPositions']],\n- 'params': ['[' + video_id + ']', '[]'],\n- }\n- try:\n- response = common.make_http_call('callpath_request', callargs)\n- common.debug('refreshVideoCurrentPositions response: {}', response)\n- except Exception: # pylint: disable=broad-except\n- ui.show_notification(title=common.get_local_string(30105),\n- msg='An error prevented the update the status watched on netflix',\n- time=10000)\n-\n-\[email protected]_execution(immediate=False)\ndef get_video_raw_data(videoids, custom_partial_path=None): # Do not apply cache to this method\n\"\"\"Retrieve raw data for specified video id's\"\"\"\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/msl/events_handler.py",
"new_path": "resources/lib/services/msl/events_handler.py",
"diff": "@@ -15,7 +15,6 @@ import time\nimport xbmc\n-import resources.lib.api.api_requests as api\nfrom resources.lib import common\nfrom resources.lib.common.cache_utils import CACHE_MANIFESTS\nfrom resources.lib.database.db_utils import TABLE_SESSION\n@@ -133,10 +132,9 @@ class EventsHandler(threading.Thread):\nif event.event_type == EVENT_STOP:\nself.clear_queue()\nif event.event_data['allow_request_update_loco']:\n- # if event.event_data['is_in_mylist']:\n- # # If video is in my list, invalidate the continueWatching list (update loco context data)\n- # api.update_loco_context('continueWatching')\n- api.update_videoid_bookmark(event.get_video_id())\n+ # Calls to nfsession\n+ common.make_http_call('update_loco_context', {'context_name': 'continueWatching'})\n+ common.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"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/nfsession/nfsession_ops.py",
"new_path": "resources/lib/services/nfsession/nfsession_ops.py",
"diff": "@@ -19,6 +19,7 @@ from resources.lib.api.exceptions import (NotLoggedInError, MissingCredentialsEr\nHttpError401, InvalidProfilesError)\nfrom resources.lib.common import cookies, cache_utils\nfrom resources.lib.globals import G\n+from resources.lib.kodi import ui\nfrom resources.lib.services.nfsession.session.path_requests import SessionPathRequests\n@@ -39,7 +40,9 @@ class NFSessionOperations(SessionPathRequests):\nself.fetch_initial_page,\nself.activate_profile,\nself.parental_control_data,\n- self.get_metadata\n+ self.get_metadata,\n+ self.update_loco_context,\n+ self.update_videoid_bookmark\n]\n# Share the activate profile function to SessionBase class\nself.external_func_activate_profile = self.activate_profile\n@@ -206,3 +209,60 @@ class NFSessionOperations(SessionPathRequests):\n# available using profiles with other languages\nraise MetadataNotAvailable\nreturn metadata_data['video']\n+\n+ def update_loco_context(self, context_name):\n+ \"\"\"Update a loco list by context\"\"\"\n+ # Call this api seem no more needed to update the continueWatching loco list\n+ # Get current loco root data\n+ loco_data = self.path_request([['loco', [context_name], ['context', 'id', 'index']]])\n+ loco_root = loco_data['loco'][1]\n+ if 'continueWatching' in loco_data['locos'][loco_root]:\n+ context_index = loco_data['locos'][loco_root]['continueWatching'][2]\n+ context_id = loco_data['locos'][loco_root][context_index][1]\n+ else:\n+ # In the new profiles, there is no 'continueWatching' list and no list is returned\n+ common.warn('update_loco_context: Update skipped due to missing context {}', context_name)\n+ return\n+\n+ path = [['locos', loco_root, 'refreshListByContext']]\n+ # After the introduction of LoCo, the following notes are to be reviewed (refers to old LoLoMo):\n+ # The fourth parameter is like a request-id, but it does not seem to match to\n+ # serverDefs/date/requestId of reactContext nor to request_id of the video event request,\n+ # seem to have some kind of relationship with renoMessageId suspect with the logblob but i am not sure.\n+ # I noticed also that this request can also be made with the fourth parameter empty.\n+ params = [common.enclose_quotes(context_id),\n+ context_index,\n+ common.enclose_quotes(context_name),\n+ '']\n+ # path_suffixs = [\n+ # [{'from': 0, 'to': 100}, 'itemSummary'],\n+ # [['componentSummary']]\n+ # ]\n+ try:\n+ response = self.callpath_request(path, params)\n+ common.debug('refreshListByContext response: {}', response)\n+ # The call response return the new context id of the previous invalidated loco context_id\n+ # and if path_suffixs is added return also the new video list data\n+ except Exception as exc: # pylint: disable=broad-except\n+ common.warn('refreshListByContext failed: {}', exc)\n+ if not common.is_debug_verbose():\n+ return\n+ ui.show_notification(title=common.get_local_string(30105),\n+ msg='An error prevented the update the loco context on Netflix',\n+ time=10000)\n+\n+ def update_videoid_bookmark(self, video_id):\n+ \"\"\"Update the videoid bookmark position\"\"\"\n+ # You can check if this function works through the official android app\n+ # by checking if the red status bar of watched time position appears and will be updated, or also\n+ # if continueWatching list will be updated (e.g. try to play a new tvshow not contained in the \"my list\")\n+ call_paths = [['refreshVideoCurrentPositions']]\n+ params = ['[' + video_id + ']', '[]']\n+ try:\n+ response = self.callpath_request(call_paths, params)\n+ common.debug('refreshVideoCurrentPositions response: {}', response)\n+ except Exception as exc: # pylint: disable=broad-except\n+ common.warn('refreshVideoCurrentPositions failed: {}', exc)\n+ ui.show_notification(title=common.get_local_string(30105),\n+ msg='An error prevented the update the status watched on Netflix',\n+ time=10000)\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Moved update_loco_context and update_videoid_bookmark to nfsession |
106,046 | 04.08.2020 14:31:57 | -7,200 | 953864c5d1ff8a285ec9b50fd59fb73c3c0f862e | Moved esn.py to utils | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/common/__init__.py",
"new_path": "resources/lib/common/__init__.py",
"diff": "@@ -22,4 +22,3 @@ from .device_utils import * # pylint: disable=redefined-builtin\nfrom .misc_utils import * # pylint: disable=redefined-builtin\nfrom .data_conversion import * # pylint: disable=redefined-builtin\nfrom .uuid_device import * # pylint: disable=redefined-builtin\n-from .esn import *\n"
},
{
"change_type": "RENAME",
"old_path": "resources/lib/common/esn.py",
"new_path": "resources/lib/utils/esn.py",
"diff": "@@ -13,8 +13,8 @@ from re import sub\nfrom resources.lib.database.db_utils import TABLE_SESSION\nfrom resources.lib.globals import G\n-from .device_utils import get_system_platform\n-from .logging import debug\n+from resources.lib.common.device_utils import get_system_platform\n+from resources.lib.common.logging import debug\ndef generate_android_esn():\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/utils/website.py",
"new_path": "resources/lib/utils/website.py",
"diff": "@@ -20,6 +20,7 @@ import resources.lib.common as common\nfrom resources.lib.database.db_exceptions import ProfilesMissing\nfrom resources.lib.database.db_utils import TABLE_SESSION\nfrom resources.lib.globals import G\n+from .esn import generate_android_esn\nfrom .exceptions import (InvalidProfilesError, InvalidAuthURLError, MbrStatusError,\nWebsiteParsingError, LoginValidateError, MbrStatusAnonymousError,\nMbrStatusNeverMemberError, MbrStatusFormerMemberError)\n@@ -97,7 +98,7 @@ def extract_session_data(content, validate=False, update_profiles=False):\n# Save only some info of the current profile from user data\nG.LOCAL_DB.set_value('build_identifier', user_data.get('BUILD_IDENTIFIER'), TABLE_SESSION)\nif not G.LOCAL_DB.get_value('esn', table=TABLE_SESSION):\n- G.LOCAL_DB.set_value('esn', common.generate_android_esn() or user_data['esn'], TABLE_SESSION)\n+ G.LOCAL_DB.set_value('esn', generate_android_esn() or user_data['esn'], TABLE_SESSION)\nG.LOCAL_DB.set_value('locale_id', user_data.get('preferredLocale').get('id', 'en-US'))\n# Extract the client version from assets core\nresult = search(r'-([0-9\\.]+)\\.js$', api_data.pop('asset_core'))\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Moved esn.py to utils |
106,046 | 04.08.2020 16:06:12 | -7,200 | bb97ded4214c0b10e9d962be38b585cb6abc0476 | Moved get_esn to esn.py | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/globals.py",
"new_path": "resources/lib/globals.py",
"diff": "@@ -343,12 +343,6 @@ class GlobalVariables(object):\n\"\"\"\nreturn G.LOCAL_DB.get_value('suspend_settings_monitor', 'False')\n- def get_esn(self):\n- \"\"\"Get the generated esn or if set get the custom esn\"\"\"\n- from resources.lib.database.db_utils import TABLE_SESSION\n- custom_esn = G.ADDON.getSetting('esn')\n- return custom_esn if custom_esn else G.LOCAL_DB.get_value('esn', '', table=TABLE_SESSION)\n-\ndef is_known_menu_context(self, context):\n\"\"\"Return true if context are one of the menu with loco_known=True\"\"\"\nfor _, data in iteritems(self.MAIN_MENU_ITEMS):\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/navigation/actions.py",
"new_path": "resources/lib/navigation/actions.py",
"diff": "@@ -14,6 +14,7 @@ import xbmc\nimport 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\nfrom resources.lib.utils.exceptions import MissingCredentialsError, CacheMiss\nfrom resources.lib.utils.api_paths import VIDEO_LIST_RATING_THUMB_PATHS, SUPPLEMENTAL_TYPE_TRAILERS\nfrom resources.lib.common import cache_utils\n@@ -163,7 +164,7 @@ class AddonActionExecutor(object):\ndef view_esn(self, pathitems=None): # pylint: disable=unused-argument\n\"\"\"Show the ESN in use\"\"\"\n- ui.show_ok_dialog(common.get_local_string(30016), G.get_esn())\n+ ui.show_ok_dialog(common.get_local_string(30016), get_esn())\ndef reset_esn(self, pathitems=None): # pylint: disable=unused-argument\n\"\"\"Reset the ESN stored (retrieved from website and manual)\"\"\"\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/msl/base_crypto.py",
"new_path": "resources/lib/services/msl/base_crypto.py",
"diff": "@@ -14,8 +14,8 @@ import base64\nimport time\nimport resources.lib.common as common\n-from resources.lib.globals import G\nfrom resources.lib.services.msl.msl_utils import MSL_DATA_FILENAME\n+from resources.lib.utils.esn import get_esn\nclass MSLBaseCrypto(object):\n@@ -37,7 +37,7 @@ class MSLBaseCrypto(object):\nself._msl_data = msl_data if msl_data else {}\nif msl_data:\nself.set_mastertoken(msl_data['tokens']['mastertoken'])\n- self.bound_esn = msl_data.get('bound_esn', G.get_esn())\n+ self.bound_esn = msl_data.get('bound_esn', get_esn())\ndef compare_mastertoken(self, mastertoken):\n\"\"\"Check if the new MasterToken is different from current due to renew\"\"\"\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/msl/events_handler.py",
"new_path": "resources/lib/services/msl/events_handler.py",
"diff": "@@ -21,6 +21,7 @@ from resources.lib.database.db_utils import TABLE_SESSION\nfrom resources.lib.globals import G\nfrom resources.lib.services.msl import msl_utils\nfrom resources.lib.services.msl.msl_utils import EVENT_START, EVENT_STOP, EVENT_ENGAGE, ENDPOINTS\n+from resources.lib.utils.esn import get_esn\ntry: # Python 2\nfrom urllib import urlencode\n@@ -124,7 +125,7 @@ class EventsHandler(threading.Thread):\n'reqName': 'events/{}'.format(event)}\nurl = ENDPOINTS['events'] + '?' + urlencode(params).replace('%2F', '/')\ntry:\n- response = self.chunked_request(url, event.request_data, G.get_esn(), disable_msl_switch=False)\n+ response = self.chunked_request(url, event.request_data, get_esn(), disable_msl_switch=False)\nevent.set_response(response)\nbreak\nexcept Exception as exc: # pylint: disable=broad-except\n@@ -252,5 +253,5 @@ class EventsHandler(threading.Thread):\ndef get_manifest(videoid):\n\"\"\"Get the manifest from cache\"\"\"\n- cache_identifier = G.get_esn() + '_' + videoid.value\n+ cache_identifier = get_esn() + '_' + videoid.value\nreturn G.CACHE.get(CACHE_MANIFESTS, cache_identifier)\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/msl/msl_handler.py",
"new_path": "resources/lib/services/msl/msl_handler.py",
"diff": "@@ -15,10 +15,11 @@ import time\nimport xbmcaddon\nimport resources.lib.common as common\n-from resources.lib.utils.exceptions import CacheMiss\nfrom resources.lib.common.cache_utils import CACHE_MANIFESTS\nfrom resources.lib.database.db_utils import TABLE_SESSION\nfrom resources.lib.globals import G\n+from resources.lib.utils.esn import get_esn\n+from resources.lib.utils.exceptions import CacheMiss\nfrom .converter import convert_to_dash\nfrom .events_handler import EventsHandler\nfrom .exceptions import MSLError\n@@ -126,7 +127,7 @@ class MSLHandler(object):\n:return: MPD XML Manifest or False if no success\n\"\"\"\ntry:\n- manifest = self._load_manifest(viewable_id, G.get_esn())\n+ manifest = self._load_manifest(viewable_id, get_esn())\nexcept MSLError as exc:\nif 'Email or password is incorrect' in G.py2_decode(str(exc)):\n# Known cases when MSL error \"Email or password is incorrect.\" can happen:\n@@ -261,7 +262,7 @@ class MSLHandler(object):\nself.msl_requests.build_request_data(self.last_license_url,\nparams,\n'drmSessionId'),\n- G.get_esn())\n+ get_esn())\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@@ -282,7 +283,7 @@ class MSLHandler(object):\ncommon.debug('Requesting bind events')\nresponse = self.msl_requests.chunked_request(ENDPOINTS['events'],\nself.msl_requests.build_request_data('/bind', {}),\n- G.get_esn(),\n+ get_esn(),\ndisable_msl_switch=False)\ncommon.debug('Bind events response: {}', response)\n@@ -309,7 +310,7 @@ class MSLHandler(object):\nresponse = self.msl_requests.chunked_request(ENDPOINTS['license'],\nself.msl_requests.build_request_data('/bundle', params),\n- G.get_esn())\n+ get_esn())\ncommon.debug('License release response: {}', response)\nexcept IndexError:\n# Example the supplemental media type have no license\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/msl/msl_requests.py",
"new_path": "resources/lib/services/msl/msl_requests.py",
"diff": "@@ -21,6 +21,7 @@ from resources.lib.services.msl.exceptions import MSLError\nfrom resources.lib.services.msl.msl_request_builder import MSLRequestBuilder\nfrom resources.lib.services.msl.msl_utils import (display_error_info, generate_logblobs_params, EVENT_BIND, ENDPOINTS,\nMSL_DATA_FILENAME)\n+from resources.lib.utils.esn import get_esn\ntry: # Python 2\nfrom urllib import urlencode\n@@ -55,7 +56,7 @@ class MSLRequests(MSLRequestBuilder):\[email protected]_execution(immediate=True)\ndef perform_key_handshake(self, data=None): # pylint: disable=unused-argument\n\"\"\"Perform a key handshake and initialize crypto keys\"\"\"\n- esn = G.get_esn()\n+ esn = get_esn()\nif not esn:\ncommon.warn('Cannot perform key handshake, missing ESN')\nreturn False\n@@ -86,7 +87,7 @@ class MSLRequests(MSLRequestBuilder):\nurl = ENDPOINTS['logblobs'] + '?' + urlencode(params).replace('%2F', '/')\nresponse = self.chunked_request(url,\nself.build_request_data('/logblob', generate_logblobs_params()),\n- G.get_esn(),\n+ get_esn(),\nforce_auth_credential=True)\ncommon.debug('Response of logblob request: {}', response)\n@@ -99,7 +100,7 @@ class MSLRequests(MSLRequestBuilder):\nis_handshake_required = True\nelse:\n# Check if the current ESN is same of ESN bound to MasterToken\n- if G.get_esn() != self.crypto.bound_esn:\n+ if get_esn() != self.crypto.bound_esn:\ncommon.debug('Stored MSL MasterToken is bound to a different ESN, '\n'a new key handshake will be performed')\nis_handshake_required = True\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/msl/msl_utils.py",
"new_path": "resources/lib/services/msl/msl_utils.py",
"diff": "@@ -21,6 +21,7 @@ from resources.lib import common\nfrom resources.lib.database.db_utils import TABLE_SESSION\nfrom resources.lib.globals import G\nfrom resources.lib.services.msl.exceptions import MSLError\n+from resources.lib.utils.esn import get_esn\ntry: # Python 2\nunicode\n@@ -194,7 +195,7 @@ def generate_logblobs_params():\n'appLogSeqNum': 0,\n'uniqueLogId': common.get_random_uuid(),\n'appId': app_id,\n- 'esn': G.get_esn(),\n+ 'esn': get_esn(),\n'lver': '',\n# 'jssid': '15822792997793', # Same value of appId\n# 'jsoffms': 1261,\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/nfsession/session/access.py",
"new_path": "resources/lib/services/nfsession/session/access.py",
"diff": "@@ -14,6 +14,7 @@ import resources.lib.utils.website as website\nimport resources.lib.common as common\nimport resources.lib.common.cookies as cookies\nimport resources.lib.kodi.ui as ui\n+from resources.lib.utils.esn import get_esn\nfrom resources.lib.utils.exceptions import (LoginValidateError, NotConnected, NotLoggedInError,\nMbrStatusNeverMemberError, MbrStatusFormerMemberError)\nfrom resources.lib.database.db_utils import TABLE_SESSION\n@@ -68,7 +69,7 @@ class SessionAccess(SessionCookie, SessionHTTPRequests):\n@staticmethod\ndef _verify_esn_existence():\n- return bool(G.get_esn())\n+ return bool(get_esn())\ndef get_safe(self, endpoint, **kwargs):\n\"\"\"\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": "@@ -15,6 +15,7 @@ import resources.lib.common as common\nfrom resources.lib.common.cache_utils import CACHE_MANIFESTS\nfrom resources.lib.globals import G\nfrom resources.lib.kodi import ui\n+from resources.lib.utils.esn import get_esn\nfrom .action_manager import ActionManager\nSTREAMS = {\n@@ -264,7 +265,7 @@ class AMStreamContinuity(ActionManager):\n# NOTE: With Kodi 18 it is not possible to read the properties of the streams\n# so the only possible way is to read the data from the manifest file\naudio_language = common.get_kodi_audio_language()\n- cache_identifier = G.get_esn() + '_' + self.videoid.value\n+ cache_identifier = get_esn() + '_' + self.videoid.value\nmanifest_data = G.CACHE.get(CACHE_MANIFESTS, cache_identifier)\ncommon.fix_locale_languages(manifest_data['timedtexttracks'])\nif not any(text_track.get('isForcedNarrative', False) is True and\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/utils/esn.py",
"new_path": "resources/lib/utils/esn.py",
"diff": "@@ -17,6 +17,13 @@ from resources.lib.common.device_utils import get_system_platform\nfrom resources.lib.common.logging import debug\n+def get_esn():\n+ \"\"\"Get the generated esn or if set get the custom esn\"\"\"\n+ from resources.lib.database.db_utils import TABLE_SESSION\n+ custom_esn = G.ADDON.getSetting('esn')\n+ return custom_esn if custom_esn else G.LOCAL_DB.get_value('esn', '', table=TABLE_SESSION)\n+\n+\ndef generate_android_esn():\n\"\"\"Generate an ESN if on android or return the one from user_data\"\"\"\nif get_system_platform() == 'android':\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Moved get_esn to esn.py |
106,046 | 04.08.2020 20:16:17 | -7,200 | 773ff9c6e0cc583042b6929ff64ad5d098aad2df | Moved cookies.py to utils | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/nfsession/nfsession_ops.py",
"new_path": "resources/lib/services/nfsession/nfsession_ops.py",
"diff": "@@ -17,7 +17,8 @@ import resources.lib.common as common\nfrom resources.lib.utils.exceptions import (NotLoggedInError, MissingCredentialsError, WebsiteParsingError,\nMbrStatusAnonymousError, MetadataNotAvailable, LoginValidateError,\nHttpError401, InvalidProfilesError)\n-from resources.lib.common import cookies, cache_utils\n+from resources.lib.common import cache_utils\n+from resources.lib.utils import cookies\nfrom resources.lib.globals import G\nfrom resources.lib.kodi import ui\nfrom resources.lib.services.nfsession.session.path_requests import SessionPathRequests\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/nfsession/session/access.py",
"new_path": "resources/lib/services/nfsession/session/access.py",
"diff": "@@ -12,7 +12,7 @@ from __future__ import absolute_import, division, unicode_literals\nimport resources.lib.utils.website as website\nimport resources.lib.common as common\n-import resources.lib.common.cookies as cookies\n+import resources.lib.utils.cookies as cookies\nimport resources.lib.kodi.ui as ui\nfrom resources.lib.utils.esn import get_esn\nfrom resources.lib.utils.exceptions import (LoginValidateError, NotConnected, NotLoggedInError,\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/nfsession/session/cookie.py",
"new_path": "resources/lib/services/nfsession/session/cookie.py",
"diff": "@@ -12,7 +12,7 @@ from __future__ import absolute_import, division, unicode_literals\nimport time\n-import resources.lib.common.cookies as cookies\n+import resources.lib.utils.cookies as cookies\nfrom resources.lib.globals import G\nfrom resources.lib.services.nfsession.session.base import SessionBase\nfrom resources.lib.utils.logging import LOG\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": "@@ -16,7 +16,7 @@ import resources.lib.utils.website as website\nimport resources.lib.common as common\nfrom resources.lib.utils.exceptions import (APIError, WebsiteParsingError, MbrStatusError, MbrStatusAnonymousError,\nHttpError401)\n-from resources.lib.common import cookies\n+from resources.lib.utils import cookies\nfrom resources.lib.database.db_utils import TABLE_SESSION\nfrom resources.lib.globals import G\nfrom resources.lib.services.nfsession.session.base import SessionBase\n"
},
{
"change_type": "RENAME",
"old_path": "resources/lib/common/cookies.py",
"new_path": "resources/lib/utils/cookies.py",
"diff": ""
}
] | Python | MIT License | castagnait/plugin.video.netflix | Moved cookies.py to utils |
106,046 | 05.08.2020 09:40:51 | -7,200 | 68ac22cb5d2d8a3d37096b0faee0648bcb2c7623 | Removed old Lolomo code | [
{
"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": "@@ -12,12 +12,12 @@ from __future__ import absolute_import, division, unicode_literals\nfrom future.utils import iteritems\nfrom resources.lib import common\n-from resources.lib.utils.data_types import (VideoListSorted, SubgenreList, SeasonList, EpisodeList, LoLoMo, LoCo,\n- VideoList, SearchVideoList, CustomVideoList)\n+from resources.lib.utils.data_types import (VideoListSorted, SubgenreList, SeasonList, EpisodeList, LoCo, VideoList,\n+ SearchVideoList, CustomVideoList)\nfrom resources.lib.common.exceptions import InvalidVideoListTypeError, InvalidVideoId\nfrom resources.lib.utils.api_paths import (VIDEO_LIST_PARTIAL_PATHS, RANGE_PLACEHOLDER, VIDEO_LIST_BASIC_PARTIAL_PATHS,\nSEASONS_PARTIAL_PATHS, EPISODES_PARTIAL_PATHS, ART_PARTIAL_PATHS,\n- GENRE_PARTIAL_PATHS, TRAILER_PARTIAL_PATHS, PATH_REQUEST_SIZE_STD, build_paths,\n+ TRAILER_PARTIAL_PATHS, PATH_REQUEST_SIZE_STD, build_paths,\nPATH_REQUEST_SIZE_MAX)\nfrom resources.lib.common import cache_utils\nfrom resources.lib.globals import G\n@@ -45,20 +45,6 @@ class DirectoryPathRequests(object):\nexcept InvalidVideoListTypeError:\nreturn []\n- @cache_utils.cache_output(cache_utils.CACHE_COMMON, fixed_identifier='lolomo_list', ignore_self_class=True)\n- def req_lolomo_list_root(self):\n- \"\"\"Retrieve root LoLoMo list\"\"\"\n- # It is used to display main menu and the menus with 'lolomo_contexts' specified, like 'recommendations' menu\n- LOG.debug('Requesting root LoLoMo lists')\n- paths = ([['lolomo', {'from': 0, 'to': 40}, ['displayName', 'context', 'id', 'index', 'length', 'genreId']]] +\n- # Titles of first 4 videos in each video list\n- [['lolomo', {'from': 0, 'to': 40}, {'from': 0, 'to': 3}, 'reference', ['title', 'summary']]] +\n- # Art for first video in each video list (will be displayed as video list art)\n- build_paths(['lolomo', {'from': 0, 'to': 40}, {'from': 0, 'to': 0}, 'reference'], ART_PARTIAL_PATHS))\n- call_args = {'paths': paths}\n- path_response = self.nfsession.path_request(**call_args)\n- return LoLoMo(path_response)\n-\n@cache_utils.cache_output(cache_utils.CACHE_COMMON, fixed_identifier='loco_list', ignore_self_class=True)\ndef req_loco_list_root(self):\n\"\"\"Retrieve root LoCo list\"\"\"\n@@ -101,28 +87,6 @@ class DirectoryPathRequests(object):\npath_response = self.nfsession.path_request(**call_args)\nreturn LoCo(path_response)\n- @cache_utils.cache_output(cache_utils.CACHE_GENRES, identify_from_kwarg_name='genre_id', ignore_self_class=True)\n- def req_lolomo_list_genre(self, genre_id):\n- \"\"\"Retrieve LoLoMos for the given genre\"\"\"\n- LOG.debug('Requesting LoLoMo for genre {}', genre_id)\n- paths = (build_paths(['genres', genre_id, 'rw'], GENRE_PARTIAL_PATHS) +\n- # Titles and art of standard lists' items\n- build_paths(['genres', genre_id, 'rw', {\"from\": 0, \"to\": 48}, {\"from\": 0, \"to\": 3}, \"reference\"],\n- [['title', 'summary']] + ART_PARTIAL_PATHS) +\n- # IDs and names of sub-genres\n- [['genres', genre_id, 'subgenres', {'from': 0, 'to': 48}, ['id', 'name']]])\n- call_args = {'paths': paths}\n- path_response = self.nfsession.path_request(**call_args)\n- return LoLoMo(path_response)\n-\n- def get_lolomo_list_id_by_context(self, context):\n- \"\"\"Return the dynamic video list ID for a LoLoMo context\"\"\"\n- try:\n- list_id = next(iter(self.req_lolomo_list_root().lists_by_context(context, True)))[0]\n- except StopIteration:\n- raise InvalidVideoListTypeError('No lists with context {} available'.format(context))\n- return list_id\n-\ndef get_loco_list_id_by_context(self, context):\n\"\"\"Return the dynamic video list ID for a LoCo context\"\"\"\ntry:\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/utils/data_types.py",
"new_path": "resources/lib/utils/data_types.py",
"diff": "@@ -18,60 +18,6 @@ from .api_paths import resolve_refs\nfrom .logging import LOG\n-class LoLoMo(object):\n- \"\"\"List of list of movies (LoLoMo)\"\"\"\n- def __init__(self, path_response, lolomoid=None):\n- self.data = path_response\n- LOG.debug('LoLoMo data: {}', self.data)\n- _filterout_contexts(self.data, ['billboard', 'showAsARow'])\n- self.id = (lolomoid\n- if lolomoid\n- else next(iter(self.data['lolomos'])))\n- self.lists = OrderedDict(\n- (key, VideoList(self.data, key))\n- for key, _\n- in resolve_refs(self.data['lolomos'][self.id], self.data))\n-\n- def __getitem__(self, key):\n- return _check_sentinel(self.data['lolomos'][self.id][key])\n-\n- def get(self, key, default=None):\n- \"\"\"Pass call on to the backing dict of this LoLoMo.\"\"\"\n- return self.data['lolomos'][self.id].get(key, default)\n-\n- def lists_by_context(self, context, break_on_first=False):\n- \"\"\"Return a generator expression that iterates over all video\n- lists with the given context.\n- Will match any video lists with type contained in context\n- if context is a list.\"\"\"\n- # 'context' may contain a list of multiple contexts or a single\n- # 'context' can be passed as a string, convert to simplify code\n- if not isinstance(context, list):\n- context = [context]\n-\n- match_context = ((lambda context, contexts: context in contexts)\n- if isinstance(context, list)\n- else (lambda context, target: context == target))\n-\n- # Keep sort order of context list\n- lists = {}\n- for context_name in context:\n- for list_id, video_list in iteritems(self.lists):\n- if match_context(video_list['context'], context_name):\n- lists.update({list_id: VideoList(self.data, list_id)})\n- if break_on_first:\n- break\n- return iteritems(lists)\n-\n- def find_by_context(self, context):\n- \"\"\"Return the video list of a context\"\"\"\n- for list_id, video_list in iteritems(self.lists):\n- if not video_list['context'] == context:\n- continue\n- return list_id, VideoList(self.data, list_id)\n- return None, None\n-\n-\nclass LoCo(object):\n\"\"\"List of components (LoCo)\"\"\"\ndef __init__(self, path_response):\n@@ -332,22 +278,6 @@ def _get_videoids(videos):\nfor video in itervalues(videos)]\n-def _filterout_contexts(data, contexts):\n- \"\"\"Deletes from the data all records related to the specified contexts\"\"\"\n- _id = next(iter(data['lolomos']))\n- for context in contexts:\n- for listid in list(data.get('lists', {})):\n- if not data['lists'][listid].get('context'):\n- continue\n- if data['lists'][listid]['context'] != context:\n- continue\n- for idkey in list(data['lolomos'][_id]):\n- if listid in data['lolomos'][_id][idkey]:\n- del data['lolomos'][_id][idkey]\n- break\n- del data['lists'][listid]\n-\n-\ndef _filterout_loco_contexts(data, contexts):\n\"\"\"Deletes from the data all records related to the specified contexts\"\"\"\nroot_id = next(iter(data['locos']))\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Removed old Lolomo code |
106,046 | 05.08.2020 11:14:55 | -7,200 | b1e080e8362af9c921c903a5af26c3de4f3ef968 | When http error 401 happen try refresh session only with shakti endpoint | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/nfsession/session/http_requests.py",
"new_path": "resources/lib/services/nfsession/session/http_requests.py",
"diff": "@@ -62,15 +62,17 @@ class SessionHTTPRequests(SessionBase):\ndata=data)\nLOG.debug('Request took {}s', perf_clock() - start)\nLOG.debug('Request returned status code {}', response.status_code)\n- if response.status_code in [404, 401] and not session_refreshed:\n- # 404 - It may happen when Netflix update the build_identifier version and causes the api address to change\n- # 401 - It may happen when authURL is not more valid (Unauthorized for url)\n- # So let's try refreshing the session data (just once)\n- LOG.warn('Try refresh session data due to {} http error', response.status_code)\n+ if not session_refreshed:\n+ # We refresh the session when happen:\n+ # Error 404: It happen when Netflix update the build_identifier version and causes the api address to change\n+ # Error 401: This is a generic error, can happen when the http request for some reason has failed,\n+ # we allow the refresh only for shakti endpoint, sometimes for unknown reasons it is necessary to update\n+ # the session for the request to be successful\n+ if response.status_code == 404 or (response.status_code == 401 and endpoint == 'shakti'):\n+ LOG.warn('Attempt to refresh the session due to HTTP error {}', response.status_code)\nif self.try_refresh_session_data():\nreturn self._request(method, endpoint, True, **kwargs)\nif response.status_code == 401:\n- LOG.error('Raise error due to too many http error 401')\nraise HttpError401\nresponse.raise_for_status()\nreturn (_raise_api_error(response.json() if response.content else {})\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | When http error 401 happen try refresh session only with shakti endpoint |
106,046 | 05.08.2020 13:16:03 | -7,200 | 25aa05f4f2952a90a89651bb0f08e29c035d0222 | Changed args to file_exists | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/common/fileops.py",
"new_path": "resources/lib/common/fileops.py",
"diff": "@@ -55,13 +55,13 @@ def create_folder(path):\nxbmcvfs.mkdirs(path)\n-def file_exists(filename, data_path=G.DATA_PATH):\n+def file_exists(file_path):\n\"\"\"\nChecks if a given file exists\n- :param filename: The filename\n+ :param file_path: File path to check\n:return: True if exists\n\"\"\"\n- return xbmcvfs.exists(xbmc.translatePath(os.path.join(data_path, filename)))\n+ return xbmcvfs.exists(xbmc.translatePath(file_path))\ndef copy_file(from_path, to_path):\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Changed args to file_exists |
106,046 | 06.08.2020 12:45:29 | -7,200 | ecefb537cdffa368e104864b313fbcc010b44b68 | Removed wrong 1e-6 multiplication
wrong calculation | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/utils/logging.py",
"new_path": "resources/lib/utils/logging.py",
"diff": "@@ -19,12 +19,11 @@ import xbmc\ndef perf_clock():\n+ if hasattr(time, 'perf_counter'):\n+ return time.perf_counter() # pylint: disable=no-member\nif hasattr(time, 'clock'):\n# time.clock() was deprecated in Python 3.3 and removed in Python 3.8\nreturn time.clock() # pylint: disable=no-member\n- if hasattr(time, 'perf_counter'):\n- # * 1e-6 convert [us] to [s]\n- return time.perf_counter() * 1e-6 # pylint: disable=no-member\nreturn time.time()\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Removed wrong 1e-6 multiplication
wrong calculation |
105,981 | 07.08.2020 23:06:46 | -7,200 | 4ce6de5ac173bfb5b630400a06671b5510d75649 | Update pull_request_template.md
`CONTRIBUTING` and `Pull Requests` was not working and i made a tiny tweak too :) | [
{
"change_type": "MODIFY",
"old_path": ".github/pull_request_template.md",
"new_path": ".github/pull_request_template.md",
"diff": "### Check if this PR fulfills these requirements:\n* [ ] My changes respect the [Kodi add-on development rules](https://kodi.wiki/view/Add-on_rules)\n-* [ ] I have read the [**CONTRIBUTING**](Contributing.md) document.\n-* [ ] I made sure there wasn't another one [Pull Requests](../../pulls) opened for the same update/change\n+* [ ] I have read the [**CONTRIBUTING**](../../master/Contributing.md) document.\n+* [ ] I made sure there wasn't another [Pull Request](../../../pulls) opened for the same update/change\n* [ ] I have successfully tested my changes locally\n#### Types of changes\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Update pull_request_template.md (#795)
`CONTRIBUTING` and `Pull Requests` was not working and i made a tiny tweak too :) |
106,046 | 08.08.2020 10:16:00 | -7,200 | 78daae8d3aa769a7daaa02e86f396ecbfae6f557 | Removed hardcoded plugin id | [
{
"change_type": "MODIFY",
"old_path": "resources/settings.xml",
"new_path": "resources/settings.xml",
"diff": "<settings>\n<category label=\"30031\"><!--General-->\n<setting label=\"30014\" type=\"lsep\"/><!--Account-->\n- <setting id=\"logout\" type=\"action\" label=\"30017\" action=\"RunPlugin(plugin://plugin.video.netflix/action/logout/)\" option=\"close\"/>\n- <setting id=\"parental_control\" type=\"action\" label=\"30062\" action=\"RunPlugin(plugin://plugin.video.netflix/action/parental_control/)\" option=\"close\"/>\n+ <setting id=\"logout\" type=\"action\" label=\"30017\" action=\"RunPlugin(plugin://$ID/action/logout/)\" option=\"close\"/>\n+ <setting id=\"parental_control\" type=\"action\" label=\"30062\" action=\"RunPlugin(plugin://$ID/action/parental_control/)\" option=\"close\"/>\n<setting label=\"30015\" type=\"lsep\"/><!--Other options-->\n<setting id=\"mylist_titles_color\" type=\"enum\" label=\"30215\" lvalues=\"13106|762|13343|13341|761|760|731|767\" default=\"1\"/>\n<setting id=\"supplemental_info_color\" type=\"enum\" label=\"30239\" lvalues=\"13106|762|13343|13341|761|760|731|767\" default=\"3\"/>\n<category label=\"30025\"><!--Library-->\n<setting label=\"30065\" type=\"lsep\"/><!--Auto-Update-->\n<setting id=\"lib_auto_upd_mode\" type=\"enum\" label=\"30224\" lvalues=\"13106|30225|30226\" default=\"1\"/>\n- <setting id=\"lib_auto_upd_check_now\" type=\"action\" label=\"30230\" action=\"RunPlugin(plugin://plugin.video.netflix/library/auto_upd_run_now/)\" visible=\"gt(-1,0)\" subsetting=\"true\"/>\n+ <setting id=\"lib_auto_upd_check_now\" type=\"action\" label=\"30230\" action=\"RunPlugin(plugin://$ID/library/auto_upd_run_now/)\" visible=\"gt(-1,0)\" subsetting=\"true\"/>\n<setting id=\"lib_auto_upd_freq\" type=\"enum\" label=\"30064\" lvalues=\"30067|30068|30069|30070\" default=\"0\" visible=\"gt(-2,1)\" subsetting=\"true\"/>\n<setting id=\"lib_auto_upd_start\" type=\"time\" label=\"30071\" visible=\"gt(-3,1)\" default=\"00:00\" subsetting=\"true\"/>\n<setting id=\"lib_auto_upd_wait_idle\" type=\"bool\" label=\"30072\" visible=\"gt(-4,1)\" default=\"false\" subsetting=\"true\"/>\n<setting id=\"lib_auto_upd_disable_notification\" type=\"bool\" label=\"30219\" default=\"false\" visible=\"gt(-5,1)\" subsetting=\"true\"/>\n<setting label=\"30227\" type=\"lsep\"/><!--Synchronize Kodi library with My List-->\n<setting id=\"lib_sync_mylist\" type=\"bool\" label=\"30114\" default=\"false\" enable=\"gt(-7,1)\"/>\n- <setting id=\"lib_sync_mylist_sel_profile\" type=\"action\" label=\"30228\" action=\"RunPlugin(plugin://plugin.video.netflix/library/sync_mylist_sel_profile/)\" enable=\"eq(-1,true) + gt(-8,1)\" visible=\"eq(-1,true)\" subsetting=\"true\"/>\n- <setting id=\"lib_sync_mylist_now\" type=\"action\" label=\"30121\" action=\"RunPlugin(plugin://plugin.video.netflix/library/sync_mylist/)\" enable=\"eq(-2,true) + gt(-9,1)\" visible=\"eq(-2,true)\" subsetting=\"true\"/>\n+ <setting id=\"lib_sync_mylist_sel_profile\" type=\"action\" label=\"30228\" action=\"RunPlugin(plugin://$ID/library/sync_mylist_sel_profile/)\" enable=\"eq(-1,true) + gt(-8,1)\" visible=\"eq(-1,true)\" subsetting=\"true\"/>\n+ <setting id=\"lib_sync_mylist_now\" type=\"action\" label=\"30121\" action=\"RunPlugin(plugin://$ID/library/sync_mylist/)\" enable=\"eq(-2,true) + gt(-9,1)\" visible=\"eq(-2,true)\" subsetting=\"true\"/>\n<setting label=\"30184\" type=\"lsep\"/><!--NFO Files-->\n<setting id=\"enable_nfo_export\" type=\"bool\" label=\"30185\" default=\"false\"/>\n<setting id=\"export_movie_nfo\" type=\"enum\" label=\"30186\" lvalues=\"21337|20422|30188\" visible=\"eq(-1,true)\" default=\"1\" subsetting=\"true\"/>\n<setting label=\"30015\" type=\"lsep\"/><!--Other options-->\n<setting id=\"enablelibraryfolder\" type=\"bool\" label=\"30026\" default=\"false\"/>\n<setting id=\"customlibraryfolder\" type=\"folder\" label=\"30027\" enable=\"eq(-1,true)\" default=\"special://profile/addon_data/plugin.video.netflix\" source=\"auto\" option=\"writeable\" subsetting=\"true\"/>\n- <setting id=\"purge_library\" type=\"action\" label=\"30125\" action=\"RunPlugin(plugin://plugin.video.netflix/library/purge/)\"/>\n- <setting id=\"import_library\" type=\"action\" label=\"30140\" action=\"RunPlugin(plugin://plugin.video.netflix/library/import_library/)\"/>\n+ <setting id=\"purge_library\" type=\"action\" label=\"30125\" action=\"RunPlugin(plugin://$ID/library/purge/)\"/>\n+ <setting id=\"import_library\" type=\"action\" label=\"30140\" action=\"RunPlugin(plugin://$ID/library/import_library/)\"/>\n<setting label=\"30199\" type=\"lsep\"/><!--Shared library-->\n<setting id=\"use_mysql\" type=\"bool\" label=\"30200\" default=\"false\"/>\n<setting id=\"mysql_username\" type=\"text\" label=\"30201\" default=\"kodi\" visible=\"eq(-1,true)\" subsetting=\"true\"/>\n<setting id=\"mysql_password\" type=\"text\" label=\"30004\" default=\"kodi\" option=\"hidden\" visible=\"eq(-2,true)\" subsetting=\"true\"/>\n<setting id=\"mysql_host\" type=\"ipaddress\" label=\"30203\" default=\"127.0.0.1\" visible=\"eq(-3,true)\" subsetting=\"true\"/>\n<setting id=\"mysql_port\" type=\"number\" label=\"30204\" default=\"3306\" visible=\"eq(-4,true)\" subsetting=\"true\"/>\n- <setting id=\"mysql_test\" type=\"action\" label=\"30205\" action=\"RunPlugin(plugin://plugin.video.netflix/library/mysql_test/)\" visible=\"false\" subsetting=\"true\" option=\"close\"/>\n- <setting id=\"mysql_device_auto_update\" type=\"action\" label=\"30207\" action=\"RunPlugin(plugin://plugin.video.netflix/library/set_autoupdate_device/)\" visible=\"eq(-6,true)\" subsetting=\"true\"/>\n- <setting id=\"mysql_check_auto_update_device\" type=\"action\" label=\"30208\" action=\"RunPlugin(plugin://plugin.video.netflix/library/check_autoupdate_device/)\" visible=\"eq(-7,true)\" subsetting=\"true\"/>\n+ <setting id=\"mysql_test\" type=\"action\" label=\"30205\" action=\"RunPlugin(plugin://$ID/library/mysql_test/)\" visible=\"false\" subsetting=\"true\" option=\"close\"/>\n+ <setting id=\"mysql_device_auto_update\" type=\"action\" label=\"30207\" action=\"RunPlugin(plugin://$ID/library/set_autoupdate_device/)\" visible=\"eq(-6,true)\" subsetting=\"true\"/>\n+ <setting id=\"mysql_check_auto_update_device\" type=\"action\" label=\"30208\" action=\"RunPlugin(plugin://$ID/library/check_autoupdate_device/)\" visible=\"eq(-7,true)\" subsetting=\"true\"/>\n</category>\n<category label=\"30166\"><!--Main menu items-->\n<setting id=\"show_menu_mylist\" type=\"bool\" label=\"30167\" default=\"true\"/>\n<setting id=\"upnext_settings\" type=\"action\" label=\"30178\" action=\"Addon.OpenSettings(service.upnext)\" visible=\"System.HasAddon(service.upnext)\" option=\"close\"/>\n</category>\n<category label=\"30023\"><!--Expert-->\n- <setting id=\"configuration_wizard\" type=\"action\" label=\"30158\" action=\"RunPlugin(plugin://plugin.video.netflix/action/configuration_wizard/)\" option=\"close\"/>\n+ <setting id=\"configuration_wizard\" type=\"action\" label=\"30158\" action=\"RunPlugin(plugin://$ID/action/configuration_wizard/)\" option=\"close\"/>\n<setting id=\"is_settings\" type=\"action\" label=\"30035\" action=\"Addon.OpenSettings(inputstream.adaptive)\" enable=\"System.HasAddon(inputstream.adaptive)\" option=\"close\"/>\n<setting id=\"ishelper_settings\" type=\"action\" label=\"30213\" action=\"Addon.OpenSettings(script.module.inputstreamhelper)\" option=\"close\"/>\n<setting label=\"30115\" type=\"lsep\"/><!--Content Profiles-->\n<setting id=\"force_widevine_l3\" type=\"bool\" label=\"30244\" visible=\"System.Platform.Android\" default=\"false\"/>\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://plugin.video.netflix/action/view_esn/)\"/>\n+ <setting id=\"view_esn\" type=\"action\" label=\"30216\" action=\"RunPlugin(plugin://$ID/action/view_esn/)\"/>\n<setting id=\"esn\" type=\"text\" label=\"30034\" value=\"\" default=\"\"/>\n- <setting id=\"reset_esn\" type=\"action\" label=\"30217\" action=\"RunPlugin(plugin://plugin.video.netflix/action/reset_esn/)\" option=\"close\"/>\n+ <setting id=\"reset_esn\" type=\"action\" label=\"30217\" action=\"RunPlugin(plugin://$ID/action/reset_esn/)\" option=\"close\"/>\n<setting label=\"30117\" type=\"lsep\"/><!--Cache-->\n<setting id=\"cache_ttl\" type=\"slider\" option=\"int\" range=\"5,5,2880\" label=\"30084\" default=\"180\"/>\n<setting id=\"cache_mylist_ttl\" type=\"slider\" option=\"int\" range=\"10,10,1440\" label=\"30086\" default=\"60\"/>\n<setting id=\"cache_metadata_ttl\" type=\"slider\" option=\"int\" range=\"1,1,60\" label=\"30085\" default=\"30\"/>\n- <setting id=\"purge_inmemory_cache\" type=\"action\" label=\"30132\" action=\"RunPlugin(plugin://plugin.video.netflix/action/purge_cache/)\"/>\n- <setting id=\"purge_complete_cache\" type=\"action\" label=\"30133\" action=\"RunPlugin(plugin://plugin.video.netflix/action/purge_cache/?on_disk=True)\"/>\n+ <setting id=\"purge_inmemory_cache\" type=\"action\" label=\"30132\" action=\"RunPlugin(plugin://$ID/action/purge_cache/)\"/>\n+ <setting id=\"purge_complete_cache\" type=\"action\" label=\"30133\" action=\"RunPlugin(plugin://$ID/action/purge_cache/?on_disk=True)\"/>\n</category>\n</settings>\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Removed hardcoded plugin id |
106,046 | 08.08.2020 10:19:30 | -7,200 | f377d3258e7ba3676224660a5d3dcc7d465fe1d6 | Moved watched status sync setting to main settings page | [
{
"change_type": "MODIFY",
"old_path": "resources/settings.xml",
"new_path": "resources/settings.xml",
"diff": "<setting id=\"logout\" type=\"action\" label=\"30017\" action=\"RunPlugin(plugin://$ID/action/logout/)\" option=\"close\"/>\n<setting id=\"parental_control\" type=\"action\" label=\"30062\" action=\"RunPlugin(plugin://$ID/action/parental_control/)\" option=\"close\"/>\n<setting label=\"30015\" type=\"lsep\"/><!--Other options-->\n+ <setting id=\"ProgressManager_enabled\" type=\"bool\" label=\"30235\" default=\"false\"/>\n+ <setting id=\"sync_watched_status_library\" type=\"bool\" label=\"30301\" default=\"false\" visible=\"eq(-1,true)\" subsetting=\"true\"/>\n+ <setting id=\"select_first_unwatched\" type=\"bool\" label=\"30243\" default=\"false\" visible=\"eq(-2,true)\" subsetting=\"true\"/>\n<setting id=\"mylist_titles_color\" type=\"enum\" label=\"30215\" lvalues=\"13106|762|13343|13341|761|760|731|767\" default=\"1\"/>\n<setting id=\"supplemental_info_color\" type=\"enum\" label=\"30239\" lvalues=\"13106|762|13343|13341|761|760|731|767\" default=\"3\"/>\n<setting id=\"disable_startup_notification\" type=\"bool\" label=\"30141\" default=\"false\"/>\n<setting id=\"viewmodeexportedid\" type=\"number\" label=\"30143\" visible=\"eq(-1,1) + eq(-20,true)\" enable=\"eq(-20,true)\" subsetting=\"true\"/>\n</category>\n<category label=\"30078\"><!--Playback-->\n- <setting id=\"ProgressManager_enabled\" type=\"bool\" label=\"30235\" default=\"false\"/>\n- <setting id=\"sync_watched_status_library\" type=\"bool\" label=\"30301\" default=\"false\" visible=\"eq(-1,true)\" subsetting=\"true\"/>\n- <setting id=\"select_first_unwatched\" type=\"bool\" label=\"30243\" default=\"false\" visible=\"eq(-2,true)\" subsetting=\"true\"/>\n<setting id=\"BookmarkManager_enabled\" type=\"bool\" label=\"30083\" visible=\"false\" default=\"true\"/>\n<setting id=\"StreamContinuityManager_enabled\" type=\"bool\" label=\"30082\" default=\"true\"/>\n<setting id=\"SectionSkipper_enabled\" type=\"bool\" label=\"30075\" default=\"true\"/>\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Moved watched status sync setting to main settings page |
106,046 | 08.08.2020 11:19:39 | -7,200 | d88dcf6e8af83a08146037aa7e7be1f4bd417fa9 | Fixed cache service regression
The service cache must not be reinitialized every time | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/globals.py",
"new_path": "resources/lib/globals.py",
"diff": "@@ -286,7 +286,7 @@ class GlobalVariables(object):\nself.CACHE_TTL = self.ADDON.getSettingInt('cache_ttl') * 60\nself.CACHE_MYLIST_TTL = self.ADDON.getSettingInt('cache_mylist_ttl') * 60\nself.CACHE_METADATA_TTL = self.ADDON.getSettingInt('cache_metadata_ttl') * 24 * 60 * 60\n- if self.IS_SERVICE:\n+ if self.IS_SERVICE and not reload_settings:\nfrom resources.lib.services.cache.cache_management import CacheManagement\nself.CACHE_MANAGEMENT = CacheManagement()\nfrom resources.lib.common.cache import Cache\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Fixed cache service regression
The service cache must not be reinitialized every time |
106,046 | 08.08.2020 11:21:24 | -7,200 | 9dfbf1a0980bce03d291eb600870b2c3214dbca4 | Invalidate cache when page results setting change | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/settings_monitor.py",
"new_path": "resources/lib/services/settings_monitor.py",
"diff": "@@ -88,8 +88,15 @@ class SettingsMonitor(xbmc.Monitor):\nG.LOCAL_DB.set_value('menu_{}_sortorder'.format(menu_id),\nmenu_sortorder_new_setting,\nTABLE_SETTINGS_MONITOR)\n- # We remove the cache to allow get the new results in the chosen order\n- G.CACHE.clear([CACHE_COMMON, CACHE_MYLIST, CACHE_SEARCH])\n+ clean_cache = True\n+\n+ # Checks for settings changes that require cache invalidation\n+ if not clean_cache:\n+ page_results = G.ADDON.getSettingInt('page_results')\n+ page_results_old = G.LOCAL_DB.get_value('page_results', 90, TABLE_SETTINGS_MONITOR)\n+ if page_results != page_results_old:\n+ G.LOCAL_DB.set_value('page_results', page_results, TABLE_SETTINGS_MONITOR)\n+ clean_cache = True\n# Check changes on content profiles\n# This is necessary because it is possible that some manifests\n@@ -112,8 +119,12 @@ class SettingsMonitor(xbmc.Monitor):\nG.LOCAL_DB.set_value('progress_manager_enabled', progress_manager_enabled, TABLE_SETTINGS_MONITOR)\ncommon.send_signal(signal=common.Signals.SWITCH_EVENTS_HANDLER, data=progress_manager_enabled)\n+ if clean_cache:\n+ # We remove the cache to allow get the new results with the new settings\n+ G.CACHE.clear([CACHE_COMMON, CACHE_MYLIST, CACHE_SEARCH])\n+\n# Avoid perform these operations when the add-on is installed from scratch and there are no credentials\n- if (clean_cache or reboot_addon) and not common.check_credentials():\n+ if reboot_addon and not common.check_credentials():\nreboot_addon = False\nif reboot_addon:\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Invalidate cache when page results setting change |
106,046 | 08.08.2020 11:33:32 | -7,200 | c01e425648125c6920afbe10b03b05cb56e44876 | Fixed pylint too-many-branches | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/settings_monitor.py",
"new_path": "resources/lib/services/settings_monitor.py",
"diff": "@@ -62,7 +62,7 @@ class SettingsMonitor(xbmc.Monitor):\nif not use_mysql_after and use_mysql_old:\nG.LOCAL_DB.set_value('use_mysql', False, TABLE_SETTINGS_MONITOR)\n- _esn_checks()\n+ _check_esn()\n# Check menu settings changes\nfor menu_id, menu_data in iteritems(G.MAIN_MENU_ITEMS):\n@@ -98,26 +98,8 @@ class SettingsMonitor(xbmc.Monitor):\nG.LOCAL_DB.set_value('page_results', page_results, TABLE_SETTINGS_MONITOR)\nclean_cache = True\n- # Check changes on content profiles\n- # This is necessary because it is possible that some manifests\n- # could be cached using the previous settings (see msl_handler - load_manifest)\n- menu_keys = ['enable_dolby_sound', 'enable_vp9_profiles', 'enable_hevc_profiles',\n- 'enable_hdr_profiles', 'enable_dolbyvision_profiles', 'enable_force_hdcp',\n- 'disable_webvtt_subtitle']\n- collect_int = ''\n- for menu_key in menu_keys:\n- collect_int += unicode(int(G.ADDON.getSettingBool(menu_key)))\n- collect_int_old = G.LOCAL_DB.get_value('content_profiles_int', '', TABLE_SETTINGS_MONITOR)\n- if collect_int != collect_int_old:\n- G.LOCAL_DB.set_value('content_profiles_int', collect_int, TABLE_SETTINGS_MONITOR)\n- G.CACHE.clear([CACHE_MANIFESTS])\n-\n- # Check if Progress Manager settings is changed\n- progress_manager_enabled = G.ADDON.getSettingBool('ProgressManager_enabled')\n- progress_manager_enabled_old = G.LOCAL_DB.get_value('progress_manager_enabled', False, TABLE_SETTINGS_MONITOR)\n- if progress_manager_enabled != progress_manager_enabled_old:\n- G.LOCAL_DB.set_value('progress_manager_enabled', progress_manager_enabled, TABLE_SETTINGS_MONITOR)\n- common.send_signal(signal=common.Signals.SWITCH_EVENTS_HANDLER, data=progress_manager_enabled)\n+ _check_msl_profiles()\n+ _check_watched_status_sync()\nif clean_cache:\n# We remove the cache to allow get the new results with the new settings\n@@ -133,8 +115,8 @@ class SettingsMonitor(xbmc.Monitor):\ncommon.container_update(common.build_url(['root'], mode=G.MODE_DIRECTORY))\n-def _esn_checks():\n- # Check if the custom esn is changed\n+def _check_esn():\n+ \"\"\"Check if the custom esn is changed\"\"\"\ncustom_esn = G.ADDON.getSetting('esn')\ncustom_esn_old = G.LOCAL_DB.get_value('custom_esn', '', TABLE_SETTINGS_MONITOR)\nif custom_esn != custom_esn_old:\n@@ -150,3 +132,28 @@ def _esn_checks():\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+\n+\n+def _check_msl_profiles():\n+ \"\"\"Check for changes on content profiles settings\"\"\"\n+ # This is necessary because it is possible that some manifests\n+ # could be cached using the previous settings (see load_manifest on msl_handler.py)\n+ menu_keys = ['enable_dolby_sound', 'enable_vp9_profiles', 'enable_hevc_profiles',\n+ 'enable_hdr_profiles', 'enable_dolbyvision_profiles', 'enable_force_hdcp',\n+ 'disable_webvtt_subtitle']\n+ collect_int = ''\n+ for menu_key in menu_keys:\n+ collect_int += unicode(int(G.ADDON.getSettingBool(menu_key)))\n+ collect_int_old = G.LOCAL_DB.get_value('content_profiles_int', '', TABLE_SETTINGS_MONITOR)\n+ if collect_int != collect_int_old:\n+ G.LOCAL_DB.set_value('content_profiles_int', collect_int, TABLE_SETTINGS_MONITOR)\n+ G.CACHE.clear([CACHE_MANIFESTS])\n+\n+\n+def _check_watched_status_sync():\n+ \"\"\"Check if NF watched status sync setting is changed\"\"\"\n+ progress_manager_enabled = G.ADDON.getSettingBool('ProgressManager_enabled')\n+ progress_manager_enabled_old = G.LOCAL_DB.get_value('progress_manager_enabled', False, TABLE_SETTINGS_MONITOR)\n+ if progress_manager_enabled != progress_manager_enabled_old:\n+ G.LOCAL_DB.set_value('progress_manager_enabled', progress_manager_enabled, TABLE_SETTINGS_MONITOR)\n+ common.send_signal(signal=common.Signals.SWITCH_EVENTS_HANDLER, data=progress_manager_enabled)\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Fixed pylint too-many-branches |
106,046 | 08.08.2020 12:58:53 | -7,200 | 32429fab5b04930caf92333179dd93562db01d04 | Changes for Code Climate | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/navigation/directory_utils.py",
"new_path": "resources/lib/navigation/directory_utils.py",
"diff": "@@ -163,23 +163,12 @@ def auto_scroll(list_data):\nworks only with Sync of watched status with netflix\n\"\"\"\n# A sad implementation to a Kodi feature available only for the Kodi library\n- if not G.ADDON.getSettingBool('ProgressManager_enabled') or not G.ADDON.getSettingBool('select_first_unwatched'):\n- return\n+ if G.ADDON.getSettingBool('ProgressManager_enabled') and G.ADDON.getSettingBool('select_first_unwatched'):\ntotal_items = len(list_data)\nif total_items:\n# Delay a bit to wait for the completion of the screen update\nxbmc.sleep(100)\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\n- else: # These infoLabel not works on Kodi 18.x\n- # Check if view sort method is \"Episode\" (ID 23 = SortByEpisodeNumber)\n- is_sort_method_episode = xbmc.getCondVisibility('Container.SortMethod(23)')\n- if not is_sort_method_episode:\n- return\n- # Check if a selection is already done (CurrentItem return the index)\n- if int(xbmc.getInfoLabel('ListItem.CurrentItem') or 2) > 1:\n+ if not _auto_scroll_init_checks():\nreturn\n# Check if all items are already watched\nwatched_items = sum(dict_item['info'].get('PlayCount', '0') != '0' for dict_item in list_data)\n@@ -206,6 +195,21 @@ def auto_scroll(list_data):\n{'setting': 'audiooutput.guisoundmode', 'value': gui_sound_mode})\n+def _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)\n+ if not xbmc.getCondVisibility('Container.SortMethod(23)'):\n+ return False\n+ # Check if a selection is already done (CurrentItem return the index)\n+ if int(xbmc.getInfoLabel('ListItem.CurrentItem') or 2) > 1:\n+ return False\n+ return True\n+\n+\ndef _find_index_last_watched(total_items, list_data):\n\"\"\"Find last watched item\"\"\"\nfor index in range(total_items - 1, -1, -1):\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/run_addon.py",
"new_path": "resources/lib/run_addon.py",
"diff": "@@ -22,6 +22,48 @@ from resources.lib.upgrade_controller import check_addon_upgrade\nfrom resources.lib.utils.logging import LOG\n+def catch_exceptions_decorator(func):\n+ \"\"\"Decorator that catch exceptions\"\"\"\n+ @wraps(func)\n+ def wrapper(*args, **kwargs):\n+ # pylint: disable=broad-except, ungrouped-imports\n+ success = False\n+ try:\n+ func(*args, **kwargs)\n+ success = True\n+ except BackendNotReady as exc_bnr:\n+ from resources.lib.kodi.ui import show_backend_not_ready\n+ show_backend_not_ready(G.py2_decode(str(exc_bnr), 'latin-1'))\n+ except InputStreamHelperError as exc:\n+ from resources.lib.kodi.ui import show_ok_dialog\n+ show_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+ '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+ # 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+ from resources.lib.kodi.ui import show_ok_dialog\n+ show_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+ except (MbrStatusNeverMemberError, MbrStatusFormerMemberError):\n+ from resources.lib.kodi.ui import show_error_info\n+ show_error_info(get_local_string(30008), get_local_string(30180), False, True)\n+ except Exception as exc:\n+ import traceback\n+ from resources.lib.kodi.ui import show_addon_error_info\n+ LOG.error(G.py2_decode(traceback.format_exc(), 'latin-1'))\n+ show_addon_error_info(exc)\n+ finally:\n+ if not success:\n+ from xbmcplugin import endOfDirectory\n+ endOfDirectory(handle=G.PLUGIN_HANDLE, succeeded=False)\n+ return wrapper\n+\n+\ndef _check_valid_credentials():\n\"\"\"Check that credentials are valid otherwise request user credentials\"\"\"\nif not check_credentials():\n@@ -42,22 +84,20 @@ def lazy_login(func):\n\"\"\"\n@wraps(func)\ndef lazy_login_wrapper(*args, **kwargs):\n+ if _check_valid_credentials():\ntry:\n- # Before call a method, check if the credentials exists\n- if not _check_valid_credentials():\n- return False\nreturn func(*args, **kwargs)\nexcept (NotLoggedInError, LoginValidateError):\n# Exceptions raised by nfsession: \"login\" / \"assert_logged_in\" / \"website_extract_session_data\"\nLOG.debug('Tried to perform an action without being logged in')\ntry:\nfrom resources.lib.utils.api_requests import login\n- if not login(ask_credentials=not check_credentials()):\n- return False\n+ if login(ask_credentials=not check_credentials()):\nLOG.debug('Account logged in, try executing again {}', func.__name__)\nreturn func(*args, **kwargs)\nexcept MissingCredentialsError:\n# Cancelled from user or left an empty field\n+ pass\nreturn False\nreturn lazy_login_wrapper\n@@ -77,14 +117,12 @@ def route(pathitems):\nLOG.warn('Route: ignoring extrafanart invocation')\nreturn False\nelse:\n- nav_handler = _get_nav_handler(root_handler)\n- if not nav_handler:\n- raise InvalidPathError('No root handler for path {}'.format('/'.join(pathitems)))\n+ nav_handler = _get_nav_handler(root_handler, pathitems)\n_execute(nav_handler, pathitems[1:], G.REQUEST_PARAMS)\nreturn True\n-def _get_nav_handler(root_handler):\n+def _get_nav_handler(root_handler, pathitems):\nnav_handler = None\nif root_handler == G.MODE_DIRECTORY:\nfrom resources.lib.navigation.directory import Directory\n@@ -98,6 +136,8 @@ def _get_nav_handler(root_handler):\nif root_handler == G.MODE_HUB:\nfrom resources.lib.navigation.hub import HubBrowser\nnav_handler = HubBrowser\n+ if not nav_handler:\n+ raise InvalidPathError('No root handler for path {}'.format('/'.join(pathitems)))\nreturn nav_handler\n@@ -159,8 +199,8 @@ def _check_addon_external_call(window_cls, prop_nf_service_status):\nreturn False\n+@catch_exceptions_decorator\ndef run(argv):\n- # pylint: disable=broad-except,ungrouped-imports,too-many-branches\n# Initialize globals right away to avoid stale values from the last addon invocation.\n# Otherwise Kodi's reuseLanguageInvoker will cause some really quirky behavior!\n# PR: https://github.com/xbmc/xbmc/pull/13814\n@@ -190,7 +230,6 @@ def run(argv):\nshow_backend_not_ready()\nsuccess = False\nif success:\n- try:\ncancel_playback = False\npathitems = [part for part in G.REQUEST_PATH.split('/') if part]\nif G.IS_ADDON_FIRSTRUN:\n@@ -206,38 +245,6 @@ def run(argv):\nsuccess = False\nelse:\nsuccess = route(pathitems)\n- except BackendNotReady as exc_bnr:\n- from resources.lib.kodi.ui import show_backend_not_ready\n- show_backend_not_ready(G.py2_decode(str(exc_bnr), 'latin-1'))\n- success = False\n- except InputStreamHelperError as exc:\n- from resources.lib.kodi.ui import show_ok_dialog\n- show_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- 'Please report it to InputStream Helper github.'.format(exc)))\n- success = False\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- # 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- from resources.lib.kodi.ui import show_ok_dialog\n- show_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- success = False\n- except (MbrStatusNeverMemberError, MbrStatusFormerMemberError):\n- from resources.lib.kodi.ui import show_error_info\n- show_error_info(get_local_string(30008), get_local_string(30180), False, True)\n- success = False\n- except Exception as exc:\n- import traceback\n- from resources.lib.kodi.ui import show_addon_error_info\n- LOG.error(G.py2_decode(traceback.format_exc(), 'latin-1'))\n- show_addon_error_info(exc)\n- success = False\n-\nif not success:\nfrom xbmcplugin import endOfDirectory\nendOfDirectory(handle=G.PLUGIN_HANDLE, succeeded=False)\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Changes for Code Climate |
106,046 | 09.08.2020 11:09:49 | -7,200 | 8618f77768f577107865c239e60fba2315374eb4 | Protect settings when auto-update is running | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/navigation/library.py",
"new_path": "resources/lib/navigation/library.py",
"diff": "@@ -68,6 +68,8 @@ class LibraryActionExecutor(object):\n\"\"\"\nSelect a profile for the synchronization of Kodi library with Netflix \"My List\"\n\"\"\"\n+ if _check_auto_update_running():\n+ return\npreselect_guid = G.SHARED_DB.get_value('sync_mylist_profile_guid',\nG.LOCAL_DB.get_guid_owner_profile())\nselected_guid = ui.show_profiles_dialog(title=common.get_local_string(30228),\n@@ -78,6 +80,8 @@ class LibraryActionExecutor(object):\ndef purge(self, pathitems): # pylint: disable=unused-argument\n\"\"\"Delete all previously exported items from the Kodi library\"\"\"\n+ if _check_auto_update_running():\n+ return\nif not ui.ask_for_confirmation(common.get_local_string(30125),\ncommon.get_local_string(30126)):\nreturn\n@@ -85,6 +89,8 @@ class LibraryActionExecutor(object):\ndef import_library(self, pathitems): # pylint: disable=unused-argument\n\"\"\"Import previous exported STRM files to add-on and/or convert them to the current STRM format type\"\"\"\n+ if _check_auto_update_running():\n+ return\nif not ui.ask_for_confirmation(common.get_local_string(30140),\ncommon.get_local_string(20135)):\nreturn\n@@ -113,6 +119,8 @@ class LibraryActionExecutor(object):\ndef set_autoupdate_device(self, pathitems): # pylint: disable=unused-argument\n\"\"\"Set the current device to manage auto-update of the shared-library (MySQL)\"\"\"\n+ if _check_auto_update_running():\n+ return\nrandom_uuid = common.get_random_uuid()\nG.LOCAL_DB.set_value('client_uuid', random_uuid)\nG.SHARED_DB.set_value('auto_update_device_uuid', random_uuid)\n@@ -127,3 +135,7 @@ class LibraryActionExecutor(object):\nclient_uuid = G.LOCAL_DB.get_value('client_uuid')\nmsg = common.get_local_string(30210 if client_uuid == uuid else 30211)\nui.show_notification(msg, time=8000)\n+\n+\n+def _check_auto_update_running():\n+ return lib_utils.is_auto_update_library_running(True)\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Protect settings when auto-update is running |
106,046 | 10.08.2020 09:26:25 | -7,200 | 45a77be6ad6c9601564e5832660fc43eecc8d118 | Removed partial HUB integration code | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/globals.py",
"new_path": "resources/lib/globals.py",
"diff": "@@ -196,7 +196,6 @@ class GlobalVariables(object):\n])\nMODE_DIRECTORY = 'directory'\n- MODE_HUB = 'hub'\nMODE_ACTION = 'action'\nMODE_PLAY = 'play'\nMODE_PLAY_STRM = 'play_strm'\n"
},
{
"change_type": "DELETE",
"old_path": "resources/lib/navigation/hub.py",
"new_path": null,
"diff": "-# -*- coding: utf-8 -*-\n-\"\"\"\n- Copyright (C) 2017 Sebastian Golasch (plugin.video.netflix)\n- Copyright (C) 2018 Caphm (original implementation module)\n- Navigation for hub mode\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-import resources.lib.common as common\n-from resources.lib.utils.logging import LOG\n-\n-\n-# Needs skin support!\n-\n-class HubBrowser(object):\n- \"\"\"Fills window properties for browsing the Netflix style Hub\"\"\"\n- # pylint: disable=no-self-use\n- def __init__(self, params):\n- LOG.debug('Initializing \"HubBrowser\" with params: {}', params)\n- self.params = params\n- if 'switch_profile_guid' in params:\n- common.make_call('activate_profile', params['switch_profile_guid'])\n-\n- def browse(self, pathitems):\n- \"\"\"Browse the hub at a given location\"\"\"\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/run_addon.py",
"new_path": "resources/lib/run_addon.py",
"diff": "@@ -133,9 +133,6 @@ def _get_nav_handler(root_handler, pathitems):\nif root_handler == G.MODE_LIBRARY:\nfrom resources.lib.navigation.library import LibraryActionExecutor\nnav_handler = LibraryActionExecutor\n- if root_handler == G.MODE_HUB:\n- from resources.lib.navigation.hub import HubBrowser\n- nav_handler = HubBrowser\nif not nav_handler:\nraise InvalidPathError('No root handler for path {}'.format('/'.join(pathitems)))\nreturn nav_handler\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Removed partial HUB integration code |
106,046 | 10.08.2020 09:55:36 | -7,200 | 43b47e3d2e89b018d8055c109580c04fe1deab29 | Protect nfsession service from possible errors | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/nfsession/nfsession.py",
"new_path": "resources/lib/services/nfsession/nfsession.py",
"diff": "@@ -13,6 +13,7 @@ import resources.lib.common as common\nfrom resources.lib.globals import G\nfrom resources.lib.services.nfsession.directorybuilder.dir_builder import DirectoryBuilder\nfrom resources.lib.services.nfsession.nfsession_ops import NFSessionOperations\n+from resources.lib.utils.logging import LOG\nclass NetflixSession(object):\n@@ -37,8 +38,11 @@ class NetflixSession(object):\ndef library_auto_update(self):\n\"\"\"Run the library auto update\"\"\"\n+ try:\n# Call the function in a thread to return immediately without blocking the service\ncommon.run_threaded(True, self._run_library_auto_update)\n+ except Exception as exc: # pylint: disable=broad-except\n+ LOG.error('library_auto_update raised an error: {}', exc)\ndef _run_library_auto_update(self):\nfrom resources.lib.kodi.library import Library\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Protect nfsession service from possible errors |
106,046 | 12.08.2020 10:23:58 | -7,200 | e384240fff00b775a46daaad6473f16e53d9e601 | Version bump (1.7.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.7.0\" provider-name=\"libdev + jojo + asciidisco + caphm + castagnait\">\n+<addon id=\"plugin.video.netflix\" name=\"Netflix\" version=\"1.7.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.7.0 (2020-07-28)\n--Big improvement in loading lists when you have many titles to My list\n--Refactor of nfsession\n--Refactor/improved library code:\n- -Improved speed and cpu use in autoupdate/sync in background\n- -Suppressed continuous appearance of loading screen when autoupdate/sync in background\n- -Widgets/Favourites managed without profile selection\n- -New Import existing library feature\n- -Play From Here context menu is fixed\n- -Reintroduced UpNext fast video playback feature\n- -Very long list of improvements/fixes full list on GitHub PR-756, PR-761\n--Managed error to account not reactivacted\n--New Chinese (simple) language translation\n--Updated translations it, sv-se, fr, de, jp, kr, hu, pl, es, pt-br, ru\n--Many other changes\n+v1.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+ These 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+-Fixed add-on inaccessibility when the current used profile no more exists\n+-Fixed feature \"Select first unwatched\" on Kodi 18.x\n+-Fixed failure to update nf watched status (seem works better now)\n+-Little speed improvement on add-on sequential executions\n+-Better handled types of exceptions with IPC\n+-Removed disable_modal_error_display expert setting\n+-Some code cleaning with other improvements\n+-Add Hebrew translation\n+-Updated translations it, el, fr, pr_br, jp, kr, hu, po, de, ro, cz, zh_cn\n</news>\n</extension>\n</addon>\n"
},
{
"change_type": "MODIFY",
"old_path": "changelog.txt",
"new_path": "changelog.txt",
"diff": "+v1.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+ These 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+-Fixed add-on inaccessibility when the current used profile no more exists\n+-Fixed feature \"Select first unwatched\" on Kodi 18.x\n+-Fixed failure to update nf watched status (seem works better now)\n+-Little speed improvement on add-on sequential executions\n+-Better handled types of exceptions with IPC\n+-Removed disable_modal_error_display expert setting\n+-Some code cleaning with other improvements\n+-Add Hebrew translation\n+-Updated translations it, el, fr, pr_br, jp, kr, hu, po, de, ro, cz, zh_cn\n+\nv1.7.0 (2020-07-28)\n-Big improvement in loading lists when you have many titles to My list\n-Refactor of nfsession\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Version bump (1.7.1) (#796) |
106,046 | 17.08.2020 15:24:57 | -7,200 | 19e6e9ffc8260c02e0eb770f83d49e352670f5d2 | Fixed http IPC switch regression | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/globals.py",
"new_path": "resources/lib/globals.py",
"diff": "@@ -276,11 +276,11 @@ class GlobalVariables(object):\nself.ADDON.getSettingString('debug_log_level'),\nself.ADDON.getSettingBool('enable_timing'))\n+ self.IPC_OVER_HTTP = self.ADDON.getSettingBool('enable_ipc_over_http')\nself._init_database(self.IS_ADDON_FIRSTRUN or reinitialize_database)\nif self.IS_ADDON_FIRSTRUN or reload_settings:\n# Put here all the global variables that need to be updated when the user changes the add-on settings\n- self.IPC_OVER_HTTP = self.ADDON.getSettingBool('enable_ipc_over_http')\n# Initialize the cache\nself.CACHE_TTL = self.ADDON.getSettingInt('cache_ttl') * 60\nself.CACHE_MYLIST_TTL = self.ADDON.getSettingInt('cache_mylist_ttl') * 60\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Fixed http IPC switch regression |
106,046 | 17.08.2020 15:25:44 | -7,200 | f1878ad9c105eedc49ec9105f092904a179531c7 | Moved cache ttl values to cache mngmnt and other changes | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/globals.py",
"new_path": "resources/lib/globals.py",
"diff": "@@ -255,6 +255,8 @@ class GlobalVariables(object):\nself.IS_SERVICE = True\nself.BASE_URL = '{scheme}://{netloc}'.format(scheme='plugin',\nnetloc=self.ADDON_ID)\n+ from resources.lib.common.kodi_ops import GetKodiVersion\n+ self.KODI_VERSION = GetKodiVersion()\n# Add absolute paths of embedded py packages (packages not supplied by Kodi)\npackages_paths = [\nos.path.join(self.ADDON_DATA_PATH, 'packages', 'mysql-connector-python')\n@@ -280,19 +282,19 @@ class GlobalVariables(object):\nself._init_database(self.IS_ADDON_FIRSTRUN or reinitialize_database)\nif self.IS_ADDON_FIRSTRUN or reload_settings:\n- # Put here all the global variables that need to be updated when the user changes the add-on settings\n+ # Put here all the global variables that need to be updated on service side\n+ # when the user changes the add-on settings\n+ if self.IS_SERVICE:\n# Initialize the cache\n- self.CACHE_TTL = self.ADDON.getSettingInt('cache_ttl') * 60\n- self.CACHE_MYLIST_TTL = self.ADDON.getSettingInt('cache_mylist_ttl') * 60\n- self.CACHE_METADATA_TTL = self.ADDON.getSettingInt('cache_metadata_ttl') * 24 * 60 * 60\n- if self.IS_SERVICE and not reload_settings:\n+ if reload_settings:\n+ self.CACHE_MANAGEMENT.load_ttl_values()\n+ else:\nfrom resources.lib.services.cache.cache_management import CacheManagement\nself.CACHE_MANAGEMENT = CacheManagement()\n+ # Reset the \"settings monitor\" of the service in case of add-on crash\n+ self.settings_monitor_suspend(False)\nfrom resources.lib.common.cache import Cache\nself.CACHE = Cache()\n- self.settings_monitor_suspend(False) # Reset the value in case of addon crash\n- from resources.lib.common.kodi_ops import GetKodiVersion\n- self.KODI_VERSION = GetKodiVersion()\ndef _init_database(self, initialize):\n# Initialize local database\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/cache/cache_management.py",
"new_path": "resources/lib/services/cache/cache_management.py",
"diff": "@@ -59,6 +59,16 @@ class CacheManagement(object):\nself.memory_cache = {}\nself._initialize()\nself.next_schedule = _compute_next_schedule()\n+ self.ttl_values = {}\n+ self.load_ttl_values()\n+\n+ def load_ttl_values(self):\n+ \"\"\"Load the ttl values from add-on settings\"\"\"\n+ self.ttl_values = {\n+ 'CACHE_TTL': G.ADDON.getSettingInt('cache_ttl') * 60,\n+ 'CACHE_MYLIST_TTL': G.ADDON.getSettingInt('cache_mylist_ttl') * 60,\n+ 'CACHE_METADATA_TTL': G.ADDON.getSettingInt('cache_metadata_ttl') * 24 * 60 * 60\n+ }\n@property\ndef identifier_prefix(self):\n@@ -168,7 +178,7 @@ class CacheManagement(object):\nidentifier = self._add_prefix(identifier)\nif not expires:\nif not ttl and bucket['default_ttl']:\n- ttl = getattr(G, bucket['default_ttl'])\n+ ttl = self.ttl_values[bucket['default_ttl']]\nexpires = int(time() + ttl)\ncache_entry = {'expires': expires, 'data': data}\n# Save the item data to memory-cache\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Moved cache ttl values to cache mngmnt and other changes |
106,046 | 17.08.2020 18:27:17 | -7,200 | e27c5b8859118dd141dc76ff62548a6c1dc44512 | Deleted code of settings that no longer exist | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/nfsession/session/access.py",
"new_path": "resources/lib/services/nfsession/session/access.py",
"diff": "@@ -139,14 +139,11 @@ class SessionAccess(SessionCookie, SessionHTTPRequests):\nG.ADDON.setSettingBool('lib_sync_mylist', False)\nG.SHARED_DB.delete_key('sync_mylist_profile_guid')\n- # Disable and reset the auto-select profile\n+ # Disable and reset the profile guid of profile auto-selection\nG.LOCAL_DB.set_value('autoselect_profile_guid', '')\n- G.ADDON.setSetting('autoselect_profile_name', '')\n- G.ADDON.setSettingBool('autoselect_profile_enabled', False)\n- # Reset of selected profile guid for library playback\n+ # Disable and reset the selected profile guid for library playback\nG.LOCAL_DB.set_value('library_playback_profile_guid', '')\n- G.ADDON.setSetting('library_playback_profile', '')\nG.settings_monitor_suspend(False)\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Deleted code of settings that no longer exist |
106,046 | 18.08.2020 10:34:52 | -7,200 | 1e07aa8cd85a0394030477267e767a0e477a4c6d | Reimplemented "All Movies","All TV shows","Browse subgenres" menus | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/navigation/directory.py",
"new_path": "resources/lib/navigation/directory.py",
"diff": "@@ -171,7 +171,7 @@ class Directory(object):\ncall_args = {\n'pathitems': pathitems,\n'menu_data': menu_data,\n- 'sub_genre_id': self.params.get('genre_id'), # Used to show the sub-genre folder (when sub-genre exists)\n+ 'sub_genre_id': self.params.get('sub_genre_id'), # Used to show the sub-genre folder when sub-genres exists\n'perpetual_range_start': self.perpetual_range_start,\n'is_dynamic_id': not G.is_known_menu_context(pathitems[2])\n}\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": "@@ -131,11 +131,9 @@ class DirectoryBuilder(DirectoryPathRequests):\ndef get_genres(self, menu_data, genre_id, force_use_videolist_id):\nif genre_id:\n# Load the LoCo list of the specified genre\n- # Todo\n- raise NotImplementedError()\n- # loco_list = self.req_loco_list_genre(genre_id)\n- # exclude_loco_known = True\n- # else:\n+ loco_list = self.req_loco_list_genre(genre_id)\n+ exclude_loco_known = True\n+ else:\n# Load the LoCo root list filtered by 'loco_contexts' specified in the menu_data\nloco_list = self.req_loco_list_root()\nexclude_loco_known = False\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": "@@ -243,9 +243,11 @@ def _create_videolist_item(list_id, video_list, menu_data, common_data, static_l\n'is_folder': True}\nadd_info_dict_item(dict_item, video_list.videoid, video_list, video_list.data, False, common_data)\ndict_item['art'] = get_art(video_list.videoid, video_list.artitem, common_data['profile_language_code'])\n+ # Add possibility to browse the sub-genres (see build_video_listing)\n+ sub_genre_id = video_list.get('genreId')\n+ params = {'sub_genre_id': unicode(sub_genre_id)} if sub_genre_id else None\ndict_item['url'] = common.build_url(pathitems,\n- # genre_id add possibility to browse the sub-genres (see build_video_listing)\n- params={'genre_id': unicode(video_list.get('genreId'))},\n+ params=params,\nmode=G.MODE_DIRECTORY)\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": "@@ -28,8 +28,7 @@ def add_items_previous_next_page(directory_items, pathitems, perpetual_range_sel\nif pathitems and perpetual_range_selector:\nif 'previous_start' in perpetual_range_selector:\nparams = {'perpetual_range_start': perpetual_range_selector.get('previous_start'),\n- 'genre_id': sub_genre_id if perpetual_range_selector.get('previous_start') == 0 else None}\n- # todo: change params to sub_genre_id\n+ 'sub_genre_id': sub_genre_id if perpetual_range_selector.get('previous_start') == 0 else None}\nprevious_page_item = {\n'url': common.build_url(pathitems=pathitems, params=params, mode=G.MODE_DIRECTORY),\n'label': common.get_local_string(30148),\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": "@@ -53,9 +53,10 @@ class DirectoryPathRequests(object):\n# (when 'loco_known'==True and loco_contexts is set, see MAIN_MENU_ITEMS in globals.py)\n# - To get list items for menus that have multiple contexts set to 'loco_contexts' like 'recommendations' menu\nLOG.debug('Requesting LoCo root lists')\n- paths = ([['loco', {'from': 0, 'to': 50}, \"componentSummary\"]] +\n+ paths = ([['loco', 'componentSummary'],\n+ ['loco', {'from': 0, 'to': 50}, 'componentSummary'],\n# Titles of first 4 videos in each video list (needed only to show titles in the plot description)\n- [['loco', {'from': 0, 'to': 50}, {'from': 0, 'to': 3}, 'reference', ['title', 'summary']]] +\n+ ['loco', {'from': 0, 'to': 50}, {'from': 0, 'to': 3}, 'reference', ['title', 'summary']]] +\n# Art for the first video of each context list (needed only to add art to the menu item)\nbuild_paths(['loco', {'from': 0, 'to': 50}, 0, 'reference'], ART_PARTIAL_PATHS))\ncall_args = {'paths': paths}\n@@ -66,23 +67,16 @@ class DirectoryPathRequests(object):\ndef req_loco_list_genre(self, genre_id):\n\"\"\"Retrieve LoCo for the given genre\"\"\"\nLOG.debug('Requesting LoCo for genre {}', genre_id)\n- # Todo: 20/06/2020 Currently make requests for genres raise this exception from netflix server\n- # (errors visible only with jsonGraph enabled on path request):\n- # Msg: No signature of method: api.Lolomo.getLolomoRequest() is applicable for argument types:\n- # (java.util.ArrayList, null, java.lang.Boolean) values: [[jaw, jawEpisode, jawTrailer], null, false]\n- # ErrCause: groovy.lang.MissingMethodException: No signature of method: api.Lolomo.getLolomoRequest()\n- # is applicable for argument types: (java.util.ArrayList, null, java.lang.Boolean)\n- # values: [[jaw, jawEpisode, jawTrailer], null, false]\n- # For reference the PR to restore the functionality: https://github.com/CastagnaIT/plugin.video.netflix/pull/685\n- paths = ([['genres', genre_id, 'name'] +\n- ['genres', genre_id, 'rw', 'componentSummary'] +\n+ paths = ([['genres', genre_id, 'name'],\n+ ['genres', genre_id, 'rw', 'componentSummary'],\n+ ['genres', genre_id, 'rw', {'from': 0, 'to': 48}, 'componentSummary'],\n# Titles of first 4 videos in each video list (needed only to show titles in the plot description)\n['genres', genre_id, 'rw',\n{'from': 0, 'to': 48}, {'from': 0, 'to': 3}, 'reference', ['title', 'summary']]] +\n# Art for the first video of each context list (needed only to add art to the menu item)\nbuild_paths(['genres', genre_id, 'rw', {'from': 0, 'to': 48}, 0, 'reference'], ART_PARTIAL_PATHS) +\n# IDs and names of sub-genres\n- [['genres', 34399, 'subgenres', {'from': 0, 'to': 30}, ['id', 'name']]])\n+ [['genres', genre_id, 'subgenres', {'from': 0, 'to': 30}, ['id', 'name']]])\ncall_args = {'paths': paths}\npath_response = self.nfsession.path_request(**call_args)\nreturn LoCo(path_response)\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/utils/data_types.py",
"new_path": "resources/lib/utils/data_types.py",
"diff": "@@ -23,8 +23,8 @@ class LoCo(object):\ndef __init__(self, path_response):\nself.data = path_response\nLOG.debug('LoCo data: {}', self.data)\n- _filterout_loco_contexts(self.data, ['billboard'])\nself.id = next(iter(self.data['locos'])) # Get loco root id\n+ _filterout_loco_contexts(self.id, self.data, ['billboard'])\ndef __getitem__(self, key):\nreturn _check_sentinel(self.data['locos'][self.id][key])\n@@ -33,6 +33,15 @@ class LoCo(object):\n\"\"\"Pass call on to the backing dict of this LoLoMo.\"\"\"\nreturn self.data['locos'][self.id].get(key, default)\n+ @property\n+ def lists(self):\n+ \"\"\"Get all video lists\"\"\"\n+ # It is as property to avoid slow down the loading of main menu\n+ lists = {}\n+ for list_id, list_data in iteritems(self.data['lists']): # pylint: disable=unused-variable\n+ lists.update({list_id: VideoListLoCo(self.data, list_id)})\n+ return lists\n+\ndef lists_by_context(self, contexts, break_on_first=False):\n\"\"\"\nGet all video lists of the given contexts\n@@ -278,10 +287,10 @@ def _get_videoids(videos):\nfor video in itervalues(videos)]\n-def _filterout_loco_contexts(data, contexts):\n+def _filterout_loco_contexts(root_id, data, contexts):\n\"\"\"Deletes from the data all records related to the specified contexts\"\"\"\n- root_id = next(iter(data['locos']))\n- for index in range(len(data['locos'][root_id]) - 1, -1, -1):\n+ total_items = data['locos'][root_id]['componentSummary']['length']\n+ for index in range(total_items - 1, -1, -1):\nlist_id = data['locos'][root_id][str(index)][1]\nif not data['lists'][list_id]['componentSummary'].get('context') in contexts:\ncontinue\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Reimplemented "All Movies","All TV shows","Browse subgenres" menus |
106,046 | 20.08.2020 16:05:18 | -7,200 | 6dad16f86df443e5c665efd635f53f582a96ecf1 | Version bump (1.8.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.7.1\" provider-name=\"libdev + jojo + asciidisco + caphm + castagnait\">\n+<addon id=\"plugin.video.netflix\" name=\"Netflix\" version=\"1.8.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.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- These 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--Fixed add-on inaccessibility when the current used profile no more exists\n--Fixed feature \"Select first unwatched\" on Kodi 18.x\n--Fixed failure to update nf watched status (seem works better now)\n--Little speed improvement on add-on sequential executions\n--Better handled types of exceptions with IPC\n--Removed disable_modal_error_display expert setting\n--Some code cleaning with other improvements\n--Add Hebrew translation\n--Updated translations it, el, fr, pr_br, jp, kr, hu, po, de, ro, cz, zh_cn\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</news>\n</extension>\n</addon>\n"
},
{
"change_type": "MODIFY",
"old_path": "changelog.txt",
"new_path": "changelog.txt",
"diff": "+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+\nv1.7.1 (2020-08-12)\n-Added Profiles menu with new profiles context menus:\n* Set for auto-selection\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Version bump (1.8.0) (#814) |
106,046 | 24.08.2020 13:39:16 | -7,200 | 5fbe642f87aa8f04b69c1f072c7e0d86fc526164 | Avoid warn log msg when there are no credentials | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/nfsession/session/access.py",
"new_path": "resources/lib/services/nfsession/session/access.py",
"diff": "@@ -18,7 +18,8 @@ import resources.lib.utils.cookies as cookies\nimport resources.lib.kodi.ui as ui\nfrom resources.lib.utils.esn import get_esn\nfrom resources.lib.common.exceptions import (LoginValidateError, NotConnected, NotLoggedInError,\n- MbrStatusNeverMemberError, MbrStatusFormerMemberError, LoginError)\n+ MbrStatusNeverMemberError, MbrStatusFormerMemberError, LoginError,\n+ MissingCredentialsError)\nfrom resources.lib.database.db_utils import TABLE_SESSION\nfrom resources.lib.globals import G\nfrom resources.lib.services.nfsession.session.cookie import SessionCookie\n@@ -49,6 +50,8 @@ class SessionAccess(SessionCookie, SessionHTTPRequests):\nif not self.is_logged_in():\nself.login()\nreturn True\n+ except MissingCredentialsError:\n+ pass\nexcept exceptions.RequestException as exc:\n# It was not possible to connect to the web service, no connection, network problem, etc\nimport traceback\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Avoid warn log msg when there are no credentials |
106,046 | 24.08.2020 15:00:26 | -7,200 | e8114ce4cf3ec14b64c75cde078bc5558e1259a7 | Add Dialog().browse stub | [
{
"change_type": "MODIFY",
"old_path": "tests/xbmcgui.py",
"new_path": "tests/xbmcgui.py",
"diff": "@@ -139,6 +139,10 @@ class Dialog:\n\"\"\"A stub implementation for the xbmcgui Dialog class select() method\"\"\"\nreturn -1\n+ def browse(self, type, heading, shares, mask=None, useThumbs=False, treatAsFolder=False, defaultt=None, enableMultiple=False): # pylint: disable=redefined-builtin\n+ \"\"\"A stub implementation for the xbmcgui Dialog class browse() method\"\"\"\n+ return ''\n+\n@staticmethod\n# def numeric(type, heading, defaultt=''): # Kodi 18\ndef numeric(type, heading, defaultt='', bHiddenInput=False): # pylint: disable=redefined-builtin\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Add Dialog().browse stub |
106,046 | 24.08.2020 14:48:09 | -7,200 | d36ef7ec701bb4aa3e3186854961b9022b258baa | Add show_browse_dialog | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/kodi/ui/dialogs.py",
"new_path": "resources/lib/kodi/ui/dialogs.py",
"diff": "@@ -133,6 +133,22 @@ 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+ \"\"\"\n+ Show 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+ :return: The selected path as string (or tuple of selected items) if user pressed 'Ok', else None\n+ \"\"\"\n+ ret = G.py2_decode(xbmcgui.Dialog().browse(browse_type, title, shares='local', useThumbs=False, treatAsFolder=False,\n+ defaultt=default_path, enableMultiple=multi_selection))\n+ # Note: when defaultt is set and the user cancel the action (when enableMultiple is False),\n+ # will be returned the defaultt value again, so we avoid this strange behavior...\n+ return None if not ret or ret == default_path else ret\n+\n+\ndef show_dlg_select(title, item_list):\n\"\"\"\nShow a select dialog for a list of objects\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Add show_browse_dialog |
106,046 | 24.08.2020 14:53:10 | -7,200 | 21fba46890ad14936c4752f9e552734e0ca54297 | Implemented browse library path to import | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/kodi/library.py",
"new_path": "resources/lib/kodi/library.py",
"diff": "@@ -303,7 +303,7 @@ class Library(LibraryTasks):\ndelay_anti_ban()\nreturn True\n- def import_library(self):\n+ def import_library(self, path):\n\"\"\"\nImports an already existing exported STRM library into the add-on library database,\nallows you to restore an existing library, by avoiding to recreate it from scratch.\n@@ -317,7 +317,7 @@ class Library(LibraryTasks):\nremove_folders = [] # List of failed imports paths to be optionally removed\nremove_titles = [] # List of failed imports titles to be optionally removed\n# Start importing STRM files\n- folders = get_library_subfolders(FOLDER_NAME_MOVIES) + get_library_subfolders(FOLDER_NAME_SHOWS)\n+ folders = 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:\nfolder_name = os.path.basename(G.py2_decode(xbmc.translatePath(folder_path)))\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/kodi/library_utils.py",
"new_path": "resources/lib/kodi/library_utils.py",
"diff": "@@ -37,9 +37,9 @@ def get_library_path():\nelse G.DATA_PATH)\n-def get_library_subfolders(folder_name):\n+def get_library_subfolders(folder_name, custom_lib_path=None):\n\"\"\"Returns all the subfolders contained in a folder of library path\"\"\"\n- section_path = common.join_folders_paths(get_library_path(), folder_name)\n+ section_path = common.join_folders_paths(custom_lib_path or get_library_path(), folder_name)\nreturn [common.join_folders_paths(section_path, G.py2_decode(folder))\nfor folder\nin common.list_dir(section_path)[0]]\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/navigation/library.py",
"new_path": "resources/lib/navigation/library.py",
"diff": "@@ -91,10 +91,12 @@ class LibraryActionExecutor(object):\n\"\"\"Import previous exported STRM files to add-on and/or convert them to the current STRM format type\"\"\"\nif _check_auto_update_running():\nreturn\n+ path = ui.show_browse_dialog(common.get_local_string(651), default_path=G.DATA_PATH)\n+ if path:\nif not ui.ask_for_confirmation(common.get_local_string(30140),\ncommon.get_local_string(20135)):\nreturn\n- get_library_cls().import_library()\n+ get_library_cls().import_library(path)\[email protected]_video_id(path_offset=1)\ndef export_new_episodes(self, videoid):\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Implemented browse library path to import |
106,046 | 25.08.2020 15:41:45 | -7,200 | f7990cb9d5f854257a24a05945d195a2195e21f4 | Add some data to http requests and login | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/msl/msl_requests.py",
"new_path": "resources/lib/services/msl/msl_requests.py",
"diff": "@@ -41,7 +41,8 @@ class MSLRequests(MSLRequestBuilder):\nself.session.headers.update({\n'User-Agent': common.get_user_agent(),\n'Content-Type': 'text/plain',\n- 'Accept': '*/*'\n+ 'Accept': '*/*',\n+ 'Host': 'www.netflix.com'\n})\nself._load_msl_data(msl_data)\nself.msl_switch_requested = False\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/nfsession/session/access.py",
"new_path": "resources/lib/services/nfsession/session/access.py",
"diff": "@@ -103,7 +103,8 @@ class SessionAccess(SessionCookie, SessionHTTPRequests):\nLOG.debug('Logging in...')\nlogin_response = self.post(\n'login',\n- data=_login_payload(common.get_credentials(), auth_url))\n+ headers={'Accept-Language': _get_accept_language_string(react_context)},\n+ data=_login_payload(common.get_credentials(), auth_url, react_context))\ntry:\nwebsite.extract_session_data(login_response, validate=True, update_profiles=True)\nLOG.info('Login successful')\n@@ -167,7 +168,13 @@ class SessionAccess(SessionCookie, SessionHTTPRequests):\ncommon.container_update(G.BASE_URL, True)\n-def _login_payload(credentials, auth_url):\n+def _login_payload(credentials, auth_url, react_context):\n+ country_id = react_context['models']['loginContext']['data']['geo']['requestCountry']['id']\n+ country_codes = react_context['models']['countryCodes']['data']['codes']\n+ try:\n+ country_code = '+' + next(dict_item for dict_item in country_codes if dict_item[\"id\"] == country_id)['code']\n+ except StopIteration:\n+ country_code = ''\nreturn {\n'userLoginId': credentials.get('email'),\n'password': credentials.get('password'),\n@@ -175,8 +182,29 @@ def _login_payload(credentials, auth_url):\n'flow': 'websiteSignUp',\n'mode': 'login',\n'action': 'loginAction',\n- 'withFields': 'rememberMe,nextPage,userLoginId,password',\n+ 'withFields': 'rememberMe,nextPage,userLoginId,password,countryCode,countryIsoCode',\n'authURL': auth_url,\n'nextPage': '',\n- 'showPassword': ''\n+ 'showPassword': '',\n+ 'countryCode': country_code,\n+ 'countryIsoCode': country_id\n}\n+\n+\n+def _get_accept_language_string(react_context):\n+ # Set the HTTP header 'Accept-Language' allow to get http strings in the right language,\n+ # and also influence the reactContext data (locale data and messages strings).\n+ # Locale is usually automatically determined by the browser,\n+ # we try get the locale code by reading the locale set as default in the reactContext.\n+ supported_locales = react_context['models']['loginContext']['data']['geo']['supportedLocales']\n+ try:\n+ locale = next(dict_item for dict_item in supported_locales if dict_item[\"default\"] is True)['locale']\n+ except StopIteration:\n+ locale = ''\n+ locale_fallback = 'en-US'\n+ if locale and locale != locale_fallback:\n+ return '{loc},{loc_l};q=0.9,{loc_fb};q=0.8,{loc_fb_l};q=0.7'.format(\n+ loc=locale, loc_l=locale[:2],\n+ loc_fb=locale_fallback, loc_fb_l=locale_fallback[:2])\n+ return '{loc},{loc_l};q=0.9'.format(\n+ loc=locale_fallback, loc_l=locale_fallback[:2])\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/nfsession/session/base.py",
"new_path": "resources/lib/services/nfsession/session/base.py",
"diff": "@@ -45,7 +45,8 @@ class SessionBase(object):\nself.session.max_redirects = 10 # Too much redirects should means some problem\nself.session.headers.update({\n'User-Agent': common.get_user_agent(enable_android_mediaflag_fix=True),\n- 'Accept-Encoding': 'gzip, deflate, br'\n+ 'Accept-Encoding': 'gzip, deflate, br',\n+ 'Host': 'www.netflix.com'\n})\nLOG.info('Initialized new session')\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/nfsession/session/http_requests.py",
"new_path": "resources/lib/services/nfsession/session/http_requests.py",
"diff": "@@ -62,6 +62,8 @@ class SessionHTTPRequests(SessionBase):\ndata=data)\nLOG.debug('Request took {}s', perf_clock() - start)\nLOG.debug('Request returned status code {}', response.status_code)\n+ # for redirect in response.history:\n+ # LOG.warn('Redirected to: [{}] {}', redirect.status_code, redirect.url)\nif not session_refreshed:\n# We refresh the session when happen:\n# Error 404: It happen when Netflix update the build_identifier version and causes the api address to change\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Add some data to http requests and login |
106,046 | 25.08.2020 20:11:40 | -7,200 | 9d9c486244f8b7aa9f11e6804d9901585d2a1e43 | Save credentials only when login successfully
Fixes add-on startup problems when unexpected exceptions happens in the
login action | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/common/credentials.py",
"new_path": "resources/lib/common/credentials.py",
"diff": "@@ -90,14 +90,12 @@ def check_credentials():\nreturn False\n-def set_credentials(email, password):\n+def set_credentials(credentials):\n\"\"\"\n- Encrypt account credentials and save them to the settings.\n- Does nothing if either email or password are not supplied.\n+ Encrypt account credentials and save them.\n\"\"\"\n- if email and password:\n- G.LOCAL_DB.set_value('account_email', encrypt_credential(email.strip()))\n- G.LOCAL_DB.set_value('account_password', encrypt_credential(password.strip()))\n+ G.LOCAL_DB.set_value('account_email', encrypt_credential(credentials['email']))\n+ G.LOCAL_DB.set_value('account_password', encrypt_credential(credentials['password']))\ndef purge_credentials():\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/kodi/ui/dialogs.py",
"new_path": "resources/lib/kodi/ui/dialogs.py",
"diff": "@@ -38,7 +38,10 @@ def ask_credentials():\ncommon.verify_credentials(email)\npassword = ask_for_password()\ncommon.verify_credentials(password)\n- common.set_credentials(email, password)\n+ return {\n+ 'email': email.strip(),\n+ 'password': password.strip()\n+ }\ndef ask_for_password():\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/nfsession/session/access.py",
"new_path": "resources/lib/services/nfsession/session/access.py",
"diff": "@@ -94,7 +94,7 @@ class SessionAccess(SessionCookie, SessionHTTPRequests):\nreturn self.post(endpoint, **kwargs)\n@measure_exec_time_decorator(is_immediate=True)\n- def login(self):\n+ def login(self, credentials=None):\n\"\"\"Perform account login\"\"\"\ntry:\n# First we get the authentication url without logging in, required for login API call\n@@ -104,9 +104,12 @@ class SessionAccess(SessionCookie, SessionHTTPRequests):\nlogin_response = self.post(\n'login',\nheaders={'Accept-Language': _get_accept_language_string(react_context)},\n- data=_login_payload(common.get_credentials(), auth_url, react_context))\n- try:\n+ data=_login_payload(credentials or common.get_credentials(), auth_url, react_context))\n+\nwebsite.extract_session_data(login_response, validate=True, update_profiles=True)\n+ if credentials:\n+ # Save credentials only when login has succeeded\n+ common.set_credentials(credentials)\nLOG.info('Login successful')\nui.show_notification(common.get_local_string(30109))\ncookies.save(self.account_hash, self.session.cookies)\n@@ -116,12 +119,13 @@ class SessionAccess(SessionCookie, SessionHTTPRequests):\ncommon.purge_credentials()\nraise_from(LoginError(unicode(exc)), exc)\nexcept (MbrStatusNeverMemberError, MbrStatusFormerMemberError) as exc:\n+ self.session.cookies.clear()\nLOG.warn('Membership status {} not valid for login', exc)\nraise_from(LoginError(common.get_local_string(30180)), exc)\nexcept Exception: # pylint: disable=broad-except\n+ self.session.cookies.clear()\nimport traceback\nLOG.error(G.py2_decode(traceback.format_exc(), 'latin-1'))\n- self.session.cookies.clear()\nraise\n@measure_exec_time_decorator(is_immediate=True)\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/utils/api_requests.py",
"new_path": "resources/lib/utils/api_requests.py",
"diff": "@@ -50,9 +50,8 @@ def logout():\ndef login(ask_credentials=True):\n\"\"\"Perform a login\"\"\"\ntry:\n- if ask_credentials:\n- ui.ask_credentials()\n- if not common.make_call('login'):\n+ credentials = {'credentials': ui.ask_credentials()} if ask_credentials else None\n+ if not common.make_call('login', credentials):\nreturn False\nreturn True\nexcept MissingCredentialsError:\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Save credentials only when login successfully
Fixes add-on startup problems when unexpected exceptions happens in the
login action |
106,046 | 25.08.2020 20:20:35 | -7,200 | 68d3924b7e76db1a8e538db47421dc86e2d5a804 | Changed "rememberMe" to False in login payload | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/services/nfsession/session/access.py",
"new_path": "resources/lib/services/nfsession/session/access.py",
"diff": "@@ -179,10 +179,12 @@ def _login_payload(credentials, auth_url, react_context):\ncountry_code = '+' + next(dict_item for dict_item in country_codes if dict_item[\"id\"] == country_id)['code']\nexcept StopIteration:\ncountry_code = ''\n+ # 25/08/2020 since a few days there are login problems, by returning the \"incorrect password\" error even\n+ # when it is correct, it seems that setting 'rememberMe' to 'false' increases a bit the probabilities of success\nreturn {\n'userLoginId': credentials.get('email'),\n'password': credentials.get('password'),\n- 'rememberMe': 'true',\n+ 'rememberMe': 'false',\n'flow': 'websiteSignUp',\n'mode': 'login',\n'action': 'loginAction',\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Changed "rememberMe" to False in login payload |
106,046 | 26.08.2020 20:32:45 | -7,200 | 0b82b97809c224e088f0f2f756d0cd7815146c39 | Add _executemany_non_query | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/database/db_base_sqlite.py",
"new_path": "resources/lib/database/db_base_sqlite.py",
"diff": "@@ -107,6 +107,19 @@ class SQLiteDatabase(db_base.BaseDatabase):\nif self.conn:\nself.conn.close()\n+ def _executemany_non_query(self, query, params, cursor=None):\n+ try:\n+ if cursor is None:\n+ cursor = self.get_cursor()\n+ cursor.executemany(query, params)\n+ except sql.Error as exc:\n+ LOG.error('SQLite error {}:', exc.args[0])\n+ raise_from(DBSQLiteError, exc)\n+ except ValueError:\n+ LOG.error('Value {}', str(params))\n+ LOG.error('Value type {}', type(params))\n+ raise\n+\ndef _execute_non_query(self, query, params=None, cursor=None, **kwargs):\ntry:\nif cursor is None:\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Add _executemany_non_query |
106,046 | 27.08.2020 18:37:20 | -7,200 | e6dcd3827fafa37e0416304f5caea1e2edd27026 | Permanently disabled cacheToDisc
The benefit is not clear apparently not seem works good
when enabled is shown the cached directory items, but the add-on is always recalled to
get the list, for what reason? | [
{
"change_type": "MODIFY",
"old_path": "resources/lib/navigation/directory.py",
"new_path": "resources/lib/navigation/directory.py",
"diff": "@@ -68,7 +68,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, False, True)\n+ self.home(None, True)\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@@ -87,11 +87,11 @@ class Directory(object):\n# The standard kodi theme does not allow to change view type if the content is \"files\" type,\n# so here we use \"images\" type, visually better to see\nfinalize_directory(convert_list_to_dir_items(list_data), G.CONTENT_IMAGES)\n- end_of_directory(True, False)\n+ end_of_directory(True)\n@measure_exec_time_decorator()\n@custom_viewmode(G.VIEW_MAINMENU)\n- def home(self, pathitems=None, cache_to_disc=True, is_autoselect_profile=False): # pylint: disable=unused-argument\n+ def home(self, pathitems=None, is_autoselect_profile=False): # pylint: disable=unused-argument\n\"\"\"Show home listing\"\"\"\nif 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@@ -103,7 +103,7 @@ class Directory(object):\nfinalize_directory(convert_list_to_dir_items(list_data), G.CONTENT_FOLDER,\ntitle=(G.LOCAL_DB.get_profile_config('profileName', '???') +\n' - ' + common.get_local_string(30097)))\n- end_of_directory(True, cache_to_disc)\n+ end_of_directory(True)\n@measure_exec_time_decorator()\[email protected]_video_id(path_offset=0, inject_full_pathitems=True)\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/navigation/directory_search.py",
"new_path": "resources/lib/navigation/directory_search.py",
"diff": "@@ -64,7 +64,7 @@ def search_list(dir_update_listing=False):\nsort_type = 'sort_label_ignore_folders'\nfinalize_directory(convert_list_to_dir_items(list_data), G.CONTENT_FOLDER, sort_type,\ncommon.get_local_string(30400))\n- end_of_directory(dir_update_listing, cache_to_disc=False)\n+ end_of_directory(dir_update_listing)\ndef search_add():\n"
},
{
"change_type": "MODIFY",
"old_path": "resources/lib/navigation/directory_utils.py",
"new_path": "resources/lib/navigation/directory_utils.py",
"diff": "@@ -116,12 +116,12 @@ def finalize_directory(items, content_type=G.CONTENT_FOLDER, sort_type='sort_not\nxbmcplugin.addDirectoryItems(G.PLUGIN_HANDLE, items)\n-def end_of_directory(dir_update_listing, cache_to_disc=True):\n+def end_of_directory(dir_update_listing):\n# If dir_update_listing=True overwrite the history list, so we can get back to the main page\nxbmcplugin.endOfDirectory(G.PLUGIN_HANDLE,\nsucceeded=True,\nupdateListing=dir_update_listing,\n- cacheToDisc=cache_to_disc)\n+ cacheToDisc=False)\ndef get_title(menu_data, extra_data):\n"
}
] | Python | MIT License | castagnait/plugin.video.netflix | Permanently disabled cacheToDisc
The benefit is not clear apparently not seem works good
when enabled is shown the cached directory items, but the add-on is always recalled to
get the list, for what reason? |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.