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,047
04.05.2020 20:32:56
14,400
257485964b7f68ae1c55b559d840316bee4ab105
remove fractional seconds sent in logblobs
[ { "change_type": "MODIFY", "old_path": "resources/lib/services/msl/msl_utils.py", "new_path": "resources/lib/services/msl/msl_utils.py", "diff": "@@ -199,7 +199,7 @@ def generate_logblobs_params():\n# 'jssid': '15822792997793', # Same value of appId\n# 'jsoffms': 1261,\n'clienttime': timestamp,\n- 'client_utc': timestamp_utc,\n+ 'client_utc': int(timestamp_utc),\n'uiver': g.LOCAL_DB.get_value('ui_version', '', table=TABLE_SESSION)\n}\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
remove fractional seconds sent in logblobs
106,046
05.05.2020 09:01:36
-7,200
0e112ab67672c75f90e8d7dcdceaef4afbfdca88
Reorganized service playback modules
[ { "change_type": "MODIFY", "old_path": "resources/lib/kodi/infolabels.py", "new_path": "resources/lib/kodi/infolabels.py", "diff": "@@ -320,7 +320,7 @@ def set_watched_status(dict_item, video_data, common_data):\nvideo_data.get('creditsOffset', video_data['runtime']))\n# To avoid asking to the server again the entire list of titles (after watched a video)\n- # to get the updated value, we override the value with the value saved in memory (see progress_manager.py)\n+ # to get the updated value, we override the value with the value saved in memory (see am_video_events.py)\ntry:\nbookmark_position = g.CACHE.get(CACHE_BOOKMARKS, video_id)\nexcept CacheMiss:\n" }, { "change_type": "MODIFY", "old_path": "resources/lib/navigation/player.py", "new_path": "resources/lib/navigation/player.py", "diff": "@@ -50,7 +50,7 @@ INPUTSTREAM_SERVER_CERTIFICATE = (\ndef play(videoid):\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 controller.py\n+ # For db settings 'upnext_play_callback_received' and 'upnext_play_callback_file_type' see action_controller.py\nis_upnext_callback_received = g.LOCAL_DB.get_value('upnext_play_callback_received', False)\nis_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" }, { "change_type": "MODIFY", "old_path": "resources/lib/run_service.py", "new_path": "resources/lib/run_service.py", "diff": "@@ -99,7 +99,7 @@ class NetflixService(object):\n\"\"\"\nStart the background services\n\"\"\"\n- from resources.lib.services.playback.controller import PlaybackController\n+ from resources.lib.services.playback.action_controller import ActionController\nfrom resources.lib.services.library_updater import LibraryUpdateService\nfrom resources.lib.services.settings_monitor import SettingsMonitor\nfor server in self.SERVERS:\n@@ -107,7 +107,7 @@ class NetflixService(object):\nserver['instance'].timeout = 1\nserver['thread'].start()\ninfo('[{}] Thread started'.format(server['name']))\n- self.controller = PlaybackController()\n+ self.controller = ActionController()\nself.library_updater = LibraryUpdateService()\nself.settings_monitor = SettingsMonitor()\n# Mark the service as active\n" }, { "change_type": "MODIFY", "old_path": "resources/lib/services/msl/msl_handler.py", "new_path": "resources/lib/services/msl/msl_handler.py", "diff": "@@ -128,7 +128,7 @@ class MSLHandler(object):\nexpiration = int(manifest['expiration'] / 1000)\nif (expiration - time.time()) < 14400:\n# Some devices remain active even longer than 48 hours, if the manifest is at the limit of the deadline\n- # when requested by stream_continuity.py / events_handler.py will cause problems\n+ # when requested by am_stream_continuity.py / events_handler.py will cause problems\n# if it is already expired, so we guarantee a minimum of safety ttl of 4h (14400s = 4 hours)\nraise CacheMiss()\nif common.is_debug_verbose():\n" }, { "change_type": "RENAME", "old_path": "resources/lib/services/playback/controller.py", "new_path": "resources/lib/services/playback/action_controller.py", "diff": "@@ -16,15 +16,15 @@ import xbmc\nimport resources.lib.common as common\nfrom resources.lib.globals import g\nfrom resources.lib.kodi import ui\n-from .action_manager import PlaybackActionManager\n-from .progress_manager import ProgressManager\n-from .resume_manager import ResumeManager\n-from .section_skipping import SectionSkipper\n-from .stream_continuity import StreamContinuityManager\n-from .upnext import UpNextNotifier\n+from .action_manager import ActionManager\n+from .am_video_events import AMVideoEvents\n+from .am_playback import AMPlayback\n+from .am_section_skipping import AMSectionSkipper\n+from .am_stream_continuity import AMStreamContinuity\n+from .am_upnext_notifier import AMUpNextNotifier\n-class PlaybackController(xbmc.Monitor):\n+class ActionController(xbmc.Monitor):\n\"\"\"\nTracks status and progress of video playbacks initiated by the add-on\n\"\"\"\n@@ -47,13 +47,13 @@ class PlaybackController(xbmc.Monitor):\n_reset_upnext_callback_state()\nself.active_player_id = None\nself.action_managers = [\n- ResumeManager(),\n- SectionSkipper(),\n- StreamContinuityManager(),\n- ProgressManager(),\n- UpNextNotifier()\n+ AMPlayback(),\n+ AMSectionSkipper(),\n+ AMStreamContinuity(),\n+ AMVideoEvents(),\n+ AMUpNextNotifier()\n]\n- self._notify_all(PlaybackActionManager.initialize, data)\n+ self._notify_all(ActionManager.call_initialize, data)\nself.tracking = True\ndef onNotification(self, sender, method, data): # pylint: disable=unused-argument\n@@ -84,16 +84,16 @@ class PlaybackController(xbmc.Monitor):\ndef on_service_tick(self):\n\"\"\"\n- Notify action managers of playback tick\n+ Notify to action managers that an interval of time has elapsed\n\"\"\"\nif self.tracking and self.active_player_id is not None:\nplayer_state = self._get_player_state()\nif player_state:\n- self._notify_all(PlaybackActionManager.on_tick, player_state)\n+ self._notify_all(ActionManager.call_on_tick, player_state)\ndef _on_playback_started(self):\nplayer_id = _get_player_id()\n- self._notify_all(PlaybackActionManager.on_playback_started, self._get_player_state(player_id))\n+ self._notify_all(ActionManager.call_on_playback_started, self._get_player_state(player_id))\nif common.is_debug_verbose() and g.ADDON.getSettingBool('show_codec_info'):\ncommon.json_rpc('Input.ExecuteAction', {'action': 'codecinfo'})\nself.active_player_id = player_id\n@@ -102,21 +102,21 @@ class PlaybackController(xbmc.Monitor):\nif self.tracking and self.active_player_id is not None:\nplayer_state = self._get_player_state()\nif player_state:\n- self._notify_all(PlaybackActionManager.on_playback_seek,\n+ self._notify_all(ActionManager.call_on_playback_seek,\nplayer_state)\ndef _on_playback_pause(self):\nif self.tracking and self.active_player_id is not None:\nplayer_state = self._get_player_state()\nif player_state:\n- self._notify_all(PlaybackActionManager.on_playback_pause,\n+ self._notify_all(ActionManager.call_on_playback_pause,\nplayer_state)\ndef _on_playback_resume(self):\nif self.tracking and self.active_player_id is not None:\nplayer_state = self._get_player_state()\nif player_state:\n- self._notify_all(PlaybackActionManager.on_playback_resume,\n+ self._notify_all(ActionManager.call_on_playback_resume,\nplayer_state)\ndef _on_playback_stopped(self):\n@@ -124,11 +124,11 @@ class PlaybackController(xbmc.Monitor):\nself.active_player_id = None\n# Immediately send the request to release the license\ncommon.send_signal(signal=common.Signals.RELEASE_LICENSE, non_blocking=True)\n- self._notify_all(PlaybackActionManager.on_playback_stopped)\n+ self._notify_all(ActionManager.call_on_playback_stopped)\nself.action_managers = None\ndef _notify_all(self, notification, data=None):\n- common.debug('Notifying all managers of {} (data={})', notification.__name__, data)\n+ common.debug('Notifying all action managers of {} (data={})', notification.__name__, data)\nfor manager in self.action_managers:\n_notify_managers(manager, notification, data)\n" }, { "change_type": "MODIFY", "old_path": "resources/lib/services/playback/action_manager.py", "new_path": "resources/lib/services/playback/action_manager.py", "diff": "@@ -13,11 +13,13 @@ from resources.lib.globals import g\nimport resources.lib.common as common\n-class PlaybackActionManager(object):\n+class ActionManager(object):\n\"\"\"\n- Base class for managers that handle executing of specific actions\n- during playback\n+ Base class for managers that handle executing of specific actions during playback\n\"\"\"\n+\n+ SETTING_ID = None # ID of the settings.xml property\n+\ndef __init__(self):\nself._enabled = None\n@@ -34,8 +36,7 @@ class PlaybackActionManager(object):\n\"\"\"\nif self._enabled is None:\ncommon.debug('Loading enabled setting from store')\n- self._enabled = g.ADDON.getSettingBool(\n- '{}_enabled'.format(self.__class__.__name__))\n+ self._enabled = g.ADDON.getSettingBool(self.SETTING_ID)\nreturn self._enabled\n@@ -43,57 +44,56 @@ class PlaybackActionManager(object):\ndef enabled(self, enabled):\nself._enabled = enabled\n- def initialize(self, data):\n+ def call_initialize(self, data):\n\"\"\"\nInitialize the manager with data when the addon initiates a playback.\n\"\"\"\n- self._call_if_enabled(self._initialize, data=data)\n+ self._call_if_enabled(self.initialize, data=data)\ncommon.debug('Initialized {}: {}', self.name, self)\n- def on_playback_started(self, player_state):\n+ def call_on_playback_started(self, player_state):\n\"\"\"\nNotify that the playback has actually started and supply initial\nplayer state\n\"\"\"\n- self._call_if_enabled(self._on_playback_started,\n- player_state=player_state)\n+ self._call_if_enabled(self.on_playback_started, player_state=player_state)\n- def on_tick(self, player_state):\n+ def call_on_tick(self, player_state):\n\"\"\"\nNotify that a playback tick has passed and supply current player state\n\"\"\"\n- self._call_if_enabled(self._on_tick, player_state=player_state)\n+ self._call_if_enabled(self.on_tick, player_state=player_state)\n- def on_playback_seek(self, player_state):\n+ def call_on_playback_seek(self, player_state):\n\"\"\"\nNotify that a playback has seek\n\"\"\"\n- self._call_if_enabled(self._on_playback_seek, player_state=player_state)\n+ self._call_if_enabled(self.on_playback_seek, player_state=player_state)\n- def on_playback_pause(self, player_state):\n+ def call_on_playback_pause(self, player_state):\n\"\"\"\nNotify that the playback is actually in pause\n\"\"\"\n- self._call_if_enabled(self._on_playback_pause, player_state=player_state)\n+ self._call_if_enabled(self.on_playback_pause, player_state=player_state)\n- def on_playback_resume(self, player_state):\n+ def call_on_playback_resume(self, player_state):\n\"\"\"\nNotify that the playback has been resumed\n\"\"\"\n- self._call_if_enabled(self._on_playback_resume, player_state=player_state)\n+ self._call_if_enabled(self.on_playback_resume, player_state=player_state)\n- def on_playback_stopped(self):\n+ def call_on_playback_stopped(self):\n\"\"\"\nNotify that a playback has stopped\n\"\"\"\n- self._call_if_enabled(self._on_playback_stopped)\n+ self._call_if_enabled(self.on_playback_stopped)\nself.enabled = None\ndef _call_if_enabled(self, target_func, **kwargs):\nif self.enabled:\ntarget_func(**kwargs)\n- def _initialize(self, data):\n+ def initialize(self, data):\n\"\"\"\nInitialize the manager for a new playback.\nIf preconditions are not met, this should raise an exception so the\n@@ -101,14 +101,14 @@ class PlaybackActionManager(object):\n\"\"\"\nraise NotImplementedError\n- def _on_playback_started(self, player_state):\n+ def on_playback_started(self, player_state):\n\"\"\"\nThis method is called when video playback starts\nNOTE: If possible never use sleep delay inside this method\notherwise it delay the execution of subsequent action managers\n\"\"\"\n- def _on_tick(self, player_state):\n+ def on_tick(self, player_state):\n\"\"\"\nThis method is called every second from the service,\nbut only after the 'on_playback_started' method will be called.\n@@ -117,14 +117,14 @@ class PlaybackActionManager(object):\n\"\"\"\nraise NotImplementedError\n- def _on_playback_seek(self, player_state):\n+ def on_playback_seek(self, player_state):\npass\n- def _on_playback_pause(self, player_state):\n+ def on_playback_pause(self, player_state):\npass\n- def _on_playback_resume(self, player_state):\n+ def on_playback_resume(self, player_state):\npass\n- def _on_playback_stopped(self):\n+ def on_playback_stopped(self):\npass\n" }, { "change_type": "RENAME", "old_path": "resources/lib/services/playback/resume_manager.py", "new_path": "resources/lib/services/playback/am_playback.py", "diff": "\"\"\"\nCopyright (C) 2017 Sebastian Golasch (plugin.video.netflix)\nCopyright (C) 2019 Smeulf (original implementation module)\n- Force resume when item played from the library\n+ Operations for changing the playback status\nSPDX-License-Identifier: MIT\nSee LICENSES/MIT.md for more information.\n@@ -13,29 +13,30 @@ import xbmc\nimport resources.lib.common as common\n-from .action_manager import PlaybackActionManager\n+from .action_manager import ActionManager\n-class ResumeManager(PlaybackActionManager):\n- \"\"\"\n- Checks if a resume action must be done\n- \"\"\"\n+class AMPlayback(ActionManager):\n+ \"\"\"Operations for changing the playback status\"\"\"\n+\n+ SETTING_ID = 'ResumeManager_enabled'\n- def __init__(self): # pylint: disable=super-on-old-class\n- super(ResumeManager, self).__init__()\n+ def __init__(self):\n+ super(AMPlayback, self).__init__()\nself.resume_position = None\nself.enabled = True\ndef __str__(self):\nreturn 'enabled={}'.format(self.enabled)\n- def _initialize(self, data):\n+ def initialize(self, data):\n+ # Due to a bug on Kodi the resume on SRTM files not works correctly, so we force the skip to the resume point\nself.resume_position = data.get('resume_position')\n- def _on_playback_started(self, player_state):\n+ def on_playback_started(self, player_state):\nif self.resume_position:\n- common.info('ResumeManager forced resume point to {}', self.resume_position)\n+ common.info('AMPlayback has forced resume point to {}', self.resume_position)\nxbmc.Player().seekTime(int(self.resume_position))\n- def _on_tick(self, player_state):\n+ def on_tick(self, player_state):\npass\n" }, { "change_type": "RENAME", "old_path": "resources/lib/services/playback/section_skipping.py", "new_path": "resources/lib/services/playback/am_section_skipping.py", "diff": "@@ -14,16 +14,19 @@ import xbmc\nimport resources.lib.common as common\nimport resources.lib.kodi.ui as ui\nfrom resources.lib.globals import g\n-from .action_manager import PlaybackActionManager\n+from .action_manager import ActionManager\nfrom .markers import SKIPPABLE_SECTIONS, get_timeline_markers\n-class SectionSkipper(PlaybackActionManager):\n+class AMSectionSkipper(ActionManager):\n\"\"\"\nChecks if a skippable section has been reached and takes appropriate action\n\"\"\"\n+\n+ SETTING_ID = 'SectionSkipper_enabled'\n+\ndef __init__(self):\n- super(SectionSkipper, self).__init__()\n+ super(AMSectionSkipper, self).__init__()\nself.markers = {}\nself.auto_skip = False\nself.pause_on_skip = False\n@@ -33,12 +36,12 @@ class SectionSkipper(PlaybackActionManager):\n.format(self.enabled, self.markers, self.auto_skip,\nself.pause_on_skip))\n- def _initialize(self, data):\n+ def initialize(self, data):\nself.markers = get_timeline_markers(data['metadata'][0])\nself.auto_skip = g.ADDON.getSettingBool('auto_skip_credits')\nself.pause_on_skip = g.ADDON.getSettingBool('pause_on_skip')\n- def _on_tick(self, player_state):\n+ def on_tick(self, player_state):\nfor section in SKIPPABLE_SECTIONS:\nself._check_section(section, player_state['elapsed_seconds'])\n@@ -80,6 +83,6 @@ class SectionSkipper(PlaybackActionManager):\nskip_to=self.markers[section]['end'],\nlabel=common.get_local_string(SKIPPABLE_SECTIONS[section]))\n- def _on_playback_stopped(self):\n+ def on_playback_stopped(self):\n# Close any dialog remaining open\nxbmc.executebuiltin('Dialog.Close(all,true)')\n" }, { "change_type": "RENAME", "old_path": "resources/lib/services/playback/stream_continuity.py", "new_path": "resources/lib/services/playback/am_stream_continuity.py", "diff": "\"\"\"\nCopyright (C) 2017 Sebastian Golasch (plugin.video.netflix)\nCopyright (C) 2018 Caphm (original implementation module)\n- Remember and restore audio stream / subtitle settings between individual\n- episodes of a tv show or movie\n+ Remember and restore audio stream / subtitle settings between individual episodes of a tv show or movie\nSPDX-License-Identifier: MIT\nSee LICENSES/MIT.md for more information.\n@@ -15,7 +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 .action_manager import PlaybackActionManager\n+from .action_manager import ActionManager\nSTREAMS = {\n'audio': {\n@@ -35,14 +34,16 @@ STREAMS = {\n}\n-class StreamContinuityManager(PlaybackActionManager):\n+class AMStreamContinuity(ActionManager):\n\"\"\"\nDetects changes in audio / subtitle streams during playback, saves them\nfor the currently playing show and restores them on subsequent episodes.\n\"\"\"\n- def __init__(self): # pylint: disable=super-on-old-class\n- super(StreamContinuityManager, self).__init__()\n+ SETTING_ID = 'StreamContinuityManager_enabled'\n+\n+ def __init__(self):\n+ super(AMStreamContinuity, self).__init__()\nself.videoid = None\nself.current_videoid = None\nself.current_streams = {}\n@@ -53,7 +54,11 @@ class StreamContinuityManager(PlaybackActionManager):\nself.legacy_kodi_version = g.KODI_VERSION.is_major_ver('18')\nself.kodi_only_forced_subtitles = None\n- def _initialize(self, data):\n+ def __str__(self):\n+ return ('enabled={}, current_videoid={}'\n+ .format(self.enabled, self.current_videoid))\n+\n+ def initialize(self, data):\nself.videoid = common.VideoId.from_dict(data['videoid'])\nif self.videoid.mediatype not in [common.VideoId.MOVIE, common.VideoId.EPISODE]:\nself.enabled = False\n@@ -65,7 +70,7 @@ class StreamContinuityManager(PlaybackActionManager):\nself.current_videoid.value, {})\nself.kodi_only_forced_subtitles = common.get_kodi_subtitle_language() == 'forced_only'\n- def _on_playback_started(self, player_state):\n+ def on_playback_started(self, player_state):\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@@ -82,7 +87,7 @@ class StreamContinuityManager(PlaybackActionManager):\n# changed by restore, otherwise when _on_tick is executed it will save twice unnecessarily\nxbmc.sleep(1000)\n- def _on_tick(self, player_state):\n+ def on_tick(self, player_state):\nself.player_state = player_state\n# Check if the audio stream is changed\ncurrent_stream = self.current_streams['audio']\n@@ -275,10 +280,6 @@ class StreamContinuityManager(PlaybackActionManager):\n# subtitleenabled is boolean and not a dict\nreturn stream_a == stream_b\n- def __repr__(self):\n- return ('enabled={}, current_videoid={}'\n- .format(self.enabled, self.current_videoid))\n-\ndef _filter_streams(streams, filter_name, match_value):\nreturn [dict_stream for dict_stream in streams if\n" }, { "change_type": "RENAME", "old_path": "resources/lib/services/playback/upnext.py", "new_path": "resources/lib/services/playback/am_upnext_notifier.py", "diff": "@@ -13,22 +13,25 @@ import xbmc\nimport resources.lib.common as common\nfrom resources.lib.globals import g\n-from .action_manager import PlaybackActionManager\n+from .action_manager import ActionManager\n-class UpNextNotifier(PlaybackActionManager):\n+class AMUpNextNotifier(ActionManager):\n\"\"\"\nPrepare the data and trigger the AddonSignal for Up Next add-on integration.\nThe signal must be sent after playback started.\n\"\"\"\n+\n+ SETTING_ID = 'UpNextNotifier_enabled'\n+\ndef __init__(self):\n- super(UpNextNotifier, self).__init__()\n+ super(AMUpNextNotifier, self).__init__()\nself.upnext_info = None\ndef __str__(self):\nreturn 'enabled={}'.format(self.enabled)\n- def _initialize(self, data):\n+ def initialize(self, data):\nif not data['videoid_next_episode'] or not data['info_data']:\nreturn\nvideoid = common.VideoId.from_dict(data['videoid'])\n@@ -36,11 +39,11 @@ class UpNextNotifier(PlaybackActionManager):\nself.upnext_info = get_upnext_info(videoid, videoid_next_episode, data['info_data'], data['metadata'],\ndata['is_played_from_addon'])\n- def _on_playback_started(self, player_state): # pylint: disable=unused-argument\n+ def on_playback_started(self, player_state): # pylint: disable=unused-argument\ncommon.debug('Sending initialization signal to Up Next Add-on')\ncommon.send_signal(common.Signals.UPNEXT_ADDON_INIT, self.upnext_info, non_blocking=True)\n- def _on_tick(self, player_state):\n+ def on_tick(self, player_state):\npass\n" }, { "change_type": "RENAME", "old_path": "resources/lib/services/playback/progress_manager.py", "new_path": "resources/lib/services/playback/am_video_events.py", "diff": "@@ -15,14 +15,16 @@ import resources.lib.common as common\nfrom resources.lib.common.cache_utils import CACHE_BOOKMARKS\nfrom resources.lib.globals import g\nfrom resources.lib.services.msl.msl_utils import EVENT_START, EVENT_ENGAGE, EVENT_STOP, EVENT_KEEP_ALIVE\n-from .action_manager import PlaybackActionManager\n+from .action_manager import ActionManager\n-class ProgressManager(PlaybackActionManager):\n+class AMVideoEvents(ActionManager):\n\"\"\"Detect the progress of the played video and send the data to the netflix service\"\"\"\n- def __init__(self): # pylint: disable=super-on-old-class\n- super(ProgressManager, self).__init__()\n+ SETTING_ID = 'ProgressManager_enabled'\n+\n+ def __init__(self):\n+ super(AMVideoEvents, self).__init__()\nself.event_data = {}\nself.videoid = None\nself.is_event_start_sent = False\n@@ -34,15 +36,18 @@ class ProgressManager(PlaybackActionManager):\nself.allow_request_update_lolomo = False\nself.window_cls = Window(10000) # Kodi home window\n- def _initialize(self, data):\n+ def __str__(self):\n+ return 'enabled={}'.format(self.enabled)\n+\n+ def initialize(self, data):\nif not data['event_data']:\n- common.warn('ProgressManager: disabled due to no event data')\n+ common.warn('AMVideoEvents: disabled due to no event data')\nself.enabled = False\nreturn\nself.event_data = data['event_data']\nself.videoid = common.VideoId.from_dict(data['videoid'])\n- def _on_tick(self, player_state):\n+ def on_tick(self, player_state):\nif self.lock_events:\nreturn\nif self.is_player_in_pause and (self.tick_elapsed - self.last_tick_count) >= 1800:\n@@ -53,8 +58,8 @@ class ProgressManager(PlaybackActionManager):\nself.lock_events = True\nelse:\nif not self.is_event_start_sent:\n- # We do not use _on_playback_started() to send EVENT_START, because StreamContinuityManager\n- # and ResumeManager may cause inconsistencies with the content of player_state data\n+ # We do not use _on_playback_started() to send EVENT_START, because the action managers\n+ # AMStreamContinuity and AMPlayback may cause inconsistencies with the content of player_state data\n# When the playback starts for the first time, for correctness should send elapsed_seconds value to 0\nif self.tick_elapsed < 5 and self.event_data['resume_position'] is None:\n@@ -88,14 +93,14 @@ class ProgressManager(PlaybackActionManager):\ndef on_playback_seek(self, player_state):\nif not self.is_event_start_sent or self.lock_events:\n- # This might happen when ResumeManager skip is performed\n+ # This might happen when the action manager AMPlayback perform a video skip\nreturn\nself._reset_tick_count()\nself._send_event(EVENT_ENGAGE, self.event_data, player_state)\nself._save_resume_time(player_state['elapsed_seconds'])\nself.allow_request_update_lolomo = True\n- def _on_playback_stopped(self):\n+ def on_playback_stopped(self):\nif not self.is_event_start_sent or self.lock_events:\nreturn\nself._reset_tick_count()\n@@ -118,7 +123,7 @@ class ProgressManager(PlaybackActionManager):\ndef _send_event(self, event_type, event_data, player_state):\nif not player_state:\n- common.warn('ProgressManager: the event [{}] cannot be sent, missing player_state data', event_type)\n+ common.warn('AMVideoEvents: the event [{}] cannot be sent, missing player_state data', event_type)\nreturn\nevent_data['allow_request_update_lolomo'] = self.allow_request_update_lolomo\ncommon.send_signal(common.Signals.QUEUE_VIDEO_EVENT, {\n@@ -126,6 +131,3 @@ class ProgressManager(PlaybackActionManager):\n'event_data': event_data,\n'player_state': player_state\n}, non_blocking=True)\n-\n- def __repr__(self):\n- return 'enabled={}'.format(self.enabled)\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
Reorganized service playback modules
106,046
03.05.2020 20:35:25
-7,200
e51c2ed1af9e6998edc0f4b47b5b9b4186ee517a
Removed not needed imports
[ { "change_type": "MODIFY", "old_path": "resources/lib/services/playback/__init__.py", "new_path": "resources/lib/services/playback/__init__.py", "diff": "# -*- coding: utf-8 -*-\n-\"\"\"\n- Copyright (C) 2017 Sebastian Golasch (plugin.video.netflix)\n- Copyright (C) 2018 Caphm (original implementation module)\n- Playback tracking and coordination of several actions during playback\n+# Copyright (C) 2017 Sebastian Golasch (plugin.video.netflix)\n+# Copyright (C) 2018 Caphm (original implementation module)\n- SPDX-License-Identifier: MIT\n- See LICENSES/MIT.md for more information.\n-\"\"\"\n-from __future__ import absolute_import, division, unicode_literals\n-\n-from .markers import get_timeline_markers\n+# SPDX-License-Identifier: MIT\n+# See LICENSES/MIT.md for more information.\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
Removed not needed imports
106,046
04.05.2020 10:22:54
-7,200
e144959a9e8e6d5b1df9cad7cd9e87f403c72cdb
Set time limit for paused playback
[ { "change_type": "MODIFY", "old_path": "resources/lib/services/playback/am_playback.py", "new_path": "resources/lib/services/playback/am_playback.py", "diff": "\"\"\"\nfrom __future__ import absolute_import, division, unicode_literals\n+import time\n+\nimport xbmc\nimport resources.lib.common as common\n@@ -25,6 +27,8 @@ class AMPlayback(ActionManager):\nsuper(AMPlayback, self).__init__()\nself.resume_position = None\nself.enabled = True\n+ self.start_time = None\n+ self.is_player_in_pause = False\ndef __str__(self):\nreturn 'enabled={}'.format(self.enabled)\n@@ -39,4 +43,17 @@ class AMPlayback(ActionManager):\nxbmc.Player().seekTime(int(self.resume_position))\ndef on_tick(self, player_state):\n- pass\n+ # Stops playback when paused for more than one hour.\n+ # Some users leave the playback paused also for more than 12 hours,\n+ # this complicates things to resume playback, because the manifest data expires and with it also all\n+ # the streams urls are no longer guaranteed, so we force the stop of the playback.\n+ if self.is_player_in_pause and (time.time() - self.start_time) > 3600:\n+ common.info('The playback has been stopped because it has been exceeded 1 hour of pause')\n+ common.stop_playback()\n+\n+ def on_playback_pause(self, player_state):\n+ self.start_time = time.time()\n+ self.is_player_in_pause = True\n+\n+ def on_playback_resume(self, player_state):\n+ self.is_player_in_pause = False\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
Set time limit for paused playback
106,046
05.05.2020 09:35:09
-7,200
c87ed30ffda7f448b02458fcb4802f7da8bf0097
Assign proper cdn id after
[ { "change_type": "MODIFY", "old_path": "resources/lib/services/msl/converter.py", "new_path": "resources/lib/services/msl/converter.py", "diff": "@@ -157,7 +157,7 @@ def _convert_video_downloadable(downloadable, adaptation_set, init_length, cdn_i\nrepresentation = ET.SubElement(\nadaptation_set, # Parent\n'Representation', # Tag\n- id=str(downloadable['urls'][0]['cdn_id']),\n+ id=str(downloadable['urls'][cdn_index]['cdn_id']),\nwidth=str(downloadable['res_w']),\nheight=str(downloadable['res_h']),\nbandwidth=str(downloadable['bitrate'] * 1024),\n@@ -214,7 +214,7 @@ def _convert_audio_downloadable(downloadable, adaptation_set, init_length, chann\nrepresentation = ET.SubElement(\nadaptation_set, # Parent\n'Representation', # Tag\n- id=str(downloadable['urls'][0]['cdn_id']),\n+ id=str(downloadable['urls'][cdn_index]['cdn_id']),\ncodecs=codec_type,\nbandwidth=str(downloadable['bitrate'] * 1024),\nmimeType='audio/mp4')\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
Assign proper cdn id after ae8e17aea7478ba24c7281c10e4fe6b83cfebd69
106,046
05.05.2020 14:23:53
-7,200
11a4b12d98f9bb1e9e64e9e580171e3d8e657172
Try handle MSL error "Email or password is incorrect"
[ { "change_type": "MODIFY", "old_path": "resources/lib/services/msl/msl_handler.py", "new_path": "resources/lib/services/msl/msl_handler.py", "diff": "@@ -21,6 +21,7 @@ from resources.lib.database.db_utils import TABLE_SESSION\nfrom resources.lib.globals import g\nfrom .converter import convert_to_dash\nfrom .events_handler import EventsHandler\n+from .exceptions import MSLError\nfrom .msl_requests import MSLRequests\nfrom .msl_utils import ENDPOINTS, display_error_info, MSL_DATA_FILENAME\nfrom .profiles import enabled_profiles\n@@ -96,7 +97,17 @@ class MSLHandler(object):\n:param viewable_id: The id of of the viewable\n:return: MPD XML Manifest or False if no success\n\"\"\"\n+ try:\nmanifest = self._load_manifest(viewable_id, g.get_esn())\n+ except MSLError as exc:\n+ if 'Email or password is incorrect' in str(exc):\n+ # Known cases when MSL error \"Email or password is incorrect.\" can happen:\n+ # - If user change the password when the nf session was still active\n+ # - Netflix has reset the password for suspicious activity when the nf session was still active\n+ # Then clear the credentials and also user tokens.\n+ common.purge_credentials()\n+ self.msl_requests.crypto.clear_user_id_tokens()\n+ raise\n# Disable 1080p Unlock for now, as it is broken due to Netflix changes\n# if (g.ADDON.getSettingBool('enable_1080p_unlock') and\n# not g.ADDON.getSettingBool('enable_vp9_profiles') and\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
Try handle MSL error "Email or password is incorrect"
106,046
05.05.2020 14:27:19
-7,200
cbdca686b541a572572ed301d15d7a38409295e5
Fixed password validity check regression
[ { "change_type": "MODIFY", "old_path": "resources/lib/services/nfsession/nfsession.py", "new_path": "resources/lib/services/nfsession/nfsession.py", "diff": "@@ -19,7 +19,8 @@ from resources.lib.globals import g\nfrom resources.lib.services.directorybuilder.dir_builder import DirectoryBuilder\nfrom resources.lib.services.nfsession.nfsession_access import NFSessionAccess\nfrom resources.lib.services.nfsession.nfsession_base import needs_login\n-from resources.lib.api.exceptions import MissingCredentialsError\n+from resources.lib.api.exceptions import (NotLoggedInError, MissingCredentialsError, WebsiteParsingError,\n+ InvalidMembershipStatusAnonymous, LoginValidateErrorIncorrectPassword)\nclass NetflixSession(NFSessionAccess, DirectoryBuilder):\n@@ -79,7 +80,7 @@ class NetflixSession(NFSessionAccess, DirectoryBuilder):\ncommon.debug('Fetch initial page')\nresponse = self._get('browse')\n# Update the session data, the profiles data to the database, and update the authURL\n- api_data = website.extract_session_data(response, update_profiles=True)\n+ api_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\nself.is_profile_session_active = api_data['is_profile_session_active']\n@@ -98,7 +99,7 @@ class NetflixSession(NFSessionAccess, DirectoryBuilder):\ncommon.info('Activating profile {}', guid)\n# INIT Method 1 - HTTP mode\nresponse = self._get('switch_profile', params={'tkn': guid})\n- self.auth_url = website.extract_session_data(response)['auth_url']\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\n@@ -259,6 +260,20 @@ class NetflixSession(NFSessionAccess, DirectoryBuilder):\ndata=data)\nreturn response_data['jsonGraph']\n+ def website_extract_session_data(self, content, **kwargs):\n+ \"\"\"Extract session data and handle errors\"\"\"\n+ try:\n+ return website.extract_session_data(content, **kwargs)\n+ except (WebsiteParsingError, InvalidMembershipStatusAnonymous, LoginValidateErrorIncorrectPassword) as exc:\n+ common.warn('Session data not valid, login can be expired or the password has been changed ({})',\n+ type(exc).__name__)\n+ if isinstance(exc, (InvalidMembershipStatusAnonymous, LoginValidateErrorIncorrectPassword)):\n+ common.purge_credentials()\n+ self.session.cookies.clear()\n+ common.send_signal(signal=common.Signals.CLEAR_USER_ID_TOKENS)\n+ raise NotLoggedInError\n+ raise\n+\ndef _set_range_selector(paths, range_start, range_end):\n\"\"\"Replace the RANGE_SELECTOR placeholder with an actual dict:\n" }, { "change_type": "MODIFY", "old_path": "resources/lib/services/nfsession/nfsession_requests.py", "new_path": "resources/lib/services/nfsession/nfsession_requests.py", "diff": "@@ -106,10 +106,6 @@ class NFSessionRequests(NFSessionBase):\nexcept InvalidMembershipStatusError:\nraise\nexcept (WebsiteParsingError, InvalidMembershipStatusAnonymous, LoginValidateErrorIncorrectPassword) as exc:\n- # Possible known causes:\n- # -Cookies may not work anymore most likely due to updates in the website\n- # -Login password has been changed\n- # -Expired cookie profiles? might cause InvalidMembershipStatusAnonymous (i am not really sure)\nimport traceback\ncommon.warn('Failed to refresh session data, login can be expired or the password has been changed ({})',\ntype(exc).__name__)\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
Fixed password validity check regression
106,046
05.05.2020 10:07:15
-7,200
75e39d5df3728941b9f9894010fb9a2cfceac3a3
Version bump (1.2.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.2.0\" provider-name=\"libdev + jojo + asciidisco + caphm + castagnait\">\n+<addon id=\"plugin.video.netflix\" name=\"Netflix\" version=\"1.2.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.2.0 (2020-04-22)\n--Parental control temporary disabled due to Netflix changes\n--New cache management\n--Add-on now is ready to works also on systems with special chars in the system path\n--Implemented profile PIN protection\n--Implemented masked PIN input (Kodi 19)\n--Implemented auto purge cache of expired items\n--Implemented paginated list of seasons\n--Implemented cache to search menu\n--Implemented Up Next also with \"Sync of watched status with Netflix\" feature\n--Add support to Python 3.8\n--Add title to search page\n--Add profile name to homepage title\n--Add a better handling of lolomo error with sync of watched status enabled\n--Add romanian, swedish translation\n--Improved watched status threshold\n--Improved watched status update in the GUI display\n--Improved catch of possible errors in events module\n-To see the full list of changes read the changelog.txt\n+v1.2.1 (2020-05-05)\n+-Reviewed access and profile selection to mitigate http error 401 (not resolved)\n+-Add Open Connect CDN setting\n+-Set time limit for paused playback\n+-Fixed a issue caused wrong date in viewing activity\n+-Fixed dash content protection data\n+-Fixed a issue caused UpNext to crash\n+-Fixed a issue caused KeyError when play videos\n+-Fixed a issue caused TypeError on more addon rollback\n+-Fixed a issue caused a double profile switch on selection\n+-Fixed a issue caused slow playback video starts (on windows)\n+-Fixed a issue caused missing of h265 media flag\n+-Fixed broken \"force the update of my list\" context menu\n+-Some changes for Kodi 19 due to API changes\n+-Updated translations de, it\n+-Other minor improvements/changes\n</news>\n</extension>\n</addon>\n" }, { "change_type": "MODIFY", "old_path": "changelog.txt", "new_path": "changelog.txt", "diff": "+v1.2.1 (2020-05-05)\n+-Reviewed access and profile selection to mitigate http error 401 (not resolved)\n+-Add Open Connect CDN setting\n+-Set time limit for paused playback\n+-Fixed a issue caused wrong date in viewing activity\n+-Fixed dash content protection data\n+-Fixed a issue caused UpNext to crash\n+-Fixed a issue caused KeyError when play videos\n+-Fixed a issue caused TypeError on more addon rollback\n+-Fixed a issue caused a double profile switch on selection\n+-Fixed a issue caused slow playback video starts (on windows)\n+-Fixed a issue caused missing of h265 media flag\n+-Fixed broken \"force the update of my list\" context menu\n+-Some changes for Kodi 19 due to API changes\n+-Updated translations de, it\n+-Other minor improvements/changes\n+\nv1.2.0 (2020-04-22)\n-Parental control temporary disabled due to Netflix changes\n-New cache management\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
Version bump (1.2.1)
106,046
06.05.2020 17:27:39
-7,200
664ce5981a6ca9c389a57f410ef9f89cd329c323
Avoid save msl data if token is the same
[ { "change_type": "MODIFY", "old_path": "resources/lib/services/msl/base_crypto.py", "new_path": "resources/lib/services/msl/base_crypto.py", "diff": "@@ -98,11 +98,14 @@ class MSLBaseCrypto(object):\ndef save_user_id_token(self, profile_guid, user_token_id):\n\"\"\"Save or update a user id token associated to a profile guid\"\"\"\nif 'user_id_tokens' not in self._msl_data:\n+ save_msl_data = True\nself._msl_data['user_id_tokens'] = {\nprofile_guid: user_token_id\n}\nelse:\n+ save_msl_data = not self._msl_data['user_id_tokens'].get(profile_guid) == user_token_id\nself._msl_data['user_id_tokens'][profile_guid] = user_token_id\n+ if save_msl_data:\nself._save_msl_data()\ndef clear_user_id_tokens(self):\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
Avoid save msl data if token is the same
106,046
06.05.2020 19:51:03
-7,200
18242cf88b61c3681889debc177f37138f376399
Kodi 19 now use 'inputstream' ref.
[ { "change_type": "MODIFY", "old_path": "resources/lib/navigation/player.py", "new_path": "resources/lib/navigation/player.py", "diff": "@@ -152,7 +152,7 @@ def get_inputstream_listitem(videoid):\nmanifest_path = MANIFEST_PATH_FORMAT.format(videoid=videoid.value)\nlist_item = xbmcgui.ListItem(path=service_url + manifest_path, offscreen=True)\nlist_item.setContentLookup(False)\n- list_item.setMimeType('application/dash+xml')\n+ list_item.setMimeType('application/xml+dash')\nlist_item.setProperty('isFolder', 'false')\nlist_item.setProperty('IsPlayable', 'true')\n@@ -186,7 +186,7 @@ def get_inputstream_listitem(videoid):\nkey=is_helper.inputstream_addon + '.server_certificate',\nvalue=INPUTSTREAM_SERVER_CERTIFICATE)\nlist_item.setProperty(\n- key='inputstreamaddon',\n+ key='inputstreamaddon' if g.KODI_VERSION.is_major_ver('18') else 'inputstream',\nvalue=is_helper.inputstream_addon)\nreturn list_item\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
Kodi 19 now use 'inputstream' ref. https://forum.kodi.tv/showthread.php?tid=353560&pid=2941249#pid2941249
106,046
07.05.2020 14:59:34
-7,200
6e03d5d8f939541465e12489d2cb37379f47f57a
Fixed dash content protection
[ { "change_type": "MODIFY", "old_path": "resources/lib/services/msl/converter.py", "new_path": "resources/lib/services/msl/converter.py", "diff": "@@ -88,18 +88,25 @@ def _get_protection_info(content):\ndef _add_protection_info(adaptation_set, pssh, keyid):\nif keyid:\n+ # Signaling presence of encrypted content\nfrom base64 import standard_b64decode\n- protection = ET.SubElement(\n+ ET.SubElement(\nadaptation_set, # Parent\n'ContentProtection', # Tag\n- value='cenc',\n- schemeIdUri='urn:mpeg:dash:mp4protection:2011')\n- protection.set('cenc:default_KID', str(uuid.UUID(bytes=standard_b64decode(keyid))))\n- else:\n+ attrib={\n+ 'schemeIdUri': 'urn:mpeg:dash:mp4protection:2011',\n+ 'cenc:default_KID': str(uuid.UUID(bytes=standard_b64decode(keyid))),\n+ 'value': 'cenc'\n+ })\n+ # Define the DRM system configuration\nprotection = ET.SubElement(\nadaptation_set, # Parent\n'ContentProtection', # Tag\n- schemeIdUri='urn:uuid:EDEF8BA9-79D6-4ACE-A3C8-27DCD51D21ED') # Widevine UUID\n+ attrib={\n+ 'schemeIdUri': 'urn:uuid:EDEF8BA9-79D6-4ACE-A3C8-27DCD51D21ED',\n+ 'value': 'widevine'\n+ })\n+ # Add child tags to the DRM system configuration ('widevine:license' is an ISA custom tag)\nET.SubElement(\nprotection, # Parent\n'widevine:license', # Tag\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
Fixed dash content protection
106,046
07.05.2020 15:12:07
-7,200
411872c32e532311e32f8bcef19e8eef944fd63a
Version bump (1.2.2)
[ { "change_type": "MODIFY", "old_path": "addon.xml", "new_path": "addon.xml", "diff": "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n-<addon id=\"plugin.video.netflix\" name=\"Netflix\" version=\"1.2.1\" provider-name=\"libdev + jojo + asciidisco + caphm + castagnait\">\n+<addon id=\"plugin.video.netflix\" name=\"Netflix\" version=\"1.2.2\" provider-name=\"libdev + jojo + asciidisco + caphm + castagnait\">\n<requires>\n<import addon=\"xbmc.python\" version=\"2.26.0\"/>\n<import addon=\"script.module.addon.signals\" version=\"0.0.3\"/>\n<forum>https://forum.kodi.tv/showthread.php?tid=329767</forum>\n<source>https://github.com/CastagnaIT/plugin.video.netflix</source>\n<news>\n-v1.2.1 (2020-05-05)\n--Reviewed access and profile selection to mitigate http error 401 (not resolved)\n--Add Open Connect CDN setting\n--Set time limit for paused playback\n--Fixed a issue caused wrong date in viewing activity\n--Fixed dash content protection data\n--Fixed a issue caused UpNext to crash\n--Fixed a issue caused KeyError when play videos\n--Fixed a issue caused TypeError on more addon rollback\n--Fixed a issue caused a double profile switch on selection\n--Fixed a issue caused slow playback video starts (on windows)\n--Fixed a issue caused missing of h265 media flag\n--Fixed broken \"force the update of my list\" context menu\n--Some changes for Kodi 19 due to API changes\n--Updated translations de, it\n--Other minor improvements/changes\n+v1.2.2 (2020-05-07)\n+-Fixed a issue regression caused problems to 1080P/4K playback\n</news>\n</extension>\n</addon>\n" }, { "change_type": "MODIFY", "old_path": "changelog.txt", "new_path": "changelog.txt", "diff": "+v1.2.2 (2020-05-07)\n+-Fixed a issue regression caused problems to 1080P/4K playback\n+\nv1.2.1 (2020-05-05)\n-Reviewed access and profile selection to mitigate http error 401 (not resolved)\n-Add Open Connect CDN setting\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
Version bump (1.2.2)
105,993
09.05.2020 10:28:46
-7,200
0032c8d0122f908c55d9a60e73208c0e9c560a26
Fix an Ubuntu issue with the add-on check
[ { "change_type": "MODIFY", "old_path": ".github/workflows/addon-check.yml", "new_path": ".github/workflows/addon-check.yml", "diff": "@@ -22,7 +22,7 @@ jobs:\npython-version: 3.8\n- name: Install dependencies\nrun: |\n- sudo apt-get install libxml2-utils xmlstarlet\n+ sudo apt-get install xmlstarlet\npython -m pip install --upgrade pip packaging\n# FIXME: Requires changes from xbmc/addon-check#217\n#pip install kodi-addon-checker\n@@ -31,7 +31,10 @@ jobs:\nrun: awk '/export-ignore/ { print $1 }' .gitattributes | xargs rm -rf --\nworking-directory: ${{ github.repository }}\n- name: Rewrite addon.xml for Matrix\n- run: xmlstarlet ed -L -u '/addon/requires/import[@addon=\"xbmc.python\"]/@version' -v \"3.0.0\" addon.xml\n+ run: |\n+ xmlstarlet ed -L -u '/addon/requires/import[@addon=\"xbmc.python\"]/@version' -v \"3.0.0\" addon.xml\n+ version=$(xmlstarlet sel -t -v 'string(/addon/@version)' addon.xml)\n+ xmlstarlet ed -L -u '/addon/@version' -v \"${version}+matrix.99\" addon.xml\nworking-directory: ${{ github.repository }}\nif: matrix.kodi-branch == 'matrix'\n- name: Run kodi-addon-checker\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
Fix an Ubuntu issue with the add-on check
106,046
09.05.2020 15:29:35
-7,200
4e83ef40ea65494d2098f3ccc3c18a47dd0a87c2
Changed param name 'component' to 'endpoint'
[ { "change_type": "MODIFY", "old_path": "resources/lib/api/api_requests.py", "new_path": "resources/lib/api/api_requests.py", "diff": "@@ -145,7 +145,7 @@ def rate(videoid, rating):\nrating = min(10, max(0, rating)) / 2\ncommon.make_call(\n'post',\n- {'component': 'set_video_rating',\n+ {'endpoint': 'set_video_rating',\n'data': {\n'titleId': int(videoid.value),\n'rating': rating}})\n@@ -160,7 +160,7 @@ def rate_thumb(videoid, rating, track_id_jaw):\nevent_uuid = common.get_random_uuid()\nresponse = common.make_call(\n'post',\n- {'component': 'set_thumb_rating',\n+ {'endpoint': 'set_thumb_rating',\n'data': {\n'eventUuid': event_uuid,\n'titleId': int(videoid.value),\n@@ -182,7 +182,7 @@ def update_my_list(videoid, operation, params):\ncommon.debug('My List: {} {}', operation, videoid)\ncommon.make_call(\n'post',\n- {'component': 'update_my_list',\n+ {'endpoint': 'update_my_list',\n'data': {\n'operation': operation,\n'videoId': videoid.value}})\n@@ -273,7 +273,7 @@ def _metadata(video_id):\nmetadata_data = ipc_call(\n'get',\n{\n- 'component': 'metadata',\n+ 'endpoint': 'metadata',\n'params': {'movieid': video_id.value,\n'_': int(time.time())}\n})\n@@ -298,7 +298,7 @@ def set_parental_control_data(data):\ntry:\nreturn common.make_call(\n'post',\n- {'component': 'pin_service',\n+ {'endpoint': 'pin_service',\n'data': {'maturityLevel': data['maturity_level'],\n'password': common.get_credentials().get('password'),\n'pin': data['pin']}}\n@@ -313,7 +313,7 @@ def verify_pin(pin):\ntry:\nreturn common.make_call(\n'post',\n- {'component': 'pin_service',\n+ {'endpoint': 'pin_service',\n'data': {'pin': pin}}\n).get('success', False)\nexcept Exception: # pylint: disable=broad-except\n@@ -326,7 +326,7 @@ def verify_profile_lock(guid, pin):\ntry:\nreturn common.make_call(\n'post',\n- {'component': 'profile_lock',\n+ {'endpoint': 'profile_lock',\n'data': {'pin': pin,\n'action': 'verify',\n'guid': guid}}\n" }, { "change_type": "MODIFY", "old_path": "resources/lib/services/nfsession/nfsession.py", "new_path": "resources/lib/services/nfsession/nfsession.py", "diff": "@@ -218,7 +218,7 @@ class NetflixSession(NFSessionAccess, DirectoryBuilder):\n# Use separators with dumps because Netflix rejects spaces\ndata = 'path=' + '&path='.join(json.dumps(path, separators=(',', ':')) for path in paths)\nresponse = self._post(\n- component='shakti',\n+ endpoint='shakti',\nparams=custom_params,\ndata=data)\nreturn response['jsonGraph'] if use_jsongraph else response['value']\n@@ -255,7 +255,7 @@ class NetflixSession(NFSessionAccess, DirectoryBuilder):\njson.dumps(path_suffix, separators=(',', ':')) for path_suffix in path_suffixs)\n# common.debug('callPath request data: {}', data)\nresponse_data = self._post(\n- component='shakti',\n+ endpoint='shakti',\nparams=custom_params,\ndata=data)\nreturn response_data['jsonGraph']\n" }, { "change_type": "MODIFY", "old_path": "resources/lib/services/nfsession/nfsession_requests.py", "new_path": "resources/lib/services/nfsession/nfsession_requests.py", "diff": "@@ -29,34 +29,34 @@ class NFSessionRequests(NFSessionBase):\[email protected]_return_call\n@needs_login\n- def get(self, component, **kwargs):\n- \"\"\"Execute a GET request to the designated component's URL.\"\"\"\n- return self._get(component, **kwargs)\n+ def get(self, endpoint, **kwargs):\n+ \"\"\"Execute a GET request to the designated endpoint.\"\"\"\n+ return self._get(endpoint, **kwargs)\[email protected]_return_call\n@needs_login\n- def post(self, component, **kwargs):\n- \"\"\"Execute a POST request to the designated component's URL.\"\"\"\n- return self._post(component, **kwargs)\n+ def post(self, endpoint, **kwargs):\n+ \"\"\"Execute a POST request to the designated endpoint.\"\"\"\n+ return self._post(endpoint, **kwargs)\n- def _get(self, component, **kwargs):\n+ def _get(self, endpoint, **kwargs):\nreturn self._request_call(\nmethod=self.session.get,\n- component=component,\n+ endpoint=endpoint,\n**kwargs)\n- def _post(self, component, **kwargs):\n+ def _post(self, endpoint, **kwargs):\nreturn self._request_call(\nmethod=self.session.post,\n- component=component,\n+ endpoint=endpoint,\n**kwargs)\[email protected]_execution(immediate=True)\n- def _request_call(self, method, component, **kwargs):\n- return self._request(method, component, None, **kwargs)\n+ def _request_call(self, method, endpoint, **kwargs):\n+ return self._request(method, endpoint, None, **kwargs)\n- def _request(self, method, component, session_refreshed, **kwargs):\n- endpoint_conf = ENDPOINTS[component]\n+ def _request(self, method, endpoint, session_refreshed, **kwargs):\n+ endpoint_conf = ENDPOINTS[endpoint]\nurl = (_api_url(endpoint_conf['address'])\nif endpoint_conf['is_api_call']\nelse _document_url(endpoint_conf['address']))\n@@ -78,7 +78,7 @@ class NFSessionRequests(NFSessionBase):\n# So let's try refreshing the session data (just once)\ncommon.warn('Try refresh session data due to {} http error', response.status_code)\nif self.try_refresh_session_data():\n- return self._request(method, component, True, **kwargs)\n+ return self._request(method, endpoint, True, **kwargs)\nif response.status_code == 401:\n# 30/04/2020: first signal of http error 401 issues\n# After the profile selection sometime can happen the http error 401 Client Error: Unauthorized for url ...\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
Changed param name 'component' to 'endpoint'
106,046
08.05.2020 20:48:53
-7,200
ac5610bd3ce8ff85d7865dd62991cd687547251b
Add option to append text to endpoint address
[ { "change_type": "MODIFY", "old_path": "resources/lib/services/nfsession/nfsession_requests.py", "new_path": "resources/lib/services/nfsession/nfsession_requests.py", "diff": "@@ -59,7 +59,7 @@ class NFSessionRequests(NFSessionBase):\nendpoint_conf = ENDPOINTS[endpoint]\nurl = (_api_url(endpoint_conf['address'])\nif endpoint_conf['is_api_call']\n- else _document_url(endpoint_conf['address']))\n+ else _document_url(endpoint_conf['address'], kwargs))\ncommon.debug('Executing {verb} request to {url}',\nverb='GET' if method == self.session.get else 'POST', url=url)\ndata, headers, params = self._prepare_request_properties(endpoint_conf, kwargs)\n@@ -180,7 +180,9 @@ class NFSessionRequests(NFSessionBase):\nreturn data_converted, headers, params\n-def _document_url(endpoint_address):\n+def _document_url(endpoint_address, kwargs):\n+ if 'append_to_address' in kwargs:\n+ endpoint_address = endpoint_address.format(kwargs['append_to_address'])\nreturn BASE_URL + endpoint_address\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
Add option to append text to endpoint address
106,046
09.05.2020 17:18:56
-7,200
78cf682f6bcd05d0d040b0b3a842b1708ce8cb0a
Implemented convert list of dict items to list of ListItems
[ { "change_type": "MODIFY", "old_path": "resources/lib/navigation/directory.py", "new_path": "resources/lib/navigation/directory.py", "diff": "@@ -17,7 +17,7 @@ import resources.lib.kodi.library as library\nimport resources.lib.kodi.ui as ui\nfrom resources.lib.database.db_utils import TABLE_MENU_DATA\nfrom resources.lib.globals import g\n-from resources.lib.navigation.directory_utils import (finalize_directory, convert_list, custom_viewmode,\n+from resources.lib.navigation.directory_utils import (finalize_directory, convert_list_to_dir_items, custom_viewmode,\nend_of_directory, get_title, verify_profile_pin)\n# What means dynamic menus (and dynamic id):\n@@ -81,7 +81,7 @@ class Directory(object):\ndef _profiles(self, list_data, extra_data): # pylint: disable=unused-argument\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\n- finalize_directory(convert_list(list_data), g.CONTENT_IMAGES)\n+ finalize_directory(convert_list_to_dir_items(list_data), g.CONTENT_IMAGES)\nend_of_directory(False, False)\[email protected]_execution(immediate=False)\n@@ -95,7 +95,7 @@ class Directory(object):\nreturn\ncommon.debug('Showing home listing')\nlist_data, extra_data = common.make_call('get_mainmenu') # pylint: disable=unused-variable\n- finalize_directory(convert_list(list_data), g.CONTENT_FOLDER,\n+ finalize_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)))\nend_of_directory(False, cache_to_disc)\n@@ -127,7 +127,7 @@ class Directory(object):\n}\nlist_data, extra_data = common.make_call('get_seasons', call_args)\n- finalize_directory(convert_list(list_data), g.CONTENT_SEASON, 'sort_only_label',\n+ finalize_directory(convert_list_to_dir_items(list_data), g.CONTENT_SEASON, 'sort_only_label',\ntitle=extra_data.get('title', ''))\nend_of_directory(self.dir_update_listing)\n@@ -141,7 +141,7 @@ class Directory(object):\n}\nlist_data, extra_data = common.make_call('get_episodes', call_args)\n- finalize_directory(convert_list(list_data), g.CONTENT_EPISODE, 'sort_episodes',\n+ finalize_directory(convert_list_to_dir_items(list_data), g.CONTENT_EPISODE, 'sort_episodes',\ntitle=extra_data.get('title', ''))\nend_of_directory(self.dir_update_listing)\n@@ -159,7 +159,7 @@ class Directory(object):\n}\nlist_data, extra_data = common.make_call('get_video_list', call_args)\n- finalize_directory(convert_list(list_data), menu_data.get('content_type', g.CONTENT_SHOW),\n+ finalize_directory(convert_list_to_dir_items(list_data), menu_data.get('content_type', g.CONTENT_SHOW),\ntitle=get_title(menu_data, extra_data))\nend_of_directory(False)\nreturn menu_data.get('view')\n@@ -185,7 +185,7 @@ class Directory(object):\n# so we adding the sort order of kodi\nsort_type = 'sort_label_ignore_folders'\n- finalize_directory(convert_list(list_data), menu_data.get('content_type', g.CONTENT_SHOW),\n+ finalize_directory(convert_list_to_dir_items(list_data), menu_data.get('content_type', g.CONTENT_SHOW),\ntitle=get_title(menu_data, extra_data), sort_type=sort_type)\nend_of_directory(self.dir_update_listing)\n@@ -203,7 +203,7 @@ class Directory(object):\n}\nlist_data, extra_data = common.make_call('get_genres', call_args)\n- finalize_directory(convert_list(list_data), g.CONTENT_FOLDER,\n+ finalize_directory(convert_list_to_dir_items(list_data), g.CONTENT_FOLDER,\ntitle=get_title(menu_data, extra_data), sort_type='sort_label')\nend_of_directory(False)\nreturn menu_data.get('view')\n@@ -222,7 +222,7 @@ class Directory(object):\n}\nlist_data, extra_data = common.make_call('get_video_list_supplemental', call_args)\n- finalize_directory(convert_list(list_data), menu_data.get('content_type', g.CONTENT_SHOW),\n+ finalize_directory(convert_list_to_dir_items(list_data), menu_data.get('content_type', g.CONTENT_SHOW),\ntitle=get_title(menu_data, extra_data))\nend_of_directory(self.dir_update_listing)\nreturn menu_data.get('view')\n@@ -242,7 +242,7 @@ class Directory(object):\n}\nlist_data, extra_data = common.make_call('get_genres', call_args)\n- finalize_directory(convert_list(list_data), g.CONTENT_FOLDER,\n+ finalize_directory(convert_list_to_dir_items(list_data), g.CONTENT_FOLDER,\ntitle=get_title(menu_data, extra_data), sort_type='sort_label')\nend_of_directory(False)\nreturn menu_data.get('view')\n@@ -257,7 +257,7 @@ class Directory(object):\n}\nlist_data, extra_data = common.make_call('get_subgenres', call_args)\n- finalize_directory(convert_list(list_data), menu_data.get('content_type', g.CONTENT_SHOW),\n+ finalize_directory(convert_list_to_dir_items(list_data), menu_data.get('content_type', g.CONTENT_SHOW),\ntitle=get_title(menu_data, extra_data),\nsort_type='sort_label')\nend_of_directory(False)\n@@ -292,7 +292,7 @@ class Directory(object):\n}\nlist_data, extra_data = common.make_call('get_video_list_chunked', call_args)\n- finalize_directory(convert_list(list_data), menu_data.get('content_type', g.CONTENT_SHOW),\n+ finalize_directory(convert_list_to_dir_items(list_data), menu_data.get('content_type', g.CONTENT_SHOW),\ntitle=get_title(menu_data, extra_data))\nend_of_directory(self.dir_update_listing)\nreturn menu_data.get('view')\n@@ -330,7 +330,7 @@ def _display_search_results(pathitems, perpetual_range_start, dir_update_listing\n@custom_viewmode(g.VIEW_SHOW)\ndef _search_results_directory(pathitems, menu_data, list_data, extra_data, dir_update_listing):\nextra_data['title'] = common.get_local_string(30011) + ' - ' + pathitems[2]\n- finalize_directory(convert_list(list_data), menu_data.get('content_type', g.CONTENT_SHOW),\n+ finalize_directory(convert_list_to_dir_items(list_data), menu_data.get('content_type', g.CONTENT_SHOW),\ntitle=get_title(menu_data, extra_data))\nend_of_directory(dir_update_listing)\nreturn menu_data.get('view')\n" }, { "change_type": "MODIFY", "old_path": "resources/lib/navigation/directory_utils.py", "new_path": "resources/lib/navigation/directory_utils.py", "diff": "@@ -53,10 +53,23 @@ def _activate_view(partial_setting_id):\nxbmc.executebuiltin('Container.SetViewMode({})'.format(view_id))\n-def convert_list(list_data):\n+def convert_list_to_list_items(list_data):\n\"\"\"Convert a generic list (of dict) items into a list of xbmcgui.Listitem\"\"\"\n+ list_items = []\n+ for dict_item in list_data:\n+ list_items.append(_convert_dict_to_listitem(dict_item))\n+ return list_items\n+\n+\n+def convert_list_to_dir_items(list_data):\n+ \"\"\"Convert a generic list (of dict) items into a list of directory tuple items for xbmcplugin.addDirectoryItems\"\"\"\ndirectory_items = []\nfor dict_item in list_data:\n+ directory_items.append((dict_item['url'], _convert_dict_to_listitem(dict_item), dict_item['is_folder']))\n+ return directory_items\n+\n+\n+def _convert_dict_to_listitem(dict_item):\nlist_item = xbmcgui.ListItem(label=dict_item['title'], offscreen=True)\nlist_item.setContentLookup(False)\nlist_item.setProperty('isFolder', str(dict_item['is_folder']))\n@@ -78,9 +91,7 @@ def convert_list(list_data):\nlist_item.addContextMenuItems(dict_item.get('menu_items', []))\nif dict_item.get('is_selected'):\nlist_item.select(True)\n- directory_items.append((dict_item['url'], list_item, dict_item['is_folder']))\n-\n- return directory_items\n+ return list_item\ndef add_sort_methods(sort_type):\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
Implemented convert list of dict items to list of ListItems
106,046
09.05.2020 17:11:23
-7,200
24bea33a323b4b8bc87b2e9aeb1f85b5c3021c88
Removed unnecessary double set label
[ { "change_type": "MODIFY", "old_path": "resources/lib/navigation/directory_utils.py", "new_path": "resources/lib/navigation/directory_utils.py", "diff": "@@ -70,11 +70,9 @@ def convert_list_to_dir_items(list_data):\ndef _convert_dict_to_listitem(dict_item):\n- list_item = xbmcgui.ListItem(label=dict_item['title'], offscreen=True)\n+ list_item = xbmcgui.ListItem(label=dict_item['label'], offscreen=True)\nlist_item.setContentLookup(False)\nlist_item.setProperty('isFolder', str(dict_item['is_folder']))\n- if dict_item.get('label'):\n- list_item.setLabel(dict_item['label'])\nif not dict_item['is_folder'] and dict_item['media_type'] in [common.VideoId.EPISODE,\ncommon.VideoId.MOVIE,\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": "@@ -58,7 +58,7 @@ def build_mainmenu_listing(lolomo_list):\nelse '')\ndict_item = {\n'url': common.build_url(data['path'], mode=g.MODE_DIRECTORY),\n- 'title': menu_title,\n+ 'label': menu_title,\n'art': {'icon': data['icon']},\n'info': {'plot': menu_description}, # The description\n'is_folder': True\n@@ -91,7 +91,7 @@ def _create_profile_item(profile_guid, is_active):\n'profile_guid': profile_guid},\nmode=g.MODE_ACTION))\ndict_item = {\n- 'title': profile_name,\n+ 'label': profile_name,\n'art': {'icon': g.LOCAL_DB.get_profile_config('avatar', '', guid=profile_guid)},\n'info': {'plot': ', '.join(description)}, # The description\n'is_selected': is_active,\n@@ -124,7 +124,7 @@ def _create_season_item(tvshowid, seasonid_value, season, season_list, common_da\ndict_item = {\n'video_id': seasonid_value,\n'media_type': seasonid.mediatype,\n- 'title': season['summary']['name'],\n+ 'label': season['summary']['name'],\n'is_folder': True\n}\nadd_info_dict_item(dict_item, seasonid, season, season_list.data, False, common_data)\n@@ -155,7 +155,7 @@ def _create_episode_item(seasonid, episodeid_value, episode, episodes_list, comm\nepisodeid = seasonid.derive_episode(episodeid_value)\ndict_item = {'video_id': episodeid_value,\n'media_type': episodeid.mediatype,\n- 'title': episode['title'],\n+ 'label': episode['title'],\n'is_folder': False}\nadd_info_dict_item(dict_item, episodeid, episode, episodes_list.data, False, common_data)\nset_watched_status(dict_item, episode, common_data)\n@@ -214,7 +214,7 @@ def _create_videolist_item(list_id, video_list, menu_data, common_data, static_l\nelse:\npath = 'video_list_sorted'\npathitems = [path, menu_data['path'][1], list_id]\n- dict_item = {'title': video_list['displayName'],\n+ dict_item = {'label': video_list['displayName'],\n'is_folder': True}\nadd_info_dict_item(dict_item, video_list.id, video_list, video_list.data, False, common_data)\ndict_item['art'] = get_art(video_list.id, video_list.artitem, common_data['profile_language_code'])\n@@ -257,7 +257,7 @@ def build_video_listing(video_list, menu_data, sub_genre_id=None, pathitems=None\n# Create the folder for the access to sub-genre\nfolder_dict_item = {\n'url': common.build_url(['genres', menu_id, sub_genre_id], mode=g.MODE_DIRECTORY),\n- 'title': common.get_local_string(30089),\n+ 'label': common.get_local_string(30089),\n'art': {'icon': 'DefaultVideoPlaylists.png'},\n'info': {'plot': common.get_local_string(30088)}, # The description\n'is_folder': True\n@@ -274,7 +274,7 @@ def _create_video_item(videoid_value, video, video_list, perpetual_range_start,\nis_in_mylist = videoid in common_data['mylist_items']\ndict_item = {'video_id': videoid_value,\n'media_type': videoid.mediatype,\n- 'title': video['title'],\n+ 'label': video['title'],\n'is_folder': is_folder}\nadd_info_dict_item(dict_item, videoid, video, video_list.data, is_in_mylist, common_data)\nset_watched_status(dict_item, video, common_data)\n@@ -312,6 +312,6 @@ def _create_subgenre_item(video_list_id, subgenre_data, menu_data):\ndict_item = {\n'url': common.build_url(pathitems, mode=g.MODE_DIRECTORY),\n'is_folder': True,\n- 'title': subgenre_data['name']\n+ 'label': subgenre_data['name']\n}\nreturn dict_item\n" }, { "change_type": "MODIFY", "old_path": "resources/lib/services/directorybuilder/dir_builder_utils.py", "new_path": "resources/lib/services/directorybuilder/dir_builder_utils.py", "diff": "@@ -32,7 +32,7 @@ def add_items_previous_next_page(directory_items, pathitems, perpetual_range_sel\n# todo: change params to sub_genre_id\nprevious_page_item = {\n'url': common.build_url(pathitems=pathitems, params=params, mode=g.MODE_DIRECTORY),\n- 'title': common.get_local_string(30148),\n+ 'label': common.get_local_string(30148),\n'art': {'thumb': _get_custom_thumb_path('FolderPagePrevious.png')},\n'is_folder': True\n}\n@@ -41,7 +41,7 @@ def add_items_previous_next_page(directory_items, pathitems, perpetual_range_sel\nparams = {'perpetual_range_start': perpetual_range_selector.get('next_start')}\nnext_page_item = {\n'url': common.build_url(pathitems=pathitems, params=params, mode=g.MODE_DIRECTORY),\n- 'title': common.get_local_string(30147),\n+ 'label': common.get_local_string(30147),\n'art': {'thumb': _get_custom_thumb_path('FolderPageNext.png')},\n'is_folder': True\n}\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
Removed unnecessary double set label
106,046
10.05.2020 18:04:08
-7,200
b6be181127a17493d936c60dab88ba1ce926df58
Allow return a value
[ { "change_type": "MODIFY", "old_path": "resources/lib/common/misc_utils.py", "new_path": "resources/lib/common/misc_utils.py", "diff": "@@ -208,8 +208,7 @@ def censure(value, length=3):\ndef run_threaded(non_blocking, target_func, *args, **kwargs):\n\"\"\"Call a function in a thread, when specified\"\"\"\nif not non_blocking:\n- target_func(*args, **kwargs)\n- return\n+ return target_func(*args, **kwargs)\nfrom threading import Thread\n- thread = Thread(target=target_func, args=args, kwargs=kwargs)\n- thread.start()\n+ Thread(target=target_func, args=args, kwargs=kwargs).start()\n+ return None\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
Allow return a value
106,046
10.05.2020 18:04:49
-7,200
aad15fec9cb86a09ba308755465f0ba7834c324e
Allow return a value from modal dialog
[ { "change_type": "MODIFY", "old_path": "resources/lib/kodi/ui/xmldialogs.py", "new_path": "resources/lib/kodi/ui/xmldialogs.py", "diff": "@@ -40,12 +40,14 @@ def show_modal_dialog(non_blocking, dlg_class, xml, path, **kwargs):\nShow a modal Dialog in the UI.\nPass kwargs minutes and/or seconds to have the dialog automatically\nclose after the specified time.\n+\n+ :return if exists return self.return_value value of dlg_class (if non_blocking=True return always None)\n\"\"\"\n# WARNING: doModal when invoked does not release the function immediately!\n# it seems that doModal waiting for all window operations to be completed before return,\n# for example the \"Skip\" dialog takes about 30 seconds to release the function (test on Kodi 19.x)\n# To be taken into account because it can do very big delays in the execution of the invoking code\n- run_threaded(non_blocking, _show_modal_dialog, dlg_class, xml, path, **kwargs)\n+ return run_threaded(non_blocking, _show_modal_dialog, dlg_class, xml, path, **kwargs)\ndef _show_modal_dialog(dlg_class, xml, path, **kwargs):\n@@ -61,6 +63,9 @@ def _show_modal_dialog(dlg_class, xml, path, **kwargs):\nalarm_time = '{:02d}:{:02d}'.format(minutes, seconds)\nxbmc.executebuiltin(CMD_CLOSE_DIALOG_BY_NOOP.format(alarm_time))\ndlg.doModal()\n+ if hasattr(dlg, 'return_value'):\n+ return dlg.return_value\n+ return None\nclass Skip(xbmcgui.WindowXMLDialog):\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
Allow return a value from modal dialog
106,046
10.05.2020 17:53:06
-7,200
432059ff14e30c66e887acb80569c84148e93242
Add possibility to set custom properties to Listitem
[ { "change_type": "MODIFY", "old_path": "resources/lib/navigation/directory_utils.py", "new_path": "resources/lib/navigation/directory_utils.py", "diff": "@@ -72,18 +72,20 @@ def convert_list_to_dir_items(list_data):\ndef _convert_dict_to_listitem(dict_item):\nlist_item = xbmcgui.ListItem(label=dict_item['label'], offscreen=True)\nlist_item.setContentLookup(False)\n- list_item.setProperty('isFolder', str(dict_item['is_folder']))\n+ properties = dict_item.get('properties', {}) # 'properties' key allow to set custom properties to xbmcgui.Listitem\n+ properties['isFolder'] = str(dict_item['is_folder'])\nif not dict_item['is_folder'] and dict_item['media_type'] in [common.VideoId.EPISODE,\ncommon.VideoId.MOVIE,\ncommon.VideoId.SUPPLEMENTAL]:\n- list_item.setProperty('IsPlayable', 'true')\n-\n- list_item.setProperty('TotalTime', dict_item.get('TotalTime', ''))\n- list_item.setProperty('ResumeTime', dict_item.get('ResumeTime', ''))\n-\n+ properties.update({\n+ 'IsPlayable': 'true',\n+ 'TotalTime': dict_item.get('TotalTime', ''),\n+ 'ResumeTime': dict_item.get('ResumeTime', '')\n+ })\nfor stream_type, quality_info in iteritems(dict_item['quality_info']):\nlist_item.addStreamInfo(stream_type, quality_info)\n+ list_item.setProperties(properties)\nlist_item.setInfo('video', dict_item.get('info', {}))\nlist_item.setArt(dict_item.get('art', {}))\nlist_item.addContextMenuItems(dict_item.get('menu_items', []))\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
Add possibility to set custom properties to Listitem
106,046
10.05.2020 17:54:14
-7,200
d9e5d8d2ca1caaedb572747859204ef6227c9db8
Add some stub implementations
[ { "change_type": "MODIFY", "old_path": "tests/xbmcgui.py", "new_path": "tests/xbmcgui.py", "diff": "@@ -251,11 +251,21 @@ class ListItem:\n\"\"\"A stub implementation for the xbmcgui ListItem class setMimeType() method\"\"\"\nreturn\n+ @staticmethod\n+ def getProperty(key):\n+ \"\"\"A stub implementation for the xbmcgui ListItem class getProperty() method\"\"\"\n+ return 'test'\n+\n@staticmethod\ndef setProperty(key, value):\n\"\"\"A stub implementation for the xbmcgui ListItem class setProperty() method\"\"\"\nreturn\n+ @staticmethod\n+ def setProperties(values):\n+ \"\"\"A stub implementation for the xbmcgui ListItem class setProperties() method\"\"\"\n+ return\n+\n@staticmethod\ndef setSubtitles(subtitleFiles):\n\"\"\"A stub implementation for the xbmcgui ListItem class setSubtitles() method\"\"\"\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
Add some stub implementations
106,046
10.05.2020 18:08:22
-7,200
c9dc360033f8862ff75e5790948f86d6530ba62a
Add profiles window dialog
[ { "change_type": "MODIFY", "old_path": "resources/language/resource.language.en_gb/strings.po", "new_path": "resources/language/resource.language.en_gb/strings.po", "diff": "@@ -504,7 +504,9 @@ msgctxt \"#30127\"\nmsgid \"Awarded rating of {}\"\nmsgstr \"\"\n-# Unused 30128\n+msgctxt \"#30128\"\n+msgid \"Select a profile\"\n+msgstr \"\"\nmsgctxt \"#30129\"\nmsgid \"Enable Up Next integration\"\n" }, { "change_type": "MODIFY", "old_path": "resources/lib/kodi/ui/xmldialogs.py", "new_path": "resources/lib/kodi/ui/xmldialogs.py", "diff": "@@ -15,7 +15,7 @@ import time\nimport xbmc\nimport xbmcgui\n-from resources.lib.common import run_threaded, get_machine\n+from resources.lib.common import run_threaded, get_machine, make_call\nfrom resources.lib.globals import g\nfrom resources.lib.kodi.ui.dialogs import show_error_info\n@@ -277,3 +277,60 @@ class RatingThumb(xbmcgui.WindowXMLDialog):\ndef onAction(self, action):\nif action.getId() in self.action_exitkeys_id:\nself.close()\n+\n+\n+def show_profiles_dialog(title=None):\n+ \"\"\"\n+ Show a dialog to select a profile\n+\n+ :return guid of selected profile or None\n+ \"\"\"\n+ # Get profiles data\n+ list_data, extra_data = make_call('get_profiles', {'request_update': True}) # pylint: disable=unused-variable\n+ return show_modal_dialog(False,\n+ Profiles,\n+ 'plugin-video-netflix-Profiles.xml',\n+ g.ADDON.getAddonInfo('path'),\n+ title=title or g.ADDON.getLocalizedString(30128),\n+ list_data=list_data)\n+\n+\n+# pylint: disable=no-member\n+class Profiles(xbmcgui.WindowXMLDialog):\n+ \"\"\"\n+ Dialog for profile selection\n+ \"\"\"\n+ def __init__(self, *args, **kwargs):\n+ self.ctrl_list = None\n+ self.return_value = None\n+ self.title = kwargs['title']\n+ self.list_data = kwargs['list_data']\n+ self.action_exitkeys_id = [ACTION_PREVIOUS_MENU,\n+ ACTION_PLAYER_STOP,\n+ ACTION_NAV_BACK]\n+ if get_machine()[0:5] == 'armv7':\n+ xbmcgui.WindowXMLDialog.__init__(self)\n+ else:\n+ try:\n+ xbmcgui.WindowXMLDialog.__init__(self, *args, **kwargs)\n+ except Exception: # pylint: disable=broad-except\n+ xbmcgui.WindowXMLDialog.__init__(self)\n+\n+ def onInit(self):\n+ self.getControl(99).setLabel(self.title)\n+ self.ctrl_list = self.getControl(10001)\n+ from resources.lib.navigation.directory_utils import convert_list_to_list_items\n+ self.ctrl_list.addItems(convert_list_to_list_items(self.list_data))\n+\n+ def onClick(self, controlID):\n+ if controlID == 10001: # Save and close dialog\n+ sel_list_item = self.ctrl_list.getSelectedItem()\n+ # 'nf_guid' property is set to Listitems from _create_profile_item of dir_builder_items.py\n+ self.return_value = sel_list_item.getProperty('nf_guid')\n+ self.close()\n+ if controlID in [10029, 100]: # Close\n+ self.close()\n+\n+ def onAction(self, action):\n+ if action.getId() in self.action_exitkeys_id:\n+ self.close()\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": "@@ -92,6 +92,7 @@ def _create_profile_item(profile_guid, is_active):\nmode=g.MODE_ACTION))\ndict_item = {\n'label': profile_name,\n+ 'properties': {'nf_guid': profile_guid},\n'art': {'icon': g.LOCAL_DB.get_profile_config('avatar', '', guid=profile_guid)},\n'info': {'plot': ', '.join(description)}, # The description\n'is_selected': is_active,\n" }, { "change_type": "ADD", "old_path": null, "new_path": "resources/skins/default/1080i/plugin-video-netflix-Profiles.xml", "diff": "+<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n+<window>\n+ <defaultcontrol>10004</defaultcontrol>\n+ <controls>\n+ <control type=\"group\">\n+ <!-- Note: some tags to the controls have been set even if not necessary to ensure compatibility with the custom skins of kodi -->\n+ <top>250</top>\n+ <left>200</left>\n+ <width>1520</width>\n+ <!-- Screen background -->\n+ <control type=\"image\">\n+ <left>-2000</left>\n+ <top>-2000</top>\n+ <width>6000</width>\n+ <height>6000</height>\n+ <animation effect=\"fade\" time=\"300\">VisibleChange</animation>\n+ <animation effect=\"fade\" start=\"0\" end=\"100\" time=\"300\">WindowOpen</animation>\n+ <animation effect=\"fade\" start=\"100\" end=\"0\" time=\"200\">WindowClose</animation>\n+ <texture colordiffuse=\"C2FFFFFF\">colors/black.png</texture>\n+ </control>\n+\n+ <control type=\"group\">\n+ <width>1520</width>\n+ <height>570</height>\n+ <!-- Window Background -->\n+ <control type=\"image\">\n+ <left>0</left>\n+ <top>0</top>\n+ <right>0</right>\n+ <bottom>0</bottom>\n+ <texture colordiffuse=\"FF1A2123\">colors/white.png</texture>\n+ <aspectratio>stretch</aspectratio>\n+ </control>\n+ <!-- Window header -->\n+ <control type=\"image\">\n+ <left>0</left>\n+ <top>0</top>\n+ <right>0</right>\n+ <height>66</height>\n+ <texture colordiffuse=\"FFFAFAFA\" border=\"2\">colors/white70.png</texture>\n+ <aspectratio>stretch</aspectratio>\n+ </control>\n+ <!-- Window text header -->\n+ <control type=\"label\" id=\"99\">\n+ <posy>0</posy> <!-- estouchy skin with label control use posy/posx tag instead of top/left -->\n+ <posx>40</posx>\n+ <top>0</top>\n+ <left>40</left>\n+ <right>100</right>\n+ <height>66</height>\n+ <textcolor>FF000000</textcolor>\n+ <font>font32_title</font>\n+ <label/>\n+ <align>left</align>\n+ <aligny>center</aligny>\n+ <shadowcolor>white</shadowcolor>\n+ </control>\n+ <!-- Window close button -->\n+ <control type=\"button\" id=\"100\">\n+ <right>10</right>\n+ <left>1450</left>\n+ <top>11</top>\n+ <width>42</width>\n+ <height>42</height>\n+ <texturefocus>dialogs/close.png</texturefocus>\n+ <texturenofocus>nf_icon.png</texturenofocus>\n+ <textoffsetx>0</textoffsetx>\n+ <align>right</align>\n+ <aligny>center</aligny>\n+ <pulseonselect>no</pulseonselect>\n+ </control>\n+ </control>\n+ <!-- Background color that encloses and highlights the controls of the window -->\n+ <control type=\"image\">\n+ <left>10</left>\n+ <top>80</top>\n+ <width>1200</width>\n+ <height>490</height>\n+ <texture border=\"40\">buttons/dialogbutton-nofo.png</texture>\n+ <aspectratio>stretch</aspectratio>\n+ </control>\n+\n+ <!-- Controls -->\n+ <control type=\"group\" id=\"10080\">\n+ <top>0</top>\n+ <left>0</left>\n+ <width>1160</width>\n+ <height>490</height>\n+ <defaultcontrol>10004</defaultcontrol>\n+ <visible>true</visible>\n+ <onright>10090</onright>\n+ <control type=\"list\" id=\"10001\">\n+ <top>100</top>\n+ <left>30</left>\n+ <width>1160</width>\n+ <height>490</height>\n+ <onleft>noop</onleft>\n+ <onright>10090</onright>\n+ <onup>noop</onup>\n+ <ondown>noop</ondown>\n+ <pagecontrol>10090</pagecontrol>\n+ <scrolltime>200</scrolltime>\n+ <itemlayout width=\"1160\" height=\"70\">\n+ <control type=\"image\">\n+ <left>10</left>\n+ <top>5</top>\n+ <width>60</width>\n+ <height>60</height>\n+ <texture>$INFO[ListItem.Icon]</texture>\n+ <aspectratio>keep</aspectratio>\n+ </control>\n+ <control type=\"label\">\n+ <left>90</left>\n+ <top>5</top>\n+ <width>600</width>\n+ <height>60</height>\n+ <font>font13</font>\n+ <textcolor>gray</textcolor>\n+ <align>left</align>\n+ <aligny>center</aligny>\n+ <label>$INFO[ListItem.Label]</label>\n+ </control>\n+ <control type=\"label\">\n+ <left>690</left>\n+ <top>5</top>\n+ <width>400</width>\n+ <height>60</height>\n+ <font>font10</font>\n+ <textcolor>gray</textcolor>\n+ <align>left</align>\n+ <aligny>center</aligny>\n+ <label>$INFO[ListItem.Plot]</label>\n+ </control>\n+ </itemlayout>\n+ <focusedlayout width=\"1160\" height=\"70\">\n+ <control type=\"image\">\n+ <left>0</left>\n+ <right>0</right>\n+ <bottom>0</bottom>\n+ <texture colordiffuse=\"button_focus\">list_focus.png</texture>\n+ <visible>Control.HasFocus(10001)</visible>\n+ </control>\n+ <control type=\"image\">\n+ <left>10</left>\n+ <top>5</top>\n+ <width>60</width>\n+ <height>60</height>\n+ <texture>$INFO[ListItem.Icon]</texture>\n+ <aspectratio>keep</aspectratio>\n+ </control>\n+ <control type=\"label\">\n+ <left>90</left>\n+ <top>5</top>\n+ <width>700</width>\n+ <height>60</height>\n+ <font>font13</font>\n+ <textcolor>white</textcolor>\n+ <align>left</align>\n+ <aligny>center</aligny>\n+ <label>$INFO[ListItem.Label]</label>\n+ </control>\n+ <control type=\"label\">\n+ <left>690</left>\n+ <top>5</top>\n+ <width>400</width>\n+ <height>60</height>\n+ <font>font10</font>\n+ <textcolor>white</textcolor>\n+ <align>left</align>\n+ <aligny>center</aligny>\n+ <label>$INFO[ListItem.Plot]</label>\n+ </control>\n+ </focusedlayout>\n+ </control>\n+ </control>\n+ <!-- Window default side buttons -->\n+ <control type=\"grouplist\" id=\"10090\">\n+ <left>1210</left>\n+ <top>92</top>\n+ <orientation>vertical</orientation>\n+ <width>300</width>\n+ <height>250</height>\n+ <itemgap>-10</itemgap>\n+ <onleft>10080</onleft>\n+\n+ <control type=\"button\" id=\"10029\">\n+ <description>Cancel button</description>\n+ <width>300</width>\n+ <height>100</height>\n+ <label>$LOCALIZE[222]</label>\n+ <font>font25_title</font>\n+ <texturefocus border=\"40\" colordiffuse=\"red\">buttons/dialogbutton-fo.png</texturefocus>\n+ <texturenofocus border=\"40\">buttons/dialogbutton-nofo.png</texturenofocus>\n+ <textcolor>white</textcolor>\n+ <disabledcolor>white</disabledcolor>\n+ <textoffsetx>20</textoffsetx>\n+ <align>center</align>\n+ <aligny>center</aligny>\n+ <pulseonselect>no</pulseonselect>\n+ </control>\n+ </control>\n+ </control>\n+ </controls>\n+</window>\n" }, { "change_type": "ADD", "old_path": "resources/skins/default/media/list_focus.png", "new_path": "resources/skins/default/media/list_focus.png", "diff": "Binary files /dev/null and b/resources/skins/default/media/list_focus.png differ\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
Add profiles window dialog
106,047
10.05.2020 14:37:04
14,400
ca8cc42c75b2f212a4d22371eb5018960d618878
use saved player state when we get a bad state
[ { "change_type": "MODIFY", "old_path": "resources/lib/services/playback/action_controller.py", "new_path": "resources/lib/services/playback/action_controller.py", "diff": "@@ -33,6 +33,7 @@ class ActionController(xbmc.Monitor):\nself.tracking = False\nself.active_player_id = None\nself.action_managers = None\n+ self._last_player_state = {}\ncommon.register_slot(self.initialize_playback, common.Signals.PLAYBACK_INITIATED)\n# UpNext Add-on - play call back method\ncommon.register_slot(self._play_callback, signal=g.ADDON_ID + '_play_action', source_id='upnextprovider')\n@@ -45,6 +46,7 @@ class ActionController(xbmc.Monitor):\n\"\"\"\nif data['is_upnext_callback_received']:\n_reset_upnext_callback_state()\n+ self._last_player_state = {}\nself.active_player_id = None\nself.action_managers = [\nAMPlayback(),\n@@ -149,18 +151,24 @@ class ActionController(xbmc.Monitor):\nexcept IOError:\nreturn {}\n- # Sometime may happen that when you stop playback, a player status without data is read,\n- # so all dict values are returned with a default empty value,\n- # then return an empty status instead of fake data\n- if not player_state['audiostreams']:\n- return {}\n-\n# convert time dict to elapsed seconds\nplayer_state['elapsed_seconds'] = (\nplayer_state['time']['hours'] * 3600 +\nplayer_state['time']['minutes'] * 60 +\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+ if ((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+ self._last_player_state = player_state\n+ else:\n+ # use saved player state\n+ player_state = self._last_player_state\n+\nreturn player_state\ndef _play_callback(self, data):\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
use saved player state when we get a bad state
106,047
10.05.2020 12:45:18
14,400
7b400335d5b03b55991a059613559e265a7d24a1
add player state to on_playback_stopped
[ { "change_type": "MODIFY", "old_path": "resources/lib/services/playback/action_controller.py", "new_path": "resources/lib/services/playback/action_controller.py", "diff": "@@ -126,7 +126,8 @@ class ActionController(xbmc.Monitor):\nself.active_player_id = None\n# Immediately send the request to release the license\ncommon.send_signal(signal=common.Signals.RELEASE_LICENSE, non_blocking=True)\n- self._notify_all(ActionManager.call_on_playback_stopped)\n+ self._notify_all(ActionManager.call_on_playback_stopped,\n+ self._last_player_state)\nself.action_managers = None\ndef _notify_all(self, notification, data=None):\n" }, { "change_type": "MODIFY", "old_path": "resources/lib/services/playback/action_manager.py", "new_path": "resources/lib/services/playback/action_manager.py", "diff": "@@ -82,11 +82,11 @@ class ActionManager(object):\n\"\"\"\nself._call_if_enabled(self.on_playback_resume, player_state=player_state)\n- def call_on_playback_stopped(self):\n+ def call_on_playback_stopped(self, player_state):\n\"\"\"\nNotify that a playback has stopped\n\"\"\"\n- self._call_if_enabled(self.on_playback_stopped)\n+ self._call_if_enabled(self.on_playback_stopped, player_state=player_state)\nself.enabled = None\ndef _call_if_enabled(self, target_func, **kwargs):\n@@ -126,5 +126,5 @@ class ActionManager(object):\ndef on_playback_resume(self, player_state):\npass\n- def on_playback_stopped(self):\n+ def on_playback_stopped(self, player_state):\npass\n" }, { "change_type": "MODIFY", "old_path": "resources/lib/services/playback/am_section_skipping.py", "new_path": "resources/lib/services/playback/am_section_skipping.py", "diff": "@@ -83,6 +83,6 @@ class AMSectionSkipper(ActionManager):\nskip_to=self.markers[section]['end'],\nlabel=common.get_local_string(SKIPPABLE_SECTIONS[section]))\n- def on_playback_stopped(self):\n+ def on_playback_stopped(self, player_state):\n# Close any dialog remaining open\nxbmc.executebuiltin('Dialog.Close(all,true)')\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": "@@ -100,7 +100,7 @@ class AMVideoEvents(ActionManager):\nself._save_resume_time(player_state['elapsed_seconds'])\nself.allow_request_update_lolomo = True\n- def on_playback_stopped(self):\n+ def on_playback_stopped(self, player_state):\nif not self.is_event_start_sent or self.lock_events:\nreturn\nself._reset_tick_count()\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
add player state to on_playback_stopped
106,047
10.05.2020 12:46:17
14,400
e30606ec414fe5af7e23fc3f84e7767dfebd778c
remove last player state from AMVideoEvents
[ { "change_type": "MODIFY", "old_path": "resources/lib/services/playback/am_video_events.py", "new_path": "resources/lib/services/playback/am_video_events.py", "diff": "@@ -30,7 +30,6 @@ class AMVideoEvents(ActionManager):\nself.is_event_start_sent = False\nself.last_tick_count = 0\nself.tick_elapsed = 0\n- self.last_player_state = {}\nself.is_player_in_pause = False\nself.lock_events = False\nself.allow_request_update_lolomo = False\n@@ -52,8 +51,8 @@ class AMVideoEvents(ActionManager):\nreturn\nif self.is_player_in_pause and (self.tick_elapsed - self.last_tick_count) >= 1800:\n# When the player is paused for more than 30 minutes we interrupt the sending of events (1800secs=30m)\n- self._send_event(EVENT_ENGAGE, self.event_data, self.last_player_state)\n- self._send_event(EVENT_STOP, self.event_data, self.last_player_state)\n+ self._send_event(EVENT_ENGAGE, self.event_data, player_state)\n+ self._send_event(EVENT_STOP, self.event_data, player_state)\nself.is_event_start_sent = False\nself.lock_events = True\nelse:\n@@ -76,7 +75,6 @@ class AMVideoEvents(ActionManager):\n# Allow request of lolomo update (for continueWatching and bookmark) only after the first minute\n# it seems that most of the time if sent earlier returns error\nself.allow_request_update_lolomo = True\n- self.last_player_state = player_state\nself.tick_elapsed += 1 # One tick almost always represents one second\ndef on_playback_pause(self, player_state):\n@@ -104,8 +102,8 @@ class AMVideoEvents(ActionManager):\nif not self.is_event_start_sent or self.lock_events:\nreturn\nself._reset_tick_count()\n- self._send_event(EVENT_ENGAGE, self.event_data, self.last_player_state)\n- self._send_event(EVENT_STOP, self.event_data, self.last_player_state)\n+ self._send_event(EVENT_ENGAGE, self.event_data, player_state)\n+ self._send_event(EVENT_STOP, self.event_data, player_state)\ndef _save_resume_time(self, resume_time):\n\"\"\"Save resume time value in order to update the infolabel cache\"\"\"\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
remove last player state from AMVideoEvents
106,046
11.05.2020 09:36:07
-7,200
8a6ef4f6b5b62c3ae4fe90c0595857654ae8bf2f
Use more appropriate comment for crypto packages
[ { "change_type": "MODIFY", "old_path": "resources/lib/common/credentials.py", "new_path": "resources/lib/common/credentials.py", "diff": "@@ -29,11 +29,11 @@ def encrypt_credential(raw):\n\"\"\"\n# pylint: disable=invalid-name,import-error\nimport base64\n- try: # Python 3\n+ try: # The crypto package depends on the library installed (see Wiki)\nfrom Crypto import Random\nfrom Crypto.Cipher import AES\nfrom Crypto.Util import Padding\n- except ImportError: # Python 2\n+ except ImportError:\nfrom Cryptodome import Random\nfrom Cryptodome.Cipher import AES\nfrom Cryptodome.Util import Padding\n@@ -53,10 +53,10 @@ def decrypt_credential(enc, secret=None):\n\"\"\"\n# pylint: disable=invalid-name,import-error\nimport base64\n- try: # Python 3\n+ try: # The crypto package depends on the library installed (see Wiki)\nfrom Crypto.Cipher import AES\nfrom Crypto.Util import Padding\n- except ImportError: # Python 2\n+ except ImportError:\nfrom Cryptodome.Cipher import AES\nfrom Cryptodome.Util import Padding\nenc = base64.b64decode(enc)\n" }, { "change_type": "MODIFY", "old_path": "resources/lib/services/msl/default_crypto.py", "new_path": "resources/lib/services/msl/default_crypto.py", "diff": "@@ -13,14 +13,14 @@ from __future__ import absolute_import, division, unicode_literals\nimport base64\nimport json\n-try: # Python 3\n+try: # The crypto package depends on the library installed (see Wiki)\nfrom Crypto.Random import get_random_bytes\nfrom Crypto.Hash import HMAC, SHA256\nfrom Crypto.Cipher import PKCS1_OAEP\nfrom Crypto.PublicKey import RSA\nfrom Crypto.Util import Padding\nfrom Crypto.Cipher import AES\n-except ImportError: # Python 2\n+except ImportError:\nfrom Cryptodome.Random import get_random_bytes\nfrom Cryptodome.Hash import HMAC, SHA256\nfrom Cryptodome.Cipher import PKCS1_OAEP\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
Use more appropriate comment for crypto packages
106,046
11.05.2020 17:18:15
-7,200
ce6966746ebf5dda467c53d58f6a6b586936e963
Add more profile info
[ { "change_type": "MODIFY", "old_path": "resources/lib/api/website.py", "new_path": "resources/lib/api/website.py", "diff": "@@ -14,6 +14,8 @@ from re import compile as recompile, DOTALL, sub\nfrom future.utils import iteritems\n+import xbmc\n+\nimport resources.lib.common as common\nfrom resources.lib.database.db_exceptions import ProfilesMissing\nfrom resources.lib.database.db_utils import (TABLE_SESSION)\n@@ -159,6 +161,8 @@ def parse_profiles(data):\nis_active = summary.pop('isActive')\ng.LOCAL_DB.set_profile(guid, is_active, sort_order)\ng.SHARED_DB.set_profile(guid, sort_order)\n+ # Add profile language description translated from locale\n+ summary['language_desc'] = xbmc.convertLanguage(summary['language'][:2], xbmc.ENGLISH_NAME)\nfor key, value in iteritems(summary):\nif key in PROFILE_DEBUG_INFO:\ncommon.debug('Profile info {}', {key: value})\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": "@@ -81,20 +81,26 @@ def build_profiles_listing():\ndef _create_profile_item(profile_guid, is_active):\nprofile_name = g.LOCAL_DB.get_profile_config('profileName', '???', guid=profile_guid)\n- description = []\n+\n+ profile_attributes = []\n+ if g.LOCAL_DB.get_profile_config('isPinLocked', False, guid=profile_guid):\n+ profile_attributes.append('[COLOR red]' + common.get_local_string(20068) + '[/COLOR]')\nif g.LOCAL_DB.get_profile_config('isAccountOwner', False, guid=profile_guid):\n- description.append(common.get_local_string(30221))\n+ profile_attributes.append(common.get_local_string(30221))\nif g.LOCAL_DB.get_profile_config('isKids', False, guid=profile_guid):\n- description.append(common.get_local_string(30222))\n+ profile_attributes.append(common.get_local_string(30222))\n+ attributes_desc = '[CR]'.join(profile_attributes) + '[CR]' if profile_attributes else ''\n+ description = attributes_desc + '[' + g.LOCAL_DB.get_profile_config('language_desc', '', guid=profile_guid) + ']'\n+\nmenu_action = common.run_plugin_action(common.build_url(pathitems=['autoselect_profile_set'],\nparams={'profile_name': profile_name.encode('utf-8'),\n'profile_guid': profile_guid},\nmode=g.MODE_ACTION))\ndict_item = {\n'label': profile_name,\n- 'properties': {'nf_guid': profile_guid},\n+ 'properties': {'nf_guid': profile_guid, 'nf_description': description.replace('[CR]', ' - ')},\n'art': {'icon': g.LOCAL_DB.get_profile_config('avatar', '', guid=profile_guid)},\n- 'info': {'plot': ', '.join(description)}, # The description\n+ 'info': {'plot': description}, # The description\n'is_selected': is_active,\n'menu_items': [(common.get_local_string(30056), menu_action)],\n'url': common.build_url(pathitems=['home'],\n" }, { "change_type": "MODIFY", "old_path": "resources/skins/default/1080i/plugin-video-netflix-Profiles.xml", "new_path": "resources/skins/default/1080i/plugin-video-netflix-Profiles.xml", "diff": "<textcolor>gray</textcolor>\n<align>left</align>\n<aligny>center</aligny>\n- <label>$INFO[ListItem.Plot]</label>\n+ <label>$INFO[ListItem.Property(nf_description)]</label>\n</control>\n</itemlayout>\n<focusedlayout width=\"1160\" height=\"70\">\n<textcolor>white</textcolor>\n<align>left</align>\n<aligny>center</aligny>\n- <label>$INFO[ListItem.Plot]</label>\n+ <label>$INFO[ListItem.Property(nf_description)]</label>\n</control>\n</focusedlayout>\n</control>\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
Add more profile info
106,046
12.05.2020 11:04:36
-7,200
757cd2866f2c89c777d12a2772484fe675743543
Updated images paths
[ { "change_type": "MODIFY", "old_path": "resources/lib/api/paths.py", "new_path": "resources/lib/api/paths.py", "diff": "@@ -20,6 +20,7 @@ RANGE_SELECTOR = 'RANGE_SELECTOR'\nART_SIZE_POSTER = '_342x684'\nART_SIZE_FHD = '_1920x1080'\n+# ART_SIZE_HD = '_1280x720'\nART_SIZE_SD = '_665x375'\nLENGTH_ATTRIBUTES = {\n@@ -33,10 +34,12 @@ 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- ['storyarts', '_1632x873', 'jpg'], # storyarts seem no more used, never found it in the results\n['bb2OGLogo', '_550x124', 'png'],\n['BGImages', '720', 'jpg']\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\nVIDEO_LIST_PARTIAL_PATHS = [\n[['requestId', 'summary', 'title', 'synopsis', 'regularSynopsis', 'evidence', 'queue',\n" }, { "change_type": "MODIFY", "old_path": "resources/lib/kodi/infolabels.py", "new_path": "resources/lib/kodi/infolabels.py", "diff": "@@ -205,9 +205,9 @@ def parse_art(videoid, item):\ninteresting_moment = common.get_multiple_paths(\npaths.ART_PARTIAL_PATHS[1] + ['url'], item, {})\nclearlogo = common.get_path_safe(\n- paths.ART_PARTIAL_PATHS[3] + ['url'], item)\n+ paths.ART_PARTIAL_PATHS[2] + ['url'], item)\nfanart = common.get_path_safe(\n- paths.ART_PARTIAL_PATHS[4] + [0, 'url'], item)\n+ paths.ART_PARTIAL_PATHS[3] + [0, 'url'], item)\nreturn _assign_art(videoid,\nboxart_large=boxarts.get(paths.ART_SIZE_FHD),\nboxart_small=boxarts.get(paths.ART_SIZE_SD),\n@@ -235,8 +235,7 @@ def _assign_art(videoid, **kwargs):\ndef _best_art(arts):\n- \"\"\"Return the best art (determined by list order of arts) or\n- an empty string if none is available\"\"\"\n+ \"\"\"Return the best art (determined by list order of arts) or an empty string if none is available\"\"\"\nreturn next((art for art in arts if art), '')\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
Updated images paths
106,046
12.05.2020 15:39:35
-7,200
2d14e2e029cc74d34ac8be1913fca4fafb28db52
Add support to "Top 10" list
[ { "change_type": "MODIFY", "old_path": "resources/language/resource.language.en_gb/strings.po", "new_path": "resources/language/resource.language.en_gb/strings.po", "diff": "@@ -957,3 +957,7 @@ msgstr \"\"\nmsgctxt \"#30241\"\nmsgid \"Open Connect CDN (the lower index is better)\"\nmsgstr \"\"\n+\n+msgctxt \"#30242\"\n+msgid \"Top 10\"\n+msgstr \"\"\n" }, { "change_type": "MODIFY", "old_path": "resources/lib/globals.py", "new_path": "resources/lib/globals.py", "diff": "@@ -100,6 +100,9 @@ class GlobalVariables(object):\n('currentTitles', {'path': ['video_list', 'currentTitles'],\n'lolomo_contexts': ['trendingNow'],\n'lolomo_known': True}),\n+ ('mostWatched', {'path': ['video_list', 'mostWatched'], # Top 10 menu\n+ 'lolomo_contexts': ['mostWatched'],\n+ 'lolomo_known': True}),\n('mostViewed', {'path': ['video_list', 'mostViewed'],\n'lolomo_contexts': ['popularTitles'],\n'lolomo_known': True}),\n" }, { "change_type": "MODIFY", "old_path": "resources/settings.xml", "new_path": "resources/settings.xml", "diff": "<setting id=\"show_menu_newrelease\" type=\"bool\" label=\"30170\" default=\"true\"/>\n<setting id=\"menu_sortorder_newrelease\" type=\"select\" label=\"30149\" lvalues=\"30150|30151|30152|30153\" visible=\"eq(-1,true)\" subsetting=\"true\" default=\"0\"/>\n<setting id=\"show_menu_currenttitles\" type=\"bool\" label=\"30171\" default=\"true\"/>\n+ <setting id=\"show_menu_mostwatched\" type=\"bool\" label=\"30242\" default=\"true\"/> <!--Top 10 menu-->\n<setting id=\"show_menu_mostviewed\" type=\"bool\" label=\"30172\" default=\"true\"/>\n<setting id=\"show_menu_netflixoriginals\" type=\"bool\" label=\"30173\" default=\"true\"/>\n<setting id=\"menu_sortorder_netflixoriginals\" type=\"select\" label=\"30149\" lvalues=\"30150|30151|30152|30153\" visible=\"eq(-1,true)\" subsetting=\"true\" default=\"0\"/>\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
Add support to "Top 10" list
106,046
12.05.2020 17:58:52
-7,200
d21f67dc70e17898c6bcbb76a5eb4a91c83b5431
Improved error description
[ { "change_type": "MODIFY", "old_path": "resources/lib/services/msl/android_crypto.py", "new_path": "resources/lib/services/msl/android_crypto.py", "diff": "@@ -49,10 +49,10 @@ class AndroidMSLCrypto(MSLBaseCrypto):\nif not drm_info['version']:\n# Possible cases where no data is obtained:\n- # I don't know if this is really the cause, but seem that using Kodi debug build with a\n- # InputStream Adaptive release build (yes users do it) cause problems\n- raise MSLError('It was not possible to get the data from Widevine CryptoSession, '\n- 'try to reinstall Kodi with latest version')\n+ # - Device with custom ROM or without Widevine support\n+ # - Using Kodi debug build with a InputStream Adaptive release build (yes users do it)\n+ raise MSLError('It was not possible to get the data from Widevine CryptoSession.\\r\\n'\n+ 'Your system is not Widevine certified or you have a wrong Kodi version installed.')\ng.LOCAL_DB.set_value('drm_system_id', drm_info['system_id'], TABLE_SESSION)\ng.LOCAL_DB.set_value('drm_security_level', drm_info['security_level'], TABLE_SESSION)\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
Improved error description
106,046
12.05.2020 21:12:57
-7,200
4be73df4db28b3b0d6a70e269579cc9cdcf7a065
Fixed wrong identification of rpi system
[ { "change_type": "MODIFY", "old_path": "resources/lib/common/uuid_device.py", "new_path": "resources/lib/common/uuid_device.py", "diff": "@@ -52,7 +52,7 @@ def _get_system_uuid():\nuuid_value = _get_windows_uuid()\nelif system == 'android':\nuuid_value = _get_android_uuid()\n- elif system == 'linux':\n+ elif system in ['linux', 'linux raspberrypi']:\nuuid_value = _get_linux_uuid()\nelif system == 'osx':\n# Due to OS restrictions on 'ios' and 'tvos' is not possible to use _get_macos_uuid()\n@@ -60,7 +60,7 @@ def _get_system_uuid():\nuuid_value = _get_macos_uuid()\nif not uuid_value:\ndebug('It is not possible to get a system UUID creating a new UUID')\n- uuid_value = _get_fake_uuid(system != 'android')\n+ uuid_value = _get_fake_uuid(system not in ['android', 'linux', 'linux raspberrypi'])\nreturn uuid.uuid5(uuid.NAMESPACE_DNS, str(uuid_value)).bytes\n@@ -185,6 +185,7 @@ def _get_fake_uuid(with_hostname=True):\nimport platform\nlist_values = [xbmc.getInfoLabel('System.Memory(total)')]\nif with_hostname:\n+ # Note: on linux systems hostname content may change after every system update\ntry:\nlist_values.append(platform.node())\nexcept Exception: # pylint: disable=broad-except\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
Fixed wrong identification of rpi system
106,046
12.05.2020 21:35:53
-7,200
c39887726d074d1340df8fa7dadbf6817ea8f45e
Print log info when linux fail to get machineid
[ { "change_type": "MODIFY", "old_path": "resources/lib/common/uuid_device.py", "new_path": "resources/lib/common/uuid_device.py", "diff": "\"\"\"\nfrom __future__ import absolute_import, division, unicode_literals\n-from .logging import debug\n+from resources.lib.globals import g\nfrom .device_utils import get_system_platform\n+from .logging import debug, warn\ntry: # Python 2\nunicode\n@@ -99,14 +100,16 @@ def _get_linux_uuid():\nuuid_value = None\ntry:\nuuid_value = subprocess.check_output(['cat', '/var/lib/dbus/machine-id']).decode('utf-8')\n- except Exception:\n- pass\n+ except Exception as exc:\n+ import traceback\n+ warn('_get_linux_uuid first attempt returned: {}', exc)\n+ warn(g.py2_decode(traceback.format_exc(), 'latin-1'))\nif not uuid_value:\ntry:\n# Fedora linux\nuuid_value = subprocess.check_output(['cat', '/etc/machine-id']).decode('utf-8')\n- except Exception:\n- pass\n+ except Exception as exc:\n+ warn('_get_linux_uuid second attempt returned: {}', exc)\nreturn uuid_value\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
Print log info when linux fail to get machineid
106,046
13.05.2020 08:44:34
-7,200
1f6ecaf2885f209f6def84db76458ccf6fc7cd4a
Add linux rpi identification
[ { "change_type": "MODIFY", "old_path": "resources/lib/config_wizard.py", "new_path": "resources/lib/config_wizard.py", "diff": "@@ -80,7 +80,7 @@ def _set_profiles(system, is_4k_capable):\n# By default we do not enable VP9 because on some devices do not fully support it\n# By default we do not enable HEVC because not all device support it, then enable it only on 4K capable devices\nenable_hevc_profiles = is_4k_capable\n- elif system == 'linux':\n+ elif system in ['linux', 'linux raspberrypi']:\n# Too many different linux systems, we can not predict all the behaviors\n# some linux distributions have encountered problems with VP9,\n# some OSMC users reported that HEVC does not work well\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
Add linux rpi identification
106,046
13.05.2020 09:11:17
-7,200
7c834739fd728197debf7ef1d1c99f0106e2f1a1
Changed warn to error
[ { "change_type": "MODIFY", "old_path": "resources/lib/common/uuid_device.py", "new_path": "resources/lib/common/uuid_device.py", "diff": "@@ -11,7 +11,7 @@ from __future__ import absolute_import, division, unicode_literals\nfrom resources.lib.globals import g\nfrom .device_utils import get_system_platform\n-from .logging import debug, warn\n+from .logging import debug, error\ntry: # Python 2\nunicode\n@@ -102,14 +102,14 @@ def _get_linux_uuid():\nuuid_value = subprocess.check_output(['cat', '/var/lib/dbus/machine-id']).decode('utf-8')\nexcept Exception as exc:\nimport traceback\n- warn('_get_linux_uuid first attempt returned: {}', exc)\n- warn(g.py2_decode(traceback.format_exc(), 'latin-1'))\n+ error('_get_linux_uuid first attempt returned: {}', exc)\n+ error(g.py2_decode(traceback.format_exc(), 'latin-1'))\nif not uuid_value:\ntry:\n# Fedora linux\nuuid_value = subprocess.check_output(['cat', '/etc/machine-id']).decode('utf-8')\nexcept Exception as exc:\n- warn('_get_linux_uuid second attempt returned: {}', exc)\n+ error('_get_linux_uuid second attempt returned: {}', exc)\nreturn uuid_value\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
Changed warn to error
106,046
13.05.2020 10:38:27
-7,200
10edbd445ccb33a40cf23d7006ed1e6043f40dea
Fixed is_in_mylist value to event data
[ { "change_type": "MODIFY", "old_path": "resources/lib/api/api_requests.py", "new_path": "resources/lib/api/api_requests.py", "diff": "@@ -61,6 +61,7 @@ def update_lolomo_context(context_name):\ncontext_id = g.LOCAL_DB.get_value('lolomo_{}_id'.format(context_name.lower()), '', TABLE_SESSION)\nif not context_index:\n+ common.warn('Update lolomo context {} skipped due to missing lolomo index', context_name)\nreturn\npath = [['lolomos', lolomo_root, 'refreshListByContext']]\n# The fourth parameter is like a request-id, but it doesn't seem to match to\n" }, { "change_type": "MODIFY", "old_path": "resources/lib/navigation/player.py", "new_path": "resources/lib/navigation/player.py", "diff": "@@ -200,18 +200,30 @@ def _verify_pin(pin_required):\ndef _get_event_data(videoid):\n\"\"\"Get data needed to send event requests to Netflix and for resume from last position\"\"\"\n- raw_data = api.get_video_raw_data([videoid], EVENT_PATHS)\n+ is_episode = videoid.mediatype == common.VideoId.EPISODE\n+ req_videoids = [videoid]\n+ if is_episode:\n+ # Get also the tvshow data\n+ req_videoids.append(videoid.derive_parent(0))\n+\n+ raw_data = api.get_video_raw_data(req_videoids, EVENT_PATHS)\nif not raw_data:\nreturn {}\n+ common.debug('Event data: {}', raw_data)\nvideoid_data = raw_data['videos'][videoid.value]\n- common.debug('Event data: {}', videoid_data)\n+\n+ if is_episode:\n+ # Get inQueue from tvshow data\n+ is_in_mylist = raw_data['videos'][str(req_videoids[1].value)]['queue'].get('inQueue', False)\n+ else:\n+ is_in_mylist = videoid_data['queue'].get('inQueue', False)\nevent_data = {'resume_position':\nvideoid_data['bookmarkPosition'] if videoid_data['bookmarkPosition'] > -1 else None,\n'runtime': videoid_data['runtime'],\n'request_id': videoid_data['requestId'],\n'watched': videoid_data['watched'],\n- 'is_in_mylist': videoid_data['queue'].get('inQueue', False)}\n+ 'is_in_mylist': is_in_mylist}\nif videoid.mediatype == common.VideoId.EPISODE:\nevent_data['track_id'] = videoid_data['trackIds']['trackId_jawEpisode']\nelse:\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
Fixed is_in_mylist value to event data
106,046
13.05.2020 15:16:51
-7,200
54d457e094ee076f796c54ab0c3389f13fa63c02
Add including_suffixes argument to delete
[ { "change_type": "MODIFY", "old_path": "resources/lib/common/cache.py", "new_path": "resources/lib/common/cache.py", "diff": "@@ -58,11 +58,16 @@ class Cache(object):\n}\nself._make_call('add', call_args, serialize_data(data))\n- def delete(self, bucket, identifier):\n- \"\"\"Delete an item from cache bucket\"\"\"\n+ def delete(self, bucket, identifier, including_suffixes=False):\n+ \"\"\"\n+ Delete an item from cache bucket\n+\n+ :param including_suffixes: if true will delete all items with the identifier that start with it\n+ \"\"\"\ncall_args = {\n'bucket': bucket,\n- 'identifier': identifier\n+ 'identifier': identifier,\n+ 'including_suffixes': including_suffixes\n}\nself._make_call('delete', call_args)\n" }, { "change_type": "MODIFY", "old_path": "resources/lib/services/cache/cache_management.py", "new_path": "resources/lib/services/cache/cache_management.py", "diff": "@@ -191,12 +191,24 @@ class CacheManagement(object):\ncommon.error('SQLite error {}:', exc.args[0])\nraise SQLiteError\n- def delete(self, bucket, identifier):\n- \"\"\"Delete an item from cache bucket\"\"\"\n+ def delete(self, bucket, identifier, including_suffixes):\n+ \"\"\"\n+ Delete an item from cache bucket\n+\n+ :param including_suffixes: if true will delete all items with the identifier that start with it\n+ \"\"\"\n# Delete the item data from in memory-cache\ntry:\nidentifier = self._add_prefix(identifier)\nbucket_data = self._get_cache_bucket(bucket['name'])\n+ if including_suffixes:\n+ keys_to_delete = []\n+ for key_identifier in bucket_data.keys():\n+ if key_identifier.startswith(identifier):\n+ keys_to_delete.append(key_identifier)\n+ for key_identifier in keys_to_delete:\n+ del bucket_data[key_identifier]\n+ else:\nif identifier in bucket_data:\ndel bucket_data[identifier]\nif bucket['is_persistent']:\n@@ -207,9 +219,13 @@ class CacheManagement(object):\npass\n@handle_connection\n- def _delete_db(self, bucket_name, identifier):\n+ def _delete_db(self, bucket_name, identifier, including_suffixes):\ntry:\ncursor = self.conn.cursor()\n+ if including_suffixes:\n+ identifier += '%'\n+ query = 'DELETE FROM cache_data WHERE bucket = ? AND identifier LIKE ?'\n+ else:\nquery = 'DELETE FROM cache_data WHERE bucket = ? AND identifier = ?'\ncursor.execute(query, (bucket_name, identifier))\nexcept sql.Error as exc:\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
Add including_suffixes argument to delete
106,046
13.05.2020 18:46:13
-7,200
7afb984fec3685efa8f491103d8defdda0443ce3
Fixed update of continuewatching list
[ { "change_type": "MODIFY", "old_path": "resources/lib/navigation/actions.py", "new_path": "resources/lib/navigation/actions.py", "diff": "@@ -139,10 +139,14 @@ class AddonActionExecutor(object):\nif self.params['menu_id'] == 'myList':\ng.CACHE.clear([CACHE_MYLIST], clear_database=False)\nif self.params['menu_id'] == 'continueWatching':\n+ # Delete the cache of continueWatching list\n# pylint: disable=unused-variable\nis_exists, list_id = common.make_call('get_continuewatching_videoid_exists', {'video_id': ''})\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')\ndef view_esn(self, pathitems=None): # pylint: disable=unused-argument\n\"\"\"Show the ESN in use\"\"\"\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": "@@ -55,7 +55,11 @@ class AMVideoEvents(ActionManager):\nvideoid_exists, list_id = common.make_http_call('get_continuewatching_videoid_exists',\n{'video_id': str(current_videoid.value)})\nif not videoid_exists:\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')\ndef on_tick(self, player_state):\nif self.lock_events:\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
Fixed update of continuewatching list
106,046
13.05.2020 20:52:23
-7,200
a83051f432886b732b3ce4e58f7bea152d2f8adf
Avoid load request module at addon startup
[ { "change_type": "MODIFY", "old_path": "resources/lib/services/msl/msl_requests.py", "new_path": "resources/lib/services/msl/msl_requests.py", "diff": "@@ -16,8 +16,6 @@ import re\nimport time\nimport zlib\n-import requests\n-\nimport resources.lib.common as common\nfrom resources.lib.globals import g\nfrom resources.lib.services.msl.exceptions import MSLError\n@@ -36,7 +34,8 @@ class MSLRequests(MSLRequestBuilder):\ndef __init__(self, msl_data=None):\nsuper(MSLRequests, self).__init__()\n- self.session = requests.session()\n+ from requests import session\n+ self.session = session()\nself.session.headers.update({\n'User-Agent': common.get_user_agent(),\n'Content-Type': 'text/plain',\n" }, { "change_type": "MODIFY", "old_path": "resources/lib/services/nfsession/nfsession.py", "new_path": "resources/lib/services/nfsession/nfsession.py", "diff": "from __future__ import absolute_import, division, unicode_literals\nimport json\n-import requests\nimport resources.lib.common as common\nimport resources.lib.api.paths as apipaths\n@@ -50,6 +49,7 @@ class NetflixSession(NFSessionAccess, DirectoryBuilder):\n@needs_login\ndef parental_control_data(self, password):\n# Ask to the service if password is right and get the PIN status\n+ from requests import exceptions\nprofile_guid = g.LOCAL_DB.get_active_profile_guid()\ntry:\nresponse = self._post('profile_hub',\n@@ -60,7 +60,7 @@ class NetflixSession(NFSessionAccess, DirectoryBuilder):\nif response.get('status') != 'ok':\ncommon.warn('Parental control status issue: {}', response)\nraise MissingCredentialsError\n- except requests.exceptions.HTTPError as exc:\n+ except exceptions.HTTPError as exc:\nif exc.response.status_code == 500:\n# This endpoint raise HTTP error 500 when the password is wrong\nraise MissingCredentialsError\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 requests\n-\nimport xbmc\nimport resources.lib.common as common\n@@ -39,12 +37,13 @@ class NFSessionAccess(NFSessionRequests, NFSessionCookie):\ndef prefetch_login(self):\n\"\"\"Check if we have stored credentials.\nIf so, do the login before the user requests it\"\"\"\n+ from requests import exceptions\ntry:\ncommon.get_credentials()\nif not self.is_logged_in():\nself._login()\nself.is_prefetch_login = True\n- except requests.exceptions.RequestException as exc:\n+ except exceptions.RequestException as exc:\n# It was not possible to connect to the web service, no connection, network problem, etc\nimport traceback\ncommon.error('Login prefetch: request exception {}', exc)\n" }, { "change_type": "MODIFY", "old_path": "resources/lib/services/nfsession/nfsession_base.py", "new_path": "resources/lib/services/nfsession/nfsession_base.py", "diff": "from __future__ import absolute_import, division, unicode_literals\nfrom functools import wraps\n-import requests\nimport resources.lib.common as common\nimport resources.lib.common.cookies as cookies\n@@ -64,7 +63,8 @@ class NFSessionBase(object):\ncommon.info('Session closed')\nexcept AttributeError:\npass\n- self.session = requests.session()\n+ from requests import session\n+ self.session = session()\nself.session.headers.update({\n'User-Agent': common.get_user_agent(enable_android_mediaflag_fix=True),\n'Accept-Encoding': 'gzip'\n" }, { "change_type": "MODIFY", "old_path": "resources/lib/services/nfsession/nfsession_requests.py", "new_path": "resources/lib/services/nfsession/nfsession_requests.py", "diff": "from __future__ import absolute_import, division, unicode_literals\nimport json\n-import requests\nimport resources.lib.common as common\nimport resources.lib.api.website as website\n@@ -97,7 +96,7 @@ class NFSessionRequests(NFSessionBase):\ndef try_refresh_session_data(self, raise_exception=False):\n\"\"\"Refresh session_data from the Netflix website\"\"\"\n- # pylint: disable=broad-except\n+ from requests import exceptions\ntry:\nself.auth_url = website.extract_session_data(self._get('browse'))['auth_url']\nself.update_session_data()\n@@ -115,13 +114,13 @@ class NFSessionRequests(NFSessionBase):\n# This prevent the MSL error: No entity association record found for the user\ncommon.send_signal(signal=common.Signals.CLEAR_USER_ID_TOKENS)\nreturn self._login()\n- except requests.exceptions.RequestException:\n+ except exceptions.RequestException:\nimport traceback\ncommon.warn('Failed to refresh session data, request error (RequestException)')\ncommon.warn(g.py2_decode(traceback.format_exc(), 'latin-1'))\nif raise_exception:\nraise\n- except Exception:\n+ except Exception: # pylint: disable=broad-except\nimport traceback\ncommon.warn('Failed to refresh session data, login expired (Exception)')\ncommon.debug(g.py2_decode(traceback.format_exc(), 'latin-1'))\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
Avoid load request module at addon startup
106,046
14.05.2020 08:41:30
-7,200
9efe457f1dccaf1d6a948c8fa1f5ef63d3e16a34
Fixed library sync due to an error caused the failure of auto-update/sync with my list
[ { "change_type": "MODIFY", "old_path": "resources/lib/kodi/library_tasks.py", "new_path": "resources/lib/kodi/library_tasks.py", "diff": "@@ -59,39 +59,40 @@ def execute_tasks(title, tasks, task_handler, **kwargs):\[email protected]_execution(immediate=False)\ndef compile_tasks(videoid, task_handler, nfo_settings=None):\n\"\"\"Compile a list of tasks for items based on the videoid\"\"\"\n- common.debug('Compiling library tasks for {}', videoid)\n- task = None\n+ common.debug('Compiling library tasks for task handler \"{}\" and videoid \"{}\"', task_handler.__name__, videoid)\n+ tasks = None\ntry:\nif task_handler == export_item:\nmetadata = api.get_metadata(videoid)\nif videoid.mediatype == common.VideoId.MOVIE:\n- task = _create_export_movie_task(videoid, metadata[0], nfo_settings)\n+ tasks = _create_export_movie_task(videoid, metadata[0], nfo_settings)\nelif videoid.mediatype in common.VideoId.TV_TYPES:\n- task = _create_export_tv_tasks(videoid, metadata, nfo_settings)\n+ tasks = _create_export_tv_tasks(videoid, metadata, nfo_settings)\nelse:\n- raise ValueError('Cannot handle {}'.format(videoid))\n+ raise ValueError('compile_tasks: cannot handle videoid \"{}\" for task handler \"{}\"'\n+ .format(videoid, task_handler.__name__))\nif task_handler == export_new_item:\nmetadata = api.get_metadata(videoid, True)\n- task = _create_new_episodes_tasks(videoid, metadata, nfo_settings)\n+ tasks = _create_new_episodes_tasks(videoid, metadata, nfo_settings)\nif task_handler == remove_item:\nif videoid.mediatype == common.VideoId.MOVIE:\n- task = _create_remove_movie_task(videoid)\n+ tasks = _create_remove_movie_task(videoid)\nif videoid.mediatype == common.VideoId.SHOW:\n- task = _compile_remove_tvshow_tasks(videoid)\n+ tasks = _compile_remove_tvshow_tasks(videoid)\nif videoid.mediatype == common.VideoId.SEASON:\n- task = _compile_remove_season_tasks(videoid)\n+ tasks = _compile_remove_season_tasks(videoid)\nif videoid.mediatype == common.VideoId.EPISODE:\n- task = _create_remove_episode_task(videoid)\n+ tasks = _create_remove_episode_task(videoid)\nexcept MetadataNotAvailable:\n- common.warn('compile_tasks: task_handler {} unavailable metadata for {} task skipped',\n+ common.warn('compile_tasks: unavailable metadata for videoid \"{}\" tasks compiling skipped',\ntask_handler, videoid)\nreturn [{}]\n- if task is None:\n- common.warn('compile_tasks: task_handler {} did not match any task for {}',\n- task_handler, videoid)\n- return task\n+ if tasks is None:\n+ common.warn('compile_tasks: no tasks have been compiled for task handler \"{}\" and videoid \"{}\"',\n+ task_handler.__name__, videoid)\n+ return tasks\ndef _create_export_movie_task(videoid, movie, nfo_settings):\n@@ -138,13 +139,12 @@ def _create_export_tv_tasks(videoid, metadata, nfo_settings):\ndef _compile_export_show_tasks(videoid, show, nfo_settings):\n- \"\"\"Compile a list of task items for all episodes of all seasons\n- of a tvshow\"\"\"\n- # This nested comprehension is nasty but necessary. It flattens\n- # the task lists for each season into one list\n- return [task for season in show['seasons']\n- for task in _compile_export_season_tasks(\n- videoid.derive_season(season['id']), show, season, nfo_settings)]\n+ \"\"\"Compile a list of task items for all episodes of all seasons of a tvshow\"\"\"\n+ tasks = []\n+ for season in show['seasons']:\n+ tasks += [task for task in\n+ _compile_export_season_tasks(videoid.derive_season(season['id']), show, season, nfo_settings)]\n+ return tasks\ndef _compile_export_season_tasks(videoid, show, season, nfo_settings):\n@@ -205,12 +205,12 @@ def _add_missing_items(tasks, season, videoid, metadata, nfo_settings):\ncommon.debug('Auto exporting episode {}', episode['id'])\nelse:\n# The season does not exist, build task for the season\n- tasks.append(_compile_export_season_tasks(\n+ tasks += _compile_export_season_tasks(\nvideoid=videoid.derive_season(season['id']),\nshow=metadata[0],\nseason=season,\nnfo_settings=nfo_settings\n- ))\n+ )\ncommon.debug('Auto exporting season {}', season['id'])\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
Fixed library sync due to an error caused the failure of auto-update/sync with my list
106,046
14.05.2020 08:45:38
-7,200
75d687dfa27a1d1c2119e7be884365f001e099de
Removed time executions by methods often called
[ { "change_type": "MODIFY", "old_path": "resources/lib/kodi/library_items.py", "new_path": "resources/lib/kodi/library_items.py", "diff": "@@ -37,7 +37,6 @@ class ItemNotFound(Exception):\n\"\"\"The requested item could not be found in the Kodi library\"\"\"\[email protected]_execution(immediate=False)\ndef get_item(videoid):\n\"\"\"Find an item in the Kodi library by its Netflix videoid and return Kodi DBID and mediatype\"\"\"\ntry:\n@@ -47,7 +46,6 @@ def get_item(videoid):\nraise ItemNotFound('The video with id {} is not present in the Kodi library'.format(videoid))\[email protected]_execution(immediate=False)\ndef _get_library_entry(videoid):\nif videoid.mediatype == common.VideoId.MOVIE:\nfile_path = g.SHARED_DB.get_movie_filepath(videoid.value)\n@@ -72,7 +70,6 @@ def _get_library_entry(videoid):\nreturn file_path, media_type\[email protected]_execution(immediate=False)\ndef _get_item(mediatype, filename):\n# To ensure compatibility with previously exported items,\n# make the filename legal\n@@ -150,7 +147,6 @@ def export_new_item(item_task, library_home):\nexport_item(item_task, library_home)\[email protected]_execution(immediate=False)\ndef export_item(item_task, library_home):\n\"\"\"Create strm file for an item and add it to the library\"\"\"\n# Paths must be legal to ensure NFS compatibility\n@@ -206,7 +202,6 @@ def _write_nfo_file(nfo_data, nfo_filename):\nfilehandle.close()\[email protected]_execution(immediate=False)\ndef remove_item(item_task, library_home=None):\n\"\"\"Remove an item from the library and delete if from disk\"\"\"\n# pylint: disable=unused-argument, broad-except\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
Removed time executions by methods often called
106,046
14.05.2020 10:30:44
-7,200
37015491b6f9288677b6f61f77b015f3fe3cefde
Missing push update
[ { "change_type": "MODIFY", "old_path": "resources/language/resource.language.it_it/strings.po", "new_path": "resources/language/resource.language.it_it/strings.po", "diff": "@@ -519,11 +519,11 @@ msgid \"Check the logfile for detailed information\"\nmsgstr \"Controlla il file di log per informazioni dettagliate\"\nmsgctxt \"#30132\"\n-msgid \"Purge in-memory cache\"\n+msgid \"Clear in-memory cache\"\nmsgstr \"Svuota cache in memoria\"\nmsgctxt \"#30133\"\n-msgid \"Purge in-memory and on-disk cache\"\n+msgid \"Clear in-memory and on-disk cache\"\nmsgstr \"Svuota cache in memoria e su disco\"\nmsgctxt \"#30134\"\n" }, { "change_type": "MODIFY", "old_path": "resources/language/resource.language.nl_nl/strings.po", "new_path": "resources/language/resource.language.nl_nl/strings.po", "diff": "@@ -517,11 +517,11 @@ msgid \"Check the logfile for detailed information\"\nmsgstr \"Controleer het logboek voor gedetaileerde informatie\"\nmsgctxt \"#30132\"\n-msgid \"Purge in-memory cache\"\n+msgid \"Clear in-memory cache\"\nmsgstr \"In-memory cache leegmaken\"\nmsgctxt \"#30133\"\n-msgid \"Purge in-memory and on-disk cache\"\n+msgid \"Clear in-memory and on-disk cache\"\nmsgstr \"In-memory en on-disk cache leegmaken\"\nmsgctxt \"#30134\"\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
Missing push update
106,046
14.05.2020 10:46:13
-7,200
43398e56965e2e8ecf767aa7945ad1600b3f52cb
Fixed pylint error unnecessary-comprehension
[ { "change_type": "MODIFY", "old_path": "resources/lib/kodi/library_tasks.py", "new_path": "resources/lib/kodi/library_tasks.py", "diff": "@@ -142,8 +142,7 @@ def _compile_export_show_tasks(videoid, show, nfo_settings):\n\"\"\"Compile a list of task items for all episodes of all seasons of a tvshow\"\"\"\ntasks = []\nfor season in show['seasons']:\n- tasks += [task for task in\n- _compile_export_season_tasks(videoid.derive_season(season['id']), show, season, nfo_settings)]\n+ tasks += _compile_export_season_tasks(videoid.derive_season(season['id']), show, season, nfo_settings)\nreturn tasks\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
Fixed pylint error unnecessary-comprehension
106,046
14.05.2020 10:53:53
-7,200
75709c792071d76633f7126446c5d9bf6767732f
Add 30128 id to all translations
[ { "change_type": "MODIFY", "old_path": "resources/language/resource.language.de_de/strings.po", "new_path": "resources/language/resource.language.de_de/strings.po", "diff": "@@ -502,7 +502,9 @@ msgctxt \"#30127\"\nmsgid \"Awarded rating of {}\"\nmsgstr \"Mit {} bewertet\"\n-# Unused 30128\n+msgctxt \"#30128\"\n+msgid \"Select a profile\"\n+msgstr \"\"\nmsgctxt \"#30129\"\nmsgid \"Enable Up Next integration\"\n" }, { "change_type": "MODIFY", "old_path": "resources/language/resource.language.hr_hr/strings.po", "new_path": "resources/language/resource.language.hr_hr/strings.po", "diff": "@@ -505,7 +505,9 @@ msgctxt \"#30127\"\nmsgid \"Awarded rating of {}\"\nmsgstr \"Dodijeljena ocjena {}\"\n-# Unused 30128\n+msgctxt \"#30128\"\n+msgid \"Select a profile\"\n+msgstr \"\"\nmsgctxt \"#30129\"\nmsgid \"Enable Up Next integration\"\n" }, { "change_type": "MODIFY", "old_path": "resources/language/resource.language.it_it/strings.po", "new_path": "resources/language/resource.language.it_it/strings.po", "diff": "@@ -504,7 +504,9 @@ msgctxt \"#30127\"\nmsgid \"Awarded rating of {}\"\nmsgstr \"Punteggio assegnato di {}\"\n-# Unused 30128\n+msgctxt \"#30128\"\n+msgid \"Select a profile\"\n+msgstr \"\"\nmsgctxt \"#30129\"\nmsgid \"Enable Up Next integration\"\n" }, { "change_type": "MODIFY", "old_path": "resources/language/resource.language.nl_nl/strings.po", "new_path": "resources/language/resource.language.nl_nl/strings.po", "diff": "@@ -502,7 +502,9 @@ msgctxt \"#30127\"\nmsgid \"Awarded rating of {}\"\nmsgstr \"Toegekende beoordeling van {}\"\n-# Unused 30128\n+msgctxt \"#30128\"\n+msgid \"Select a profile\"\n+msgstr \"\"\nmsgctxt \"#30129\"\nmsgid \"Enable Up Next integration\"\n" }, { "change_type": "MODIFY", "old_path": "resources/language/resource.language.pl_pl/strings.po", "new_path": "resources/language/resource.language.pl_pl/strings.po", "diff": "@@ -504,7 +504,9 @@ msgctxt \"#30127\"\nmsgid \"Awarded rating of {}\"\nmsgstr \"Przyznana ocena {}\"\n-# Unused 30128\n+msgctxt \"#30128\"\n+msgid \"Select a profile\"\n+msgstr \"\"\nmsgctxt \"#30129\"\nmsgid \"Enable Up Next integration\"\n" }, { "change_type": "MODIFY", "old_path": "resources/language/resource.language.tr_tr/strings.po", "new_path": "resources/language/resource.language.tr_tr/strings.po", "diff": "@@ -502,7 +502,9 @@ msgctxt \"#30127\"\nmsgid \"Awarded rating of {}\"\nmsgstr \"Verilen derecelendirme {}\"\n-# Unused 30128\n+msgctxt \"#30128\"\n+msgid \"Select a profile\"\n+msgstr \"\"\nmsgctxt \"#30129\"\nmsgid \"Enable Up Next integration\"\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
Add 30128 id to all translations
106,046
14.05.2020 15:07:39
-7,200
8216d05f8c32373dec1ad51cabfab57904b6ee57
Removed possibility to invalidate 'queue' context it was strange that nf invalidated this context now it doesn't seem to happen anymore perhaps was a nf bug
[ { "change_type": "MODIFY", "old_path": "resources/lib/services/msl/events_handler.py", "new_path": "resources/lib/services/msl/events_handler.py", "diff": "@@ -136,11 +136,6 @@ class EventsHandler(threading.Thread):\nif event.event_data['is_in_mylist']:\n# If video is in my list, invalidate the continueWatching list (update lolomo context data)\napi.update_lolomo_context('continueWatching')\n- else:\n- # Else invalidate the 'queue' list (update lolomo context data)\n- # Todo: get 'queue' lolomo id/index\n- # api.update_lolomo_context('queue')\n- pass\napi.update_videoid_bookmark(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" } ]
Python
MIT License
castagnait/plugin.video.netflix
Removed possibility to invalidate 'queue' context it was strange that nf invalidated this context now it doesn't seem to happen anymore perhaps was a nf bug
106,046
14.05.2020 20:14:35
-7,200
f8d00dfdd7a01d96623df15000ddaeb20f70076a
Fixed 'refresh' behaviour in get_metadata
[ { "change_type": "MODIFY", "old_path": "resources/lib/api/api_requests.py", "new_path": "resources/lib/api/api_requests.py", "diff": "@@ -227,15 +227,19 @@ def _update_mylist_cache(videoid, operation, params):\[email protected]_execution(immediate=False)\ndef get_metadata(videoid, refresh=False):\n\"\"\"Retrieve additional metadata for the given VideoId\"\"\"\n+ metadata_data = {}, None\n# Delete the cache if we need to refresh the all metadata\nif refresh:\n- g.CACHE.delete(cache_utils.CACHE_METADATA, videoid.value)\n- metadata_data = {}, None\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))\nif videoid.mediatype not in [common.VideoId.EPISODE, common.VideoId.SEASON]:\n- metadata_data = _metadata(videoid), None\n+ # videoid of type tvshow, movie, supplemental\n+ metadata_data = _metadata(video_id=videoid), None\nelif videoid.mediatype == common.VideoId.SEASON:\n- metadata_data = _metadata(videoid.derive_parent(None)), None\n- else:\n+ metadata_data = _metadata(video_id=videoid.derive_parent(None)), None\n+ else: # it is an episode\ntry:\nmetadata_data = _episode_metadata(videoid)\nexcept KeyError as exc:\n@@ -243,18 +247,19 @@ def get_metadata(videoid, refresh=False):\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- common.debug('{}, refreshing cache', exc)\n- g.CACHE.delete(cache_utils.CACHE_METADATA, videoid.tvshowid)\n+ common.debug('find_episode_metadata raised an error: {}, refreshing cache', exc)\ntry:\n- metadata_data = _episode_metadata(videoid)\n+ metadata_data = _episode_metadata(videoid, refresh_cache=True)\nexcept KeyError as exc:\n- common.error(exc)\n+ common.error('Episode metadata not found, find_episode_metadata raised an error: {}', exc)\nreturn metadata_data\[email protected]_execution(immediate=False)\n-def _episode_metadata(videoid):\n- show_metadata = _metadata(videoid)\n+def _episode_metadata(videoid, refresh_cache=False):\n+ tvshow_videoid = videoid.derive_parent(0)\n+ if refresh_cache:\n+ g.CACHE.delete(cache_utils.CACHE_METADATA, str(tvshow_videoid))\n+ show_metadata = _metadata(video_id=tvshow_videoid)\nepisode_metadata, season_metadata = common.find_episode_metadata(videoid, show_metadata)\nreturn episode_metadata, season_metadata, show_metadata\n@@ -262,9 +267,9 @@ def _episode_metadata(videoid):\[email protected]_execution(immediate=False)\n@cache_utils.cache_output(cache_utils.CACHE_METADATA, identify_from_kwarg_name='video_id')\ndef _metadata(video_id):\n- \"\"\"Retrieve additional metadata for a video.This is a separate method from\n- metadata(videoid) to work around caching issues when new episodes are added\n- to a show by Netflix.\"\"\"\n+ \"\"\"Retrieve additional metadata for a video.\n+ This is a separate method from get_metadata(videoid) to work around caching issues\n+ when new episodes are added to a tv show by Netflix.\"\"\"\nimport time\ncommon.debug('Requesting metadata for {}', video_id)\n# Always use params 'movieid' to all videoid identifier\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
Fixed 'refresh' behaviour in get_metadata
106,046
15.05.2020 13:57:55
-7,200
5ce0a4ea59092220f171c1a49c28007c2218644c
Avoid save unknown audio language and avoid restore empty dict
[ { "change_type": "MODIFY", "old_path": "resources/lib/services/playback/am_stream_continuity.py", "new_path": "resources/lib/services/playback/am_stream_continuity.py", "diff": "@@ -92,7 +92,9 @@ class AMStreamContinuity(ActionManager):\n# Check if the audio stream is changed\ncurrent_stream = self.current_streams['audio']\nplayer_stream = player_state.get(STREAMS['audio']['current'])\n- if not self._is_stream_value_equal(current_stream, player_stream):\n+ # If the current audio language is labeled as 'unk' means unknown, skip the save for the next check,\n+ # this has been verified on Kodi 18, the cause is unknown\n+ if player_stream['language'] != 'unk' and not self._is_stream_value_equal(current_stream, player_stream):\nself._set_current_stream('audio', player_state)\nself._save_changed_stream('audio', player_stream)\ncommon.debug('audio has changed from {} to {}', current_stream, player_stream)\n@@ -102,7 +104,7 @@ class AMStreamContinuity(ActionManager):\n# otherwise Kodi reacts strangely if only one value of these is restored\ncurrent_stream = self.current_streams['subtitle']\nplayer_stream = player_state.get(STREAMS['subtitle']['current'])\n- if player_stream is None:\n+ if not player_stream:\n# I don't know the cause:\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@@ -132,11 +134,11 @@ class AMStreamContinuity(ActionManager):\n})\ndef _restore_stream(self, stype):\n- common.debug('Trying to restore {}...', stype)\nset_stream = STREAMS[stype]['setter']\nstored_stream = self.sc_settings.get(stype)\n- if stored_stream is None:\n+ if stored_stream is None or (isinstance(stored_stream, dict) and not stored_stream):\nreturn\n+ common.debug('Trying to restore {} with stored data {}', stype, stored_stream)\ndata_type_dict = isinstance(stored_stream, dict)\nif self.legacy_kodi_version:\n# Kodi version 18, this is the old method that have a unresolvable bug:\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
Avoid save unknown audio language and avoid restore empty dict
106,046
15.05.2020 18:59:55
-7,200
b81b631851ff796202bb878855e1679a542d55a6
Add support to promo trailer video for custom kodi skins The custom Kodi skins can now use the property ListItem.Trailer to implement for example the playback of a promo video when a listitem is selected
[ { "change_type": "MODIFY", "old_path": "resources/lib/api/paths.py", "new_path": "resources/lib/api/paths.py", "diff": "@@ -12,6 +12,7 @@ from future.utils import iteritems\nimport resources.lib.common as common\n+from resources.lib.globals import g\nfrom .exceptions import InvalidReferenceError\nMAX_PATH_REQUEST_SIZE = 47 # Stands for 48 results, is the default value defined by netflix for a single request\n@@ -45,7 +46,7 @@ VIDEO_LIST_PARTIAL_PATHS = [\n[['requestId', 'summary', 'title', 'synopsis', 'regularSynopsis', 'evidence', 'queue',\n'episodeCount', 'info', 'maturity', 'runtime', 'seasonCount',\n'releaseYear', 'userRating', 'numSeasonsLabel', 'bookmarkPosition', 'creditsOffset',\n- 'dpSupplementalMessage', 'watched', 'delivery', 'sequiturEvidence']],\n+ 'dpSupplementalMessage', 'watched', 'delivery', 'sequiturEvidence', 'promoVideo']],\n[['genres', 'tags', 'creators', 'directors', 'cast'],\n{'from': 0, 'to': 10}, ['id', 'name']]\n] + ART_PARTIAL_PATHS\n@@ -100,14 +101,17 @@ INFO_MAPPINGS = {\n'userrating': ['userRating', 'userRating'],\n'mpaa': ['maturity', 'rating', 'value'],\n'duration': 'runtime',\n- # 'bookmark': 'bookmarkPosition',\n- # 'playcount': 'watched'\n+ # 'trailer' add the trailer button support to 'Information' window of ListItem, can be used from custom Kodi skins\n+ # to reproduce a background promo video when a ListItem is selected\n+ 'trailer': ['promoVideo', 'id']\n}\nINFO_TRANSFORMATIONS = {\n'season_shortname': lambda sn: ''.join([n for n in sn if n.isdigit()]),\n'rating': lambda r: r / 10,\n- 'playcount': lambda w: int(w) # pylint: disable=unnecessary-lambda\n+ 'playcount': lambda w: int(w), # pylint: disable=unnecessary-lambda\n+ 'trailer': lambda video_id: common.build_url(pathitems=[common.VideoId.SUPPLEMENTAL, str(video_id)],\n+ mode=g.MODE_PLAY)\n}\nREFERENCE_MAPPINGS = {\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
Add support to promo trailer video for custom kodi skins The custom Kodi skins can now use the property ListItem.Trailer to implement for example the playback of a promo video when a listitem is selected
106,046
15.05.2020 20:46:57
-7,200
568fb2fa121e23bf95c0ab8459bab5e70d2e66eb
Add strf_timestamp
[ { "change_type": "MODIFY", "old_path": "resources/lib/common/misc_utils.py", "new_path": "resources/lib/common/misc_utils.py", "diff": "@@ -119,6 +119,19 @@ def strp(value, form):\nreturn def_value\n+def strf_timestamp(timestamp, form):\n+ \"\"\"\n+ Helper function to safely create string date time from a timestamp value\n+\n+ :return: string - date time in the specified form\n+ \"\"\"\n+ from datetime import datetime\n+ try:\n+ return datetime.utcfromtimestamp(timestamp).strftime(form)\n+ except Exception: # pylint: disable=broad-except\n+ return ''\n+\n+\n# def compress_data(data):\n# \"\"\"GZIP and b64 encode data\"\"\"\n# out = StringIO()\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
Add strf_timestamp
106,046
15.05.2020 20:47:33
-7,200
46434021f865bd61a5795d0736cdf7e19eafdb85
Add date of availability info
[ { "change_type": "MODIFY", "old_path": "resources/lib/api/paths.py", "new_path": "resources/lib/api/paths.py", "diff": "@@ -44,7 +44,7 @@ ART_PARTIAL_PATHS = [\nVIDEO_LIST_PARTIAL_PATHS = [\n[['requestId', 'summary', 'title', 'synopsis', 'regularSynopsis', 'evidence', 'queue',\n- 'episodeCount', 'info', 'maturity', 'runtime', 'seasonCount',\n+ 'episodeCount', 'info', 'maturity', 'runtime', 'seasonCount', 'availability',\n'releaseYear', 'userRating', 'numSeasonsLabel', 'bookmarkPosition', 'creditsOffset',\n'dpSupplementalMessage', 'watched', 'delivery', 'sequiturEvidence', 'promoVideo']],\n[['genres', 'tags', 'creators', 'directors', 'cast'],\n@@ -103,7 +103,8 @@ INFO_MAPPINGS = {\n'duration': 'runtime',\n# 'trailer' add the trailer button support to 'Information' window of ListItem, can be used from custom Kodi skins\n# to reproduce a background promo video when a ListItem is selected\n- 'trailer': ['promoVideo', 'id']\n+ 'trailer': ['promoVideo', 'id'],\n+ 'dateadded': ['availability', 'availabilityStartTime']\n}\nINFO_TRANSFORMATIONS = {\n@@ -111,7 +112,8 @@ INFO_TRANSFORMATIONS = {\n'rating': lambda r: r / 10,\n'playcount': lambda w: int(w), # pylint: disable=unnecessary-lambda\n'trailer': lambda video_id: common.build_url(pathitems=[common.VideoId.SUPPLEMENTAL, str(video_id)],\n- mode=g.MODE_PLAY)\n+ mode=g.MODE_PLAY),\n+ 'dateadded': lambda ats: common.strf_timestamp(int(ats / 1000), '%Y-%m-%d %H:%M:%S')\n}\nREFERENCE_MAPPINGS = {\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
Add date of availability info
106,046
16.05.2020 09:43:43
-7,200
96f8bee139aa068913ad23059cac19dcf2a70d64
Restored mediaflags to directories
[ { "change_type": "MODIFY", "old_path": "resources/lib/navigation/directory_utils.py", "new_path": "resources/lib/navigation/directory_utils.py", "diff": "@@ -83,7 +83,7 @@ def _convert_dict_to_listitem(dict_item):\n'TotalTime': dict_item.get('TotalTime', ''),\n'ResumeTime': dict_item.get('ResumeTime', '')\n})\n- for stream_type, quality_info in iteritems(dict_item['quality_info']):\n+ for stream_type, quality_info in iteritems(dict_item.get('quality_info', {})):\nlist_item.addStreamInfo(stream_type, quality_info)\nlist_item.setProperties(properties)\nlist_item.setInfo('video', dict_item.get('info', {}))\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
Restored mediaflags to directories
106,046
16.05.2020 10:41:32
-7,200
fa481f08071308abcd1758dab4edaa83f8f4f002
Fixed wrong frame rate switching This also fixes problems with dolby vision that caused lost signal with messing colours Tested on kodi 18.6
[ { "change_type": "MODIFY", "old_path": "resources/lib/services/msl/converter.py", "new_path": "resources/lib/services/msl/converter.py", "diff": "@@ -170,7 +170,8 @@ def _convert_video_downloadable(downloadable, adaptation_set, init_length, cdn_i\nbandwidth=str(downloadable['bitrate'] * 1024),\nnflxContentProfile=str(downloadable['content_profile']),\ncodecs=_determine_video_codec(downloadable['content_profile']),\n- frameRate=str(downloadable['framerate_value'] / downloadable['framerate_scale']),\n+ frameRate='{fps_rate}/{fps_scale}'.format(fps_rate=downloadable['framerate_value'],\n+ fps_scale=downloadable['framerate_scale']),\nmimeType='video/mp4')\n_add_base_url(representation, downloadable['urls'][cdn_index]['url'])\n_add_segment_base(representation, init_length)\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
Fixed wrong frame rate switching This also fixes problems with dolby vision that caused lost signal with messing colours Tested on kodi 18.6
106,046
16.05.2020 16:08:36
-7,200
527372a75ce92658726570efe17adbb2540e1831
Moved cache clear on upgrade to service now that the cache is managed by service, we can do a little speedup the addon startup after an upgrade
[ { "change_type": "MODIFY", "old_path": "resources/lib/upgrade_controller.py", "new_path": "resources/lib/upgrade_controller.py", "diff": "@@ -59,8 +59,6 @@ def _perform_addon_changes(previous_ver, current_ver):\nmsg = ('This update resets the settings to auto-update library.\\r\\n'\n'Therefore only in case you are using auto-update must be reconfigured.')\nui.show_ok_dialog('Netflix upgrade', msg)\n- # Clear cache (prevents problems when netflix change data structures)\n- g.CACHE.clear()\n# Always leave this to last - After the operations set current version\ng.LOCAL_DB.set_value('addon_previous_version', current_ver)\n@@ -68,6 +66,8 @@ def _perform_addon_changes(previous_ver, current_ver):\ndef _perform_service_changes(previous_ver, current_ver):\n\"\"\"Perform actions for an version bump\"\"\"\ndebug('Initialize service upgrade operations, from version {} to {})', previous_ver, current_ver)\n+ # Clear cache (prevents problems when netflix change data structures)\n+ g.CACHE.clear()\nif previous_ver and is_less_version(previous_ver, '1.2.0'):\n# In the version 1.2.0 has been implemented a new cache management\nfrom resources.lib.upgrade_actions import delete_cache_folder\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
Moved cache clear on upgrade to service now that the cache is managed by service, we can do a little speedup the addon startup after an upgrade
106,046
17.05.2020 14:33:39
-7,200
6889c4e90d0770c38d25bd906cf840a0d17e342c
Execute colorize_text only one time
[ { "change_type": "MODIFY", "old_path": "resources/lib/kodi/infolabels.py", "new_path": "resources/lib/kodi/infolabels.py", "diff": "@@ -90,14 +90,13 @@ def _add_supplemental_plot_info(infos_copy, item, common_data):\nplot = infos_copy.get('Plot', '')\nplotoutline = infos_copy.get('PlotOutline', '')\nif suppl_text:\n+ suppl_text = _colorize_text(common_data['supplemental_info_color'], suppl_text)\nif plot:\nplot += '[CR][CR]'\nif plotoutline:\nplotoutline += '[CR][CR]'\n- infos_copy.update(\n- {'Plot': plot + _colorize_text(common_data['supplemental_info_color'], suppl_text)})\n- infos_copy.update(\n- {'PlotOutline': plotoutline + _colorize_text(common_data['supplemental_info_color'], suppl_text)})\n+ infos_copy.update({'Plot': plot + suppl_text})\n+ infos_copy.update({'PlotOutline': plotoutline + suppl_text})\ndef get_art(videoid, item, profile_language_code=''):\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
Execute colorize_text only one time
106,046
17.05.2020 20:27:26
-7,200
52716516627e664d848e516365183f50799072aa
Fixed add title color wrong behaviour
[ { "change_type": "MODIFY", "old_path": "resources/lib/kodi/infolabels.py", "new_path": "resources/lib/kodi/infolabels.py", "diff": "@@ -286,10 +286,10 @@ def get_info_from_library(videoid):\ndef add_title_color(dict_item, infos_copy, common_data):\n\"\"\"Highlight list item title when the videoid is contained in my-list\"\"\"\n- updated_title = _colorize_text(common_data['mylist_titles_color'], infos_copy['title'])\n- if dict_item['is_folder']:\n- dict_item['Label'] = updated_title\n- # When a xbmcgui.Listitem is not a folder 'label' is replaced by 'title' property of infoLabel\n+ updated_title = _colorize_text(common_data['mylist_titles_color'], dict_item['label'])\n+ dict_item['label'] = updated_title\n+ # When a xbmcgui.Listitem is not a folder 'label' is replaced by 'Title' property of infoLabel\n+ if not dict_item['is_folder']:\ninfos_copy['Title'] = updated_title\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
Fixed add title color wrong behaviour
106,046
17.05.2020 20:31:20
-7,200
51ceb6d05da41169cdb2629e2971f6de4f4b62c4
Version bump (1.3.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.3.0\" provider-name=\"libdev + jojo + asciidisco + caphm + castagnait\">\n+<addon id=\"plugin.video.netflix\" name=\"Netflix\" version=\"1.3.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.3.1 (2020-05-17)\n+Note to RPI devices: credentials will be asked again a storage problem has been fixed\n+-Fixed KeyError issue\n+\nv1.3.0 (2020-05-17)\nNote to RPI devices: credentials will be asked again a storage problem has been fixed\n-Reimplemented parental control\n" }, { "change_type": "MODIFY", "old_path": "changelog.txt", "new_path": "changelog.txt", "diff": "+v1.3.1 (2020-05-17)\n+Note to RPI devices: credentials will be asked again a storage problem has been fixed\n+-Fixed KeyError issue\n+\nv1.3.0 (2020-05-17)\nNote to RPI devices: credentials will be asked again a storage problem has been fixed\n-Reimplemented parental control\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
Version bump (1.3.1)
106,046
18.05.2020 09:47:02
-7,200
78bc2596e9fc277b673ccb0ee6c3e7a9ee0530f0
Add Plot fallback to skin not support PlotOutline
[ { "change_type": "MODIFY", "old_path": "resources/lib/kodi/infolabels.py", "new_path": "resources/lib/kodi/infolabels.py", "diff": "@@ -67,7 +67,9 @@ def add_info_dict_item(dict_item, videoid, item, raw_data, is_in_mylist, common_\ndict_item['quality_info'] = quality_infos\n# Use a deepcopy of dict to not reflect future changes to the dictionary also to the cache\ninfos_copy = copy.deepcopy(infos)\n-\n+ if 'Plot' not in infos_copy and 'PlotOutline' in infos_copy:\n+ # Not all skins support read value from PlotOutline\n+ infos_copy['Plot'] = infos_copy['PlotOutline']\n_add_supplemental_plot_info(infos_copy, item, common_data)\nif is_in_mylist and common_data.get('mylist_titles_color'):\nadd_title_color(dict_item, infos_copy, common_data)\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
Add Plot fallback to skin not support PlotOutline
106,046
18.05.2020 16:55:32
-7,200
b4359875887567285216b64c9f8a3e5fee50d359
Fixed UnicodeWarning error globals.py:225: UnicodeWarning: Unicode equal comparison failed to convert both arguments to Unicode - interpreting them as being unequal if path not in sys.path:
[ { "change_type": "MODIFY", "old_path": "resources/lib/globals.py", "new_path": "resources/lib/globals.py", "diff": "@@ -30,6 +30,11 @@ from future.utils import iteritems\nimport xbmc\nimport xbmcaddon\n+try: # Python 2\n+ unicode\n+except NameError: # Python 3\n+ unicode = str # pylint: disable=redefined-builtin,invalid-name\n+\nclass GlobalVariables(object):\n\"\"\"Encapsulation for global variables to work around quirks with\n@@ -220,10 +225,16 @@ class GlobalVariables(object):\nmodule_paths = [\nos.path.join(self.ADDON_DATA_PATH, 'modules', 'mysql-connector-python')\n]\n- for path in module_paths:\n- path = xbmc.translatePath(path)\n- if path not in sys.path:\n- sys.path.insert(0, g.py2_decode(path))\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+ sys_path_filtered = [value for value in sys.path if isinstance(value, unicode)]\n+\n+ for path in module_paths: # module_paths has unicode type values\n+ path = g.py2_decode(xbmc.translatePath(path))\n+ if path not in sys_path_filtered:\n+ sys.path.insert(0, path) # This add an unicode string type\nself.CACHE_PATH = os.path.join(self.DATA_PATH, 'cache')\nself.COOKIE_PATH = os.path.join(self.DATA_PATH, 'COOKIE')\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
Fixed UnicodeWarning error globals.py:225: UnicodeWarning: Unicode equal comparison failed to convert both arguments to Unicode - interpreting them as being unequal if path not in sys.path:
106,046
18.05.2020 19:55:42
-7,200
3995a7c6e0b5938438c28a3fd13d52ca3312d978
Fixed unicodedecode error
[ { "change_type": "MODIFY", "old_path": "resources/lib/api/paths.py", "new_path": "resources/lib/api/paths.py", "diff": "@@ -115,7 +115,7 @@ INFO_MAPPINGS = [\n]\nINFO_TRANSFORMATIONS = {\n- 'Season': lambda s_value: ''.join([n for n in str(s_value) if n.isdigit()]), # isdigit is needed for shortName key\n+ 'Season': lambda s_value: _convert_season(s_value),\n'Episode': lambda ep: str(ep), # pylint: disable=unnecessary-lambda\n'Rating': lambda r: r / 10,\n'PlayCount': lambda w: int(w), # pylint: disable=unnecessary-lambda\n@@ -132,6 +132,13 @@ REFERENCE_MAPPINGS = {\n}\n+def _convert_season(value):\n+ if isinstance(value, int):\n+ return str(value)\n+ # isdigit is needed to filter out non numeric characters from 'shortName' key\n+ return ''.join([n for n in g.py2_encode(value) if n.isdigit()])\n+\n+\ndef build_paths(base_path, partial_paths):\n\"\"\"Build a list of full paths by concatenating each partial path with the base path\"\"\"\npaths = [base_path + partial_path for partial_path in partial_paths]\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
Fixed unicodedecode error
106,046
19.05.2020 10:01:08
-7,200
9b1df155c9140cbe855d7a9f537b7a8badd3489c
Close socket safe way
[ { "change_type": "MODIFY", "old_path": "resources/lib/common/device_utils.py", "new_path": "resources/lib/common/device_utils.py", "diff": "@@ -29,10 +29,10 @@ def select_unused_port():\n:return: int - Free port\n\"\"\"\nimport socket\n- sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)\n+ from contextlib import closing\n+ with closing(socket.socket(socket.AF_INET, socket.SOCK_STREAM)) as sock:\nsock.bind(('127.0.0.1', 0))\n_, port = sock.getsockname()\n- sock.close()\nreturn port\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
Close socket safe way
106,046
19.05.2020 12:57:31
-7,200
73eefb4b35d89181e19bb617672aa12365b5dd5e
modelgroup must always be in capital letters
[ { "change_type": "MODIFY", "old_path": "resources/lib/api/website.py", "new_path": "resources/lib/api/website.py", "diff": "@@ -313,7 +313,7 @@ def generate_esn(user_data):\nif g.LOCAL_DB.get_value('drm_security_level', '', table=TABLE_SESSION) == 'L1':\nesn = 'NFANDROID2-PRV-'\nif nrdp_modelgroup:\n- esn += nrdp_modelgroup + '-'\n+ esn += nrdp_modelgroup.upper() + '-'\nelse:\nesn += model.replace(' ', '').upper() + '-'\nelse:\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
modelgroup must always be in capital letters
106,046
19.05.2020 14:08:10
-7,200
58fd4431b079545183536dcef58ade9724668020
Removed Title property simplifies things
[ { "change_type": "MODIFY", "old_path": "resources/lib/api/paths.py", "new_path": "resources/lib/api/paths.py", "diff": "@@ -91,7 +91,6 @@ VIDEO_LIST_RATING_THUMB_PATHS = [\nSUPPLEMENTAL_TYPE_TRAILERS = 'trailers'\nINFO_MAPPINGS = [\n- ('Title', 'title'),\n('Year', 'releaseYear'),\n('Plot', 'regularSynopsis'), # Complete plot (Kodi 18 original skins do not use plotoutline)\n('PlotOutline', 'synopsis'), # Small plot\n" }, { "change_type": "MODIFY", "old_path": "resources/lib/kodi/infolabels.py", "new_path": "resources/lib/kodi/infolabels.py", "diff": "@@ -72,7 +72,8 @@ def add_info_dict_item(dict_item, videoid, item, raw_data, is_in_mylist, common_\ninfos_copy['Plot'] = infos_copy['PlotOutline']\n_add_supplemental_plot_info(infos_copy, item, common_data)\nif is_in_mylist and common_data.get('mylist_titles_color'):\n- add_title_color(dict_item, infos_copy, common_data)\n+ # Highlight ListItem title when the videoid is contained in my-list\n+ dict_item['label'] = _colorize_text(common_data['mylist_titles_color'], dict_item['label'])\ndict_item['info'] = infos_copy\n@@ -286,15 +287,6 @@ def get_info_from_library(videoid):\nreturn infos, art\n-def add_title_color(dict_item, infos_copy, common_data):\n- \"\"\"Highlight list item title when the videoid is contained in my-list\"\"\"\n- updated_title = _colorize_text(common_data['mylist_titles_color'], dict_item['label'])\n- dict_item['label'] = updated_title\n- # When a xbmcgui.Listitem is not a folder 'label' is replaced by 'Title' property of infoLabel\n- if not dict_item['is_folder']:\n- infos_copy['Title'] = updated_title\n-\n-\ndef _colorize_text(color_name, text):\nif color_name:\nreturn '[COLOR {}]{}[/COLOR]'.format(color_name, text)\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
Removed Title property simplifies things
106,046
19.05.2020 17:12:21
-7,200
ff75836e4192dc294e0e5fe4bd10babd28ffaf1f
Fixed upnext regression
[ { "change_type": "MODIFY", "old_path": "resources/lib/api/paths.py", "new_path": "resources/lib/api/paths.py", "diff": "@@ -91,6 +91,7 @@ VIDEO_LIST_RATING_THUMB_PATHS = [\nSUPPLEMENTAL_TYPE_TRAILERS = 'trailers'\nINFO_MAPPINGS = [\n+ ('Title', 'title'), # Title is needed only for UpNext metadata on play method\n('Year', 'releaseYear'),\n('Plot', 'regularSynopsis'), # Complete plot (Kodi 18 original skins do not use plotoutline)\n('PlotOutline', 'synopsis'), # Small plot\n" }, { "change_type": "MODIFY", "old_path": "resources/lib/kodi/infolabels.py", "new_path": "resources/lib/kodi/infolabels.py", "diff": "@@ -48,7 +48,7 @@ MEDIA_TYPE_MAPPINGS = {\n}\n-def get_info(videoid, item, raw_data, profile_language_code=''):\n+def get_info(videoid, item, raw_data, profile_language_code='', include_title=False):\n\"\"\"Get the infolabels data\"\"\"\ncache_identifier = videoid.value + '_' + profile_language_code\ntry:\n@@ -58,6 +58,8 @@ def get_info(videoid, item, raw_data, profile_language_code=''):\nexcept CacheMiss:\ninfos, quality_infos = parse_info(videoid, item, raw_data)\ng.CACHE.add(CACHE_INFOLABELS, cache_identifier, {'infos': infos, 'quality_infos': quality_infos})\n+ if not include_title:\n+ infos.pop('Title', None)\nreturn infos, quality_infos\n@@ -256,7 +258,8 @@ def get_info_from_netflix(videoids):\ninfo_data = {}\nfor videoid in videoids:\ntry:\n- infos = get_info(videoid, None, None, profile_language_code)[0]\n+ infos = get_info(videoid, None, None, profile_language_code,\n+ include_title=True)[0]\nart = _get_art(videoid, None, profile_language_code)\ninfo_data[videoid.value] = infos, art\ncommon.debug('Got infolabels and art from cache for videoid {}', videoid)\n@@ -268,7 +271,8 @@ def get_info_from_netflix(videoids):\ncommon.debug('Retrieving infolabels and art from API for {} videoids', len(videoids_to_request))\nraw_data = api.get_video_raw_data(videoids_to_request)\nfor videoid in videoids_to_request:\n- infos = get_info(videoid, raw_data['videos'][videoid.value], raw_data, profile_language_code)[0]\n+ infos = get_info(videoid, raw_data['videos'][videoid.value], raw_data, profile_language_code,\n+ include_title=True)[0]\nart = get_art(videoid, raw_data['videos'][videoid.value], profile_language_code)\ninfo_data[videoid.value] = infos, art\nreturn info_data\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": "@@ -75,11 +75,11 @@ def get_upnext_info(videoid, videoid_next_episode, info_data, metadata, is_playe\ndef _upnext_info(videoid, infos, art):\n\"\"\"Create a data dict for Up Next signal\"\"\"\n# Double check to 'rating' key, sometime can be an empty string, not accepted by Up Next add-on\n- rating = infos.get('rating', None)\n+ rating = infos.get('Rating', None)\nreturn {\n'episodeid': videoid.episodeid,\n'tvshowid': videoid.tvshowid,\n- 'title': infos['title'],\n+ 'title': infos['Title'],\n'art': {\n'tvshow.poster': art.get('poster', ''),\n'thumb': art.get('thumb', ''),\n@@ -88,12 +88,12 @@ def _upnext_info(videoid, infos, art):\n'tvshow.clearart': art.get('clearart', ''),\n'tvshow.clearlogo': art.get('clearlogo', '')\n},\n- 'plot': infos['plot'],\n- 'showtitle': infos['tvshowtitle'],\n- 'playcount': infos.get('playcount', 0),\n- 'runtime': infos['duration'],\n- 'season': infos['season'],\n- 'episode': infos['episode'],\n+ 'plot': infos.get('Plot', infos.get('PlotOutline', '')),\n+ 'showtitle': infos['TVShowTitle'],\n+ 'playcount': infos.get('PlayCount', 0),\n+ 'runtime': infos['Duration'],\n+ 'season': infos['Season'],\n+ 'episode': infos['Episode'],\n'rating': rating if rating else None,\n- 'firstaired': infos.get('year', infos.get('firstaired', ''))\n+ 'firstaired': infos.get('Year', '')\n}\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
Fixed upnext regression
106,046
19.05.2020 18:05:31
-7,200
b83d92586dd80f42cba09b668d02c9e54af51462
Fixed UnicodeDecodeError on chinese OS and improved error output
[ { "change_type": "MODIFY", "old_path": "resources/lib/common/ipc.py", "new_path": "resources/lib/common/ipc.py", "diff": "@@ -107,7 +107,12 @@ def make_http_call(callname, data):\nexcept HTTPError as exc:\nresult = json.loads(exc.reason)\nexcept URLError as exc:\n- raise BackendNotReady('The service has returned: {}'.format(exc.reason))\n+ # On PY2 the exception message have to be decoded with latin-1 for system with symbolic characters\n+ err_msg = g.py2_decode(str(exc), 'latin-1')\n+ if '10049' in err_msg:\n+ err_msg += '\\r\\nPossible cause is wrong localhost settings in your operative system.'\n+ error(err_msg)\n+ raise BackendNotReady(g.py2_encode(err_msg, encoding='latin-1'))\n_raise_for_error(callname, result)\nreturn result\n@@ -133,7 +138,12 @@ def make_http_call_cache(callname, params, data):\nexcept KeyError:\nraise Exception('The service has returned: {}'.format(exc.reason))\nexcept URLError as exc:\n- raise BackendNotReady('The service has returned: {}'.format(exc.reason))\n+ # On PY2 the exception message have to be decoded with latin-1 for system with symbolic characters\n+ err_msg = g.py2_decode(str(exc), 'latin-1')\n+ if '10049' in err_msg:\n+ err_msg += '\\r\\nPossible cause is wrong localhost settings in your operative system.'\n+ error(err_msg)\n+ raise BackendNotReady(g.py2_encode(err_msg, encoding='latin-1'))\nreturn result\n" }, { "change_type": "MODIFY", "old_path": "resources/lib/globals.py", "new_path": "resources/lib/globals.py", "diff": "@@ -385,11 +385,11 @@ class GlobalVariables(object):\nreturn value.decode(encoding)\nreturn value\n- def py2_encode(self, value):\n+ def py2_encode(self, value, encoding='utf-8'):\n\"\"\"Encode text only on python 2\"\"\"\n# To remove when Kodi 18 support is over / Py2 dead\nif self.PY_IS_VER2:\n- return value.encode('utf-8')\n+ return value.encode(encoding)\nreturn value\n@staticmethod\n" }, { "change_type": "MODIFY", "old_path": "resources/lib/kodi/ui/dialogs.py", "new_path": "resources/lib/kodi/ui/dialogs.py", "diff": "@@ -99,8 +99,11 @@ def ask_for_resume(resume_position):\n])\n-def show_backend_not_ready():\n- return xbmcgui.Dialog().ok(common.get_local_string(30105), common.get_local_string(30138))\n+def show_backend_not_ready(error_details=None):\n+ message = common.get_local_string(30138)\n+ if error_details:\n+ message += '\\r\\n\\r\\nError details:\\r\\n' + error_details\n+ return xbmcgui.Dialog().ok(common.get_local_string(30105), message)\ndef show_ok_dialog(title, message):\n" }, { "change_type": "MODIFY", "old_path": "resources/lib/run_addon.py", "new_path": "resources/lib/run_addon.py", "diff": "@@ -207,9 +207,9 @@ def run(argv):\nroute([part for part in g.PATH.split('/') if part])\nelse:\nsuccess = False\n- except BackendNotReady:\n+ except BackendNotReady as exc_bnr:\nfrom resources.lib.kodi.ui import show_backend_not_ready\n- show_backend_not_ready()\n+ show_backend_not_ready(g.py2_decode(str(exc_bnr), 'latin-1'))\nsuccess = False\nexcept InputStreamHelperError as exc:\nfrom resources.lib.kodi.ui import show_ok_dialog\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
Fixed UnicodeDecodeError on chinese OS and improved error output
106,046
20.05.2020 08:37:56
-7,200
a8011319fb30cf58b38cbc7e8c95328ba248f90b
Version bump (1.3.2)
[ { "change_type": "MODIFY", "old_path": "addon.xml", "new_path": "addon.xml", "diff": "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n-<addon id=\"plugin.video.netflix\" name=\"Netflix\" version=\"1.3.1\" provider-name=\"libdev + jojo + asciidisco + caphm + castagnait\">\n+<addon id=\"plugin.video.netflix\" name=\"Netflix\" version=\"1.3.2\" provider-name=\"libdev + jojo + asciidisco + caphm + castagnait\">\n<requires>\n<import addon=\"xbmc.python\" version=\"2.26.0\"/>\n<import addon=\"script.module.addon.signals\" version=\"0.0.3\"/>\n<forum>https://forum.kodi.tv/showthread.php?tid=329767</forum>\n<source>https://github.com/CastagnaIT/plugin.video.netflix</source>\n<news>\n-v1.3.1 (2020-05-17)\n-Note to RPI devices: credentials will be asked again a storage problem has been fixed\n--Fixed KeyError issue\n-\n-v1.3.0 (2020-05-17)\n-Note to RPI devices: credentials will be asked again a storage problem has been fixed\n--Reimplemented parental control\n--Add new \"Top 10\" menu list\n--Add support to promo video trailer for custom skins\n--Add metadata Season and Episode value to ListItem's\n--Add metadata PlotOutline and Trailer values to ListItem's\n--Continue watching is now working with Netflix watched status sync\n--Fixed wrong video framerate, caused Dolby Vision signal loss and wrong colors\n--Fixed an issue that caused a wrong watched status sync at end of playback\n--Fixed an issue that caused missing to export some new seasons\n--Fixed an issue that caused the library sync to crash in some situations\n--Fixed a possible issue that can cause a wrong audio language selection on the episodes\n--Fixed a possible issue that can cause streamcontinuity to crash due to empty subtitle data\n--Fixed non visible media-flags to tvshows\n--Updated translations en, it, pt-br, de, sv-se, hu, nl, pl\n--Minor improvements/fixes\n+v1.3.2 (2020-05-20)\n+-Fixed some issues on chinese systems\n+-Fixed errors on loading lists\n+-Fixed missing plot in some skins\n+-Fixed ESN generation (lower case issue)\n+-Fixed UpNext regressions\n+-Updated translations es, sv-se\n</news>\n</extension>\n</addon>\n" }, { "change_type": "MODIFY", "old_path": "changelog.txt", "new_path": "changelog.txt", "diff": "+v1.3.2 (2020-05-20)\n+-Fixed some issues on chinese systems\n+-Fixed errors on loading lists\n+-Fixed missing plot in some skins\n+-Fixed ESN generation (lower case issue)\n+-Fixed UpNext regressions\n+-Updated translations es, sv-se\n+\nv1.3.1 (2020-05-17)\nNote to RPI devices: credentials will be asked again a storage problem has been fixed\n-Fixed KeyError issue\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
Version bump (1.3.2) (#648)
106,046
20.05.2020 10:20:01
-7,200
f49cd1fd729e98fe9b42fd4607754ed7f4e9db86
Fix for ListItem type episode i do not understand all this different rules between ListItem's
[ { "change_type": "MODIFY", "old_path": "resources/lib/kodi/infolabels.py", "new_path": "resources/lib/kodi/infolabels.py", "diff": "@@ -58,7 +58,8 @@ def get_info(videoid, item, raw_data, profile_language_code='', include_title=Fa\nexcept CacheMiss:\ninfos, quality_infos = parse_info(videoid, item, raw_data)\ng.CACHE.add(CACHE_INFOLABELS, cache_identifier, {'infos': infos, 'quality_infos': quality_infos})\n- if not include_title:\n+ # The ListItem's of type episode use 'Title' instead 'Label'\n+ if not include_title and not videoid.mediatype == common.VideoId.EPISODE:\ninfos.pop('Title', None)\nreturn infos, quality_infos\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
Fix for ListItem type episode i do not understand all this different rules between ListItem's
106,046
20.05.2020 16:42:25
-7,200
c2cefeb043b8c1133d53ba9e594aff9e90f7e05b
Use API method for profile switch Fix PIN locked profile switch
[ { "change_type": "MODIFY", "old_path": "resources/lib/services/nfsession/nfsession.py", "new_path": "resources/lib/services/nfsession/nfsession.py", "diff": "@@ -98,19 +98,20 @@ class NetflixSession(NFSessionAccess, DirectoryBuilder):\nif not self.is_profile_session_active or (self.is_profile_session_active and\nguid != current_active_guid):\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- response = self._get('switch_profile', params={'tkn': guid})\n- self.auth_url = self.website_extract_session_data(response)['auth_url']\n+ # response = self._get('switch_profile', params={'tkn': guid})\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\n- # self._get(endpoint='activate_profile',\n- # params={'switchProfileGuid': guid,\n- # '_': int(time.time()),\n- # 'authURL': self.auth_url})\n- # # Retrieve browse page to update authURL\n- # response = self._get('browse')\n- # self.auth_url = website.extract_session_data(response)['auth_url']\n+ import time\n+ self._get(endpoint='activate_profile',\n+ params={'switchProfileGuid': guid,\n+ '_': int(time.time()),\n+ 'authURL': self.auth_url})\n+ # Retrieve browse page to update authURL\n+ response = self._get('browse')\n+ self.auth_url = website.extract_session_data(response)['auth_url']\n# END Method 2\nself.is_profile_session_active = True\ng.LOCAL_DB.switch_active_profile(guid)\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
Use API method for profile switch Fix PIN locked profile switch
106,046
21.05.2020 11:14:31
-7,200
ecd2ae6b8b525caff60d7da914e2eb924fb70d26
Handled Kodi audio language mediadefault/original with forced subtitles
[ { "change_type": "MODIFY", "old_path": "resources/lib/common/kodiops.py", "new_path": "resources/lib/common/kodiops.py", "diff": "@@ -164,31 +164,44 @@ def get_current_kodi_profile_name(no_spaces=True):\nreturn __CURRENT_KODI_PROFILE_NAME__\n-def get_kodi_audio_language():\n- \"\"\"Return the audio language from Kodi settings\"\"\"\n+def get_kodi_audio_language(iso_format=xbmc.ISO_639_1, use_fallback=True):\n+ \"\"\"\n+ Return the audio language from Kodi settings\n+ WARNING: when use_fallback is False, based on Kodi settings can also return values as: 'mediadefault', 'original'\n+ \"\"\"\naudio_language = json_rpc('Settings.GetSettingValue', {'setting': 'locale.audiolanguage'})\n- return convert_language_iso(audio_language['value'])\n+ converted_lang = convert_language_iso(audio_language['value'], iso_format, use_fallback)\n+ if not converted_lang:\n+ if audio_language['value'] == 'default':\n+ # Kodi audio language settings is set as \"User interface language\"\n+ converted_lang = xbmc.getLanguage(iso_format, False) # Get lang. active\n+ else:\n+ converted_lang = audio_language['value']\n+ return converted_lang\n-def get_kodi_subtitle_language():\n- \"\"\"Return the subtitle language from Kodi settings\"\"\"\n+def get_kodi_subtitle_language(iso_format=xbmc.ISO_639_1):\n+ \"\"\"\n+ Return the subtitle language from Kodi settings\n+ \"\"\"\nsubtitle_language = json_rpc('Settings.GetSettingValue', {'setting': 'locale.subtitlelanguage'})\nif subtitle_language['value'] == 'forced_only':\nreturn subtitle_language['value']\n- return convert_language_iso(subtitle_language['value'])\n+ return convert_language_iso(subtitle_language['value'], iso_format)\n-def convert_language_iso(from_value, use_fallback=True):\n+def convert_language_iso(from_value, iso_format=xbmc.ISO_639_1, use_fallback=True):\n\"\"\"\nConvert language code from an English name or three letter code (ISO 639-2) to two letter code (ISO 639-1)\n+ :param iso_format: specify the iso format (ISO_639_1 or ISO_639_2)\n:param use_fallback: if True when the conversion fails, is returned the current Kodi active language\n\"\"\"\n- converted_lang = xbmc.convertLanguage(g.py2_encode(from_value), xbmc.ISO_639_1)\n+ converted_lang = xbmc.convertLanguage(g.py2_encode(from_value), iso_format)\nif not use_fallback:\nreturn converted_lang\n- converted_lang = converted_lang if converted_lang else xbmc.getLanguage(xbmc.ISO_639_1, False)\n- return converted_lang if converted_lang else 'en'\n+ converted_lang = converted_lang if converted_lang else xbmc.getLanguage(iso_format, False) # Get lang. active\n+ return converted_lang if converted_lang else 'en' if iso_format == xbmc.ISO_639_1 else 'eng'\ndef fix_locale_languages(data_list):\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": "@@ -249,11 +249,11 @@ class AMStreamContinuity(ActionManager):\n# So can cause a wrong subtitle language or in a permanent display of subtitles!\n# This does not reflect the setting chosen in the Kodi player and is very annoying!\n# There is no other solution than to disable the subtitles manually.\n- audio_language = common.get_kodi_audio_language()\nif self.legacy_kodi_version:\n# --- ONLY FOR KODI VERSION 18 ---\n# NOTE: With Kodi 18 it is not possible to read the properties of the streams\n# so the only possible way is to read the data from the manifest file\n+ audio_language = common.get_kodi_audio_language()\ncache_identifier = g.get_esn() + '_' + self.videoid.value\nmanifest_data = g.CACHE.get(CACHE_MANIFESTS, cache_identifier)\ncommon.fix_locale_languages(manifest_data['timedtexttracks'])\n@@ -263,9 +263,22 @@ class AMStreamContinuity(ActionManager):\nself.sc_settings.update({'subtitleenabled': False})\nelse:\n# --- ONLY FOR KODI VERSION 19 ---\n- # Check the current stream\n+ audio_language = common.get_kodi_audio_language(iso_format=xbmc.ISO_639_2, use_fallback=False)\n+ if audio_language == 'mediadefault':\n+ # Find the language of the default audio track\n+ audio_list = self.player_state.get(STREAMS['audio']['list'])\n+ for audio_track in audio_list:\n+ if audio_track['isdefault']:\n+ audio_language = audio_track['language']\n+ break\nplayer_stream = self.player_state.get(STREAMS['subtitle']['current'])\n- if not player_stream['isforced'] or player_stream['language'] != audio_language:\n+ if audio_language == 'original':\n+ # Do nothing\n+ is_language_appropriate = True\n+ else:\n+ is_language_appropriate = player_stream['language'] == audio_language\n+ # Check if the current stream is forced and with an appropriate subtitle language\n+ if not player_stream['isforced'] or not is_language_appropriate:\nself.sc_settings.update({'subtitleenabled': False})\ndef _is_stream_value_equal(self, stream_a, stream_b):\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
Handled Kodi audio language mediadefault/original with forced subtitles
106,046
21.05.2020 13:10:10
-7,200
d0467c28340beb6b5d6171157724639b48046a7b
Translations fixes from CI
[ { "change_type": "MODIFY", "old_path": "resources/language/resource.language.it_it/strings.po", "new_path": "resources/language/resource.language.it_it/strings.po", "diff": "@@ -42,11 +42,11 @@ msgstr \"Ricerca per titoli, persone, generi\"\nmsgctxt \"#30004\"\nmsgid \"Password\"\n-msgstr \"\"\n+msgstr \"Password\"\nmsgctxt \"#30005\"\nmsgid \"E-mail\"\n-msgstr \"\"\n+msgstr \"E-mail\"\nmsgctxt \"#30006\"\nmsgid \"Enter PIN to access this profile\"\n@@ -80,7 +80,7 @@ msgstr \"Nessuna corrispondenza trovata\"\nmsgctxt \"#30014\"\nmsgid \"Account\"\n-msgstr \"\"\n+msgstr \"Account\"\nmsgctxt \"#30015\"\nmsgid \"Other options\"\n@@ -88,7 +88,7 @@ msgstr \"Altre opzioni\"\nmsgctxt \"#30016\"\nmsgid \"ESN\"\n-msgstr \"\"\n+msgstr \"ESN\"\nmsgctxt \"#30017\"\nmsgid \"Logout\"\n" }, { "change_type": "MODIFY", "old_path": "resources/language/resource.language.ko_kr/strings.po", "new_path": "resources/language/resource.language.ko_kr/strings.po", "diff": "@@ -48,7 +48,9 @@ msgctxt \"#30005\"\nmsgid \"E-mail\"\nmsgstr \"E-mail\"\n-# Unused 30006\n+msgctxt \"#30006\"\n+msgid \"Enter PIN to access this profile\"\n+msgstr \"\"\nmsgctxt \"#30007\"\nmsgid \"Parental Control PIN (4 digits)\"\n@@ -923,3 +925,39 @@ msgstr \"\"\nmsgctxt \"#30233\"\nmsgid \"Only show titles rated [B]{}[/B].\"\nmsgstr \"\"\n+\n+msgctxt \"#30234\"\n+msgid \"Install Up Next add-on\"\n+msgstr \"\"\n+\n+msgctxt \"#30235\"\n+msgid \"[WIP] Synchronize the watched status of the videos with Netflix\"\n+msgstr \"\"\n+\n+msgctxt \"#30236\"\n+msgid \"Change watched status (locally)\"\n+msgstr \"\"\n+\n+msgctxt \"#30237\"\n+msgid \"Marked as watched|Marked as unwatched|Restored Netflix watched status\"\n+msgstr \"\"\n+\n+msgctxt \"#30238\"\n+msgid \"Up Next notifications (watch next video)\"\n+msgstr \"\"\n+\n+msgctxt \"#30239\"\n+msgid \"Color of supplemental plot info\"\n+msgstr \"\"\n+\n+msgctxt \"#30240\"\n+msgid \"The background services cannot be started due to this problem:\\r\\n{}\"\n+msgstr \"\"\n+\n+msgctxt \"#30241\"\n+msgid \"Open Connect CDN (the lower index is better)\"\n+msgstr \"\"\n+\n+msgctxt \"#30242\"\n+msgid \"Top 10\"\n+msgstr \"\"\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
Translations fixes from CI
106,046
19.05.2020 20:33:08
-7,200
d5cb5e359509a7d0a20be702f29a52f2df3f8084
Moved activete_profile to directory_utils
[ { "change_type": "MODIFY", "old_path": "resources/lib/navigation/directory.py", "new_path": "resources/lib/navigation/directory.py", "diff": "@@ -18,7 +18,7 @@ import resources.lib.kodi.ui as ui\nfrom resources.lib.database.db_utils import TABLE_MENU_DATA\nfrom resources.lib.globals import g\nfrom resources.lib.navigation.directory_utils import (finalize_directory, convert_list_to_dir_items, custom_viewmode,\n- end_of_directory, get_title, verify_profile_pin)\n+ end_of_directory, get_title, activate_profile)\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@@ -65,7 +65,7 @@ class Directory(object):\ncommon.info('Performing auto-selection of profile {}', autoselect_profile_guid)\n# Do not perform the profile switch if navigation come from a page that is not the root url,\n# prevents profile switching when returning to the main menu from one of the sub-menus\n- if not is_parent_root_path or self._activate_profile(autoselect_profile_guid):\n+ if not is_parent_root_path or activate_profile(autoselect_profile_guid):\nself.home(None, False, True)\nreturn\nlist_data, extra_data = common.make_call('get_profiles', {'request_update': False})\n@@ -90,7 +90,7 @@ class Directory(object):\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- if not self._activate_profile(self.params['switch_profile_guid']):\n+ if not activate_profile(self.params['switch_profile_guid']):\nxbmcplugin.endOfDirectory(g.PLUGIN_HANDLE, succeeded=False)\nreturn\ncommon.debug('Showing home listing')\n@@ -100,15 +100,6 @@ class Directory(object):\n' - ' + common.get_local_string(30097)))\nend_of_directory(False, cache_to_disc)\n- def _activate_profile(self, guid):\n- pin_result = verify_profile_pin(guid)\n- if not pin_result:\n- if pin_result is not None:\n- ui.show_notification(common.get_local_string(30106), time=8000)\n- return False\n- common.make_call('activate_profile', guid)\n- return True\n-\[email protected]_execution(immediate=False)\[email protected]_video_id(path_offset=0, inject_full_pathitems=True)\ndef show(self, videoid, pathitems):\n" }, { "change_type": "MODIFY", "old_path": "resources/lib/navigation/directory_utils.py", "new_path": "resources/lib/navigation/directory_utils.py", "diff": "@@ -21,7 +21,7 @@ import resources.lib.common as common\nfrom resources.lib.api.api_requests import verify_profile_lock\nfrom resources.lib.database.db_utils import TABLE_MENU_DATA\nfrom resources.lib.globals import g\n-from resources.lib.kodi.ui import ask_for_pin\n+from resources.lib.kodi import ui\ndef custom_viewmode(partial_setting_id):\n@@ -138,9 +138,20 @@ def get_title(menu_data, extra_data):\ntable=TABLE_MENU_DATA).get('title', '')))\n+def activate_profile(guid):\n+ \"\"\"Activate a profile and ask the PIN if required\"\"\"\n+ pin_result = verify_profile_pin(guid)\n+ if not pin_result:\n+ if pin_result is not None:\n+ ui.show_notification(common.get_local_string(30106), time=8000)\n+ return False\n+ common.make_call('activate_profile', guid)\n+ return True\n+\n+\ndef 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 = ask_for_pin(common.get_local_string(30006))\n+ pin = ui.ask_for_pin(common.get_local_string(30006))\nreturn None if not pin else verify_profile_lock(guid, pin)\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
Moved activete_profile to directory_utils
106,046
19.05.2020 20:18:06
-7,200
5b1e6fde54a8fed6d5d39598c636d18f51a6f2ca
Improved profiles dialog
[ { "change_type": "MODIFY", "old_path": "resources/lib/kodi/ui/xmldialogs.py", "new_path": "resources/lib/kodi/ui/xmldialogs.py", "diff": "@@ -279,20 +279,25 @@ class RatingThumb(xbmcgui.WindowXMLDialog):\nself.close()\n-def show_profiles_dialog(title=None):\n+def show_profiles_dialog(title=None, title_prefix=None, preselect_guid=None):\n\"\"\"\nShow a dialog to select a profile\n:return guid of selected profile or None\n\"\"\"\n+ if not title:\n+ title = g.ADDON.getLocalizedString(30128)\n+ if title_prefix:\n+ title = title_prefix + ' - ' + title\n# Get profiles data\nlist_data, extra_data = make_call('get_profiles', {'request_update': True}) # pylint: disable=unused-variable\nreturn show_modal_dialog(False,\nProfiles,\n'plugin-video-netflix-Profiles.xml',\ng.ADDON.getAddonInfo('path'),\n- title=title or g.ADDON.getLocalizedString(30128),\n- list_data=list_data)\n+ title=title,\n+ list_data=list_data,\n+ preselect_guid=preselect_guid)\n# pylint: disable=no-member\n@@ -305,6 +310,7 @@ class Profiles(xbmcgui.WindowXMLDialog):\nself.return_value = None\nself.title = kwargs['title']\nself.list_data = kwargs['list_data']\n+ self.preselect_guid = kwargs.get('preselect_guid')\nself.action_exitkeys_id = [ACTION_PREVIOUS_MENU,\nACTION_PLAYER_STOP,\nACTION_NAV_BACK]\n@@ -321,6 +327,14 @@ class Profiles(xbmcgui.WindowXMLDialog):\nself.ctrl_list = self.getControl(10001)\nfrom resources.lib.navigation.directory_utils import convert_list_to_list_items\nself.ctrl_list.addItems(convert_list_to_list_items(self.list_data))\n+ # Preselect the ListItem by guid\n+ self.ctrl_list.selectItem(0)\n+ if self.preselect_guid:\n+ for index, profile_data in enumerate(self.list_data):\n+ if profile_data['properties']['nf_guid'] == self.preselect_guid:\n+ self.ctrl_list.selectItem(index)\n+ break\n+ self.setFocusId(10001)\ndef onClick(self, controlID):\nif controlID == 10001: # Save and close dialog\n" }, { "change_type": "MODIFY", "old_path": "resources/skins/default/1080i/plugin-video-netflix-Profiles.xml", "new_path": "resources/skins/default/1080i/plugin-video-netflix-Profiles.xml", "diff": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<window>\n- <defaultcontrol>10004</defaultcontrol>\n+ <defaultcontrol>10001</defaultcontrol>\n<controls>\n<control type=\"group\">\n<!-- Note: some tags to the controls have been set even if not necessary to ensure compatibility with the custom skins of kodi -->\n<left>0</left>\n<width>1160</width>\n<height>490</height>\n- <defaultcontrol>10004</defaultcontrol>\n+ <defaultcontrol>10001</defaultcontrol>\n<visible>true</visible>\n<onright>10090</onright>\n<control type=\"list\" id=\"10001\">\n<onright>10090</onright>\n<onup>noop</onup>\n<ondown>noop</ondown>\n- <pagecontrol>10090</pagecontrol>\n- <scrolltime>200</scrolltime>\n<itemlayout width=\"1160\" height=\"70\">\n<control type=\"image\">\n<left>10</left>\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
Improved profiles dialog
106,046
24.05.2020 10:40:30
-7,200
0dd02403c5a2584e1fd7f7636bf2536b8c2eddb1
Lower case codec key
[ { "change_type": "MODIFY", "old_path": "resources/lib/kodi/infolabels.py", "new_path": "resources/lib/kodi/infolabels.py", "diff": "@@ -30,9 +30,9 @@ except NameError: # Python 3\n# it is not possible to provide specific info, then we set info according to the video properties of the video list data\n# h264 is the entry-level codec always available to all streams, the 4k only works with HEVC\nQUALITIES = [\n- {'Codec': 'h264', 'width': '960', 'height': '540'},\n- {'Codec': 'h264', 'width': '1920', 'height': '1080'},\n- {'Codec': 'hevc', 'width': '3840', 'height': '2160'}\n+ {'codec': 'h264', 'width': '960', 'height': '540'},\n+ {'codec': 'h264', 'width': '1920', 'height': '1080'},\n+ {'codec': 'hevc', 'width': '3840', 'height': '2160'}\n]\nCOLORS = [None, 'blue', 'red', 'green', 'white', 'yellow', 'black', 'gray']\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
Lower case codec key
106,046
24.05.2020 18:50:23
-7,200
e237e9c2c60c1dcb5ca74e7bb4ce3c319bee1617
Do not use same memory reference for path Fix wrong mainmenu directories path after return to profiles list twice
[ { "change_type": "MODIFY", "old_path": "resources/lib/services/directorybuilder/dir_builder_items.py", "new_path": "resources/lib/services/directorybuilder/dir_builder_items.py", "diff": "@@ -212,7 +212,7 @@ def build_lolomo_listing(lolomo_list, menu_data, force_use_videolist_id=False, e\ndef _create_videolist_item(list_id, video_list, menu_data, common_data, static_lists=False):\nif static_lists and g.is_known_menu_context(video_list['context']):\n- pathitems = menu_data['path']\n+ pathitems = list(menu_data['path']) # Make a copy\npathitems.append(video_list['context'])\nelse:\n# It is a dynamic video list / menu context\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
Do not use same memory reference for path Fix wrong mainmenu directories path after return to profiles list twice
105,993
25.05.2020 23:01:08
-7,200
53680236eae93bb86078770c506cfcb3dc629b11
This fixes a KeyError issue
[ { "change_type": "MODIFY", "old_path": "resources/lib/services/cache/cache_management.py", "new_path": "resources/lib/services/cache/cache_management.py", "diff": "@@ -276,7 +276,7 @@ class CacheManagement(object):\nbucket_content = self._get_cache_bucket(bucket['name'])\nfor identifier, cache_entry in list(bucket_content.items()): # pylint: disable=unused-variable\nif cache_entry['expires'] < timestamp:\n- del bucket_content['identifier']\n+ del bucket_content[identifier]\nif bucket_names_db:\nself._delete_expired_db(bucket_names_db, timestamp)\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
This fixes a KeyError issue
106,046
26.05.2020 18:01:17
-7,200
522cfdf84a39c43038e10f1498b9927d118a17be
Fixed unicodedecode error on Exception object The exception message on py2 can not contain unicode type string
[ { "change_type": "MODIFY", "old_path": "resources/lib/services/msl/msl_handler.py", "new_path": "resources/lib/services/msl/msl_handler.py", "diff": "@@ -100,7 +100,7 @@ class MSLHandler(object):\ntry:\nmanifest = self._load_manifest(viewable_id, g.get_esn())\nexcept MSLError as exc:\n- if 'Email or password is incorrect' in str(exc):\n+ if '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# - If user change the password when the nf session was still active\n# - Netflix has reset the password for suspicious activity when the nf session was still active\n" }, { "change_type": "MODIFY", "old_path": "resources/lib/services/msl/msl_requests.py", "new_path": "resources/lib/services/msl/msl_requests.py", "diff": "@@ -244,17 +244,17 @@ def _raise_if_error(decoded_response):\ndef _get_error_details(decoded_response):\n# Catch a chunk error\nif 'errordata' in decoded_response:\n- return json.loads(base64.standard_b64decode(decoded_response['errordata']))['errormsg']\n+ return g.py2_encode(json.loads(base64.standard_b64decode(decoded_response['errordata']))['errormsg'])\n# Catch a manifest error\nif 'error' in decoded_response:\nif decoded_response['error'].get('errorDisplayMessage'):\n- return decoded_response['error']['errorDisplayMessage']\n+ return g.py2_encode(decoded_response['error']['errorDisplayMessage'])\n# Catch a license error\nif 'result' in decoded_response and isinstance(decoded_response.get('result'), list):\nif 'error' in decoded_response['result'][0]:\nif decoded_response['result'][0]['error'].get('errorDisplayMessage'):\n- return decoded_response['result'][0]['error']['errorDisplayMessage']\n- return 'Unhandled error check log.'\n+ return g.py2_encode(decoded_response['result'][0]['error']['errorDisplayMessage'])\n+ return g.py2_encode('Unhandled error check log.')\[email protected]_execution(immediate=True)\n" }, { "change_type": "MODIFY", "old_path": "resources/lib/services/msl/msl_utils.py", "new_path": "resources/lib/services/msl/msl_utils.py", "diff": "@@ -57,8 +57,12 @@ def display_error_info(func):\ntry:\nreturn func(*args, **kwargs)\nexcept Exception as exc:\n- ui.show_error_info(common.get_local_string(30028), unicode(exc),\n- unknown_error=not(unicode(exc)),\n+ if isinstance(exc, MSLError):\n+ message = g.py2_decode(str(exc))\n+ else:\n+ message = str(exc)\n+ ui.show_error_info(common.get_local_string(30028), message,\n+ unknown_error=not message,\nnetflix_error=isinstance(exc, MSLError))\nraise\nreturn error_catching_wrapper\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
Fixed unicodedecode error on Exception object The exception message on py2 can not contain unicode type string
106,046
26.05.2020 18:40:14
-7,200
c365594f2a100190e7af12fadc2319c4fa7c89f8
Make easier to change IPC timeout
[ { "change_type": "MODIFY", "old_path": "resources/lib/common/ipc.py", "new_path": "resources/lib/common/ipc.py", "diff": "@@ -22,6 +22,8 @@ try: # Python 2\nexcept NameError: # Python 3\nunicode = str # pylint: disable=redefined-builtin\n+IPC_TIMEOUT_SECS = 20\n+\nclass BackendNotReady(Exception):\n\"\"\"The background services are not started yet\"\"\"\n@@ -102,7 +104,7 @@ def make_http_call(callname, data):\ninstall_opener(build_opener(ProxyHandler({}))) # don't use proxy for localhost\ntry:\nresult = json.loads(\n- urlopen(url=url, data=json.dumps(data).encode('utf-8'), timeout=16).read(),\n+ urlopen(url=url, data=json.dumps(data).encode('utf-8'), timeout=IPC_TIMEOUT_SECS).read(),\nobject_pairs_hook=OrderedDict)\nexcept HTTPError as exc:\nresult = json.loads(exc.reason)\n@@ -131,7 +133,7 @@ def make_http_call_cache(callname, params, data):\ninstall_opener(build_opener(ProxyHandler({}))) # don't use proxy for localhost\nr = Request(url=url, data=data, headers={'Params': json.dumps(params)})\ntry:\n- result = urlopen(r, timeout=16).read()\n+ result = urlopen(r, timeout=IPC_TIMEOUT_SECS).read()\nexcept HTTPError as exc:\ntry:\nraise apierrors.__dict__[exc.reason]()\n@@ -156,7 +158,7 @@ def make_addonsignals_call(callname, data):\nsource_id=g.ADDON_ID,\nsignal=callname,\ndata=data,\n- timeout_ms=16000)\n+ timeout_ms=IPC_TIMEOUT_SECS * 1000)\n_raise_for_error(callname, result)\nif result is None:\nraise Exception('Addon Signals call timeout')\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
Make easier to change IPC timeout
106,046
27.05.2020 10:57:31
-7,200
0e552ae7aed806f79297520f72d30b651357c7d2
Ignore KeyError as a single instance should never happen
[ { "change_type": "MODIFY", "old_path": "resources/lib/services/cache/cache_management.py", "new_path": "resources/lib/services/cache/cache_management.py", "diff": "@@ -202,15 +202,15 @@ class CacheManagement(object):\nidentifier = self._add_prefix(identifier)\nbucket_data = self._get_cache_bucket(bucket['name'])\nif including_suffixes:\n- keys_to_delete = []\n- for key_identifier in bucket_data.keys():\n- if key_identifier.startswith(identifier):\n- keys_to_delete.append(key_identifier)\n+ keys_to_delete = [key_identifier for key_identifier in bucket_data.keys()\n+ if key_identifier.startswith(identifier)]\n+ else:\n+ keys_to_delete = [identifier]\nfor key_identifier in keys_to_delete:\n+ try:\ndel bucket_data[key_identifier]\n- else:\n- if identifier in bucket_data:\n- del bucket_data[identifier]\n+ except KeyError:\n+ pass\nif bucket['is_persistent']:\n# Delete the item data from cache database\nself._delete_db(bucket['name'], identifier, including_suffixes)\n@@ -276,7 +276,10 @@ class CacheManagement(object):\nbucket_content = self._get_cache_bucket(bucket['name'])\nfor identifier, cache_entry in list(bucket_content.items()):\nif cache_entry['expires'] < timestamp:\n+ try:\ndel bucket_content[identifier]\n+ except KeyError:\n+ pass\nif bucket_names_db:\nself._delete_expired_db(bucket_names_db, timestamp)\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
Ignore KeyError as a single instance should never happen
106,046
27.05.2020 11:04:36
-7,200
c4dde4de1a76f319576a9ed669a62addae5b5754
Avoid CacheMiss error to IPC it showed the error in the log but those who are not aware of the operation could not understand that it doesn't matter
[ { "change_type": "MODIFY", "old_path": "resources/lib/api/api_requests.py", "new_path": "resources/lib/api/api_requests.py", "diff": "@@ -210,12 +210,9 @@ def _update_mylist_cache(videoid, operation, params):\nexcept CacheMiss:\npass\nelse:\n- try:\ncommon.make_call('add_videoids_to_video_list_cache', {'cache_bucket': cache_utils.CACHE_MYLIST,\n'cache_identifier': mylist_identifier,\n'video_ids': [videoid.value]})\n- except CacheMiss:\n- pass\ntry:\nmy_list_videoids = g.CACHE.get(cache_utils.CACHE_MYLIST, 'my_list_items')\nmy_list_videoids.append(videoid)\n" }, { "change_type": "MODIFY", "old_path": "resources/lib/services/directorybuilder/dir_builder.py", "new_path": "resources/lib/services/directorybuilder/dir_builder.py", "diff": "@@ -13,6 +13,7 @@ from future.utils import iteritems\nfrom resources.lib import common\nfrom resources.lib.api.data_types import merge_data_type\n+from resources.lib.api.exceptions import CacheMiss\nfrom resources.lib.common import VideoId, g\nfrom resources.lib.services.directorybuilder.dir_builder_items import (build_video_listing, build_subgenres_listing,\nbuild_season_listing, build_episode_listing,\n@@ -154,11 +155,13 @@ class DirectoryBuilder(DirectoryRequests):\[email protected]_execution(immediate=True)\[email protected]_return_call\ndef add_videoids_to_video_list_cache(self, cache_bucket, cache_identifier, video_ids):\n- \"\"\"Add the specified video ids to a video list datatype in the cache\"\"\"\n- # Warning this method raise CacheMiss exception if cache is missing\n+ \"\"\"Add the specified video ids to a video list datatype in the cache (only if the cache item exists)\"\"\"\n+ try:\nvideo_list_sorted_data = g.CACHE.get(cache_bucket, cache_identifier)\nmerge_data_type(video_list_sorted_data, self.req_datatype_video_list_byid(video_ids))\ng.CACHE.add(cache_bucket, cache_identifier, video_list_sorted_data)\n+ except CacheMiss:\n+ pass\[email protected]_return_call\ndef get_continuewatching_videoid_exists(self, video_id):\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
Avoid CacheMiss error to IPC it showed the error in the log but those who are not aware of the operation could not understand that it doesn't matter
106,046
28.05.2020 08:51:14
-7,200
35603affbd353da5468a53603a060a66b5df78e6
Initial adaptions to new "Loco" page type
[ { "change_type": "MODIFY", "old_path": "resources/lib/api/website.py", "new_path": "resources/lib/api/website.py", "diff": "@@ -43,7 +43,8 @@ PAGE_ITEMS_INFO = [\n'models/userInfo/data/pinEnabled',\n'models/serverDefs/data/BUILD_IDENTIFIER',\n'models/esnGeneratorModel/data/esn',\n- 'models/memberContext/data/geo/preferredLocale'\n+ 'models/memberContext/data/geo/preferredLocale',\n+ 'models/truths/data/isLocoSupported'\n]\nPAGE_ITEMS_API_URL = {\n@@ -100,6 +101,25 @@ def extract_session_data(content, validate=False, update_profiles=False):\nif update_profiles:\nparse_profiles(falcor_cache)\n+ g.LOCAL_DB.set_value('is_loco_supported', user_data.get('isLocoSupported'), TABLE_SESSION)\n+ if user_data.get('isLocoSupported'):\n+ # 21/05/2020 - Netflix is introducing a new paging type called \"loco\", it is similar to \"lolomo\"\n+ # The lolomo data here is obtained by a separated request from update_lolomo_data in nfsession.py\n+\n+ # Extract loco root id\n+ # NOTE: loco root ID is not same of lolomo root id\n+ loco_root = falcor_cache['loco']['value'][1]\n+ # g.LOCAL_DB.set_value('lolomo_root_id', loco_root, TABLE_SESSION)\n+\n+ # Check if current 'profile session' is still active\n+ # Todo: 25/05/2020 - This not works, currently the \"locos\" list is always empty\n+ is_profile_session_active = 'componentSummary' in falcor_cache['locos'][loco_root]\n+\n+ # Extract loco continueWatching id and index\n+ # Todo: 25/05/2020 - Without the \"locos\" list is not possible get this data here\n+ # g.LOCAL_DB.set_value('lolomo_continuewatching_index', '', TABLE_SESSION)\n+ # g.LOCAL_DB.set_value('lolomo_continuewatching_id', '', TABLE_SESSION)\n+ else:\n# Extract lolomo root id\nlolomo_root = falcor_cache['lolomo']['value'][1]\ng.LOCAL_DB.set_value('lolomo_root_id', lolomo_root, TABLE_SESSION)\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.database.db_utils import TABLE_SESSION\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@@ -38,7 +39,8 @@ class NetflixSession(NFSessionAccess, DirectoryBuilder):\nself.perpetual_path_request,\nself.callpath_request,\nself.get,\n- self.post\n+ self.post,\n+ self.update_lolomo_data\n]\nfor slot in self.slots:\ncommon.register_slot(slot)\n@@ -89,7 +91,7 @@ class NetflixSession(NFSessionAccess, DirectoryBuilder):\[email protected]_execution(immediate=True)\[email protected]_return_call\n@needs_login\n- def activate_profile(self, guid):\n+ def activate_profile(self, guid, ignore_update_lolomo_data=False):\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@@ -117,6 +119,8 @@ class NetflixSession(NFSessionAccess, DirectoryBuilder):\ng.LOCAL_DB.switch_active_profile(guid)\ng.CACHE_MANAGEMENT.identifier_prefix = guid\nself.update_session_data()\n+ if not ignore_update_lolomo_data:\n+ self.update_lolomo_data()\n@needs_login\ndef _perpetual_path_request_switch_profiles(self, paths, length_params,\n@@ -131,13 +135,13 @@ class NetflixSession(NFSessionAccess, DirectoryBuilder):\n# Current profile active\ncurrent_profile_guid = g.LOCAL_DB.get_active_profile_guid()\n# Switch profile (only if necessary) in order to get My List videos\n- self.activate_profile(mylist_profile_guid)\n+ self.activate_profile(mylist_profile_guid, ignore_update_lolomo_data=True)\n# Get the My List data\npath_response = self._perpetual_path_request(paths, length_params, perpetual_range_start,\nno_limit_req)\nif mylist_profile_guid != current_profile_guid:\n# Reactive again the previous profile\n- self.activate_profile(current_profile_guid)\n+ self.activate_profile(current_profile_guid, ignore_update_lolomo_data=True)\nreturn path_response\[email protected]_return_call\n@@ -276,6 +280,27 @@ class NetflixSession(NFSessionAccess, DirectoryBuilder):\nraise NotLoggedInError\nraise\n+ def update_lolomo_data(self, data=None): # pylint: disable=unused-argument\n+ \"\"\"Get and save current lolomo data\"\"\"\n+ # 25/05/2020 Method used for accounts \"loco\" page type enabled only\n+ # accounts that use \"loco\" at this moment it is not possible to use extract_session_data (see website.py)\n+ # to obtain \"loco\" data then we force the use of \"lolomo\"\n+ if not g.LOCAL_DB.get_value('is_loco_supported', table=TABLE_SESSION):\n+ return\n+ lolomo_root = ''\n+ context_index = ''\n+ context_id = ''\n+ if g.ADDON.getSettingBool('ProgressManager_enabled') and self.is_logged_in():\n+ lolomo_data = self._path_request([['lolomo', ['continueWatching'], ['context', 'id', 'index']]])\n+ lolomo_root = lolomo_data['lolomo'][1]\n+ # Todo: In the new profiles, there is no 'continueWatching' list and no list is returned\n+ if 'continueWatching' in lolomo_data['lolomos'][lolomo_root]:\n+ context_index = lolomo_data['lolomos'][lolomo_root]['continueWatching'][2]\n+ context_id = lolomo_data['lolomos'][lolomo_root][context_index][1]\n+ g.LOCAL_DB.set_value('lolomo_root_id', lolomo_root, TABLE_SESSION)\n+ g.LOCAL_DB.set_value('lolomo_continuewatching_index', context_index, TABLE_SESSION)\n+ g.LOCAL_DB.set_value('lolomo_continuewatching_id', context_id, TABLE_SESSION)\n+\ndef _set_range_selector(paths, range_start, range_end):\n\"\"\"Replace the RANGE_SELECTOR placeholder with an actual dict:\n" }, { "change_type": "MODIFY", "old_path": "resources/lib/services/settings_monitor.py", "new_path": "resources/lib/services/settings_monitor.py", "diff": "@@ -114,6 +114,8 @@ class SettingsMonitor(xbmc.Monitor):\nif progress_manager_enabled != progress_manager_enabled_old:\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+ # Get or reset the lolomo data\n+ common.send_signal(signal='update_lolomo_data')\n# Avoid perform these operations when the add-on is installed from scratch and there are no credentials\nif (clean_cache or reboot_addon) and not common.check_credentials():\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
Initial adaptions to new "Loco" page type
106,046
28.05.2020 10:29:10
-7,200
d729e92f2b851a8c3dfa0d2c25e46c23edd9e8a0
Add missing py2 decode
[ { "change_type": "MODIFY", "old_path": "resources/lib/api/website.py", "new_path": "resources/lib/api/website.py", "diff": "@@ -182,7 +182,7 @@ def parse_profiles(data):\ng.LOCAL_DB.set_profile(guid, is_active, sort_order)\ng.SHARED_DB.set_profile(guid, sort_order)\n# Add profile language description translated from locale\n- summary['language_desc'] = xbmc.convertLanguage(summary['language'][:2], xbmc.ENGLISH_NAME)\n+ summary['language_desc'] = g.py2_decode(xbmc.convertLanguage(summary['language'][:2], xbmc.ENGLISH_NAME))\nfor key, value in iteritems(summary):\nif key in PROFILE_DEBUG_INFO:\ncommon.debug('Profile info {}', {key: value})\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
Add missing py2 decode
106,046
28.05.2020 16:44:51
-7,200
9b8cb615eb97b0679aaa85f1cc85a6f892c22262
Compare as a string
[ { "change_type": "MODIFY", "old_path": "resources/lib/services/nfsession/nfsession.py", "new_path": "resources/lib/services/nfsession/nfsession.py", "diff": "@@ -285,7 +285,7 @@ class NetflixSession(NFSessionAccess, DirectoryBuilder):\n# 25/05/2020 Method used for accounts \"loco\" page type enabled only\n# accounts that use \"loco\" at this moment it is not possible to use extract_session_data (see website.py)\n# to obtain \"loco\" data then we force the use of \"lolomo\"\n- if not g.LOCAL_DB.get_value('is_loco_supported', table=TABLE_SESSION):\n+ if g.LOCAL_DB.get_value('is_loco_supported', table=TABLE_SESSION) == 'False':\nreturn\nlolomo_root = ''\ncontext_index = ''\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
Compare as a string
106,046
30.05.2020 14:06:16
-7,200
0c819e081e636aa0f1a42690d28346ac9d9df883
Version bump (1.4.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.3.2\" provider-name=\"libdev + jojo + asciidisco + caphm + castagnait\">\n+<addon id=\"plugin.video.netflix\" name=\"Netflix\" version=\"1.4.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.3.2 (2020-05-20)\n--Fixed some issues on chinese systems\n--Fixed errors on loading lists\n--Fixed missing plot in some skins\n--Fixed ESN generation (lower case issue)\n--Fixed UpNext regressions\n--Updated translations es, sv-se\n+v1.4.0 (2020-05-30)\n+-Implemented profile selection to library (preferences in the settings/playback)\n+ This also fixes following related issues when play from library:\n+ -Missing audio/subtitle languages\n+ -Missing metadata\n+ -Wrong age restrictions\n+ -Video content not available\n+-Initial adaptions for the new NF changes (cause of KeyError \"lolomo\")\n+-Fixed profile switch for PIN protected profiles\n+-Fixed forced subtitles sel. issues when Kodi audio lang setting is Original/Media default (Kodi 19)\n+-Fixed regression for missing skin codec media-flag\n+-Fixed an issue that caused loss of skin view type after switch profile\n+-Fixed KeyError issue when performed the scheduled clear expired cache\n+-Fixed unicodedecode error with Kodi 18 and MSL errors\n+-Updated translations de, es, hu, ro, sv-se, tr, pl\n+-Other minor fixes\n</news>\n</extension>\n</addon>\n" }, { "change_type": "MODIFY", "old_path": "changelog.txt", "new_path": "changelog.txt", "diff": "+v1.4.0 (2020-05-30)\n+-Implemented profile selection to library (preferences in the settings/playback)\n+ This also fixes following related issues when play from library:\n+ -Missing audio/subtitle languages\n+ -Missing metadata\n+ -Wrong age restrictions\n+ -Video content not available\n+-Initial adaptions for the new NF changes (cause of KeyError \"lolomo\")\n+-Fixed profile switch for PIN protected profiles\n+-Fixed forced subtitles sel. issues when Kodi audio lang setting is Original/Media default (Kodi 19)\n+-Fixed regression for missing skin codec media-flag\n+-Fixed an issue that caused loss of skin view type after switch profile\n+-Fixed KeyError issue when performed the scheduled clear expired cache\n+-Fixed unicodedecode error with Kodi 18 and MSL errors\n+-Updated translations de, es, hu, ro, sv-se, tr, pl\n+-Other minor fixes\n+\nv1.3.2 (2020-05-20)\n-Fixed some issues on chinese systems\n-Fixed errors on loading lists\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
Version bump (1.4.0) (#672)
106,046
01.06.2020 18:37:40
-7,200
2272c4ff1a89317825e743c67c6ce7f6e5a74c79
Disabled refreshListByContext call due to netflix changes
[ { "change_type": "MODIFY", "old_path": "resources/lib/api/api_requests.py", "new_path": "resources/lib/api/api_requests.py", "diff": "@@ -55,6 +55,11 @@ def login(ask_credentials=True):\ndef update_lolomo_context(context_name):\n\"\"\"Update the lolomo list by context\"\"\"\n+ # 01/06/2020: refreshListByContext often return HTTP error 500, currently i have seen that in the website is\n+ # performed only when the video played is not added to \"my list\", but with a strange mixed data:\n+ # context_id: the id of continueWatching\n+ # context_index: that seem to point to \"My list\" id context index\n+ # This api is no more needed to update the continueWatching lolomo list\nlolomo_root = g.LOCAL_DB.get_value('lolomo_root_id', '', TABLE_SESSION)\ncontext_index = g.LOCAL_DB.get_value('lolomo_{}_index'.format(context_name.lower()), '', TABLE_SESSION)\n@@ -107,7 +112,8 @@ def update_lolomo_context(context_name):\ndef 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 status bar watched of the video will be updated\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\")\ncallargs = {\n'callpaths': [['refreshVideoCurrentPositions']],\n'params': ['[' + video_id + ']', '[]'],\n" }, { "change_type": "MODIFY", "old_path": "resources/lib/services/msl/events_handler.py", "new_path": "resources/lib/services/msl/events_handler.py", "diff": "@@ -133,9 +133,9 @@ class EventsHandler(threading.Thread):\nif event.event_type == EVENT_STOP:\nself.clear_queue()\nif event.event_data['allow_request_update_lolomo']:\n- if event.event_data['is_in_mylist']:\n- # If video is in my list, invalidate the continueWatching list (update lolomo context data)\n- api.update_lolomo_context('continueWatching')\n+ # if event.event_data['is_in_mylist']:\n+ # # If video is in my list, invalidate the continueWatching list (update lolomo context data)\n+ # api.update_lolomo_context('continueWatching')\napi.update_videoid_bookmark(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" } ]
Python
MIT License
castagnait/plugin.video.netflix
Disabled refreshListByContext call due to netflix changes
106,046
04.06.2020 14:27:28
-7,200
3c42758b6f0bebcb6a68f58a29d020bfda134e69
Avoid execute decorators
[ { "change_type": "MODIFY", "old_path": "resources/lib/services/nfsession/nfsession.py", "new_path": "resources/lib/services/nfsession/nfsession.py", "diff": "@@ -92,6 +92,9 @@ class NetflixSession(NFSessionAccess, DirectoryBuilder):\[email protected]_return_call\n@needs_login\ndef activate_profile(self, guid, ignore_update_lolomo_data=False):\n+ self._activate_profile(guid, ignore_update_lolomo_data)\n+\n+ def _activate_profile(self, guid, ignore_update_lolomo_data=False):\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@@ -135,13 +138,13 @@ class NetflixSession(NFSessionAccess, DirectoryBuilder):\n# Current profile active\ncurrent_profile_guid = g.LOCAL_DB.get_active_profile_guid()\n# Switch profile (only if necessary) in order to get My List videos\n- self.activate_profile(mylist_profile_guid, ignore_update_lolomo_data=True)\n+ self._activate_profile(mylist_profile_guid, ignore_update_lolomo_data=True)\n# Get the My List data\npath_response = self._perpetual_path_request(paths, length_params, perpetual_range_start,\nno_limit_req)\nif mylist_profile_guid != current_profile_guid:\n# Reactive again the previous profile\n- self.activate_profile(current_profile_guid, ignore_update_lolomo_data=True)\n+ self._activate_profile(current_profile_guid, ignore_update_lolomo_data=True)\nreturn path_response\[email protected]_return_call\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
Avoid execute decorators
106,046
04.06.2020 18:52:48
-7,200
d33d80f83697806d2f645b466d509c7b392a4023
Renamed wrong name "id" to "videoid"
[ { "change_type": "MODIFY", "old_path": "resources/lib/api/data_types.py", "new_path": "resources/lib/api/data_types.py", "diff": "@@ -83,11 +83,12 @@ class VideoList:\nself.contained_titles = None\nself.videoids = None\nif has_data:\n- self.id = common.VideoId(\n+ # Generate one videoid, or from the first id of the list or with specified one\n+ self.videoid = common.VideoId(\nvideoid=(list_id\nif list_id\nelse next(iter(self.data['lists']))))\n- self.videos = OrderedDict(resolve_refs(self.data['lists'][self.id.value], self.data))\n+ self.videos = OrderedDict(resolve_refs(self.data['lists'][self.videoid.value], self.data))\nif self.videos:\n# self.artitem = next(itervalues(self.videos))\nself.artitem = listvalues(self.videos)[0]\n@@ -98,11 +99,11 @@ class VideoList:\nself.videoids = None\ndef __getitem__(self, key):\n- return _check_sentinel(self.data['lists'][self.id.value][key])\n+ return _check_sentinel(self.data['lists'][self.videoid.value][key])\ndef get(self, key, default=None):\n\"\"\"Pass call on to the backing dict of this VideoList.\"\"\"\n- return _check_sentinel(self.data['lists'][self.id.value].get(key, default))\n+ return _check_sentinel(self.data['lists'][self.videoid.value].get(key, default))\nclass VideoListSorted:\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": "@@ -223,8 +223,8 @@ def _create_videolist_item(list_id, video_list, menu_data, common_data, static_l\npathitems = [path, menu_data['path'][1], list_id]\ndict_item = {'label': video_list['displayName'],\n'is_folder': True}\n- add_info_dict_item(dict_item, video_list.id, video_list, video_list.data, False, common_data)\n- dict_item['art'] = get_art(video_list.id, video_list.artitem, common_data['profile_language_code'])\n+ add_info_dict_item(dict_item, video_list.videoid, video_list, video_list.data, False, common_data)\n+ dict_item['art'] = get_art(video_list.videoid, video_list.artitem, common_data['profile_language_code'])\ndict_item['url'] = common.build_url(pathitems,\n# genre_id add possibility to browse the sub-genres (see build_video_listing)\nparams={'genre_id': unicode(video_list.get('genreId'))},\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
Renamed wrong name "id" to "videoid"
106,046
04.06.2020 20:22:19
-7,200
9df55313af4ed49003f239889060e7fa6d112f99
Small fix to genres request not works yet, at this moment the subgenres ids are not listed in the website with the default view, they are visible only with ordered list view So or nf website has problems or they have cut out the api request to implement other ways
[ { "change_type": "MODIFY", "old_path": "resources/lib/api/paths.py", "new_path": "resources/lib/api/paths.py", "diff": "@@ -57,7 +57,7 @@ VIDEO_LIST_BASIC_PARTIAL_PATHS = [\nGENRE_PARTIAL_PATHS = [\n[[\"id\", \"requestId\", \"summary\", \"name\"]],\n- [{\"from\": 0, \"to\": 50},\n+ [{\"from\": 0, \"to\": 48},\n[\"context\", \"displayName\", \"genreId\", \"id\", \"isTallRow\", \"length\",\n\"requestId\", \"type\", \"videoId\"]]\n]\n" }, { "change_type": "MODIFY", "old_path": "resources/lib/navigation/directory.py", "new_path": "resources/lib/navigation/directory.py", "diff": "@@ -229,7 +229,7 @@ class Directory(object):\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- 'genre_id': None if len(pathitems) < 3 else pathitems[2],\n+ 'genre_id': None if len(pathitems) < 3 else int(pathitems[2]),\n'force_use_videolist_id': False,\n}\nlist_data, extra_data = common.make_call('get_genres', call_args)\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
Small fix to genres request not works yet, at this moment the subgenres ids are not listed in the website with the default view, they are visible only with ordered list view So or nf website has problems or they have cut out the api request to implement other ways
106,053
05.06.2020 09:28:12
25,200
8412230e751b2b03d89f8857f4a26a9559e540f9
bug: - Add back ListItem.Title * :bug: - Add back ListItem.Title Close * :ok_hand: - Add ListItem.Title to InfoLabel dict ok_hand::rewind: - Leave "normal" ListItems untouched
[ { "change_type": "MODIFY", "old_path": "resources/lib/kodi/infolabels.py", "new_path": "resources/lib/kodi/infolabels.py", "diff": "@@ -48,7 +48,7 @@ MEDIA_TYPE_MAPPINGS = {\n}\n-def get_info(videoid, item, raw_data, profile_language_code='', include_title=False):\n+def get_info(videoid, item, raw_data, profile_language_code=''):\n\"\"\"Get the infolabels data\"\"\"\ncache_identifier = videoid.value + '_' + profile_language_code\ntry:\n@@ -58,9 +58,6 @@ def get_info(videoid, item, raw_data, profile_language_code='', include_title=Fa\nexcept CacheMiss:\ninfos, quality_infos = parse_info(videoid, item, raw_data)\ng.CACHE.add(CACHE_INFOLABELS, cache_identifier, {'infos': infos, 'quality_infos': quality_infos})\n- # The ListItem's of type episode use 'Title' instead 'Label'\n- if not include_title and not videoid.mediatype == common.VideoId.EPISODE:\n- infos.pop('Title', None)\nreturn infos, quality_infos\n@@ -77,6 +74,7 @@ def add_info_dict_item(dict_item, videoid, item, raw_data, is_in_mylist, common_\nif is_in_mylist and common_data.get('mylist_titles_color'):\n# Highlight ListItem title when the videoid is contained in my-list\ndict_item['label'] = _colorize_text(common_data['mylist_titles_color'], dict_item['label'])\n+ infos_copy['title'] = dict_item['label']\ndict_item['info'] = infos_copy\n@@ -259,8 +257,7 @@ def get_info_from_netflix(videoids):\ninfo_data = {}\nfor videoid in videoids:\ntry:\n- infos = get_info(videoid, None, None, profile_language_code,\n- include_title=True)[0]\n+ infos = get_info(videoid, None, None, profile_language_code)[0]\nart = _get_art(videoid, None, profile_language_code)\ninfo_data[videoid.value] = infos, art\ncommon.debug('Got infolabels and art from cache for videoid {}', videoid)\n@@ -272,8 +269,7 @@ def get_info_from_netflix(videoids):\ncommon.debug('Retrieving infolabels and art from API for {} videoids', len(videoids_to_request))\nraw_data = api.get_video_raw_data(videoids_to_request)\nfor videoid in videoids_to_request:\n- infos = get_info(videoid, raw_data['videos'][videoid.value], raw_data, profile_language_code,\n- include_title=True)[0]\n+ infos = get_info(videoid, raw_data['videos'][videoid.value], raw_data, profile_language_code)[0]\nart = get_art(videoid, raw_data['videos'][videoid.value], profile_language_code)\ninfo_data[videoid.value] = infos, art\nreturn info_data\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
:bug: - Add back ListItem.Title (#681) * :bug: - Add back ListItem.Title Close #680 * :ok_hand: - Add ListItem.Title to InfoLabel dict :ok_hand::rewind: - Leave "normal" ListItems untouched
106,046
05.06.2020 20:05:44
-7,200
fdd15eec8e5dc85fc3eb35418ad666f6267379ac
Fixed wrong range
[ { "change_type": "MODIFY", "old_path": "resources/lib/navigation/directory_utils.py", "new_path": "resources/lib/navigation/directory_utils.py", "diff": "@@ -179,7 +179,7 @@ def auto_scroll(list_data):\nreturn\nsteps = 1\n# Find last watched item\n- for index in range(total_items - 1, 0, -1):\n+ for index in range(total_items - 1, -1, -1):\ndict_item = list_data[index]\nif dict_item['info'].get('PlayCount', '0') != '0':\n# Last watched item\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
Fixed wrong range
106,046
04.06.2020 16:21:05
-7,200
8ffce8007c27cbba169d0a56c3249258862002ca
Removed old EDGE ESN generator This method is deprecated
[ { "change_type": "MODIFY", "old_path": "resources/lib/globals.py", "new_path": "resources/lib/globals.py", "diff": "@@ -335,23 +335,6 @@ class GlobalVariables(object):\ncustom_esn = g.ADDON.getSetting('esn')\nreturn custom_esn if custom_esn else g.LOCAL_DB.get_value('esn', '', table=TABLE_SESSION)\n- def get_edge_esn(self):\n- \"\"\"Get a previously generated edge ESN from the settings or generate\n- a new one if none exists\"\"\"\n- return self.ADDON.getSetting('edge_esn') or self.generate_edge_esn()\n-\n- def generate_edge_esn(self):\n- \"\"\"Generate a random EDGE ESN and save it to the settings\"\"\"\n- import random\n- esn = ['NFCDIE-02-']\n- possible = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'\n- for _ in range(0, 30):\n- esn.append(random.choice(possible))\n- edge_esn = ''.join(esn)\n- self.settings_monitor_suspend(True, True)\n- self.ADDON.setSetting('edge_esn', edge_esn)\n- return edge_esn\n-\ndef is_known_menu_context(self, context):\n\"\"\"Return true if context are one of the menu with lolomo_known=True\"\"\"\nfor menu_id, data in iteritems(self.MAIN_MENU_ITEMS): # pylint: disable=unused-variable\n" }, { "change_type": "MODIFY", "old_path": "resources/lib/services/msl/msl_handler.py", "new_path": "resources/lib/services/msl/msl_handler.py", "diff": "@@ -116,19 +116,20 @@ class MSLHandler(object):\n# manifest = self.get_edge_manifest(viewable_id, manifest)\nreturn self.__tranform_to_dash(manifest)\n- def get_edge_manifest(self, viewable_id, chrome_manifest):\n- \"\"\"Load a manifest with an EDGE ESN and replace playback_context and drm_context\"\"\"\n- common.debug('Loading EDGE manifest')\n- esn = g.get_edge_esn()\n- common.debug('Switching MSL data to EDGE')\n- self.msl_requests.perform_key_handshake(esn)\n- manifest = self._load_manifest(viewable_id, esn)\n- manifest['playbackContextId'] = chrome_manifest['playbackContextId']\n- manifest['drmContextId'] = chrome_manifest['drmContextId']\n- common.debug('Successfully loaded EDGE manifest')\n- common.debug('Resetting MSL data to Chrome')\n- self.msl_requests.perform_key_handshake()\n- return manifest\n+ # Old EDGE ESN no longer exists, keep for future possible workarounds\n+ # def get_edge_manifest(self, viewable_id, chrome_manifest):\n+ # \"\"\"Load a manifest with an EDGE ESN and replace playback_context and drm_context\"\"\"\n+ # common.debug('Loading EDGE manifest')\n+ # esn = g.get_edge_esn()\n+ # common.debug('Switching MSL data to EDGE')\n+ # self.msl_requests.perform_key_handshake(esn)\n+ # manifest = self._load_manifest(viewable_id, esn)\n+ # manifest['playbackContextId'] = chrome_manifest['playbackContextId']\n+ # manifest['drmContextId'] = chrome_manifest['drmContextId']\n+ # common.debug('Successfully loaded EDGE manifest')\n+ # common.debug('Resetting MSL data to Chrome')\n+ # self.msl_requests.perform_key_handshake()\n+ # return manifest\[email protected]_execution(immediate=True)\ndef _load_manifest(self, viewable_id, esn):\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
Removed old EDGE ESN generator This method is deprecated
106,046
04.06.2020 16:21:59
-7,200
cf214cb7f909040346ea89df12497213e5eafc81
Show info message as warn
[ { "change_type": "MODIFY", "old_path": "resources/lib/services/msl/msl_requests.py", "new_path": "resources/lib/services/msl/msl_requests.py", "diff": "@@ -66,7 +66,7 @@ class MSLRequests(MSLRequestBuilder):\n# pylint: disable=unused-argument\nesn = data or g.get_esn()\nif not esn:\n- common.info('Cannot perform key handshake, missing ESN')\n+ common.warn('Cannot perform key handshake, missing ESN')\nreturn False\ncommon.debug('Performing key handshake. ESN: {}', esn)\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
Show info message as warn
106,046
06.06.2020 13:44:56
-7,200
46d73d4ed35e321d3eaff24b5728bc8f31ad2b2c
Avoid handshake on addon startup
[ { "change_type": "MODIFY", "old_path": "resources/lib/services/msl/msl_requests.py", "new_path": "resources/lib/services/msl/msl_requests.py", "diff": "@@ -48,13 +48,6 @@ class MSLRequests(MSLRequestBuilder):\ntry:\nself.crypto.load_msl_data(msl_data)\nself.crypto.load_crypto_session(msl_data)\n-\n- # Add-on just installed, the service starts but there is no esn\n- if g.get_esn():\n- # This is also done here only try to speed up the loading of manifest\n- self._check_mastertoken_validity()\n- except MSLError:\n- raise\nexcept Exception: # pylint: disable=broad-except\nimport traceback\ncommon.error(g.py2_decode(traceback.format_exc(), 'latin-1'))\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
Avoid handshake on addon startup
106,046
07.06.2020 14:12:06
-7,200
aff732633817798210440a9223cc7372cd00e1f1
Put profiles language to debug
[ { "change_type": "MODIFY", "old_path": "resources/lib/api/website.py", "new_path": "resources/lib/api/website.py", "diff": "@@ -66,7 +66,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']\n+PROFILE_DEBUG_INFO = ['profileName', 'isAccountOwner', 'isActive', 'isKids', 'maturityLevel', 'language']\[email protected]_execution(immediate=True)\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
Put profiles language to debug
106,046
07.06.2020 17:43:37
-7,200
0c3f8740265eb4072cf64e4879799b8f24f54637
Removed hevc-dv no more exists
[ { "change_type": "MODIFY", "old_path": "resources/lib/services/msl/profiles.py", "new_path": "resources/lib/services/msl/profiles.py", "diff": "@@ -18,7 +18,6 @@ CENC_PRK = 'dash-cenc-prk'\nCENC = 'dash-cenc'\nCENC_TL = 'dash-cenc-tl'\nHDR = 'hevc-hdr-main10-'\n-DV = 'hevc-dv-main10-'\nDV5 = 'hevc-dv5-main10-'\nVP9_PROFILE0 = 'vp9-profile0-'\nVP9_PROFILE2 = 'vp9-profile2-'\n@@ -60,8 +59,6 @@ PROFILES = {\ntails=[(BASE_LEVELS, CENC),\n(BASE_LEVELS, CENC_PRK)]),\n'dolbyvision':\n- _profile_strings(base=DV,\n- tails=[(BASE_LEVELS, CENC)]) +\n_profile_strings(base=DV5,\ntails=[(BASE_LEVELS, CENC_PRK)]),\n'vp9profile0':\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
Removed hevc-dv no more exists
106,046
07.06.2020 20:07:45
-7,200
b1b173f8159875d4ebe09d73026352c20189dda8
Improved autoscroll method feature limited to episode sort method add support to descending sort order reduced sleep delay
[ { "change_type": "MODIFY", "old_path": "resources/lib/navigation/directory_utils.py", "new_path": "resources/lib/navigation/directory_utils.py", "diff": "@@ -168,7 +168,11 @@ def auto_scroll(list_data):\ntotal_items = len(list_data)\nif total_items:\n# Delay a bit to wait for the completion of the screen update\n- xbmc.sleep(150)\n+ xbmc.sleep(100)\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)\nif int(xbmc.getInfoLabel('ListItem.CurrentItem') or 2) > 1:\nreturn\n@@ -177,7 +181,7 @@ def auto_scroll(list_data):\nto_resume_items = sum(dict_item.get('ResumeTime', '0') != '0' for dict_item in list_data)\nif total_items == watched_items or (watched_items + to_resume_items) == 0:\nreturn\n- steps = 1\n+ steps = 0\n# Find last watched item\nfor index in range(total_items - 1, -1, -1):\ndict_item = list_data[index]\n@@ -189,6 +193,10 @@ def auto_scroll(list_data):\n# Last partial watched item\nsteps += index\nbreak\n+ # Get the sort order of the view\n+ is_sort_descending = xbmc.getInfoLabel('Container.SortOrder') == 'Descending'\n+ if is_sort_descending:\n+ steps = (total_items - 1) - steps\ngui_sound_mode = common.json_rpc('Settings.GetSettingValue',\n{'setting': 'audiooutput.guisoundmode'})['value']\nif gui_sound_mode != 0:\n@@ -196,7 +204,7 @@ def auto_scroll(list_data):\ncommon.json_rpc('Settings.SetSettingValue',\n{'setting': 'audiooutput.guisoundmode', 'value': 0})\n# Auto scroll the list\n- for _ in range(0, steps):\n+ for _ in range(0, steps + 1):\ncommon.json_rpc('Input.Down')\nif gui_sound_mode != 0:\n# Restore GUI sounds\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
Improved autoscroll method -feature limited to episode sort method -add support to descending sort order -reduced sleep delay
106,046
09.06.2020 14:44:24
-7,200
abbab2a0af5032f7f72072dab2f92c75d6d3c480
Disabled menu features until best times Due to website changes are disabled: All tv shows All movies Browse sub-genres in to Lists of all kinds sub-menus
[ { "change_type": "MODIFY", "old_path": "resources/lib/globals.py", "new_path": "resources/lib/globals.py", "diff": "@@ -144,21 +144,22 @@ class GlobalVariables(object):\n'description_id': None,\n'icon': 'DefaultMovies.png',\n'content_type': CONTENT_MOVIE}),\n- ('tvshows', {'path': ['genres', 'tvshows', '83'],\n- 'lolomo_contexts': None,\n- 'lolomo_known': False,\n- 'request_context_name': 'genres', # Used for sub-menus\n- 'label_id': 30095,\n- 'description_id': None,\n- 'icon': 'DefaultTVShows.png'}),\n- ('movies', {'path': ['genres', 'movies', '34399'],\n- 'lolomo_contexts': None,\n- 'lolomo_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+ # Todo: Disabled All tv shows/All movies lolomo menu due to website changes\n+ # ('tvshows', {'path': ['genres', 'tvshows', '83'],\n+ # 'lolomo_contexts': None,\n+ # 'lolomo_known': False,\n+ # 'request_context_name': 'genres', # Used for sub-menus\n+ # 'label_id': 30095,\n+ # 'description_id': None,\n+ # 'icon': 'DefaultTVShows.png'}),\n+ # ('movies', {'path': ['genres', 'movies', '34399'],\n+ # 'lolomo_contexts': None,\n+ # 'lolomo_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" }, { "change_type": "MODIFY", "old_path": "resources/lib/services/directorybuilder/dir_builder_items.py", "new_path": "resources/lib/services/directorybuilder/dir_builder_items.py", "diff": "@@ -227,7 +227,8 @@ def _create_videolist_item(list_id, video_list, menu_data, common_data, static_l\ndict_item['art'] = get_art(video_list.videoid, video_list.artitem, common_data['profile_language_code'])\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+ # Todo: Disabled sub-genre menu due to website changes\n+ # params={'genre_id': unicode(video_list.get('genreId'))},\nmode=g.MODE_DIRECTORY)\nreturn dict_item\n" }, { "change_type": "MODIFY", "old_path": "resources/settings.xml", "new_path": "resources/settings.xml", "diff": "<setting id=\"menu_sortorder_tvshowsgenres\" type=\"select\" label=\"30149\" lvalues=\"30150|30151|30152|30153\" visible=\"eq(-1,true)\" subsetting=\"true\" default=\"0\"/>\n<setting id=\"show_menu_moviesgenres\" type=\"bool\" label=\"30175\" default=\"true\"/>\n<setting id=\"menu_sortorder_moviesgenres\" type=\"select\" label=\"30149\" lvalues=\"30150|30151|30152|30153\" visible=\"eq(-1,true)\" subsetting=\"true\" default=\"0\"/>\n+ <!--\n<setting id=\"show_menu_tvshows\" type=\"bool\" label=\"30095\" default=\"true\"/>\n<setting id=\"menu_sortorder_tvshows\" type=\"select\" label=\"30149\" lvalues=\"30150|30151|30152|30153\" visible=\"eq(-1,true)\" subsetting=\"true\" default=\"0\"/>\n<setting id=\"show_menu_movies\" type=\"bool\" label=\"30096\" default=\"true\"/>\n<setting id=\"menu_sortorder_movies\" type=\"select\" label=\"30149\" lvalues=\"30150|30151|30152|30153\" visible=\"eq(-1,true)\" subsetting=\"true\" default=\"0\"/>\n+ -->\n<setting id=\"show_menu_genres\" type=\"bool\" label=\"30010\" default=\"true\"/>\n<setting id=\"menu_sortorder_genres\" type=\"select\" label=\"30149\" lvalues=\"30150|30151|30152|30153\" visible=\"eq(-1,true)\" subsetting=\"true\" default=\"0\"/>\n<setting id=\"show_menu_search\" type=\"bool\" label=\"30011\" default=\"true\"/>\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
Disabled menu features until best times Due to website changes are disabled: -All tv shows -All movies -Browse sub-genres in to Lists of all kinds sub-menus
106,046
10.06.2020 10:31:54
-7,200
309809bb35711621bec359ded389a84fd863792b
Autoscroll fixes
[ { "change_type": "MODIFY", "old_path": "resources/lib/navigation/directory_utils.py", "new_path": "resources/lib/navigation/directory_utils.py", "diff": "@@ -169,6 +169,7 @@ 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# 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@@ -181,20 +182,9 @@ def auto_scroll(list_data):\nto_resume_items = sum(dict_item.get('ResumeTime', '0') != '0' for dict_item in list_data)\nif total_items == watched_items or (watched_items + to_resume_items) == 0:\nreturn\n- steps = 0\n- # Find last watched item\n- for index in range(total_items - 1, -1, -1):\n- dict_item = list_data[index]\n- if dict_item['info'].get('PlayCount', '0') != '0':\n- # Last watched item\n- steps += index + 1\n- break\n- if dict_item.get('ResumeTime', '0') != '0':\n- # Last partial watched item\n- steps += index\n- break\n+ steps = _find_index_last_watched(total_items, list_data)\n# Get the sort order of the view\n- is_sort_descending = xbmc.getInfoLabel('Container.SortOrder') == 'Descending'\n+ is_sort_descending = xbmc.getCondVisibility('Container.SortDirection(descending)')\nif is_sort_descending:\nsteps = (total_items - 1) - steps\ngui_sound_mode = common.json_rpc('Settings.GetSettingValue',\n@@ -210,3 +200,16 @@ def auto_scroll(list_data):\n# Restore GUI sounds\ncommon.json_rpc('Settings.SetSettingValue',\n{'setting': 'audiooutput.guisoundmode', 'value': gui_sound_mode})\n+\n+\n+def _find_index_last_watched(total_items, list_data):\n+ \"\"\"Find last watched item\"\"\"\n+ for index in range(total_items - 1, -1, -1):\n+ dict_item = list_data[index]\n+ if dict_item['info'].get('PlayCount', '0') != '0':\n+ # Last watched item\n+ return index + 1\n+ if dict_item.get('ResumeTime', '0') != '0':\n+ # Last partial watched item\n+ return index\n+ return 0\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
Autoscroll fixes
106,046
12.06.2020 14:07:45
-7,200
db4cecc6d2fcb9efe2c980727e95627fe4e5b10c
Removed edge esn check
[ { "change_type": "MODIFY", "old_path": "resources/lib/common/misc_utils.py", "new_path": "resources/lib/common/misc_utils.py", "diff": "@@ -173,11 +173,6 @@ def enclose_quotes(content):\nreturn '\"' + content + '\"'\n-def is_edge_esn(esn):\n- \"\"\"Return True if the esn is an EDGE esn\"\"\"\n- return esn.startswith('NFCDIE-02-')\n-\n-\ndef is_minimum_version(version, min_version):\n\"\"\"Return True if version is equal or greater to min_version\"\"\"\nreturn list(map(int, version.split('.'))) >= list(map(int, min_version.split('.')))\n" }, { "change_type": "MODIFY", "old_path": "resources/lib/services/msl/msl_requests.py", "new_path": "resources/lib/services/msl/msl_requests.py", "diff": "@@ -65,7 +65,7 @@ class MSLRequests(MSLRequestBuilder):\ncommon.debug('Performing key handshake. ESN: {}', esn)\nresponse = _process_json_response(self._post(ENDPOINTS['manifest'], self.handshake_request(esn)))\nheader_data = self.decrypt_header_data(response['headerdata'], False)\n- self.crypto.parse_key_response(header_data, not common.is_edge_esn(esn))\n+ self.crypto.parse_key_response(header_data, True)\n# Delete all the user id tokens (are correlated to the previous mastertoken)\nself.crypto.clear_user_id_tokens()\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
Removed edge esn check
106,046
13.06.2020 17:56:35
-7,200
a2993d65df8d3f1bf36734b093106a4885ae3b27
Version bump (1.4.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.4.0\" provider-name=\"libdev + jojo + asciidisco + caphm + castagnait\">\n+<addon id=\"plugin.video.netflix\" name=\"Netflix\" version=\"1.4.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.4.0 (2020-05-30)\n--Implemented profile selection to library (preferences in the settings/playback)\n- This also fixes following related issues when play from library:\n- -Missing audio/subtitle languages\n- -Missing metadata\n- -Wrong age restrictions\n- -Video content not available\n--Initial adaptions for the new NF changes (cause of KeyError \"lolomo\")\n--Fixed profile switch for PIN protected profiles\n--Fixed forced subtitles sel. issues when Kodi audio lang setting is Original/Media default (Kodi 19)\n--Fixed regression for missing skin codec media-flag\n--Fixed an issue that caused loss of skin view type after switch profile\n--Fixed KeyError issue when performed the scheduled clear expired cache\n--Fixed unicodedecode error with Kodi 18 and MSL errors\n--Updated translations de, es, hu, ro, sv-se, tr, pl\n--Other minor fixes\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+-Minor changes/fixes\n</news>\n</extension>\n</addon>\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+-Minor changes/fixes\n+\nv1.4.0 (2020-05-30)\n-Implemented profile selection to library (preferences in the settings/playback)\nThis also fixes following related issues when play from library:\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
Version bump (1.4.1) (#686)
106,046
13.06.2020 18:08:27
-7,200
0e3c6bae17ca492c5f63cbc4c4730a2c14498e4d
Missed to update code from
[ { "change_type": "MODIFY", "old_path": "resources/lib/services/msl/base_crypto.py", "new_path": "resources/lib/services/msl/base_crypto.py", "diff": "@@ -124,7 +124,7 @@ class MSLBaseCrypto(object):\n\"\"\"Check if user id token is expired\"\"\"\ntoken_data = json.loads(base64.standard_b64decode(user_id_token['tokendata']))\n# Subtract 5min as a safety measure\n- return (token_data['expiration'] - 300) > time.time()\n+ return (token_data['expiration'] - 300) < time.time()\ndef is_current_mastertoken_expired(self):\n\"\"\"Check if the current MasterToken is expired\"\"\"\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
Missed to update code from a38e11ddb8819dfef37ddc6340af281e62898a6f
106,046
17.06.2020 09:49:34
-7,200
ce2bf0b591aac19ea35efc1758eadce1aeb6a829
Add randomness delay on full sync
[ { "change_type": "MODIFY", "old_path": "resources/lib/kodi/library.py", "new_path": "resources/lib/kodi/library.py", "diff": "from __future__ import absolute_import, division, unicode_literals\nimport os\n+import random\nfrom functools import wraps\nimport xbmc\n@@ -156,6 +157,8 @@ def sync_mylist_to_library():\nexecute_library_tasks(videoid, [export_item],\ncommon.get_local_string(30018),\nnfo_settings=nfo_settings)\n+ # Add some randomness between operations to limit servers load and ban risks\n+ xbmc.sleep(random.randint(1000, 3001))\[email protected]_execution(immediate=False)\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
Add randomness delay on full sync
106,046
20.06.2020 20:52:12
-7,200
bbb3f52294e21b22adc60441c8b08b55354d853f
Changes for new nf LoCo page
[ { "change_type": "MODIFY", "old_path": "resources/lib/api/api_requests.py", "new_path": "resources/lib/api/api_requests.py", "diff": "@@ -53,22 +53,18 @@ def login(ask_credentials=True):\nraise\n-def update_lolomo_context(context_name):\n- \"\"\"Update the lolomo list by context\"\"\"\n- # 01/06/2020: refreshListByContext often return HTTP error 500, currently i have seen that in the website is\n- # performed only when the video played is not added to \"my list\", but with a strange mixed data:\n- # context_id: the id of continueWatching\n- # context_index: that seem to point to \"My list\" id context index\n- # This api is no more needed to update the continueWatching lolomo list\n- lolomo_root = g.LOCAL_DB.get_value('lolomo_root_id', '', TABLE_SESSION)\n-\n- context_index = g.LOCAL_DB.get_value('lolomo_{}_index'.format(context_name.lower()), '', TABLE_SESSION)\n- context_id = g.LOCAL_DB.get_value('lolomo_{}_id'.format(context_name.lower()), '', TABLE_SESSION)\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)\nif not context_index:\n- common.warn('Update lolomo context {} skipped due to missing lolomo index', context_name)\n+ common.warn('Update loco context {} skipped due to missing loco index', context_name)\nreturn\n- path = [['lolomos', lolomo_root, 'refreshListByContext']]\n+ path = [['locos', loco_root, 'refreshListByContext']]\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@@ -81,15 +77,8 @@ def update_lolomo_context(context_name):\ncommon.enclose_quotes(context_name),\n'']\n# path_suffixs = [\n- # [['trackIds', 'context', 'length', 'genreId', 'videoId', 'displayName', 'isTallRow', 'isShowAsARow',\n- # 'impressionToken', 'showAsARow', 'id', 'requestId']],\n- # [{'from': 0, 'to': 100}, 'reference', 'summary'],\n- # [{'from': 0, 'to': 100}, 'reference', 'title'],\n- # [{'from': 0, 'to': 100}, 'reference', 'titleMaturity'],\n- # [{'from': 0, 'to': 100}, 'reference', 'userRating'],\n- # [{'from': 0, 'to': 100}, 'reference', 'userRatingRequestId'],\n- # [{'from': 0, 'to': 100}, 'reference', 'boxarts', '_342x192', 'jpg'],\n- # [{'from': 0, 'to': 100}, 'reference', 'promoVideo']\n+ # [{'from': 0, 'to': 100}, 'itemSummary'],\n+ # [['componentSummary']]\n# ]\ncallargs = {\n'callpaths': path,\n@@ -99,13 +88,13 @@ def update_lolomo_context(context_name):\ntry:\nresponse = common.make_http_call('callpath_request', callargs)\ncommon.debug('refreshListByContext response: {}', response)\n- # The call response return the new context id of the previous invalidated lolomo context_id\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\nexcept Exception: # pylint: disable=broad-except\nif not common.is_debug_verbose():\nreturn\nui.show_notification(title=common.get_local_string(30105),\n- msg='An error prevented the update the lolomo context on netflix',\n+ msg='An error prevented the update the loco context on netflix',\ntime=10000)\n" }, { "change_type": "MODIFY", "old_path": "resources/lib/api/data_types.py", "new_path": "resources/lib/api/data_types.py", "diff": "@@ -71,6 +71,82 @@ class LoLoMo(object):\nreturn None, None\n+class LoCo(object):\n+ \"\"\"List of components (LoCo)\"\"\"\n+ def __init__(self, path_response):\n+ self.data = path_response\n+ common.debug('LoCo data: {}', self.data)\n+ _filterout_loco_contexts(self.data, ['billboard'])\n+ self.id = next(iter(self.data['locos'])) # Get loco root id\n+\n+ def __getitem__(self, key):\n+ return _check_sentinel(self.data['locos'][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['locos'][self.id].get(key, default)\n+\n+ def lists_by_context(self, contexts, break_on_first=False):\n+ \"\"\"\n+ Get all video lists of the given contexts\n+\n+ :param contexts: list of context names\n+ :param break_on_first: stop the research at first match\n+ :return iteritems of a dict where key=list id, value=VideoListLoCo object data\n+ \"\"\"\n+ lists = {}\n+ for list_id, list_data in iteritems(self.data['lists']):\n+ if list_data['componentSummary']['context'] in contexts:\n+ lists.update({list_id: VideoListLoCo(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 and the id list of a context\"\"\"\n+ for list_id, data in iteritems(self.data['lists']):\n+ if data['componentSummary']['context'] != context:\n+ continue\n+ return list_id, VideoListLoCo(self.data, list_id)\n+ return None, None\n+\n+\n+class VideoListLoCo:\n+ \"\"\"A video list, for LoCo data\"\"\"\n+ def __init__(self, path_response, list_id):\n+ # common.debug('VideoListLoCo data: {}', path_response)\n+ self.perpetual_range_selector = path_response.get('_perpetual_range_selector')\n+ self.data = path_response\n+ self.list_id = list_id\n+ self.videoids = None\n+ # Set a 'UNSPECIFIED' type videoid (special handling for menus see parse_info in infolabels.py)\n+ self.videoid = common.VideoId(videoid=list_id)\n+ self.contained_titles = None\n+ self.artitem = None\n+ if 'lists' not in path_response:\n+ # No data in path response\n+ return\n+ # Set videos data for the specified list id\n+ self.videos = OrderedDict(resolve_refs(self.data['lists'][list_id], self.data))\n+ if not self.videos:\n+ return\n+ # Set first videos titles (special handling for menus see parse_info in infolabels.py)\n+ self.contained_titles = _get_titles(self.videos)\n+ # Set art data of first video (special handling for menus see parse_info in infolabels.py)\n+ self.artitem = listvalues(self.videos)[0]\n+ try:\n+ self.videoids = _get_videoids(self.videos)\n+ except KeyError:\n+ self.videoids = None\n+\n+ def __getitem__(self, key):\n+ return _check_sentinel(self.data['lists'][self.list_id]['componentSummary'][key])\n+\n+ def get(self, key, default=None):\n+ \"\"\"Pass call on to the backing dict of this VideoList.\"\"\"\n+ return _check_sentinel(self.data['lists'][self.list_id]['componentSummary'].get(key, default))\n+\n+\nclass VideoList:\n\"\"\"A video list\"\"\"\ndef __init__(self, path_response, list_id=None):\n@@ -238,8 +314,7 @@ def _check_sentinel(value):\ndef _get_title(video):\n- \"\"\"Get the title of a video (either from direct key or nested within\n- summary)\"\"\"\n+ \"\"\"Get the title of a video (either from direct key or nested within summary)\"\"\"\nreturn video.get('title', video.get('summary', {}).get('title'))\n@@ -270,3 +345,14 @@ def _filterout_contexts(data, contexts):\ndel data['lolomos'][_id][idkey]\nbreak\ndel data['lists'][listid]\n+\n+\n+def _filterout_loco_contexts(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+ list_id = data['locos'][root_id][str(index)][1]\n+ if not data['lists'][list_id]['componentSummary'].get('context') in contexts:\n+ continue\n+ del data['lists'][list_id]\n+ del data['locos'][root_id][str(index)]\n" }, { "change_type": "MODIFY", "old_path": "resources/lib/api/website.py", "new_path": "resources/lib/api/website.py", "diff": "@@ -43,8 +43,8 @@ PAGE_ITEMS_INFO = [\n'models/userInfo/data/pinEnabled',\n'models/serverDefs/data/BUILD_IDENTIFIER',\n'models/esnGeneratorModel/data/esn',\n- 'models/memberContext/data/geo/preferredLocale',\n- 'models/truths/data/isLocoSupported'\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,6 +67,25 @@ 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@@ -101,54 +120,63 @@ def extract_session_data(content, validate=False, update_profiles=False):\nif update_profiles:\nparse_profiles(falcor_cache)\n- g.LOCAL_DB.set_value('is_loco_supported', user_data.get('isLocoSupported'), TABLE_SESSION)\n- if user_data.get('isLocoSupported'):\n- # 21/05/2020 - Netflix is introducing a new paging type called \"loco\", it is similar to \"lolomo\"\n- # The lolomo data here is obtained by a separated request from update_lolomo_data in nfsession.py\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+ # 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\n- # NOTE: loco root ID is not same of lolomo root id\nloco_root = falcor_cache['loco']['value'][1]\n- # g.LOCAL_DB.set_value('lolomo_root_id', loco_root, TABLE_SESSION)\n+ g.LOCAL_DB.set_value('loco_root_id', loco_root, TABLE_SESSION)\n- # Check if current 'profile session' is still active\n- # Todo: 25/05/2020 - This not works, currently the \"locos\" list is always empty\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)\nis_profile_session_active = 'componentSummary' in falcor_cache['locos'][loco_root]\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- # Todo: 25/05/2020 - Without the \"locos\" list is not possible get this data here\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('lolomo_continuewatching_index', '', TABLE_SESSION)\n# g.LOCAL_DB.set_value('lolomo_continuewatching_id', '', TABLE_SESSION)\n- else:\n- # Extract lolomo root id\n- lolomo_root = falcor_cache['lolomo']['value'][1]\n- g.LOCAL_DB.set_value('lolomo_root_id', lolomo_root, TABLE_SESSION)\n-\n- # Check if current 'profile session' is still active\n- # What means 'profile session':\n- # In web browser, after you select a profile and then you close the browse page,\n- # when you reopen it you will not be asked to select a profile again, this means that the same profile session\n- # still active, and the lolomo root id (and child contexts id's) are still the same.\n- # Here one way to understand this, is checking if there is an 'summary' entry in the lolomos dictionary.\n- is_profile_session_active = 'summary' in falcor_cache['lolomos'][lolomo_root]\n-\n- # Extract lolomo continueWatching id and index\n- cw_list_data = jgraph_get('continueWatching', falcor_cache['lolomos'][lolomo_root], falcor_cache)\n- if cw_list_data:\n- context_index = falcor_cache['lolomos'][lolomo_root]['continueWatching']['value'][2]\n- g.LOCAL_DB.set_value('lolomo_continuewatching_index', context_index, TABLE_SESSION)\n- g.LOCAL_DB.set_value('lolomo_continuewatching_id', jgraph_get('id', cw_list_data), 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- # (needed to update lolomo list for watched state sync, see update_lolomo_context in api_requests.py)\n- cur_profile = jgraph_get_path(['profilesList', 'current'], falcor_cache)\n- common.warn('Context continueWatching not found in lolomos 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- else:\n- common.warn('Is not possible to find the context continueWatching, the profile session is no more active')\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+ # -- END --\n# Save only some info of the current profile from user data\ng.LOCAL_DB.set_value('build_identifier', user_data.get('BUILD_IDENTIFIER'), TABLE_SESSION)\n" }, { "change_type": "MODIFY", "old_path": "resources/lib/services/directorybuilder/dir_builder.py", "new_path": "resources/lib/services/directorybuilder/dir_builder.py", "diff": "@@ -50,8 +50,8 @@ class DirectoryBuilder(DirectoryRequests):\[email protected]_execution(immediate=True)\[email protected]_return_call\ndef get_mainmenu(self):\n- lolomo_list = self.req_lolomo_list_root()\n- return build_mainmenu_listing(lolomo_list)\n+ loco_list = self.req_loco_list_root()\n+ return build_mainmenu_listing(loco_list)\[email protected]_execution(immediate=True)\[email protected]_return_call\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": "@@ -12,8 +12,8 @@ from __future__ import absolute_import, division, unicode_literals\nfrom future.utils import iteritems\nfrom resources.lib import common\n-from resources.lib.api.data_types import (VideoListSorted, SubgenreList, SeasonList, EpisodeList, LoLoMo, VideoList,\n- SearchVideoList, CustomVideoList)\n+from resources.lib.api.data_types import (VideoListSorted, SubgenreList, SeasonList, EpisodeList, LoLoMo, LoCo,\n+ VideoList, SearchVideoList, CustomVideoList)\nfrom resources.lib.api.exceptions import InvalidVideoListTypeError\nfrom resources.lib.api.paths import (VIDEO_LIST_PARTIAL_PATHS, RANGE_SELECTOR, VIDEO_LIST_BASIC_PARTIAL_PATHS,\nSEASONS_PARTIAL_PATHS, EPISODES_PARTIAL_PATHS, ART_PARTIAL_PATHS,\n@@ -59,6 +59,23 @@ class DirectoryRequests(object):\npath_response = self.netflix_session._path_request(**call_args)\nreturn LoLoMo(path_response)\n+ @cache_utils.cache_output(cache_utils.CACHE_COMMON, fixed_identifier='loco_list', ignore_self_class=True)\n+ def req_loco_list_root(self):\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+ common.debug('Requesting LoCo root lists')\n+ paths = ([['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+ # Art for the first video of each context list (needed only to add art to the menu item)\n+ build_paths(['loco', {'from': 0, 'to': 50}, 0, 'reference'], ART_PARTIAL_PATHS))\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" }, { "change_type": "MODIFY", "old_path": "resources/lib/services/msl/events_handler.py", "new_path": "resources/lib/services/msl/events_handler.py", "diff": "@@ -134,8 +134,8 @@ class EventsHandler(threading.Thread):\nself.clear_queue()\nif event.event_data['allow_request_update_lolomo']:\n# if event.event_data['is_in_mylist']:\n- # # If video is in my list, invalidate the continueWatching list (update lolomo context data)\n- # api.update_lolomo_context('continueWatching')\n+ # # If video is in my list, invalidate the continueWatching list (update loco context data)\n+ # api.update_loco_context('continueWatching')\napi.update_videoid_bookmark(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@@ -233,11 +233,12 @@ class EventsHandler(threading.Thread):\n'preferUnletterboxed': False, # Should be set equal to the manifest request\n'uiplaycontext': {\n# 'list_id': list_id, # not mandatory\n- # Add 'lolomo_id' seems to prevent failure of the 'refreshListByContext' request\n- 'lolomo_id': g.LOCAL_DB.get_value('lolomo_root_id', '', TABLE_SESSION), # not mandatory\n+ # lolomo_id: use loco root id value\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': event_data['request_id'],\n+ # request_id: use requestId of loco root\n+ 'request_id': g.LOCAL_DB.get_value('loco_root_requestid', '', TABLE_SESSION),\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.py", "new_path": "resources/lib/services/nfsession/nfsession.py", "diff": "@@ -14,7 +14,6 @@ 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.database.db_utils import TABLE_SESSION\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@@ -39,8 +38,7 @@ class NetflixSession(NFSessionAccess, DirectoryBuilder):\nself.perpetual_path_request,\nself.callpath_request,\nself.get,\n- self.post,\n- self.update_lolomo_data\n+ self.post\n]\nfor slot in self.slots:\ncommon.register_slot(slot)\n@@ -91,10 +89,10 @@ class NetflixSession(NFSessionAccess, DirectoryBuilder):\[email protected]_execution(immediate=True)\[email protected]_return_call\n@needs_login\n- def activate_profile(self, guid, ignore_update_lolomo_data=False):\n- self._activate_profile(guid, ignore_update_lolomo_data)\n+ def activate_profile(self, guid):\n+ self._activate_profile(guid)\n- def _activate_profile(self, guid, ignore_update_lolomo_data=False):\n+ def _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@@ -122,8 +120,6 @@ class NetflixSession(NFSessionAccess, DirectoryBuilder):\ng.LOCAL_DB.switch_active_profile(guid)\ng.CACHE_MANAGEMENT.identifier_prefix = guid\nself.update_session_data()\n- if not ignore_update_lolomo_data:\n- self.update_lolomo_data()\n@needs_login\ndef _perpetual_path_request_switch_profiles(self, paths, length_params,\n@@ -138,13 +134,13 @@ class NetflixSession(NFSessionAccess, DirectoryBuilder):\n# Current profile active\ncurrent_profile_guid = g.LOCAL_DB.get_active_profile_guid()\n# Switch profile (only if necessary) in order to get My List videos\n- self._activate_profile(mylist_profile_guid, ignore_update_lolomo_data=True)\n+ self._activate_profile(mylist_profile_guid)\n# Get the My List data\npath_response = self._perpetual_path_request(paths, length_params, perpetual_range_start,\nno_limit_req)\nif mylist_profile_guid != current_profile_guid:\n# Reactive again the previous profile\n- self._activate_profile(current_profile_guid, ignore_update_lolomo_data=True)\n+ self._activate_profile(current_profile_guid)\nreturn path_response\[email protected]_return_call\n@@ -283,27 +279,6 @@ class NetflixSession(NFSessionAccess, DirectoryBuilder):\nraise NotLoggedInError\nraise\n- def update_lolomo_data(self, data=None): # pylint: disable=unused-argument\n- \"\"\"Get and save current lolomo data\"\"\"\n- # 25/05/2020 Method used for accounts \"loco\" page type enabled only\n- # accounts that use \"loco\" at this moment it is not possible to use extract_session_data (see website.py)\n- # to obtain \"loco\" data then we force the use of \"lolomo\"\n- if g.LOCAL_DB.get_value('is_loco_supported', table=TABLE_SESSION) == 'False':\n- return\n- lolomo_root = ''\n- context_index = ''\n- context_id = ''\n- if g.ADDON.getSettingBool('ProgressManager_enabled') and self.is_logged_in():\n- lolomo_data = self._path_request([['lolomo', ['continueWatching'], ['context', 'id', 'index']]])\n- lolomo_root = lolomo_data['lolomo'][1]\n- # Todo: In the new profiles, there is no 'continueWatching' list and no list is returned\n- if 'continueWatching' in lolomo_data['lolomos'][lolomo_root]:\n- context_index = lolomo_data['lolomos'][lolomo_root]['continueWatching'][2]\n- context_id = lolomo_data['lolomos'][lolomo_root][context_index][1]\n- g.LOCAL_DB.set_value('lolomo_root_id', lolomo_root, TABLE_SESSION)\n- g.LOCAL_DB.set_value('lolomo_continuewatching_index', context_index, TABLE_SESSION)\n- g.LOCAL_DB.set_value('lolomo_continuewatching_id', context_id, TABLE_SESSION)\n-\ndef _set_range_selector(paths, range_start, range_end):\n\"\"\"Replace the RANGE_SELECTOR placeholder with an actual dict:\n" }, { "change_type": "MODIFY", "old_path": "resources/lib/services/nfsession/nfsession_requests.py", "new_path": "resources/lib/services/nfsession/nfsession_requests.py", "diff": "@@ -156,7 +156,7 @@ class NFSessionRequests(NFSessionBase):\n'routeAPIRequestsThroughFTL': 'false',\n'isVolatileBillboardsEnabled': 'true',\n'isTop10Supported': 'true',\n- 'isLocoSupported': 'false',\n+ 'categoryCraversEnabled': 'false',\n'original_path': '/shakti/{}/pathEvaluator'.format(\ng.LOCAL_DB.get_value('build_identifier', '', TABLE_SESSION))\n}\n" }, { "change_type": "MODIFY", "old_path": "resources/lib/services/settings_monitor.py", "new_path": "resources/lib/services/settings_monitor.py", "diff": "@@ -109,8 +109,6 @@ class SettingsMonitor(xbmc.Monitor):\nif progress_manager_enabled != progress_manager_enabled_old:\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- # Get or reset the lolomo data\n- common.send_signal(signal='update_lolomo_data')\n# Avoid perform these operations when the add-on is installed from scratch and there are no credentials\nif (clean_cache or reboot_addon) and not common.check_credentials():\n" } ]
Python
MIT License
castagnait/plugin.video.netflix
Changes for new nf LoCo page