diff --git a/addon.xml b/addon.xml index f3a9876ab..82080ea3b 100644 --- a/addon.xml +++ b/addon.xml @@ -1,5 +1,5 @@ - + diff --git a/changelog.txt b/changelog.txt index 5f4318280..5d76f7b58 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,3 +1,10 @@ +## v7.0.9+beta.5 +### Fixed +- Fix disabling certification verification #841 +- Fix not using player request fallbacks #845 +- Fix incorrectly identifying VP9 streams #833 +- Fix videos not able to be re-opened from Kodi playlist #810 + ## v7.0.9+beta.4 ### Fixed - Fix issues with next page and jump to page in related video listings diff --git a/resources/lib/youtube_plugin/kodion/constants/const_settings.py b/resources/lib/youtube_plugin/kodion/constants/const_settings.py index a2099a811..c02f1d1d2 100644 --- a/resources/lib/youtube_plugin/kodion/constants/const_settings.py +++ b/resources/lib/youtube_plugin/kodion/constants/const_settings.py @@ -81,3 +81,4 @@ HTTPD_PORT = 'kodion.http.port' # (number) HTTPD_LISTEN = 'kodion.http.listen' # (string) HTTPD_WHITELIST = 'kodion.http.ip.whitelist' # (string) +HTTPD_IDLE_SLEEP = 'youtube.http.idle_sleep' # (bool) diff --git a/resources/lib/youtube_plugin/kodion/items/xbmc/xbmc_items.py b/resources/lib/youtube_plugin/kodion/items/xbmc/xbmc_items.py index a286e3c8d..99569e4e8 100644 --- a/resources/lib/youtube_plugin/kodion/items/xbmc/xbmc_items.py +++ b/resources/lib/youtube_plugin/kodion/items/xbmc/xbmc_items.py @@ -418,11 +418,11 @@ def video_playback_item(context, video_item, show_fanart=None, **_kwargs): if current_system_version.compatible(21, 0): isa_capabilities = context.inputstream_adaptive_capabilities() - if video_item.live and isa_capabilities['manifest_config_prop']: + if video_item.live and 'manifest_config_prop' in isa_capabilities: props['inputstream.adaptive.manifest_config'] = dumps({ 'timeshift_bufferlimit': 4 * 60 * 60, }) - if not settings.verify_ssl() and isa_capabilities['config_prop']: + if not settings.verify_ssl() and 'config_prop' in isa_capabilities: props['inputstream.adaptive.config'] = dumps({ 'ssl_verify_peer': False, }) diff --git a/resources/lib/youtube_plugin/kodion/monitors/service_monitor.py b/resources/lib/youtube_plugin/kodion/monitors/service_monitor.py index a704d9573..5a35fffaf 100644 --- a/resources/lib/youtube_plugin/kodion/monitors/service_monitor.py +++ b/resources/lib/youtube_plugin/kodion/monitors/service_monitor.py @@ -42,7 +42,7 @@ def __init__(self, context): self.httpd = None self.httpd_thread = None - self.httpd_sleep_allowed = True + self.httpd_sleep_allowed = settings.httpd_sleep_allowed() self.system_idle = False self.refresh = False @@ -106,7 +106,7 @@ def onNotification(self, sender, method, data): self.interrupt = True elif target == SERVER_WAKEUP: if not self.httpd and self.httpd_required(): - self.httpd_sleep_allowed = False + self.httpd_sleep_allowed = None self.start_httpd() if data.get('response_required'): self.set_property(WAKEUP, target) @@ -164,6 +164,10 @@ def onSettingsChanged(self): self._whitelist = whitelist httpd_restart = httpd_started + sleep_allowed = settings.httpd_sleep_allowed() + if sleep_allowed is False: + self.httpd_sleep_allowed = False + if self.httpd_required(settings): if httpd_restart: self.restart_httpd() diff --git a/resources/lib/youtube_plugin/kodion/network/requests.py b/resources/lib/youtube_plugin/kodion/network/requests.py index f735a6bea..4c060c4d6 100644 --- a/resources/lib/youtube_plugin/kodion/network/requests.py +++ b/resources/lib/youtube_plugin/kodion/network/requests.py @@ -35,8 +35,11 @@ class SSLHTTPAdapter(HTTPAdapter): def init_poolmanager(self, *args, **kwargs): kwargs['ssl_context'] = self._ssl_context - super(SSLHTTPAdapter, self).init_poolmanager(*args, **kwargs) + return super(SSLHTTPAdapter, self).init_poolmanager(*args, **kwargs) + def cert_verify(self, conn, url, verify, cert): + self._ssl_context.check_hostname = bool(verify) + return super(SSLHTTPAdapter, self).cert_verify(conn, url, verify, cert) class BaseRequestsClass(object): _session = Session() diff --git a/resources/lib/youtube_plugin/kodion/service_runner.py b/resources/lib/youtube_plugin/kodion/service_runner.py index 1e3efa730..89fc41fff 100644 --- a/resources/lib/youtube_plugin/kodion/service_runner.py +++ b/resources/lib/youtube_plugin/kodion/service_runner.py @@ -90,9 +90,12 @@ def run(): httpd_idle_time_ms = 0 monitor.shutdown_httpd(sleep=True) else: - if pop_property(SERVER_POST_START): - monitor.httpd_sleep_allowed = True - httpd_idle_time_ms = 0 + if monitor.httpd_sleep_allowed is None: + if pop_property(SERVER_POST_START): + monitor.httpd_sleep_allowed = True + httpd_idle_time_ms = 0 + else: + pop_property(SERVER_POST_START) else: if httpd_idle_time_ms >= httpd_ping_period_ms: httpd_idle_time_ms = 0 diff --git a/resources/lib/youtube_plugin/kodion/settings/abstract_settings.py b/resources/lib/youtube_plugin/kodion/settings/abstract_settings.py index 3af3346fd..3e51fa107 100644 --- a/resources/lib/youtube_plugin/kodion/settings/abstract_settings.py +++ b/resources/lib/youtube_plugin/kodion/settings/abstract_settings.py @@ -290,6 +290,11 @@ def httpd_whitelist(self): allow_list.append('.'.join(map(str, octets))) return allow_list + def httpd_sleep_allowed(self, value=None): + if value is not None: + return self.set_bool(SETTINGS.HTTPD_IDLE_SLEEP, value) + return self.get_bool(SETTINGS.HTTPD_IDLE_SLEEP, True) + def api_config_page(self): return self.get_bool(SETTINGS.API_CONFIG_PAGE, False) diff --git a/resources/lib/youtube_plugin/youtube/helper/stream_info.py b/resources/lib/youtube_plugin/youtube/helper/stream_info.py index 91f92e4de..eea0b3c36 100644 --- a/resources/lib/youtube_plugin/youtube/helper/stream_info.py +++ b/resources/lib/youtube_plugin/youtube/helper/stream_info.py @@ -662,7 +662,9 @@ class StreamInfo(YouTubeRequestClient): # video - order based on comparative compression ratio 'av01': 1, 'vp9': 0.75, + 'vp09': 0.75, 'vp8': 0.55, + 'vp08': 0.55, 'avc1': 0.5, 'h.264': 0.5, 'h.263': 0.4, @@ -1360,9 +1362,11 @@ def _get_stream_info(self): if self._access_token: client_data['_access_token'] = self._access_token + last_status = None + num_errors = num_requests = 0 while 1: for client_name in self._prioritised_clients: - if status is not None: + if last_status: self._context.log_warning( 'Failed to retrieve video info - ' 'video_id: {0}, client: {1}, auth: {2},\n' @@ -1370,7 +1374,7 @@ def _get_stream_info(self): video_id, client['_name'], bool(client.get('_access_token')), - status, + last_status, reason or 'UNKNOWN', ) ) @@ -1393,9 +1397,10 @@ def _get_stream_info(self): **client ) + num_requests += 1 video_details = result.get('videoDetails', {}) playability_status = result.get('playabilityStatus', {}) - status = playability_status.get('status', '').upper() + status = playability_status.get('status', 'ERROR').upper() reason = playability_status.get('reason', '') if video_details and video_id != video_details.get('videoId'): @@ -1406,7 +1411,6 @@ def _get_stream_info(self): if status == 'OK': break elif status in { - '', 'AGE_CHECK_REQUIRED', 'AGE_VERIFICATION_REQUIRED', 'CONTENT_CHECK_REQUIRED', @@ -1415,6 +1419,9 @@ def _get_stream_info(self): 'LOGIN_REQUIRED', 'UNPLAYABLE', }: + if not last_status or status == last_status: + num_errors += 1 + last_status = status if (playability_status.get('desktopLegacyAgeGateReason') and _settings.age_gate()): break @@ -1447,17 +1454,16 @@ def _get_stream_info(self): ) if url and url.startswith('//support.google.com/youtube/answer/12318250'): status = 'CONTENT_NOT_AVAILABLE_IN_THIS_APP' - continue else: self._context.log_debug( 'Unknown playabilityStatus in player response:\n|{0}|' .format(playability_status) ) - continue - break # Only attempt to remove Authorization header if clients iterable # was exhausted i.e. request attempted using all clients else: + if num_errors == num_requests: + break if '_access_token' in client_data: del client_data['_access_token'] continue @@ -1787,7 +1793,7 @@ def _process_stream_data(self, stream_data, default_lang_code='und'): codec = re.match(r'codecs="([a-z0-9]+([.\-][0-9](?="))?)', codecs) if codec: codec = codec.group(1) - if codec.startswith('vp9'): + if codec.startswith(('vp9', 'vp09')): codec = 'vp9' elif codec.startswith('dts'): codec = 'dts' diff --git a/resources/settings.xml b/resources/settings.xml index 604bbcc1d..1bd96ae23 100644 --- a/resources/settings.xml +++ b/resources/settings.xml @@ -994,6 +994,11 @@ RunScript($ID,config/show_client_ip) + + 0 + true + +