Skip to content

Commit

Permalink
Merge pull request #351 from hagaygo/fix-youtube-addon-call
Browse files Browse the repository at this point in the history
Fix youtube addon call for trailer playback
  • Loading branch information
mcarlton00 authored Oct 25, 2024
2 parents cf62e5f + de74b0a commit 29151d8
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions resources/lib/functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -945,7 +945,10 @@ def play_action(params):

def play_item_trailer(item_id):
log.debug("== ENTER: playTrailer ==")

handle = int(sys.argv[1]) if sys.argv and len(sys.argv) > 1 else -1
if handle != -1:
xbmcplugin.endOfDirectory(handle, succeeded=False, updateListing=False, cacheToDisc=False)

url = "/Users/{}/Items/{}/LocalTrailers?format=json".format(
user_details.get('user_id'), item_id
)
Expand Down Expand Up @@ -1021,7 +1024,7 @@ def play_item_trailer(item_id):
elif trailer.get("type") == "remote":
youtube_id = trailer.get("url").rsplit('=', 1)[1]
url_root = "plugin.video.youtube/play/?video_id="
play_url = "RunPlugin(plugin://{}{})".format(url_root, youtube_id)
play_url = "PlayMedia(plugin://{}{})".format(url_root, youtube_id)
log.debug("youtube_plugin: {0}".format(play_url))

xbmc.executebuiltin(play_url)

0 comments on commit 29151d8

Please sign in to comment.