Skip to content

Commit

Permalink
Use XbmcContext.create_uri rather than manually creating plugin commands
Browse files Browse the repository at this point in the history
  • Loading branch information
MoojMidge committed Dec 13, 2024
1 parent ffada49 commit 659e868
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ def create_uri(self,
if run:
return ''.join(('RunPlugin(', uri, ')'))
if play:
return ''.join(('PlayMedia(', uri, ')'))
return ''.join(('PlayMedia(', uri, ',playlist_type_hint=1)'))
if replace:
return ''.join(('ReplaceWindow(Videos, ', uri, ')'))
return uri
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,13 @@ def uri_action(context, uri):

elif context.is_plugin_path(uri, PATHS.PLAY):
context.log_debug('Redirecting for playback: |{0}|'.format(uri))
action = 'PlayMedia({0}, playlist_type_hint=1)'.format(uri)
uri = urlsplit(uri)
action = context.create_uri(
(uri.path.rstrip('/'),),
uri.query,
parse_params=True,
play=True,
)
result = True

elif uri.startswith('RunPlugin('):
Expand Down
9 changes: 7 additions & 2 deletions resources/lib/youtube_plugin/youtube/helper/yt_play.py
Original file line number Diff line number Diff line change
Expand Up @@ -323,8 +323,13 @@ def process(provider, context, **_kwargs):
return UriItem('command://Action(Play)')

if context.get_handle() == -1:
return UriItem('command://PlayMedia({0}, playlist_type_hint=1)'
.format(context.create_uri((PATHS.PLAY,), params)))
return UriItem('command://{0}'.format(
context.create_uri(
(PATHS.PLAY,),
params,
play=True,
)
))

ui.set_property(BUSY_FLAG)
playlist_player = context.get_playlist_player()
Expand Down

0 comments on commit 659e868

Please sign in to comment.