Help with really simple Ambx script
#1
I followed this great thread http://forum.xbmc.org/showthread.php?p=540108
and managed to get xbmc live working with ambx .

The only problem is that I need to go into terminal and type these commands

sudo boblightd
export DISPLAY=:0.0
boblight-X11


I know it should be really easy writing a script so that I can execute it within xbmc but I just cant figure out how to do it. Tried all day !!

I know im an idiot but any help would be great.
Reply
#2
You can start boblightd in /etc/rc.local, I don't know where you can start boblight-X11 on xbmc live.
Reply
#3
create a simple script:

bob-start.sh
Code:
#!/bin/sh
/usr/bin/boblight-X11 -f

download and install the laucher plugin:
http://forum.xbmc.org/showthread.php?tid=35739

create a launcher for your script and you're done.
you can now execute the script using the launcher plugin.


to start boblight with a single press of a button, map this command to a key on your remote:
RunPlugin(plugin://programs/Launcher/?bob-start)
Do not PM or e-mail Team-Kodi members directly asking for support.
Always read the Forum rules, Kodi online-manual, FAQ, Help and Search the forum before posting.
Reply
#4
Thats a great help ronie Big Grin I will give it a go this weekend. And thankyou bobo for making it possible (it works far better than I expected )
Reply
#5
Thanks for the help ronie, I now have ambx as a shortcut on favourites (via the launcher) and as a function on my remote.

This is the shell script I used to get it to work:

bob-start.sh
Code:
#!/bin/sh
echo xbmcpassword | sudo -S boblightd
export DISPLAY=:0.0
boblight-X11


(adding password into script is not a problem for me, as my pc is only a HTPC)
Reply
#6
Is it possible to get python to execute shell commands though, because then we could create a gui with like

Speed: 10,20,30,40,50,60,70,80,90,100
Interval: 0.1,0.2,0.3,0.4,0.5
Brightness: 1,2,3,4,5,6,7,8,9,10
Saturation: 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,29,20

then when you change a value it does:
killall boblight-X11
boblight-X11 -s 5 -t 0.1 -a 20 -v 3

depending on what values were selected, could also have it save and load the settings and an enable on startup or something. I've not done any python coding before, but i'd have a go at it if it was possible, any ideas?
Reply
#7
From what I have read, it should be a fairly straight forward process, although like you I have never programmed in python before (actually before I got my HTPC I hadn't programmed since my computing degree 10 years ago)

The most elegant solution would be simply to pass the commands directly to the shell script, but in practice I dont know how easy that would be.

A simpler solution might be to get the python script in the gui to write the variables into a text file (which should be fairly simple), Alter the shell script to read the variables in the text file, and have a separate python script in the gui which then starts/ stops the script

Start shell script
Code:
import os
os.system( executute bash script)

Thats probably how I would approach it, but I am not the best person to advise.
Reply
#8
hmm, something like the following might work then?:

os.system('killall boblight-X11')
os.system('boblight-X11 -s 5 -t 0.1 -a 20 -v 3')

Will have a try tonight

*edit*
Or even
Code:
import xbmc, xbmcgui, os, time

varS = 5
varT = 0.1
varA = 20
varV = 3
class amBX(xbmcgui.Window):
    def __init__(self):
        self.buttonSatUp = xbmcgui.ControlButton(350, 400, 80, 30, "Increase Saturation")
        self.addControl(self.buttonSatUp)
        self.buttonSatDown = xbmcgui.ControlButton(350, 600, 80, 30, "Decrease Saturation")
        self.addControl(self.buttonSatDown)
        self.setFocus(self.buttonSatUp)        
    def onControl(self, control):
        if control == self.buttonSatUp:
            varS = varS + 1
        if control == self.buttonSatDown:
            varS = varS - 1
        os.system('killall boblight-X11')
        time.sleep(2)
        os.system('boblight-X11 -s '+varS+' -t '+varT+' -a '+varA+' -v '+varV)
Reply
#9
Kode, you might want to check with bob.. there is a branch of XBMC that has built in boblight functionality but I'm not entirely sure when (or if) this is due for release..
The adjustments you are after may already be included in that ?

Also, you might want to put a pause between those two commands since I use something similar to stop and reload boblight but found I had to wait a second or two for boblight to close before trying to reload it.
Reply
#10
Thanks for the advice Swifty.

I did see somewhere that there was a branch with boblight built in, but i'd already installed combustd and boblight by then, so not sure what, if any advantages that would give me, unless it allows you to change parameters through the gui (which is what i'm guessing you are suggesting it might?)
Reply

Logout Mark Read Team Forum Stats Members Help
Help with really simple Ambx script0