Start Addon with XBMC (optional) and also manually
#1
Question 
hi there!

i'm enhancing my Wake-On-LAN Addon for Eden and i'd like to provide 2 options to use it:

1. autostart it with XBMC
2. launch it manually in the programs-section

i already got this to work via this code in the addon.xml:

Code:
<extension point="xbmc.python.script"
             library="default.py" />
  <extension point="xbmc.service"
             library="default.py" />

the only problem i still have, is that the option to autostart the script with XBMC should be optional via an addon-setting. to achieve this, imho i would need the possibility to distinguish, if the script was launched during startup, or manually. i could then build the script like this:

Code:
autostartSetting = settings.getSetting("autostart")
isLaunchedAsAutostart = ......

if (isLaunchedAsAutostart == True):
  if (autostartSetting == True):
    doTheWaktingUp...
else:
  doTheWaktingUp...

does anybody have an idea, how i could find out the "isLaunchedAsAutostart"? or maybe there is a different, better solution to achieve what i would like to?

many thanks in advance!
Reply
#2
Code:
autostartSetting = settings.getSetting("autostart")
if (autostartSetting == "true"):
    doTheWaktingUp...
else:
  doTheWaktingUp...

this should work. Your problem is getSetting return string "true" not True
Reply
#3
queeup Wrote:
Code:
autostartSetting = settings.getSetting("autostart")
if (autostartSetting == "true"):
    doTheWaktingUp...
else:
  doTheWaktingUp...

this should work. Your problem is getSetting return string "true" not True

ah, thanks for pointing me towards that!

however, this is not the problem, that i was facing. the problem is, that i want my addon to behave like that:

launch the script on xbmc-start ONLY if setting autostart = true,
and lanuch the script everytime, when invoked manually.

but i already found a solution. i changed the addon.xml to this:
Code:
<extension point="xbmc.python.script"
             library="default.py" />
  <extension point="xbmc.service"
             library="autostart.py" />
that way, different scripts are launched on autostart and on manual start, and so i can control the behaviour.

silly me, i didn't think of that before. Rolleyes
Reply

Logout Mark Read Team Forum Stats Members Help
Start Addon with XBMC (optional) and also manually0