2011-12-04, 09:29
How can a script or addon be started automatically when xbmc starts? A use case would be to start the add-on "Wake_On_Lan" every time xbmc is started.
import xbmc
xbmc.executebuiltin("WakeOnLan(FF:FF:FF:FF:FF:FF)")
<favourite name="YouTube" thumb="C:\Users\renniej\AppData\Roaming\XBMC\addons\plugin.video.youtube\icon.png">ActivateWindow(10024,"plugin://plugin.video.youtube/")</favourite>
import xbmc
xbmc.executebuiltin("ActivateWindow(10024,\"plugin://plugin.video.youtube\")")
xbmc_atv2 Wrote:Is there a similar Perl script that is called upon when xbmc quits?
jhsrennie Wrote:To have your autoexec.py do a wakeonlan, which is an emminently reasonable use of autoexec.py, create the following autoexec.py in your userdata folder:
Code:import xbmc
xbmc.executebuiltin("WakeOnLan(FF:FF:FF:FF:FF:FF)")
(2011-12-06, 10:25)jhsrennie Wrote: autoexec.py is still supported in Eden. Services are a special type of add-on and not generally relevant to your question.
To have your autoexec.py do a wakeonlan, which is an emminently reasonable use of autoexec.py, create the following autoexec.py in your userdata folder:
Code:import xbmc
xbmc.executebuiltin("WakeOnLan(FF:FF:FF:FF:FF:FF)")
Starting an add-on is slightly, but only slightly, harder because you need to work out what command is needed. To do this add the add-on to your favourites and open favourites.xml in a text editor. For example if I do this with the YouTube add-on, my favourites.xml contains:
Code:<favourite name="YouTube" thumb="C:\Users\renniej\AppData\Roaming\XBMC\addons\plugin.video.youtube\icon.png">ActivateWindow(10024,"plugin://plugin.video.youtube/")</favourite>
so the script you need would be:
Code:import xbmc
xbmc.executebuiltin("ActivateWindow(10024,\"plugin://plugin.video.youtube\")")
JR