Skip to content

Commit

Permalink
Fix youtube addon call for trailer playback
Browse files Browse the repository at this point in the history
youtube addon maintainer says RunPlugin is an invalid way to call the addon.

So changed the call to use PlayMedia

More info on anxdpanic/plugin.video.youtube#937
  • Loading branch information
hagaygo authored Oct 23, 2024
1 parent cf62e5f commit 586e227
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 None
if handle:
xbmcplugin.endOfDirectory(int(sys.argv[1]), 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 586e227

Please sign in to comment.