xbianonpi/xbian-package-upstart-xbmc-bridge — pull request #5 by anaconda (2014-06-17 14:15:37+00:00)
Title: Make upstart-xbmc-bridge.py an add-on.

**Needs xbianonpi/xbian-patches#9 merged.**

Why:
* does _not_ depend on the JSON-RPC TCP server, fixing user errors like http://forum.xbian.org/thread-2330-post-23022.html#pid23022;
* it can't be easily disabled by mistake (it requires the user to delete/move its directory to be disabled).

Differences:
* the add-on doesn't save the exit code in /run/lock/xbmc.quit as it's already in logs and/or dmesg.

Fixes:
* the old script emitted a "library ACTION=_START_ MODE=SCAN" event when library scan _finished_, so a stop event was never emitted.

To test you need to:
* build XBMC with xbianonpi/xbian-patches#9;
* `echo manual | sudo tee /etc/init/xbian-xbmc-bridge.override`;
* optionally place the following Upstart somewhere in /etc/init so you can have a log:
```
start on library or player or screensaver or xbmcplevel

task

script
echo "$(date) event:$UPSTART_EVENTS action:$ACTION type:$TYPE mode:$MODE level:$LEVEL prevlevel:$PREVLEVEL" >> /home/xbian/test-ub
end script
```
* stop and start XBMC;
* do a library scan, clean, play something, ...