From dcc45577a88a1392cbba18732ce2b90e8480152d Mon Sep 17 00:00:00 2001
From: MoojMidge <56883549+MoojMidge@users.noreply.github.com>
Date: Sun, 17 Nov 2024 04:36:54 +1100
Subject: [PATCH 01/10] Fix incorrect duration display in Kodi 18 and Kodi 19
(cherry picked from commit 97951af8d7861e3f2cbe7931cfc22edeb17939e3)
---
resources/lib/youtube_plugin/kodion/items/xbmc/xbmc_items.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
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 44ab20b2b..ea6375273 100644
--- a/resources/lib/youtube_plugin/kodion/items/xbmc/xbmc_items.py
+++ b/resources/lib/youtube_plugin/kodion/items/xbmc/xbmc_items.py
@@ -113,7 +113,7 @@ def set_info(list_item, item, properties, set_play_count=True, resume=True):
list_item.addStreamInfo(info_type, {'duration': duration})
if duration is not None:
- info_labels['duration'] = value
+ info_labels['duration'] = duration
elif isinstance(item, DirectoryItem):
info_type = 'video'
From 3b576d8d95be42a29158536eb31872fee1204dcf Mon Sep 17 00:00:00 2001
From: MoojMidge <56883549+MoojMidge@users.noreply.github.com>
Date: Sun, 17 Nov 2024 16:50:43 +1100
Subject: [PATCH 02/10] Fix possible error with getting names of bookmarks that
have not been updated with info
(cherry picked from commit 0465d6f9e4a25d8dc5840733da3aa3a7d543d7dc)
---
resources/lib/youtube_plugin/youtube/provider.py | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/resources/lib/youtube_plugin/youtube/provider.py b/resources/lib/youtube_plugin/youtube/provider.py
index a19cb3590..3ae559bf3 100644
--- a/resources/lib/youtube_plugin/youtube/provider.py
+++ b/resources/lib/youtube_plugin/youtube/provider.py
@@ -1630,6 +1630,7 @@ def _update(new_item):
if isinstance(item, float):
kind = 'youtube#channel'
yt_id = item_id
+ item_name = ''
partial = True
elif isinstance(item, BaseItem):
partial = False
@@ -1644,9 +1645,11 @@ def _update(new_item):
else:
kind = 'youtube#channel'
yt_id = getattr(item, 'channel_id', None)
+ item_name = item.get_name()
else:
kind = None
yt_id = None
+ item_name = ''
partial = False
if not yt_id:
@@ -1677,7 +1680,7 @@ def _update(new_item):
'_context_menu': {
'context_menu': (
menu_items.bookmark_remove(
- context, item_id, item.get_name()
+ context, item_id, item_name
),
menu_items.bookmarks_clear(
context
From 413bf052d7e95eb59f586bc3add4ced747968b61 Mon Sep 17 00:00:00 2001
From: MoojMidge <56883549+MoojMidge@users.noreply.github.com>
Date: Mon, 18 Nov 2024 12:15:23 +1100
Subject: [PATCH 03/10] Fix missing "Live" label in Kodi 18
(cherry picked from commit d051ad055c26be3c4be1f8a638187c566b24d7f9)
---
.../lib/youtube_plugin/kodion/context/xbmc/xbmc_context.py | 2 +-
resources/settings.xml | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/resources/lib/youtube_plugin/kodion/context/xbmc/xbmc_context.py b/resources/lib/youtube_plugin/kodion/context/xbmc/xbmc_context.py
index c13a9dbb7..12daa62fe 100644
--- a/resources/lib/youtube_plugin/kodion/context/xbmc/xbmc_context.py
+++ b/resources/lib/youtube_plugin/kodion/context/xbmc/xbmc_context.py
@@ -124,7 +124,7 @@ class XbmcContext(AbstractContext):
'isa.enable.check': 30579,
'key.requirement': 30731,
'liked.video': 30716,
- 'live': 839,
+ 'live': 19664,
'live.completed': 30647,
'live.upcoming': 30646,
'maintenance.bookmarks': 30800,
diff --git a/resources/settings.xml b/resources/settings.xml
index 607bcd33d..ea33b17cb 100644
--- a/resources/settings.xml
+++ b/resources/settings.xml
@@ -242,7 +242,7 @@
-
+
@@ -529,7 +529,7 @@
true
-
+
0
true
From 0202e54161635799a48ca1002c05f2c73b147a36 Mon Sep 17 00:00:00 2001
From: MoojMidge <56883549+MoojMidge@users.noreply.github.com>
Date: Mon, 18 Nov 2024 16:47:37 +1100
Subject: [PATCH 04/10] Allow ISA and MPD in 720p performance preset in Setup
Wizard
(cherry picked from commit 4cae9950e0e3251747bc259bde824d5f734cb568)
---
.../lib/youtube_plugin/youtube/helper/yt_setup_wizard.py | 5 -----
1 file changed, 5 deletions(-)
diff --git a/resources/lib/youtube_plugin/youtube/helper/yt_setup_wizard.py b/resources/lib/youtube_plugin/youtube/helper/yt_setup_wizard.py
index 6b211459b..d09ddfdb2 100644
--- a/resources/lib/youtube_plugin/youtube/helper/yt_setup_wizard.py
+++ b/resources/lib/youtube_plugin/youtube/helper/yt_setup_wizard.py
@@ -123,11 +123,6 @@ def process_performance_settings(context, step, steps, **_kwargs):
'max_resolution': 3, # 720p
'stream_features': ('avc1', 'mp4a', 'filter'),
'num_items': 10,
- 'settings': (
- (settings.use_isa, (False,)),
- (settings.use_mpd_videos, (False,)),
- (settings.set_subtitle_download, (True,)),
- ),
},
'1080p30_avc': {
'max_resolution': 4, # 1080p
From c4909a5f8a2ba89587fbfb3a606af6e111cd5bd6 Mon Sep 17 00:00:00 2001
From: MoojMidge <56883549+MoojMidge@users.noreply.github.com>
Date: Tue, 19 Nov 2024 07:10:01 +1100
Subject: [PATCH 05/10] Fix uncaught exception when sign-in does not succeed
#985
(cherry picked from commit 6e3363291658390b9f72aa6a9419e22f076b1e92)
---
.../kodion/json_store/access_manager.py | 11 ++++++-----
.../lib/youtube_plugin/youtube/helper/yt_login.py | 2 +-
2 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/resources/lib/youtube_plugin/kodion/json_store/access_manager.py b/resources/lib/youtube_plugin/kodion/json_store/access_manager.py
index a6d8b62d5..e6e9a4b83 100644
--- a/resources/lib/youtube_plugin/kodion/json_store/access_manager.py
+++ b/resources/lib/youtube_plugin/kodion/json_store/access_manager.py
@@ -456,11 +456,12 @@ def update_access_token(self,
}
if expiry is not None:
- details['token_expires'] = time.time() + (
- min(map(int, [val for val in expiry if val]))
- if isinstance(expiry, (list, tuple)) else
- int(expiry)
- )
+ if isinstance(expiry, (list, tuple)):
+ expiry = [val for val in expiry if val]
+ expiry = min(map(int, expiry)) if expiry else -1
+ else:
+ expiry = int(expiry)
+ details['token_expires'] = time.time() + expiry
if refresh_token is not None:
details['refresh_token'] = (
diff --git a/resources/lib/youtube_plugin/youtube/helper/yt_login.py b/resources/lib/youtube_plugin/youtube/helper/yt_login.py
index f495b993a..3d6ba7d18 100644
--- a/resources/lib/youtube_plugin/youtube/helper/yt_login.py
+++ b/resources/lib/youtube_plugin/youtube/helper/yt_login.py
@@ -121,7 +121,7 @@ def _do_login(token_type):
tokens = ['tv', 'personal']
for token_type, token in enumerate(tokens):
- new_token = _do_login(token_type) or (None, 0, None)
+ new_token = _do_login(token_type) or ('', -1, '')
tokens[token_type] = new_token
context.log_debug('YouTube Login:'
From e6b9241f4f4eae422e6bea1618bf5f963384b106 Mon Sep 17 00:00:00 2001
From: MoojMidge <56883549+MoojMidge@users.noreply.github.com>
Date: Wed, 20 Nov 2024 07:00:06 +1100
Subject: [PATCH 06/10] Fix missing "Ask" translation string
(cherry picked from commit ce402abd0af4c25439963f7ee6a4c1cad9690d1f)
# Conflicts:
# resources/lib/youtube_plugin/kodion/context/xbmc/xbmc_context.py
---
.../lib/youtube_plugin/kodion/context/xbmc/xbmc_context.py | 2 +-
resources/lib/youtube_plugin/kodion/script_actions.py | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/resources/lib/youtube_plugin/kodion/context/xbmc/xbmc_context.py b/resources/lib/youtube_plugin/kodion/context/xbmc/xbmc_context.py
index 12daa62fe..fc4ea0b8a 100644
--- a/resources/lib/youtube_plugin/kodion/context/xbmc/xbmc_context.py
+++ b/resources/lib/youtube_plugin/kodion/context/xbmc/xbmc_context.py
@@ -62,7 +62,6 @@ class XbmcContext(AbstractContext):
'api.personal.failed': 30599,
'api.secret': 30203,
'are_you_sure': 750,
- 'ask': 863,
'bookmark': 30101,
'bookmark.channel': 30803,
'bookmark.created': 21362,
@@ -190,6 +189,7 @@ class XbmcContext(AbstractContext):
'search.sort.title': 369,
'search.sort.viewCount': 30767,
'search.title': 137,
+ 'select': 424,
'select.listen.ip': 30644,
'select_video_quality': 30010,
'settings': 10004,
diff --git a/resources/lib/youtube_plugin/kodion/script_actions.py b/resources/lib/youtube_plugin/kodion/script_actions.py
index 21ab91556..93531a968 100644
--- a/resources/lib/youtube_plugin/kodion/script_actions.py
+++ b/resources/lib/youtube_plugin/kodion/script_actions.py
@@ -67,7 +67,7 @@ def _config_actions(context, action, *_args):
sub_opts = [
localize('none'),
- localize('ask'),
+ localize('select'),
localize('subtitles.with_fallback') % (preferred, fallback),
preferred,
'%s (%s)' % (preferred, localize('subtitles.no_asr')),
From a77d46a73dd8a93d8ee281b7c29fde2410253da4 Mon Sep 17 00:00:00 2001
From: MoojMidge <56883549+MoojMidge@users.noreply.github.com>
Date: Mon, 25 Nov 2024 10:26:05 +1100
Subject: [PATCH 07/10] Fix incorrect parameter name breaking auto-remove from
Watch Later #993
(cherry picked from commit 24594e6ee77f342c1a9853e1b993beb0dc6e969d)
---
resources/lib/youtube_plugin/kodion/monitors/player_monitor.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/resources/lib/youtube_plugin/kodion/monitors/player_monitor.py b/resources/lib/youtube_plugin/kodion/monitors/player_monitor.py
index 89c208cc4..2ca9e656a 100644
--- a/resources/lib/youtube_plugin/kodion/monitors/player_monitor.py
+++ b/resources/lib/youtube_plugin/kodion/monitors/player_monitor.py
@@ -244,7 +244,7 @@ def run(self):
category='video',
playlist_id=watch_later_id,
video_id=playlist_item_id,
- item_name='',
+ video_name='',
confirmed=True,
)
else:
From 46c389bd814779dda40a54307aa2358868a4d921 Mon Sep 17 00:00:00 2001
From: MoojMidge <56883549+MoojMidge@users.noreply.github.com>
Date: Thu, 28 Nov 2024 11:08:48 +1100
Subject: [PATCH 08/10] Only use OAuth tokens if necessary #994 #996
- Workaround for issues with family/linked accounts
- Workaround for potential future restrictions on use of OAuth
---
.../youtube/helper/stream_info.py | 167 ++++++++++--------
1 file changed, 90 insertions(+), 77 deletions(-)
diff --git a/resources/lib/youtube_plugin/youtube/helper/stream_info.py b/resources/lib/youtube_plugin/youtube/helper/stream_info.py
index 50044a8e2..e44833366 100644
--- a/resources/lib/youtube_plugin/youtube/helper/stream_info.py
+++ b/resources/lib/youtube_plugin/youtube/helper/stream_info.py
@@ -1380,9 +1380,11 @@ def load_stream_info(self, video_id):
'country',
'not available',
}
- skip_reasons = {
+ reauth_reasons = {
'age',
'inappropriate',
+ }
+ skip_reasons = {
'latest version',
}
retry_reasons = {
@@ -1393,11 +1395,8 @@ def load_stream_info(self, video_id):
abort = False
client_data = {'json': {'videoId': video_id}}
- if self._access_token:
- auth = True
- client_data['_access_token'] = self._access_token
- else:
- auth = False
+ access_token = self._access_token
+ auth = False
for name, clients in self._client_groups.items():
if not clients:
@@ -1409,81 +1408,95 @@ def load_stream_info(self, video_id):
status = None
- for client_name in clients:
- _client = self.build_client(client_name, client_data)
- if not _client:
- continue
-
- _result = self.request(
- video_info_url,
- 'POST',
- response_hook=self._response_hook_json,
- error_title='Player request failed',
- error_hook=self._error_hook,
- error_hook_kwargs={
- 'video_id': video_id,
- 'client': client_name,
- 'auth': bool(_client.get('_access_token')),
- },
- **_client
- ) or {}
-
- video_details = _result.get('videoDetails', {})
- playability = _result.get('playabilityStatus', {})
- status = playability.get('status', 'ERROR').upper()
- reason = playability.get('reason', 'UNKNOWN')
-
- if video_details and video_id != video_details.get('videoId'):
- status = 'CONTENT_NOT_AVAILABLE_IN_THIS_APP'
- reason = 'Watch on the latest version of YouTube'
-
- if (age_gate_enabled
- and playability.get('desktopLegacyAgeGateReason')):
- abort = True
- break
- elif status == 'LIVE_STREAM_OFFLINE':
- abort = True
- break
- elif status == 'OK':
- break
- elif status in {
- 'AGE_CHECK_REQUIRED',
- 'AGE_VERIFICATION_REQUIRED',
- 'CONTENT_CHECK_REQUIRED',
- 'LOGIN_REQUIRED',
- 'CONTENT_NOT_AVAILABLE_IN_THIS_APP',
- 'ERROR',
- 'UNPLAYABLE',
- }:
- log_warning(
- 'Failed to retrieve video info'
- '\n\tStatus: {status}'
- '\n\tReason: {reason}'
- '\n\tvideo_id: |{video_id}|'
- '\n\tClient: |{client}|'
- '\n\tAuth: |{auth}|'
- .format(
- status=status,
- reason=reason or 'UNKNOWN',
- video_id=video_id,
- client=_client['_name'],
- auth=auth,
- )
- )
- compare_reason = reason.lower()
- if any(why in compare_reason for why in retry_reasons):
+ restart = False
+ while 1:
+ for client_name in clients:
+ _client = self.build_client(client_name, client_data)
+ if not _client:
continue
- if any(why in compare_reason for why in skip_reasons):
+
+ _result = self.request(
+ video_info_url,
+ 'POST',
+ response_hook=self._response_hook_json,
+ error_title='Player request failed',
+ error_hook=self._error_hook,
+ error_hook_kwargs={
+ 'video_id': video_id,
+ 'client': client_name,
+ 'auth': bool(_client.get('_access_token')),
+ },
+ **_client
+ ) or {}
+
+ video_details = _result.get('videoDetails', {})
+ playability = _result.get('playabilityStatus', {})
+ status = playability.get('status', 'ERROR').upper()
+ reason = playability.get('reason', 'UNKNOWN')
+
+ if (video_details
+ and video_id != video_details.get('videoId')):
+ status = 'CONTENT_NOT_AVAILABLE_IN_THIS_APP'
+ reason = 'Watch on the latest version of YouTube'
+
+ if (age_gate_enabled
+ and playability.get('desktopLegacyAgeGateReason')):
+ abort = True
break
- if any(why in compare_reason for why in abort_reasons):
+ elif status == 'LIVE_STREAM_OFFLINE':
abort = True
break
+ elif status == 'OK':
+ break
+ elif status in {
+ 'AGE_CHECK_REQUIRED',
+ 'AGE_VERIFICATION_REQUIRED',
+ 'CONTENT_CHECK_REQUIRED',
+ 'LOGIN_REQUIRED',
+ 'CONTENT_NOT_AVAILABLE_IN_THIS_APP',
+ 'ERROR',
+ 'UNPLAYABLE',
+ }:
+ log_warning(
+ 'Failed to retrieve video info'
+ '\n\tStatus: {status}'
+ '\n\tReason: {reason}'
+ '\n\tvideo_id: |{video_id}|'
+ '\n\tClient: |{client}|'
+ '\n\tAuth: |{auth}|'
+ .format(
+ status=status,
+ reason=reason or 'UNKNOWN',
+ video_id=video_id,
+ client=_client['_name'],
+ auth=auth,
+ )
+ )
+ compare_reason = reason.lower()
+ if any(why in compare_reason for why in reauth_reasons):
+ if access_token and not auth:
+ auth = True
+ client_data['_access_token'] = access_token
+ restart = True
+ break
+ if any(why in compare_reason for why in retry_reasons):
+ continue
+ if any(why in compare_reason for why in skip_reasons):
+ break
+ if any(why in compare_reason for why in abort_reasons):
+ abort = True
+ break
+ else:
+ log_debug(
+ 'Unknown playabilityStatus in player response'
+ '\n\tplayabilityStatus: {0}'
+ .format(playability)
+ )
else:
- log_debug(
- 'Unknown playabilityStatus in player response'
- '\n\tplayabilityStatus: {0}'
- .format(playability)
- )
+ break
+ if not restart:
+ break
+ restart = False
if abort:
break
@@ -1624,7 +1637,7 @@ def load_stream_info(self, video_id):
'',
'',
)) + '||R{{SSM}}|R',
- 'token': self._access_token,
+ 'token': access_token,
}
break
else:
From e0b77b284eda37a848e673ebd0d9f63d2c3c9607 Mon Sep 17 00:00:00 2001
From: MoojMidge <56883549+MoojMidge@users.noreply.github.com>
Date: Mon, 18 Nov 2024 09:30:05 +1100
Subject: [PATCH 09/10] Fix processing of "q" and "channelId" search query
params
(cherry picked from commit 5fa396d95dc0be3a4b2dfd6876f2ce63be199c06)
---
resources/lib/youtube_plugin/youtube/client/youtube.py | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/resources/lib/youtube_plugin/youtube/client/youtube.py b/resources/lib/youtube_plugin/youtube/client/youtube.py
index 4ab1dc2de..dafbaa44a 100644
--- a/resources/lib/youtube_plugin/youtube/client/youtube.py
+++ b/resources/lib/youtube_plugin/youtube/client/youtube.py
@@ -1430,7 +1430,7 @@ def search_with_params(self, params, **kwargs):
'relevanceLanguage': self._language,
}
- search_query = params.get('q')
+ search_query = params.get('q', '')
if '|' in search_query:
search_params['q'] = search_query.replace('|', '%7C')
@@ -1444,9 +1444,8 @@ def search_with_params(self, params, **kwargs):
channel_id = params.get('channelId')
if channel_id == 'mine':
+ del params['channelId']
params['forMine'] = True
- else:
- params['channelId'] = channel_id
location = params.get('location')
if location is True:
From 0791474b304a24e442ceb63b673e7bc921cdd9e9 Mon Sep 17 00:00:00 2001
From: MoojMidge <56883549+MoojMidge@users.noreply.github.com>
Date: Thu, 28 Nov 2024 13:16:38 +1100
Subject: [PATCH 10/10] Version bump v7.1.1.3
---
addon.xml | 2 +-
changelog.txt | 11 ++++++++++-
2 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/addon.xml b/addon.xml
index 78c493bb4..90191fc5e 100644
--- a/addon.xml
+++ b/addon.xml
@@ -1,5 +1,5 @@
-
+
diff --git a/changelog.txt b/changelog.txt
index afeecd5a5..eb13564cd 100644
--- a/changelog.txt
+++ b/changelog.txt
@@ -1,4 +1,4 @@
-## v7.1.1.1
+## v7.1.1.3
### Fixed
- Fix http server not listening on any interface if listen IP is 0.0.0.0 #927
- Standardise return type of LoginClient.refresh_token #932
@@ -33,6 +33,13 @@
- Attempt to fix possible deadlock on http server shutdown
- Fix potential infinite loop with old data from access_manager.json #980
- Reduce unnecessary window navigation fallback attempts
+- Fix incorrect duration display in Kodi 18 and Kodi 19 #999
+- Fix possible error with getting names of bookmarks that have not been updated with info
+- Fix missing "Live" label in Kodi 18
+- Fix uncaught exception when sign-in does not succeed #985
+- Fix missing "Ask" translation string
+- Fix incorrect parameter name breaking auto-remove from Watch Later #993
+- Fix processing of "q" and "channelId" search query params #1004
### Changed
- Improve display and update of bookmarks
@@ -49,6 +56,8 @@
- path parameters used for folders and sub-folders
- query parameters used for changing display modes, filtering, sorting and inputs
- Don't retry server wakeup on error unless settings change
+- Allow ISA and MPD in 720p performance preset in Setup Wizard
+- Only use OAuth tokens if necessary #994 #996
### New
- Explicitly enable TCP keep alive #913