def play_video(path):
"""
Play a video by the provided path.
:param path: str
"""
# if the previous two if statements dont hit then the path is a
# video path so modify the string and play it with the youtube plugin
###############
# the path to let videos be played by the youtube plugin
youtubePath='plugin://plugin.video.youtube/?action=play_video&videoid='
# remove the full webaddress to make youtube plugin work correctly
path=path.replace('https://youtube.com/watch?v=','')
# also check for partial webaddresses we only need the video id
path=path.replace('watch?v=','')
# add youtube path to path to make videos play with the kodi youtube plugin
path=youtubePath+path
# Create a playable item with a path to play.
play_item = xbmcgui.ListItem(path=path)
# Pass the item to the Kodi player.
xbmcplugin.setResolvedUrl(_handle, True, listitem=play_item)
评论列表
文章目录