Forget autoexec.py: the right way to automatically starts addons

  Thread Rating:
  • 2 Votes - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Post Reply
blinkseb Offline
Team-XBMC Developer
Posts: 599
Joined: Jan 2010
Reputation: 3
Location: Lyon, France
Post: #1
In Eden, the autoexec.py file won't be needed anymore, thanks to the new extension point 'xbmc.service'.

A service is an addon started with xbmc. You'll find more informations about these on the wiki, http://wiki.xbmc.org/index.php?title=HOW...g_services

AndroIRC - Best IRC client for Android!
find quote
daledude Offline
Member
Posts: 67
Joined: Oct 2009
Reputation: 0
Post: #2
This is cool. Will an addon developer be able to add a service programatically? Having an addon entry is nice and all, but will I be able to allow control of it being enabled/disabled through my addons settings?
find quote
spiff Offline
Retired Developer
Posts: 12,386
Joined: Nov 2003
Post: #3
of course, it's just like any other add-on. disable it and it won't start...
find quote
V-Turn Offline
Senior Member
Posts: 102
Joined: Oct 2004
Reputation: 6
Post: #4
This says that the autoexec.py will be obsolete : does anybody know if this means it won't be used at all anymore? Probably many people are using it right now (myself at least), so it would be difficult to require every hack to be converted to addons. (Just my 0.02€Wink

V.
(This post was last modified: 2011-03-01 01:05 by V-Turn.)
find quote
solexalex Offline
Skilled Python Coder
Posts: 707
Joined: Jul 2004
Reputation: 6
Post: #5
it is a good idea, and keeping the autoexec.py seems to me a good idea too. Too many times when a new XBMC version is released, backwrd compatilbility is not made. I think it is sad and it adds the feeling that addons are not reliable...

Anyway keep going the good job !

Maybe a kind of feature request... It has been a while we have autoexec.py to run scripts at XBMC startup, what about a special script (or extension point) to do some job at XBMC "off time" (when XBMC close). It can be helpfull to stop home made python servers properly, or send messages to listening clients, or even cleanup some temporary files that an addon may have write anywhere...
find quote
blinkseb Offline
Team-XBMC Developer
Posts: 599
Joined: Jan 2010
Reputation: 3
Location: Lyon, France
Post: #6
solexalex Wrote:it is a good idea, and keeping the autoexec.py seems to me a good idea too. Too many times when a new XBMC version is released, backwrd compatilbility is not made. I think it is sad and it adds the feeling that addons are not reliable...

Anyway keep going the good job !

Maybe a kind of feature request... It has been a while we have autoexec.py to run scripts at XBMC startup, what about a special script (or extension point) to do some job at XBMC "off time" (when XBMC close). It can be helpfull to stop home made python servers properly, or send messages to listening clients, or even cleanup some temporary files that an addon may have write anywhere...

xbmc.abortRequested is set to true when XBMC is closed. Moreover, you can already listen for a json announcement telling you xbmc is closing.

AndroIRC - Best IRC client for Android!
find quote
solexalex Offline
Skilled Python Coder
Posts: 707
Joined: Jul 2004
Reputation: 6
Post: #7
oh ! OK for xbmc.abortRequested ! I didn't noticed !
Thanks (and sorry for being a little "off topic")
find quote
vikjon0 Offline
---
Posts: 2,500
Joined: Apr 2009
Reputation: 8
Location: Sweden
Post: #8
This is not available in Dharma? I am only asking because the autoexec.py wiki page have been removed already....
find quote
lophie Offline
Junior Member
Posts: 12
Joined: Feb 2011
Reputation: 0
Post: #9
Yes is it available in dharma I'm trying to implement this yet no clue how Sad
find quote
blinkseb Offline
Team-XBMC Developer
Posts: 599
Joined: Jan 2010
Reputation: 3
Location: Lyon, France
Post: #10
No, it's not available on Dharma, it wasn't backported

AndroIRC - Best IRC client for Android!
find quote
lophie Offline
Junior Member
Posts: 12
Joined: Feb 2011
Reputation: 0
Post: #11
blinkseb Wrote:No, it's not available on Dharma, it wasn't backported

so if we downloaded the latest how would we implements this?
find quote
V-Turn Offline
Senior Member
Posts: 102
Joined: Oct 2004
Reputation: 6
Post: #12
lophie Wrote:so if we downloaded the latest how would we implements this?

Here is what I have (XBMC 10.0 "Dharma") on Ubuntu: /home/user/.xbmc/userdata/autoexec.py
Code:
## auto execute scripts when xbmc starts
## note:- use only one script at a time which asks for user input!

import os, xbmc

# create playlists from iTunes playlist file
print "running autoexec.py"
xbmc.executescript('special://home/scripts/myscript.py')
print "finished autoexec.py"

and myscript.py is located in /home/user/.xbmc/scripts

Hope that helps.

V.
find quote
Joerg.Liebner Offline
Junior Member
Posts: 4
Joined: Feb 2011
Reputation: 0
Post: #13
Do i understand this right? autoexec.py is gone, service has not yet come, so there is no mechanism for autostart at the moment?
find quote
spiff Offline
Retired Developer
Posts: 12,386
Joined: Nov 2003
Post: #14
you understand exactly everything wrong Smile

services are in master, autoexec.py is gone in master, autoexec.py still works in dharma.
find quote
cbull Offline
Junior Member
Posts: 1
Joined: Apr 2011
Reputation: 0
Post: #15
The Wiki page is very misleading, as it suggests that xbmc.service is available in Dharma.

http://wiki.xbmc.org/index.php?title=Add...elopement)
find quote
Post Reply