Oh yes you can!
Thx Ned for being the only one to take time out and try to help
I can't believe I managed to find this out, after much, much digging around in all 4 corners of the internet, I managed to cobble together bits and bobs.
This for me turned out to be one of those itches that wouldn't be left alone and needed to be scratched. It turns out that other people were querying to do something along the same lines and were struggling.
I almost ditched xbmc as someone had a solution that worked in vlc.
In the end I found some stuff on xbmc python how-to - most of it went over my head, but gave me some pointers.
I will post what I've done here, one noob helping other noobs and helping the xbmc community at large.
I've used keyboard mapping, so when I press 'd' at the home screen it runs a python script which plays scenes/sections from several movies.
(The idea is that anytime somebody wants a demo of surround sound, they just press 'd' and instantly a demo plays of various scenes from various movies!)
(this is for windows)
For the key mapping, create a keyboard.xml file in:
C:\Users\<your user>\AppData\Roaming\XBMC\userdata\keymaps
Add the following key mapping for the home screen which assigns the key 'd' to run the script playdemo.py:
I also have key 'f' to activate the favourites window from the home screen.
Code:
<keymap>
<Home>
<keyboard>
<d>RunScript(C:\Users\<your user>\AppData\Roaming\XBMC\userdata\myscripts\playdemo.py)</d>
<f>ActivateWindow(Favourites)</f>
</keyboard>
</Home>
</keymap>
In the userdata directory I have created a myscripts folder to keep any python scripts.
Create a playdemo.py file in notepad and enter the following:
Code:
# variables containing movies we want to demo - note the double \\
movie1 = 'D:\\Media\\Movies\\movie1.mkv'
movie2 = 'D:\\Media\\Movies\\movie2.mkv'
movie3 = 'D:\\Media\\Movies\\movie3.mkv'
# tell xbmc to play our file we specified in the above variable
xbmc.Player().play(movie1)
xbmc.Player().seekTime(120) # time is in seconds, i.e. 2 mins
xbmc.executebuiltin('XBMC.Notification(Information:, Movie 1 demo-scene 1, 3)') # display notification of scene
xbmc.sleep(10000) # goto sleep for 10 seconds - this is in milliseconds, or however long you want to play the scene
# play next scene from movie
xbmc.Player().seekTime(1800) # time is in seconds, i.e. 30 mins
xbmc.executebuiltin('XBMC.Notification(Information:, Movie 1 demo-scene 2, 3)') # display notification of scene
xbmc.sleep(10000) # goto sleep for 10 seconds - this is in milliseconds, or however long you want to play the scene, then play next scene
# movie 2
xbmc.Player().play(movie2)
xbmc.Player().seekTime(120) # time is in seconds, i.e. 2 mins
xbmc.executebuiltin('XBMC.Notification(Information:, Movie 2 demo-scene 1, 3)') # display notification of scene
xbmc.sleep(10000) # goto sleep for 10 seconds - this is in milliseconds, or however long you want to play the scene
# play next scene from movie
xbmc.Player().seekTime(1800) # time is in seconds, i.e. 30 mins
xbmc.executebuiltin('XBMC.Notification(Information:, Movie 2 demo-scene 2, 3)') # display notification of scene
xbmc.sleep(10000) # goto sleep for 10 seconds - this is in milliseconds, or however long you want to play the scene, then play next scene
xbmc.executebuiltin('XBMC.Notification(Information:, End Of Demo, )')
xbmc.Player().stop()
Its pretty straightforward, but only when you know what to do!
The python api docs can be quite cryptic for the noob - doesn't really give much info on the arguments to the methods.
Hope this helps others.
If there is a better way of doing the above please let me know as this is my very first attempt and I'm quite new to python.
The only problem is that when it switches between movies (and not between scenes of the same movie), you see the home screen momentarily before the next movie begins, which reduces the experience somewhat. Is there a way to prevent this?