2017-09-15, 00:07
Hello all,
I am just starting to play with the Python libraries and I am a little bit lost.
Basically what I am trying to achieve is to press one button on my remote and go directly to the most recent video listed by a plugin.
I do not want to create an addon just for this but just a simple script. I added the following line in ~/.kodi/userdata/keymaps/gen.xml and that part works, the script is executed when I push the button:
My script test.py:
Now I am looking to select the first video in the list (the most recent one) but I cannot find how to do. Does anybody know? Or does anybody know if there is a better way to do?
I am just starting to play with the Python libraries and I am a little bit lost.
Basically what I am trying to achieve is to press one button on my remote and go directly to the most recent video listed by a plugin.
I do not want to create an addon just for this but just a simple script. I added the following line in ~/.kodi/userdata/keymaps/gen.xml and that part works, the script is executed when I push the button:
Code:
<key id="251">RunScript(/home/osmc/.kodi/userdata/scripts/test.py)</key>
My script test.py:
Code:
#! /usr/bin/env python
import xbmc
xbmc.executebuiltin('ActivateWindow(10025,"plugin://plugin.video.belgium/?action=show_videos&channel_id=rtbf&id=9&url=https%3a%2f%2fwww.rtbf.be%2fauvio%2femissions%2fdetail_le-12-minutes%3fid%3d9")') # go to video list
xbmc.executebuiltin('Container.Refresh') # refresh the list to get the last episodes
xbmc.executebuiltin('Container.SetSortMethod(2)') # sort by date
??? # select the first video
??? # play it
Now I am looking to select the first video in the list (the most recent one) but I cannot find how to do. Does anybody know? Or does anybody know if there is a better way to do?