Skip to content

Commit

Permalink
Fix plugin category label not being applied if content type not set
Browse files Browse the repository at this point in the history
  • Loading branch information
MoojMidge committed Nov 12, 2024
1 parent 739d996 commit 8a8247a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
21 changes: 14 additions & 7 deletions resources/lib/youtube_plugin/kodion/context/xbmc/xbmc_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -548,20 +548,26 @@ def set_content(self, content_type, sub_type=None, category_label=None):
))

def apply_content(self):
# ui local variable used for ui.get_view_manager() in unofficial version
ui = self.get_ui()

content_type = ui.pop_property(CONTENT_TYPE)
if not content_type:
return
if content_type:
content_type, sub_type, category_label = json.loads(content_type)
self.log_debug('Applying content-type: |{type}| for |{path}|'.format(
type=(sub_type or content_type), path=self.get_path()
))
xbmcplugin.setContent(self._plugin_handle, content_type)
else:
content_type = None
sub_type = None
category_label = None

content_type, sub_type, category_label = json.loads(content_type)
self.log_debug('Applying content-type: |{type}| for |{path}|'.format(
type=(sub_type or content_type), path=self.get_path()
))
xbmcplugin.setContent(self._plugin_handle, content_type)
if category_label is None:
category_label = self.get_param('category_label')
if category_label:
xbmcplugin.setPluginCategory(self._plugin_handle, category_label)

detailed_labels = self.get_settings().show_detailed_labels()
if sub_type == 'history':
self.add_sort_method(
Expand All @@ -583,6 +589,7 @@ def apply_content(self):
(SORT.UNSORTED,),
(SORT.LABEL,),
)

if content_type == CONTENT.VIDEO_CONTENT:
self.add_sort_method(
(SORT.CHANNEL, '[%A - ]%T \u2022 %P', '%D | %J'),
Expand Down
1 change: 1 addition & 0 deletions resources/lib/youtube_plugin/youtube/provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -1214,6 +1214,7 @@ def on_root(provider, context, re_match):
# _.get_my_playlists()

# context.set_content(CONTENT.LIST_CONTENT)
context.set_param('category_label', localize('youtube'))

result = []

Expand Down

0 comments on commit 8a8247a

Please sign in to comment.