2023-09-30, 23:50
(2023-09-30, 23:36)banggun Wrote: I've been searching but couldn't find much documentation on this is there any way to play a first video returned from a search result?
this will play the first search result from the imdb trailers addon, a little rework and you can apply it to your situation
python:infotag=sys.listitem.getVideoInfoTag()
title=sys.listitem.getLabel()
year=str(infotag.getYear())
xbmcgui.Dialog().notification("Trailers", "Finding trailers for {} {} ...".format(title,year))
playpath="plugin://plugin.video.imdb.trailers/?action=search_word&keyword={} {}".format(title,year)
payload = {'jsonrpc': '2.0', 'method': "Files.GetDirectory", 'params': {"properties": ['title'],"directory": playpath, "media": "video"}, 'id': 1}
info = xbmc.executeJSONRPC(json.dumps(payload))
info = json.loads(info)
info = info["result"]
if info['files'][0]:
xbmc.executebuiltin("PlayMedia({})".format(info['files'][0]['file']))
of course, if you're not ready to do some coding then you're pretty well stuck with whatever the developer has provided