From 85a8746860b8c57308979cbd0fd302319085cb0e Mon Sep 17 00:00:00 2001 From: MoojMidge <56883549+MoojMidge@users.noreply.github.com> Date: Sun, 17 Mar 2024 20:45:42 +1100 Subject: [PATCH 01/17] Fix calling Profiler without timer --- resources/lib/youtube_plugin/kodion/debug.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/resources/lib/youtube_plugin/kodion/debug.py b/resources/lib/youtube_plugin/kodion/debug.py index a271c251d..f8e76500c 100644 --- a/resources/lib/youtube_plugin/kodion/debug.py +++ b/resources/lib/youtube_plugin/kodion/debug.py @@ -172,7 +172,10 @@ def wrapper(*args, **kwargs): return wrapper def _create_profiler(self): - self._profiler = self._Profile(timer=self._timer) + if self._timer: + self._profiler = self._Profile(timer=self._timer) + else: + self._profiler = self._Profile() self._profiler.enable() @classmethod From d395ce8b76361c8d97d92aef6295e88ad4fef0b9 Mon Sep 17 00:00:00 2001 From: MoojMidge <56883549+MoojMidge@users.noreply.github.com> Date: Mon, 18 Mar 2024 11:03:04 +1100 Subject: [PATCH 02/17] Fix Python2 implicit unicode conversion with wrong encoding - Caused as a result of 56c106f - Fixes #639 --- resources/lib/youtube_plugin/youtube/client/youtube.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/lib/youtube_plugin/youtube/client/youtube.py b/resources/lib/youtube_plugin/youtube/client/youtube.py index 7dcc40471..3ebb2f263 100644 --- a/resources/lib/youtube_plugin/youtube/client/youtube.py +++ b/resources/lib/youtube_plugin/youtube/client/youtube.py @@ -1537,9 +1537,9 @@ def fetch_xml(_url, _responses): if response: response.encoding = 'utf-8' xml_data = to_unicode(response.content) + xml_data = xml_data.replace('\n', '') if not current_system_version.compatible(19, 0): xml_data = xml_data.encode('utf-8') - xml_data = xml_data.replace('\n', '') root = ET.fromstring(xml_data) From 13cbfe16fdbc2ee449054bf9af69f15a6c572460 Mon Sep 17 00:00:00 2001 From: MoojMidge <56883549+MoojMidge@users.noreply.github.com> Date: Mon, 18 Mar 2024 18:09:00 +1100 Subject: [PATCH 03/17] Fix incorrectly logging batched settings changes - Number of settings changed was incremented, but never reset after processing --- resources/lib/youtube_plugin/kodion/monitors/service_monitor.py | 1 + 1 file changed, 1 insertion(+) diff --git a/resources/lib/youtube_plugin/kodion/monitors/service_monitor.py b/resources/lib/youtube_plugin/kodion/monitors/service_monitor.py index fba447dff..637ca98ce 100644 --- a/resources/lib/youtube_plugin/kodion/monitors/service_monitor.py +++ b/resources/lib/youtube_plugin/kodion/monitors/service_monitor.py @@ -73,6 +73,7 @@ def onSettingsChanged(self): return if changes > 1: log_debug('onSettingsChanged: {0} changes'.format(changes)) + self._settings_changes = 0 settings = self._settings settings.flush(xbmcaddon.Addon(ADDON_ID)) From f0ffb272b2eb9ade7b7b0b01f089c6dc42e6a867 Mon Sep 17 00:00:00 2001 From: MoojMidge <56883549+MoojMidge@users.noreply.github.com> Date: Mon, 18 Mar 2024 18:26:37 +1100 Subject: [PATCH 04/17] Tidy up workflow files --- .github/workflows/make-release.yml | 1 - .github/workflows/submit-release.yml | 18 ++++++++++++------ 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/.github/workflows/make-release.yml b/.github/workflows/make-release.yml index 813839779..c90ada102 100644 --- a/.github/workflows/make-release.yml +++ b/.github/workflows/make-release.yml @@ -59,7 +59,6 @@ jobs: version=$(xmlstarlet sel -t -v 'string(/addon/@version)' addon.xml) xmlstarlet ed -L -P \ -s '/addon/extension[@point="xbmc.addon.metadata"]' -t elem -n news -v "${news:0:1500}" \ - -u '/addon/@version' -v "${version}" \ addon.xml filename=${{ github.event.repository.name }}-${version}.zip cd .. diff --git a/.github/workflows/submit-release.yml b/.github/workflows/submit-release.yml index df66d6467..b884fe769 100644 --- a/.github/workflows/submit-release.yml +++ b/.github/workflows/submit-release.yml @@ -52,7 +52,9 @@ jobs: git add . git commit -m "Remove Unwanted Files" news=$(awk '/^## /{rel_num++} {if(rel_num==2){exit} if(rel_num==1){print}}' changelog.txt | sed -E 's/ ?#[[:digit:]]+[., ]?//;s/\r//') - xmlstarlet ed -L -P -s '/addon/extension[@point="xbmc.addon.metadata"]' -t elem -n news -v "${news:0:1500}" addon.xml + xmlstarlet ed -L -P \ + -s '/addon/extension[@point="xbmc.addon.metadata"]' -t elem -n news -v "${news:0:1500}" \ + addon.xml git add . git commit -m "Update news" working-directory: ${{ github.event.repository.name }} @@ -80,14 +82,18 @@ jobs: git add . git commit -m "Remove Unwanted Files" news=$(awk '/^## /{rel_num++} {if(rel_num==2){exit} if(rel_num==1){print}}' changelog.txt | sed -E 's/ ?#[[:digit:]]+[., ]?//;s/\r//') - xmlstarlet ed -L -P -s '/addon/extension[@point="xbmc.addon.metadata"]' -t elem -n news -v "${news:0:1500}" addon.xml + xmlstarlet ed -L -P \ + -s '/addon/extension[@point="xbmc.addon.metadata"]' -t elem -n news -v "${news:0:1500}" \ + addon.xml git add . git commit -m "Update news" version=$(xmlstarlet sel -t -v 'string(/addon/@version)' addon.xml) - xmlstarlet ed -L -P -u '/addon/@version' -v "${version}+matrix.1" addon.xml - xmlstarlet ed -L -P -u '/addon/requires/import[@addon="xbmc.python"]/@version' -v '3.0.0' addon.xml - xmlstarlet ed -L -P -u '/addon/requires/import[@addon="inputstream.adaptive"]/@version' -v '19.0.0' addon.xml - xmlstarlet ed -L -P -d '/addon/requires/import[@addon="script.module.infotagger"]' addon.xml + xmlstarlet ed -L -P \ + -u '/addon/@version' -v "${version}+matrix.1" \ + -u '/addon/requires/import[@addon="xbmc.python"]/@version' -v '3.0.0' \ + -u '/addon/requires/import[@addon="inputstream.adaptive"]/@version' -v '19.0.0' \ + -d '/addon/requires/import[@addon="script.module.infotagger"]' \ + addon.xml git add . git commit -m "Kodi 19 Patch" working-directory: ${{ github.event.repository.name }} From de051883d8ef5679bbd4cc421e617f44065a76f2 Mon Sep 17 00:00:00 2001 From: MoojMidge <56883549+MoojMidge@users.noreply.github.com> Date: Tue, 19 Mar 2024 10:59:41 +1100 Subject: [PATCH 05/17] Fix use of strm parameter --- .../lib/youtube_plugin/kodion/items/xbmc/xbmc_items.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) 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 d83252b9a..35bac7395 100644 --- a/resources/lib/youtube_plugin/kodion/items/xbmc/xbmc_items.py +++ b/resources/lib/youtube_plugin/kodion/items/xbmc/xbmc_items.py @@ -205,6 +205,7 @@ def video_playback_item(context, video_item, show_fanart=None): 'path': uri, 'offscreen': True, } + props = {} else: kwargs = { 'label': video_item.get_title() or video_item.get_name(), @@ -212,9 +213,9 @@ def video_playback_item(context, video_item, show_fanart=None): 'path': uri, 'offscreen': True, } - props = { - 'isPlayable': str(video_item.playable).lower(), - } + props = { + 'isPlayable': str(video_item.playable).lower(), + } if (alternative_player and settings.alternative_player_web_urls() @@ -262,6 +263,7 @@ def video_playback_item(context, video_item, show_fanart=None): list_item.setMimeType(mime_type) if is_strm: + list_item.setProperties(props) return list_item if not context.get_param('resume'): From 4d1c665b4caa3d09dc6911e2113a87829ed0a8d1 Mon Sep 17 00:00:00 2001 From: MoojMidge <56883549+MoojMidge@users.noreply.github.com> Date: Tue, 19 Mar 2024 11:05:01 +1100 Subject: [PATCH 06/17] Make colours used for video/comment detail labels user configurable --- .../resource.language.en_au/strings.po | 12 +++++ .../resource.language.en_gb/strings.po | 12 +++++ .../resource.language.en_nz/strings.po | 12 +++++ .../resource.language.en_us/strings.po | 12 +++++ .../kodion/constants/const_settings.py | 1 + .../kodion/settings/abstract_settings.py | 4 ++ .../youtube_plugin/youtube/helper/utils.py | 14 ++---- resources/settings.xml | 48 +++++++++++++++++++ 8 files changed, 105 insertions(+), 10 deletions(-) diff --git a/resources/language/resource.language.en_au/strings.po b/resources/language/resource.language.en_au/strings.po index bd26e055d..608cebe5a 100644 --- a/resources/language/resource.language.en_au/strings.po +++ b/resources/language/resource.language.en_au/strings.po @@ -1472,3 +1472,15 @@ msgstr "" msgctxt "#30792" msgid "8K/60 fps, HDR, using AV1 | Modern device or PC with full capabilities " msgstr "" + +msgctxt "#30793" +msgid "Views count display colour" +msgstr "" + +msgctxt "#30794" +msgid "Likes count display colour" +msgstr "" + +msgctxt "#30795" +msgid "Comments count display colour" +msgstr "" diff --git a/resources/language/resource.language.en_gb/strings.po b/resources/language/resource.language.en_gb/strings.po index 9513e9d15..c6d5dac9c 100644 --- a/resources/language/resource.language.en_gb/strings.po +++ b/resources/language/resource.language.en_gb/strings.po @@ -1472,3 +1472,15 @@ msgstr "" msgctxt "#30792" msgid "8K/60 fps, HDR, using AV1 | Modern device or PC with full capabilities " msgstr "" + +msgctxt "#30793" +msgid "Views count display colour" +msgstr "" + +msgctxt "#30794" +msgid "Likes count display colour" +msgstr "" + +msgctxt "#30795" +msgid "Comments count display colour" +msgstr "" diff --git a/resources/language/resource.language.en_nz/strings.po b/resources/language/resource.language.en_nz/strings.po index 017ac8151..baf15fa46 100644 --- a/resources/language/resource.language.en_nz/strings.po +++ b/resources/language/resource.language.en_nz/strings.po @@ -1472,3 +1472,15 @@ msgstr "" msgctxt "#30792" msgid "8K/60 fps, HDR, using AV1 | Modern device or PC with full capabilities " msgstr "" + +msgctxt "#30793" +msgid "Views count display colour" +msgstr "" + +msgctxt "#30794" +msgid "Likes count display colour" +msgstr "" + +msgctxt "#30795" +msgid "Comments count display colour" +msgstr "" diff --git a/resources/language/resource.language.en_us/strings.po b/resources/language/resource.language.en_us/strings.po index ec44c55f8..2e63088d4 100644 --- a/resources/language/resource.language.en_us/strings.po +++ b/resources/language/resource.language.en_us/strings.po @@ -1473,3 +1473,15 @@ msgstr "" msgctxt "#30792" msgid "8K/60 fps, HDR, using AV1 | Modern device or PC with full capabilities " msgstr "" + +msgctxt "#30793" +msgid "Views count display color" +msgstr "" + +msgctxt "#30794" +msgid "Likes count display color" +msgstr "" + +msgctxt "#30795" +msgid "Comments count display color" +msgstr "" diff --git a/resources/lib/youtube_plugin/kodion/constants/const_settings.py b/resources/lib/youtube_plugin/kodion/constants/const_settings.py index 155bc9769..6ad3e0d3a 100644 --- a/resources/lib/youtube_plugin/kodion/constants/const_settings.py +++ b/resources/lib/youtube_plugin/kodion/constants/const_settings.py @@ -23,6 +23,7 @@ SUBTITLE_DOWNLOAD = 'kodion.subtitle.download' # (bool) SETUP_WIZARD = 'kodion.setup_wizard' # (bool) SETUP_WIZARD_RUNS = 'kodion.setup_wizard.forced_runs' # (int) +LABEL_COLOR = 'youtube.view.label.color' # (string) LANGUAGE = 'youtube.language' # (str) REGION = 'youtube.region' # (str) LOCATION = 'youtube.location' # (str) diff --git a/resources/lib/youtube_plugin/kodion/settings/abstract_settings.py b/resources/lib/youtube_plugin/kodion/settings/abstract_settings.py index 13f65d9ff..fe39cad1e 100644 --- a/resources/lib/youtube_plugin/kodion/settings/abstract_settings.py +++ b/resources/lib/youtube_plugin/kodion/settings/abstract_settings.py @@ -382,3 +382,7 @@ def get_history_playlist(self): def set_history_playlist(self, value): return self.set_string(settings.HISTORY_PLAYLIST, value) + + def get_label_color(self, label_part): + setting_name = '.'.join((settings.LABEL_COLOR, label_part)) + return self.get_string(setting_name, 'white') diff --git a/resources/lib/youtube_plugin/youtube/helper/utils.py b/resources/lib/youtube_plugin/youtube/helper/utils.py index 273cbe385..fdbf06100 100644 --- a/resources/lib/youtube_plugin/youtube/helper/utils.py +++ b/resources/lib/youtube_plugin/youtube/helper/utils.py @@ -29,13 +29,6 @@ ISHelper = None -__COLOR_MAP = { - 'commentCount': 'cyan', - 'favoriteCount': 'gold', - 'likeCount': 'lime', - 'viewCount': 'lightblue', -} - __RE_PLAYLIST_MATCH = re.compile( r'^(/channel/(?P[^/]+))/playlist/(?P[^/]+)/?$' ) @@ -65,6 +58,7 @@ def get_thumb_timestamp(minutes=15): def make_comment_item(context, snippet, uri, total_replies=0): + settings = context.get_settings() ui = context.get_ui() author = ui.bold(snippet['authorDisplayName']) @@ -76,7 +70,7 @@ def make_comment_item(context, snippet, uri, total_replies=0): like_count = snippet['likeCount'] if like_count: like_count = friendly_number(like_count) - color = __COLOR_MAP['likeCount'] + color = settings.get_label_color('likeCount') label_likes = ui.color(color, ui.bold(like_count)) plot_likes = ui.color(color, ui.bold(' '.join(( like_count, context.localize('video.comments.likes') @@ -86,7 +80,7 @@ def make_comment_item(context, snippet, uri, total_replies=0): if total_replies: total_replies = friendly_number(total_replies) - color = __COLOR_MAP['commentCount'] + color = settings.get_label_color('commentCount') label_replies = ui.color(color, ui.bold(total_replies)) plot_replies = ui.color(color, ui.bold(' '.join(( total_replies, context.localize('video.comments.replies') @@ -471,7 +465,7 @@ def update_video_infos(provider, context, video_id_dict, if not value: continue - color = __COLOR_MAP.get(stat, 'white') + color = settings.get_label_color(stat) label = context.localize(label) if value == 1: label = label.rstrip('s') diff --git a/resources/settings.xml b/resources/settings.xml index f82058bc1..6f5144152 100644 --- a/resources/settings.xml +++ b/resources/settings.xml @@ -704,6 +704,54 @@ true + + 0 + ffadd8e6 + + + String.StartsWith(System.BuildVersionShort,1) + + + + true + true + + + + + + + 0 + ff00ff00 + + + String.StartsWith(System.BuildVersionShort,1) + + + + true + true + + + + + + + 0 + ff00ffff + + + String.StartsWith(System.BuildVersionShort,1) + + + + true + true + + + + + 0 1 From 90b8e6500c4088fcab57ba085ed3e24c9126fad8 Mon Sep 17 00:00:00 2001 From: MoojMidge <56883549+MoojMidge@users.noreply.github.com> Date: Tue, 19 Mar 2024 11:05:53 +1100 Subject: [PATCH 07/17] Remove extra whitespace at end of translation string --- resources/language/resource.language.en_au/strings.po | 2 +- resources/language/resource.language.en_gb/strings.po | 2 +- resources/language/resource.language.en_nz/strings.po | 2 +- resources/language/resource.language.en_us/strings.po | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/resources/language/resource.language.en_au/strings.po b/resources/language/resource.language.en_au/strings.po index 608cebe5a..cccfa5102 100644 --- a/resources/language/resource.language.en_au/strings.po +++ b/resources/language/resource.language.en_au/strings.po @@ -1470,7 +1470,7 @@ msgid "4K/60 fps, HDR, using AV1 | Fire TV Cube Gen 3, Fire TV Stick 4K Max, Ver msgstr "" msgctxt "#30792" -msgid "8K/60 fps, HDR, using AV1 | Modern device or PC with full capabilities " +msgid "8K/60 fps, HDR, using AV1 | Modern device or PC with full capabilities" msgstr "" msgctxt "#30793" diff --git a/resources/language/resource.language.en_gb/strings.po b/resources/language/resource.language.en_gb/strings.po index c6d5dac9c..0c43f0fe2 100644 --- a/resources/language/resource.language.en_gb/strings.po +++ b/resources/language/resource.language.en_gb/strings.po @@ -1470,7 +1470,7 @@ msgid "4K/60 fps, HDR, using AV1 | Fire TV Cube Gen 3, Fire TV Stick 4K Max, Ver msgstr "" msgctxt "#30792" -msgid "8K/60 fps, HDR, using AV1 | Modern device or PC with full capabilities " +msgid "8K/60 fps, HDR, using AV1 | Modern device or PC with full capabilities" msgstr "" msgctxt "#30793" diff --git a/resources/language/resource.language.en_nz/strings.po b/resources/language/resource.language.en_nz/strings.po index baf15fa46..680169667 100644 --- a/resources/language/resource.language.en_nz/strings.po +++ b/resources/language/resource.language.en_nz/strings.po @@ -1470,7 +1470,7 @@ msgid "4K/60 fps, HDR, using AV1 | Fire TV Cube Gen 3, Fire TV Stick 4K Max, Ver msgstr "" msgctxt "#30792" -msgid "8K/60 fps, HDR, using AV1 | Modern device or PC with full capabilities " +msgid "8K/60 fps, HDR, using AV1 | Modern device or PC with full capabilities" msgstr "" msgctxt "#30793" diff --git a/resources/language/resource.language.en_us/strings.po b/resources/language/resource.language.en_us/strings.po index 2e63088d4..75105ebba 100644 --- a/resources/language/resource.language.en_us/strings.po +++ b/resources/language/resource.language.en_us/strings.po @@ -1471,7 +1471,7 @@ msgid "4K/60 fps, HDR, using AV1 | Fire TV Cube Gen 3, Fire TV Stick 4K Max, Ver msgstr "" msgctxt "#30792" -msgid "8K/60 fps, HDR, using AV1 | Modern device or PC with full capabilities " +msgid "8K/60 fps, HDR, using AV1 | Modern device or PC with full capabilities" msgstr "" msgctxt "#30793" From f5bf31bbbfd4c6ad2c6d227ff15ec45baa4f0e23 Mon Sep 17 00:00:00 2001 From: MoojMidge <56883549+MoojMidge@users.noreply.github.com> Date: Tue, 19 Mar 2024 11:07:08 +1100 Subject: [PATCH 08/17] Tidy up setting constants - No content change, only re-ordering to match general settings layout --- .../kodion/constants/const_settings.py | 82 ++++++++++--------- 1 file changed, 45 insertions(+), 37 deletions(-) diff --git a/resources/lib/youtube_plugin/kodion/constants/const_settings.py b/resources/lib/youtube_plugin/kodion/constants/const_settings.py index 6ad3e0d3a..e7f405e14 100644 --- a/resources/lib/youtube_plugin/kodion/constants/const_settings.py +++ b/resources/lib/youtube_plugin/kodion/constants/const_settings.py @@ -11,43 +11,61 @@ from __future__ import absolute_import, division, unicode_literals -THUMB_SIZE = 'kodion.thumbnail.size' # (int) -SHOW_FANART = 'kodion.fanart.show' # (bool) -SAFE_SEARCH = 'kodion.safe.search' # (int) -ITEMS_PER_PAGE = 'kodion.content.max_per_page' # (int) -SEARCH_SIZE = 'kodion.search.size' # (int) -CACHE_SIZE = 'kodion.cache.size' # (int) +SETUP_WIZARD = 'kodion.setup_wizard' # (bool) +SETUP_WIZARD_RUNS = 'kodion.setup_wizard.forced_runs' # (int) + +MPD_VIDEOS = 'kodion.mpd.videos' # (bool) +MPD_STREAM_SELECT = 'kodion.mpd.stream.select' # (int) +MPD_QUALITY_SELECTION = 'kodion.mpd.quality.selection' # (int) +MPD_STREAM_FEATURES = 'kodion.mpd.stream.features' # (list[string]) +VIDEO_QUALITY_ASK = 'kodion.video.quality.ask' # (bool) +VIDEO_QUALITY = 'kodion.video.quality' # (int) AUDIO_ONLY = 'kodion.audio_only' # (bool) -AGE_GATE = 'kodion.age.gate' # (bool) + SUBTITLE_SELECTION = 'kodion.subtitle.languages.num' # (int) SUBTITLE_DOWNLOAD = 'kodion.subtitle.download' # (bool) -SETUP_WIZARD = 'kodion.setup_wizard' # (bool) -SETUP_WIZARD_RUNS = 'kodion.setup_wizard.forced_runs' # (int) -LABEL_COLOR = 'youtube.view.label.color' # (string) -LANGUAGE = 'youtube.language' # (str) -REGION = 'youtube.region' # (str) -LOCATION = 'youtube.location' # (str) -LOCATION_RADIUS = 'youtube.location.radius' # (int) -PLAY_COUNT_MIN_PERCENT = 'kodion.play_count.percent' # (int) -USE_LOCAL_HISTORY = 'kodion.history.local' # (bool) -USE_REMOTE_HISTORY = 'kodion.history.remote' # (bool) + +ITEMS_PER_PAGE = 'kodion.content.max_per_page' # (int) HIDE_SHORT_VIDEOS = 'youtube.hide_shorts' # (bool) -DETAILED_DESCRIPTION = 'youtube.view.description.details' # (bool) -DETAILED_LABELS = 'youtube.view.label.details' # (bool) -SUPPORT_ALTERNATIVE_PLAYER = 'kodion.support.alternative_player' # (bool) -ALTERNATIVE_PLAYER_WEB_URLS = 'kodion.alternative_player.web.urls' # (bool) +SAFE_SEARCH = 'kodion.safe.search' # (int) +AGE_GATE = 'kodion.age.gate' # (bool) +API_CONFIG_PAGE = 'youtube.api.config.page' # (bool) +API_KEY = 'youtube.api.key' # (string) +API_ID = 'youtube.api.id' # (string) +API_SECRET = 'youtube.api.secret' # (string) ALLOW_DEV_KEYS = 'youtube.allow.dev.keys' # (bool) -VIDEO_QUALITY = 'kodion.video.quality' # (int) -VIDEO_QUALITY_ASK = 'kodion.video.quality.ask' # (bool) +WATCH_LATER_PLAYLIST = 'youtube.folder.watch_later.playlist' # (str) +HISTORY_PLAYLIST = 'youtube.folder.history.playlist' # (str) + +CLIENT_SELECTION = 'youtube.client.selection' # (int) +SUPPORT_ALTERNATIVE_PLAYER = 'kodion.support.alternative_player' # (bool) +ALTERNATIVE_PLAYER_WEB_URLS = 'kodion.alternative_player.web.urls' # (bool) + USE_ISA = 'kodion.video.quality.isa' # (bool) LIVE_STREAMS = 'kodion.live_stream.selection' # (int) -MPD_VIDEOS = 'kodion.mpd.videos' # (bool) -MPD_QUALITY_SELECTION = 'kodion.mpd.quality.selection' # (int) -MPD_STREAM_FEATURES = 'kodion.mpd.stream.features' # (list[string]) -MPD_STREAM_SELECT = 'kodion.mpd.stream.select' # (int) + +USE_LOCAL_HISTORY = 'kodion.history.local' # (bool) +USE_REMOTE_HISTORY = 'kodion.history.remote' # (bool) + +SEARCH_SIZE = 'kodion.search.size' # (int) +CACHE_SIZE = 'kodion.cache.size' # (int) + +DETAILED_DESCRIPTION = 'youtube.view.description.details' # (bool) +DETAILED_LABELS = 'youtube.view.label.details' # (bool) +LABEL_COLOR = 'youtube.view.label.color' # (string) + +THUMB_SIZE = 'kodion.thumbnail.size' # (int) +SHOW_FANART = 'kodion.fanart.show' # (bool) + +LANGUAGE = 'youtube.language' # (str) +REGION = 'youtube.region' # (str) +LOCATION = 'youtube.location' # (str) +LOCATION_RADIUS = 'youtube.location.radius' # (int) + +PLAY_COUNT_MIN_PERCENT = 'kodion.play_count.percent' # (int) VERIFY_SSL = 'requests.ssl.verify' # (bool) CONNECT_TIMEOUT = 'requests.timeout.connect' # (int) @@ -56,13 +74,3 @@ HTTPD_PORT = 'kodion.http.port' # (number) HTTPD_LISTEN = 'kodion.http.listen' # (string) HTTPD_WHITELIST = 'kodion.http.ip.whitelist' # (string) - -API_CONFIG_PAGE = 'youtube.api.config.page' # (bool) -API_KEY = 'youtube.api.key' # (string) -API_ID = 'youtube.api.id' # (string) -API_SECRET = 'youtube.api.secret' # (string) - -CLIENT_SELECTION = 'youtube.client.selection' # (int) - -WATCH_LATER_PLAYLIST = 'youtube.folder.watch_later.playlist' # (str) -HISTORY_PLAYLIST = 'youtube.folder.history.playlist' # (str) From f153b205de0e68269f9e4043fc1c59e040a8fffa Mon Sep 17 00:00:00 2001 From: MoojMidge <56883549+MoojMidge@users.noreply.github.com> Date: Wed, 20 Mar 2024 06:15:12 +1100 Subject: [PATCH 09/17] Only set cache size to 20 MB in setup wizard if not already set to higher value --- resources/lib/youtube_plugin/youtube/helper/yt_setup_wizard.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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 347adde71..2ca351a9a 100644 --- a/resources/lib/youtube_plugin/youtube/helper/yt_setup_wizard.py +++ b/resources/lib/youtube_plugin/youtube/helper/yt_setup_wizard.py @@ -324,7 +324,8 @@ def process_default_settings(_provider, context, step, steps): settings.live_stream_type(2) if not xbmcvfs.exists('special://profile/playercorefactory.xml'): settings.alternative_player_web_urls(False) - settings.cache_size(20) + if settings.cache_size() < 20: + settings.cache_size(20) if settings.use_isa() and not httpd_status(): settings.httpd_listen('0.0.0.0') return step From 1f9dbe1557adca4312ed08af2a51a01c9166a314 Mon Sep 17 00:00:00 2001 From: MoojMidge <56883549+MoojMidge@users.noreply.github.com> Date: Wed, 20 Mar 2024 06:19:17 +1100 Subject: [PATCH 10/17] Remove refresh_container parameter - Was duplicating functionality of refresh parameter --- .../lib/youtube_plugin/kodion/context/abstract_context.py | 1 - resources/lib/youtube_plugin/kodion/items/menu_items.py | 8 ++++---- resources/lib/youtube_plugin/youtube/helper/utils.py | 5 ++--- resources/lib/youtube_plugin/youtube/helper/yt_video.py | 4 ++-- 4 files changed, 8 insertions(+), 10 deletions(-) diff --git a/resources/lib/youtube_plugin/kodion/context/abstract_context.py b/resources/lib/youtube_plugin/kodion/context/abstract_context.py index 9e6ba6668..b1da24633 100644 --- a/resources/lib/youtube_plugin/kodion/context/abstract_context.py +++ b/resources/lib/youtube_plugin/kodion/context/abstract_context.py @@ -43,7 +43,6 @@ class AbstractContext(object): 'play', 'prompt_for_subtitles', 'refresh', - 'refresh_container' 'resume', 'screensaver', 'strm', diff --git a/resources/lib/youtube_plugin/kodion/items/menu_items.py b/resources/lib/youtube_plugin/kodion/items/menu_items.py index a6238b1fe..c118c6da3 100644 --- a/resources/lib/youtube_plugin/kodion/items/menu_items.py +++ b/resources/lib/youtube_plugin/kodion/items/menu_items.py @@ -13,7 +13,7 @@ from ..constants import paths -def more_for_video(context, video_id, logged_in=False, refresh_container=False): +def more_for_video(context, video_id, logged_in=False, refresh=False): return ( context.localize('video.more'), 'RunPlugin({0})'.format(context.create_uri( @@ -21,7 +21,7 @@ def more_for_video(context, video_id, logged_in=False, refresh_container=False): { 'video_id': video_id, 'logged_in': logged_in, - 'refresh_container': refresh_container, + 'refresh': refresh, }, )) ) @@ -242,14 +242,14 @@ def add_my_subscriptions_filter(context, channel_name): ) -def rate_video(context, video_id, refresh_container=False): +def rate_video(context, video_id, refresh=False): return ( context.localize('video.rate'), 'RunPlugin({0})'.format(context.create_uri( ('video', 'rate',), { 'video_id': video_id, - 'refresh_container': refresh_container, + 'refresh': refresh, }, )) ) diff --git a/resources/lib/youtube_plugin/youtube/helper/utils.py b/resources/lib/youtube_plugin/youtube/helper/utils.py index fdbf06100..d6a60b8de 100644 --- a/resources/lib/youtube_plugin/youtube/helper/utils.py +++ b/resources/lib/youtube_plugin/youtube/helper/utils.py @@ -674,14 +674,13 @@ def update_video_infos(provider, context, video_id_dict, ) # more... - refresh_container = path.startswith((paths.LIKED_VIDEOS, - paths.DISLIKED_VIDEOS)) + refresh = path.startswith((paths.LIKED_VIDEOS, paths.DISLIKED_VIDEOS)) context_menu.extend(( menu_items.more_for_video( context, video_id, logged_in=logged_in, - refresh_container=refresh_container, + refresh=refresh, ), menu_items.play_with_subtitles( context, video_id diff --git a/resources/lib/youtube_plugin/youtube/helper/yt_video.py b/resources/lib/youtube_plugin/youtube/helper/yt_video.py index 2085d11e3..9154a1f54 100644 --- a/resources/lib/youtube_plugin/youtube/helper/yt_video.py +++ b/resources/lib/youtube_plugin/youtube/helper/yt_video.py @@ -70,7 +70,7 @@ def _process_rate_video(provider, context, re_match): elif response.get('status_code') == 204: # this will be set if we are in the 'Liked Video' playlist - if context.get_param('refresh_container'): + if context.get_param('refresh'): context.get_ui().refresh_container() if result == 'none': @@ -104,7 +104,7 @@ def _process_more_for_video(context): menu_items.content_from_description(context, video_id), menu_items.rate_video(context, video_id, - params.get('refresh_container')), + params.get('refresh')), ] if params.get('logged_in') else [ menu_items.related_videos(context, video_id), menu_items.video_comments(context, video_id), From d5ed618bef70c80b08dffe7d2a1ee39081e62b69 Mon Sep 17 00:00:00 2001 From: MoojMidge <56883549+MoojMidge@users.noreply.github.com> Date: Wed, 20 Mar 2024 06:27:48 +1100 Subject: [PATCH 11/17] Add missing video_name parameter --- resources/lib/youtube_plugin/kodion/context/abstract_context.py | 1 + 1 file changed, 1 insertion(+) diff --git a/resources/lib/youtube_plugin/kodion/context/abstract_context.py b/resources/lib/youtube_plugin/kodion/context/abstract_context.py index b1da24633..cb57c4fde 100644 --- a/resources/lib/youtube_plugin/kodion/context/abstract_context.py +++ b/resources/lib/youtube_plugin/kodion/context/abstract_context.py @@ -88,6 +88,7 @@ class AbstractContext(object): 'uri', 'videoid', # deprecated 'video_id', + 'video_name', 'visitor', } From 801fa19718d5052f52c5a8c93b83429bb9ddbd03 Mon Sep 17 00:00:00 2001 From: MoojMidge <56883549+MoojMidge@users.noreply.github.com> Date: Wed, 20 Mar 2024 09:13:28 +1100 Subject: [PATCH 12/17] Reload playlist when deleting items --- .../kodion/context/abstract_context.py | 1 + .../lib/youtube_plugin/kodion/items/menu_items.py | 12 +++++++----- .../youtube_plugin/kodion/ui/xbmc/xbmc_context_ui.py | 9 +++++++++ .../lib/youtube_plugin/youtube/helper/yt_playlist.py | 10 ++++++---- 4 files changed, 23 insertions(+), 9 deletions(-) diff --git a/resources/lib/youtube_plugin/kodion/context/abstract_context.py b/resources/lib/youtube_plugin/kodion/context/abstract_context.py index cb57c4fde..4fb476040 100644 --- a/resources/lib/youtube_plugin/kodion/context/abstract_context.py +++ b/resources/lib/youtube_plugin/kodion/context/abstract_context.py @@ -83,6 +83,7 @@ class AbstractContext(object): 'playlist_name', 'q', 'rating', + 'reload_path', 'search_type', 'subscription_id', 'uri', diff --git a/resources/lib/youtube_plugin/kodion/items/menu_items.py b/resources/lib/youtube_plugin/kodion/items/menu_items.py index c118c6da3..a639353d7 100644 --- a/resources/lib/youtube_plugin/kodion/items/menu_items.py +++ b/resources/lib/youtube_plugin/kodion/items/menu_items.py @@ -129,11 +129,13 @@ def remove_video_from_playlist(context, playlist_id, video_id, video_name): context.localize('remove'), 'RunPlugin({0})'.format(context.create_uri( ('playlist', 'remove', 'video',), - { - 'playlist_id': playlist_id, - 'video_id': video_id, - 'video_name': video_name, - }, + dict( + context.get_params(), + playlist_id=playlist_id, + video_id=video_id, + video_name=video_name, + reload_path=context.get_path(), + ), )) ) diff --git a/resources/lib/youtube_plugin/kodion/ui/xbmc/xbmc_context_ui.py b/resources/lib/youtube_plugin/kodion/ui/xbmc/xbmc_context_ui.py index 5adb49e9f..fab41fb4f 100644 --- a/resources/lib/youtube_plugin/kodion/ui/xbmc/xbmc_context_ui.py +++ b/resources/lib/youtube_plugin/kodion/ui/xbmc/xbmc_context_ui.py @@ -133,6 +133,15 @@ def refresh_container(self): addon_id=ADDON_ID )) + def reload_container(self, path=None): + context = self._context + xbmc.executebuiltin('ReplaceWindow(Videos, {0})'.format( + context.create_uri( + path or context.get_path(), + dict(context.get_params(), refresh=True), + ) + )) + @staticmethod def set_property(property_id, value): property_id = '-'.join((ADDON_ID, property_id)) diff --git a/resources/lib/youtube_plugin/youtube/helper/yt_playlist.py b/resources/lib/youtube_plugin/youtube/helper/yt_playlist.py index 14a6c7bd2..11db64bbc 100644 --- a/resources/lib/youtube_plugin/youtube/helper/yt_playlist.py +++ b/resources/lib/youtube_plugin/youtube/helper/yt_playlist.py @@ -69,9 +69,10 @@ def _process_remove_video(provider, context): listitem_title = context.get_listitem_detail('Title', attr=True) keymap_action = False - playlist_id = context.get_param('playlist_id', '') - video_id = context.get_param('video_id', '') - video_name = context.get_param('video_name', '') + params = context.get_params() + playlist_id = params.pop('playlist_id', '') + video_id = params.pop('video_id', '') + video_name = params.pop('video_name', '') # keymap support if (not playlist_id and not video_id and listitem_playlist_id @@ -103,7 +104,8 @@ def _process_remove_video(provider, context): if not success: return False - context.get_ui().refresh_container() + path = params.pop('reload_path', None) + context.get_ui().reload_container(path) context.get_ui().show_notification( message=context.localize('playlist.removed_from'), From 2b805edd4e893c10e4d1560d67aaa0c8217b07c8 Mon Sep 17 00:00:00 2001 From: MoojMidge <56883549+MoojMidge@users.noreply.github.com> Date: Wed, 20 Mar 2024 09:15:05 +1100 Subject: [PATCH 13/17] Use XbmcContextUI.on_ok rather than xbmcgui.Dialog.ok directly --- .../lib/youtube_plugin/kodion/plugin/xbmc/xbmc_plugin.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/resources/lib/youtube_plugin/kodion/plugin/xbmc/xbmc_plugin.py b/resources/lib/youtube_plugin/kodion/plugin/xbmc/xbmc_plugin.py index 76da42618..a317e9523 100644 --- a/resources/lib/youtube_plugin/kodion/plugin/xbmc/xbmc_plugin.py +++ b/resources/lib/youtube_plugin/kodion/plugin/xbmc/xbmc_plugin.py @@ -13,7 +13,7 @@ from traceback import format_stack from ..abstract_plugin import AbstractPlugin -from ...compatibility import xbmcgui, xbmcplugin +from ...compatibility import xbmcplugin from ...exceptions import KodionException from ...items import ( AudioItem, @@ -66,7 +66,7 @@ def run(self, provider, context): context.log_error('XbmcRunner.run - {exc}:\n{details}'.format( exc=exc, details=''.join(format_stack()) )) - xbmcgui.Dialog().ok("Error in ContentProvider", exc.__str__()) + ui.on_ok("Error in ContentProvider", exc.__str__()) xbmcplugin.endOfDirectory(self.handle, succeeded=False) return False From 67fe61959085c72ee3d972eed0d866207db056b2 Mon Sep 17 00:00:00 2001 From: MoojMidge <56883549+MoojMidge@users.noreply.github.com> Date: Wed, 20 Mar 2024 09:17:14 +1100 Subject: [PATCH 14/17] Increase number of lines logged using the Profiler --- resources/lib/youtube_plugin/kodion/debug.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/lib/youtube_plugin/kodion/debug.py b/resources/lib/youtube_plugin/kodion/debug.py index f8e76500c..81002d9c8 100644 --- a/resources/lib/youtube_plugin/kodion/debug.py +++ b/resources/lib/youtube_plugin/kodion/debug.py @@ -205,7 +205,7 @@ def get_stats(self, flush=True, reuse=False): self._Stats( self._profiler, stream=output_stream - ).strip_dirs().sort_stats('cumulative', 'time').print_stats(20) + ).strip_dirs().sort_stats('cumulative', 'time').print_stats(50) # Occurs when no stats were able to be generated from profiler except TypeError: pass From a442315175dbfd7779e1d39423bb170cfb1064b7 Mon Sep 17 00:00:00 2001 From: MoojMidge <56883549+MoojMidge@users.noreply.github.com> Date: Wed, 20 Mar 2024 10:10:07 +1100 Subject: [PATCH 15/17] Version bump v7.0.4+beta.3 --- addon.xml | 2 +- changelog.txt | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/addon.xml b/addon.xml index c0926108e..f58d42983 100644 --- a/addon.xml +++ b/addon.xml @@ -1,5 +1,5 @@ - + diff --git a/changelog.txt b/changelog.txt index 6c506e8a9..11975fb4f 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,3 +1,15 @@ +## v7.0.4+beta.3 +### Fixed +- Fix issues with Profiler running without timer when debug logging was enabled +- Fix additional Python 2 unicode handling issues when accessing My Subscription #639 + + ### Changed + - Only set combined cache size to 20 MB in Setup Wizard if value is not already larger + - Cached playlist items will be forced to reload when deleting item from playlist rather than waiting 5 minutes + + ### New + - Make colours used for extra details in video listings customisable in Kodi 20+ + ## v7.0.4+beta.2 ### Fixed - Overhaul of http server settings to try and fix #633 From 35ca9bb4ba3933bf258fd2c3af9268d78fa8c944 Mon Sep 17 00:00:00 2001 From: MoojMidge <56883549+MoojMidge@users.noreply.github.com> Date: Thu, 21 Mar 2024 11:38:21 +1100 Subject: [PATCH 16/17] Version bump v7.0.4 - Unreleased v7.0.4+beta.3 becomes v7.0.4 --- addon.xml | 2 +- changelog.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/addon.xml b/addon.xml index f58d42983..7e724c820 100644 --- a/addon.xml +++ b/addon.xml @@ -1,5 +1,5 @@ - + diff --git a/changelog.txt b/changelog.txt index 11975fb4f..7a544fb63 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,4 +1,4 @@ -## v7.0.4+beta.3 +## v7.0.4 ### Fixed - Fix issues with Profiler running without timer when debug logging was enabled - Fix additional Python 2 unicode handling issues when accessing My Subscription #639 From 6806edd61188f4ee2c58e491950804c7df5d061f Mon Sep 17 00:00:00 2001 From: MoojMidge <56883549+MoojMidge@users.noreply.github.com> Date: Fri, 22 Mar 2024 20:39:17 +1100 Subject: [PATCH 17/17] Update workflows to use target repository identifier for all releases --- .github/workflows/make-release.yml | 7 ++++--- .github/workflows/submit-release.yml | 3 ++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/.github/workflows/make-release.yml b/.github/workflows/make-release.yml index c90ada102..4b21880e5 100644 --- a/.github/workflows/make-release.yml +++ b/.github/workflows/make-release.yml @@ -59,8 +59,9 @@ jobs: version=$(xmlstarlet sel -t -v 'string(/addon/@version)' addon.xml) xmlstarlet ed -L -P \ -s '/addon/extension[@point="xbmc.addon.metadata"]' -t elem -n news -v "${news:0:1500}" \ + -u '/addon/@version' -v "${version}+nexus.1" \ addon.xml - filename=${{ github.event.repository.name }}-${version}.zip + filename=${{ github.event.repository.name }}-${version}.nexus.1.zip cd .. zip -r $filename ${{ github.event.repository.name }} mv .git ${{ github.event.repository.name }} @@ -84,9 +85,9 @@ jobs: version=$(xmlstarlet sel -t -v 'string(/addon/@version)' addon.xml) xmlstarlet ed -L -P \ -s '/addon/extension[@point="xbmc.addon.metadata"]' -t elem -n news -v "${news:0:1500}" \ - -u '/addon/@version' -v "${version}+unofficial.1" \ + -u '/addon/@version' -v "${version}+nexus.unofficial.1" \ addon.xml - filename=${{ github.event.repository.name }}-${version}.unofficial.1.zip + filename=${{ github.event.repository.name }}-${version}.nexus.unofficial.1.zip cd .. zip -r $filename ${{ github.event.repository.name }} mv .git ${{ github.event.repository.name }} diff --git a/.github/workflows/submit-release.yml b/.github/workflows/submit-release.yml index b884fe769..4fc105bfb 100644 --- a/.github/workflows/submit-release.yml +++ b/.github/workflows/submit-release.yml @@ -54,9 +54,10 @@ jobs: news=$(awk '/^## /{rel_num++} {if(rel_num==2){exit} if(rel_num==1){print}}' changelog.txt | sed -E 's/ ?#[[:digit:]]+[., ]?//;s/\r//') xmlstarlet ed -L -P \ -s '/addon/extension[@point="xbmc.addon.metadata"]' -t elem -n news -v "${news:0:1500}" \ + -u '/addon/@version' -v "${version}+nexus.1" \ addon.xml git add . - git commit -m "Update news" + git commit -m "Update news and repository identifier" working-directory: ${{ github.event.repository.name }} - name: Submit to Official Repository (Nexus)