[RELEASE] Official XBMC boblight Addon
(2013-12-25, 13:41)hannemann Wrote:
(2013-09-19, 16:11)TeKo Wrote: You can create a 2nd boblight.conf for movies with hardcoded blackborders.

But that would man that you have to restart boblight everytime you switch from zoomed to normal.

I am searching for a solution on the same problem.
I have a second boblight.conf and wrote a script that copys the config file to /etc/boblight.conf and restarts the daemon. But it seems that the addon has to be restarted also.
Does anyone know if it is possible to activate/deactivate an addon via command line?
I've found a solution for my Setup.

On my machine the Boblight starts to flicker if i restart boblightd several times.
A new configuration for boblightd and a restart of the daemon does not apply immediatly. A restart of the addon solves that issues. It is possible to start/stop an addon via jsonrpc.

On Linux you can use
Code:
curl -s -H "Accept: application/json" -H "Content-type: application/json" -d '{"jsonrpc":"2.0","method":"Addons.SetAddonEnabled","id":1,"params":{"addonid":"script.xbmc.boblight","enabled":false}}' http://localhost:8080/jsonrpc
The JSON looks like
Code:
{
    "jsonrpc":"2.0",
    "method":"Addons.SetAddonEnabled",
    "id":1,
    "params":{
        "addonid":"script.xbmc.boblight",
        "enabled":false
    }
}
Possible values for parameter enabled are (bool)true, (bool)false and (string)toggle

Hardcoded black borders are especially a problem if you watch TV and if youre lights areas are quite small. I use e.g. one percent only.
Therefore i wrote some scripts that allow me to start/stop the addon and daemon and handle different configurations with only one button on my remote.

My configurations for the Daemon are splitted into parts. The common configuration is located in the file /etc/default/boblight.conf/device.conf and the lights specific files are located in the same path and named e.g 16:9.conf and 21:9.conf
According to the coosen configuration these files are put together in /etc/boblight.conf

I want to have the addon disabled on startup so i insert the addonId into the disabled table in the Addons DB before XBMC start up, if it doesn't already exist. I've done that via the script boblightXbmc which accepts one argument $1: on|off. If XBMC is running, the addon will be toggled via jsonrpc, if not its done directly in the Addons DB

boblightStatus checks if the addon is enabled or not. Just like boblightXbmc this is done via jsonrpc or Database.

toggleBoblight starts/stops the daemon and builds the desired configuration. Arguments are $1: on|off $2: configuration (here 16:9|21:9)

Here are my scripts. Maybe its useful for someone:
boblightStatus (check if addon is enabled)
Code:
#!/bin/bash

if pidof xbmc.bin > /dev/null; then
    STATUS=$(curl -s -H "Accept: application/json" -H "Content-type: application/json" -d '{"jsonrpc":"2.0","method":"Addons.GetAddonDetails","id":1,"params":{"addonid":"script.xbmc.boblight","properties":["enabled"]}}' http://localhost:8080/jsonrpc | egrep -o 'true|false')
else
    STATUS=$(/usr/bin/sqlite3 /home/xbmc/.xbmc/userdata/Database/Addons15.db 'SELECT * FROM disabled WHERE addonid="script.xbmc.boblight"')
    if [ "$STATUS" == "" ]; then
        STATUS="true"
    else
        STATUS="false";
    fi
fi
if [ "$STATUS" == "true" ]; then
        exit 0
elif [ "$STATUS" == "false" ]; then
        exit 1
else
        exit 2
fi
boblightXbmc (enable/disable addon, arguments: on/off)
Code:
#!/bin/bash

XBMC=true
if pidof xbmc.bin > /dev/null; then
    CMD="/usr/bin/curl -s -H \"Accept: application/json\" -H \"Content-type: application/json\" -d '{\"jsonrpc\":\"2.0\",\"method\":\"Addons.SetAddonEnabled\",\"id\":1,\"params\":{\"addonid\":\"script.xbmc.boblight\",\"enabled\":XXX}}' http://localhost:8080/jsonrpc"
    SET='"toggle"'
else
    XBMC=false
    CMD="/usr/bin/sqlite3 /home/xbmc/.xbmc/userdata/Database/Addons15.db 'XXX'"
fi

logger -t BOBLIGHT "Toggle XBMC Addon $1"
if [ "$1" == "on" ]; then
    if ! /usr/local/bin/boblightStatus; then
        logger -t BOBLIGHT "XBMC Addon is not running"
        if pidof boblightd > /dev/null; then
            logger -t BOBLIGHT 'Daemon running...'
            if $XBMC; then
                logger -t BOBLIGHT "XBMC is running"
                eval ${CMD/XXX/true} > /dev/null
            fi
        elif $XBMC; then
            logger -t BOBLIGHT 'XBMC running but Daemon seems to bo off'
            xbmc-send --action="Notification(Boblight error, Daemon not running, 5000, /home/xbmc/.xbmc/addons/script.xbmc.boblight/icon.png)"
        else
            logger -t BOBLIGHT 'XBMC is not running, deleting disabled status from Addons DB'
            eval ${CMD/XXX/DELETE FROM disabled WHERE addonid=\"script.xbmc.boblight\"}
        fi
        if /usr/local/bin/boblightStatus; then
            logger -t BOBLIGHT 'successfully enabled'
            exit 0
        else
            logger -t BOBLIGHT 'error enabling addon'
            exit 1
        fi
    else
        logger -t BOBLIGHT "XBMC Addon is already running"
        exit 0
    fi
elif [ "$1" == "off" ]; then
    if /usr/local/bin/boblightStatus; then
        logger -t BOBLIGHT "XBMC Addon is running"
        
        if $XBMC; then
            logger -t BOBLIGHT "XBMC is running"
            eval ${CMD/XXX/false} > /dev/null
        else
            logger -t BOBLIGHT 'XBMC is not running, inserting disabled status into Addons DB'
            eval ${CMD/XXX/INSERT INTO disabled (addonID) VALUES(\"script.xbmc.boblight\")}
        fi
        if ! /usr/local/bin/boblightStatus; then
            logger -t BOBLIGHT 'successfully disabled'
            exit 0
        else
            logger -t BOBLIGHT 'error disabling addon'
            exit 1
        fi
    else
        logger -t BOBLIGHT "XBMC Addon is already disabled"
        exit 0
    fi
fi

${CMD/XXX/"toggle"} > /dev/null
toggleBoblight (enable/disable the daemon, arguments: on/off configuration)
Code:
#!/bin/bash

LOCK=/tmp/boblightToggle
if [ -e $LOCK ]; then
    logger -t BOBLIGHT locked...
    exit 1
fi

function unlock {
    sleep 5
    rm $LOCK
}

logger -t BOBLIGHT "toggle Boblight Daemon $1 $2"

touch $LOCK

if pidof boblightd > /dev/null && [ "$1" != "on" ]; then
    logger -t BOBLIGHT disable
    
    xbmc-send --action="notification(Boblight,Disabling Daemon,5000,/home/xbmc/.xbmc/addons/script.xbmc.boblight/icon.png)"
    service boblight stop
    [ -e /etc/boblight.conf ] && rm /etc/boblight.conf
    if ! pidof boblightd > /dev/null; then
        unlock &
        exit 0
    fi
elif [ "$1" == "on" ]; then
    logger -t BOBLIGHT "enable $2"

    NEWCONF=false
    if [ -e /etc/boblight.conf ]; then
        CONF=$(egrep -o 'CONFIG;[0-9:]*' /etc/boblight.conf | cut -d';' -f2)
    else
        CONF=none
    fi

    logger -t BOBLIGHT "Current: $CONF, New: $2"

    if [ "$2" != "" ] && [ "$2" != "$CONF" ]; then
        logger -t BOBLIGHT "Preparing new configuration $2"
        NEWCONF=true
        cat /etc/default/boblight.conf/device.conf /etc/default/boblight.conf/$2.conf > /etc/boblight.conf
    elif [ "$2" != "" ]; then
        logger -t BOBLIGHT "Current configuration $2 is OK"
        if pidof boblightd > /dev/null; then
            logger -t BOBLIGHT "Boblight already running... exit..."
            unlock &
            exit 0
        else
            logger -t BOBLIGHT "...starting Boblight Daemon"
            service boblight start
        fi
    fi

    if $NEWCONF && pidof boblightd > /dev/null; then
        logger -t BOBLIGHT "...restarting Boblight Daemon"
        service boblight restart
    fi

    if pidof boblightd > /dev/null; then
        unlock &
        exit 0
    fi
fi
unlock &
exit 1
Boblight upstart (pre-start script)
Code:
pre-start script

[ ! -e /etc/boblight.conf ] && cat /etc/default/boblight.conf/device.conf /etc/default/boblight.conf/16:9.conf > /etc/boblight.conf

if pidof xbmc.bin > /dev/null; then
    CONF=$(egrep 'CONFIG;.*' /etc/boblight.conf | cut -d';' -f2)
    xbmc-send --action="notification(Boblight configuration,$CONF,5000,/home/xbmc/.xbmc/addons/script.xbmc.boblight/icon.png)"
fi

end script
XBMC Upstart
Code:
pre-start script
logger -t XBMC-INIT 'Checking Status of Boblight addon'
if boblightStatus; then
    logger -t XBMC-INIT "disabling Boblight addon"
    boblightXbmc off
fi
if ! pidof boblightd > /dev/null; then
    service boblight start
fi

end script

pre-stop script
if boblightStatus; then
    boblightXbmc off
fi
service boblight stop
end script
/etc/lirc/lircrc
Code:
# boblight toggle
begin
    prog = irexec
    button = toggle_boblight
    config = /usr/local/bin/toggleBoblight on 16:9 && /usr/local/bin/boblightXbmc on
    config = /usr/local/bin/boblightXbmc off && /usr/local/bin/toggleBoblight on 21:9 && /usr/local/bin/boblightXbmc on
    config = /usr/local/bin/boblightXbmc off
end
I know this is a whole bunch of code that surely could be simplified, but it works.
Dependencies are curl, sqlite3, logger, xbmc-eventclient xbmc-send
Reply


Messages In This Thread
[No subject] - by Lunatixz - 2011-12-07, 08:22
[No subject] - by Memphiz - 2011-12-07, 09:15
[No subject] - by Memphiz - 2011-12-07, 10:01
[No subject] - by Lunatixz - 2011-12-07, 11:05
[No subject] - by snipah - 2011-12-07, 12:11
[No subject] - by Memphiz - 2011-12-07, 12:32
[No subject] - by Clumsy - 2011-12-07, 13:29
[No subject] - by snipah - 2011-12-07, 13:52
[No subject] - by Memphiz - 2011-12-07, 18:41
[No subject] - by Memphiz - 2011-12-07, 18:47
[No subject] - by snipah - 2011-12-07, 21:04
[No subject] - by Memphiz - 2011-12-07, 21:09
[No subject] - by Memphiz - 2011-12-07, 21:10
[No subject] - by snipah - 2011-12-07, 21:36
[No subject] - by Memphiz - 2011-12-07, 21:39
[No subject] - by Memphiz - 2011-12-07, 22:12
[No subject] - by snipah - 2011-12-07, 23:16
[No subject] - by Memphiz - 2011-12-08, 00:36
[No subject] - by snipah - 2011-12-08, 08:39
[No subject] - by Elbert - 2011-12-09, 17:11
[No subject] - by lordindy - 2011-12-09, 17:16
[No subject] - by Elbert - 2011-12-10, 14:21
[No subject] - by Memphiz - 2011-12-10, 15:09
[No subject] - by Elbert - 2011-12-10, 16:20
[No subject] - by Memphiz - 2011-12-10, 16:43
[No subject] - by Elbert - 2011-12-10, 17:16
[No subject] - by Memphiz - 2011-12-10, 17:46
[No subject] - by bobo1on1 - 2011-12-10, 18:14
[No subject] - by Elbert - 2011-12-10, 19:05
[No subject] - by Lunatixz - 2011-12-13, 05:45
[No subject] - by Memphiz - 2011-12-13, 10:01
[No subject] - by Lunatixz - 2011-12-13, 21:25
[No subject] - by Memphiz - 2011-12-14, 00:11
[No subject] - by Dannydeman - 2011-12-18, 23:42
[No subject] - by Memphiz - 2011-12-18, 23:54
[No subject] - by bleze - 2011-12-19, 00:01
[No subject] - by bleze - 2011-12-19, 00:23
[No subject] - by Memphiz - 2011-12-19, 10:56
[No subject] - by Kode - 2011-12-19, 13:49
[No subject] - by bleze - 2011-12-19, 22:04
[No subject] - by Memphiz - 2011-12-19, 22:17
[No subject] - by bleze - 2011-12-19, 22:31
[No subject] - by Memphiz - 2011-12-19, 23:37
[No subject] - by bleze - 2011-12-20, 19:15
[No subject] - by bleze - 2011-12-20, 21:18
[No subject] - by bobo1on1 - 2011-12-20, 23:41
[No subject] - by Memphiz - 2011-12-21, 14:07
[No subject] - by bleze - 2011-12-21, 18:01
[No subject] - by Memphiz - 2011-12-21, 19:58
[No subject] - by Wikking - 2011-12-22, 12:43
[No subject] - by Memphiz - 2011-12-22, 16:34
[No subject] - by Wikking - 2011-12-22, 17:28
[No subject] - by ECEC - 2011-12-22, 18:07
[No subject] - by bobo1on1 - 2011-12-22, 18:55
[No subject] - by ECEC - 2011-12-22, 20:44
[No subject] - by bobo1on1 - 2011-12-22, 21:20
[No subject] - by Eoghlear - 2011-12-23, 00:57
[No subject] - by bobo1on1 - 2011-12-23, 03:10
[No subject] - by metheos - 2011-12-24, 22:45
[No subject] - by bleze - 2011-12-27, 01:23
[No subject] - by Eoghlear - 2011-12-27, 18:03
[No subject] - by bobo1on1 - 2011-12-27, 18:58
[No subject] - by Adam B. - 2011-12-28, 16:55
[No subject] - by bobo1on1 - 2011-12-28, 17:18
[No subject] - by Adam B. - 2011-12-28, 17:31
[No subject] - by Memphiz - 2011-12-29, 01:28
[No subject] - by Adam B. - 2011-12-29, 03:59
[No subject] - by Wikking - 2011-12-29, 11:22
[No subject] - by Adam B. - 2011-12-29, 12:11
[No subject] - by Wikking - 2011-12-29, 14:19
[No subject] - by bobo1on1 - 2011-12-29, 17:47
[No subject] - by bleze - 2011-12-29, 18:18
[No subject] - by Adam B. - 2011-12-30, 04:14
[No subject] - by LastMile - 2011-12-30, 05:43
[No subject] - by Memphiz - 2011-12-30, 13:04
[No subject] - by Adam B. - 2011-12-30, 13:47
[No subject] - by sraue - 2011-12-30, 16:22
were to buy - by pang - 2012-01-01, 09:17
[No subject] - by Elbert - 2012-01-01, 12:38
[No subject] - by LastMile - 2012-01-01, 23:34
[No subject] - by pigr8 - 2012-01-05, 04:10
[No subject] - by xalaros - 2012-01-06, 12:24
[No subject] - by schumi2004 - 2012-01-06, 12:44
[No subject] - by Memphiz - 2012-01-06, 15:00
[No subject] - by Ghostface - 2012-01-09, 11:42
[No subject] - by Memphiz - 2012-01-09, 13:10
[No subject] - by trouty00 - 2012-01-09, 15:29
[No subject] - by trouty00 - 2012-01-09, 18:31
[No subject] - by Memphiz - 2012-01-09, 21:31
[No subject] - by trouty00 - 2012-01-09, 23:36
[No subject] - by bobo1on1 - 2012-01-10, 00:18
[No subject] - by trouty00 - 2012-01-10, 17:27
[No subject] - by bobo1on1 - 2012-01-10, 20:12
[No subject] - by regnets - 2012-01-10, 22:49
[No subject] - by kimp93 - 2012-01-11, 01:54
[No subject] - by Memphiz - 2012-01-11, 14:52
[No subject] - by bobo1on1 - 2012-01-11, 18:40
[No subject] - by kimp93 - 2012-01-11, 21:30
[No subject] - by regnets - 2012-01-12, 09:38
[No subject] - by Memphiz - 2012-01-12, 11:13
[No subject] - by regnets - 2012-01-12, 13:59
[No subject] - by regnets - 2012-01-15, 23:05
[No subject] - by m_K_o - 2012-01-21, 19:39
[No subject] - by Lunatixz - 2012-01-22, 07:17
[No subject] - by Memphiz - 2012-01-22, 12:49
[No subject] - by kimp93 - 2012-01-24, 17:51
[No subject] - by Memphiz - 2012-01-24, 20:33
[No subject] - by MrHenky - 2012-01-24, 21:08
[No subject] - by bobo1on1 - 2012-01-24, 21:14
[No subject] - by kimp93 - 2012-01-24, 21:29
[No subject] - by MrHenky - 2012-01-24, 22:32
[No subject] - by devnull - 2012-01-25, 22:01
Possible Feature Addition? - by DarioS - 2012-01-25, 22:29
[No subject] - by Memphiz - 2012-01-26, 00:11
[No subject] - by MrHenky - 2012-01-26, 15:17
[No subject] - by ski107 - 2012-01-28, 09:10
[No subject] - by ski107 - 2012-01-28, 09:13
[No subject] - by PolliSoft - 2012-01-28, 14:50
[No subject] - by MrHenky - 2012-01-28, 23:42
[No subject] - by PolliSoft - 2012-01-29, 00:23
[No subject] - by ski107 - 2012-01-29, 02:04
[No subject] - by MrHenky - 2012-01-29, 15:45
[No subject] - by silvine - 2012-01-29, 18:50
[No subject] - by ski107 - 2012-01-29, 18:52
[No subject] - by MrHenky - 2012-01-29, 19:19
[No subject] - by MrHenky - 2012-01-30, 00:41
[No subject] - by Memphiz - 2012-01-30, 12:55
[No subject] - by devnull - 2012-01-30, 13:05
[No subject] - by Scidd0w - 2012-01-30, 18:09
[No subject] - by Lunatixz - 2012-02-01, 01:21
[No subject] - by PolliSoft - 2012-02-02, 12:52
[No subject] - by MrHenky - 2012-02-03, 20:01
[No subject] - by Adam B. - 2012-02-03, 20:57
[No subject] - by PolliSoft - 2012-02-06, 00:20
[No subject] - by Memphiz - 2012-02-06, 00:26
[No subject] - by bobo1on1 - 2012-02-06, 00:39
[No subject] - by PolliSoft - 2012-02-06, 01:14
[No subject] - by bobo1on1 - 2012-02-06, 01:29
[No subject] - by PolliSoft - 2012-02-06, 08:41
[No subject] - by Lunatixz - 2012-02-07, 01:52
[No subject] - by Memphiz - 2012-02-07, 11:33
[No subject] - by PolliSoft - 2012-02-07, 11:57
[No subject] - by bobo1on1 - 2012-02-07, 16:37
[No subject] - by MrHenky - 2012-02-08, 11:47
[No subject] - by smajor - 2012-02-12, 15:50
[No subject] - by Memphiz - 2012-02-12, 23:26
[No subject] - by Lunatixz - 2012-02-13, 00:57
[No subject] - by smajor - 2012-02-13, 10:49
[No subject] - by smajor - 2012-02-13, 11:26
[No subject] - by Lunatixz - 2012-02-13, 19:22
[No subject] - by smajor - 2012-02-13, 19:33
[No subject] - by George - 2012-02-13, 20:06
[No subject] - by smajor - 2012-02-13, 20:58
SEDU-Box and Boblight - by XBMCManni - 2012-02-15, 16:55
hardware setup - by Monkeysweat - 2012-02-15, 20:31
[No subject] - by George - 2012-02-16, 11:22
[No subject] - by smajor - 2012-02-16, 12:32
[No subject] - by Memphiz - 2012-02-16, 12:43
[No subject] - by phil65 - 2012-02-16, 15:04
[No subject] - by draven187 - 2012-02-16, 17:09
[No subject] - by triberraar - 2012-02-18, 14:12
[No subject] - by Adam B. - 2012-02-18, 16:28
[No subject] - by triberraar - 2012-02-18, 18:22
[No subject] - by smajor - 2012-02-18, 20:24
[No subject] - by Memphiz - 2012-02-19, 02:19
[No subject] - by smajor - 2012-02-19, 11:10
[No subject] - by triberraar - 2012-02-19, 14:33
[No subject] - by schumi2004 - 2012-02-21, 13:38
[No subject] - by hotlobster - 2012-02-21, 14:44
[No subject] - by Memphiz - 2012-02-21, 16:54
[No subject] - by Memphiz - 2012-02-21, 16:55
[No subject] - by hotlobster - 2012-02-21, 18:28
[No subject] - by bobo1on1 - 2012-02-21, 18:41
[No subject] - by Memphiz - 2012-02-22, 10:51
[No subject] - by Memphiz - 2012-02-22, 10:53
[No subject] - by hotlobster - 2012-02-22, 11:06
[No subject] - by Memphiz - 2012-02-22, 17:00
[No subject] - by phil65 - 2012-02-27, 05:22
[No subject] - by Memphiz - 2012-02-27, 12:48
[No subject] - by schumi2004 - 2012-02-27, 15:28
[No subject] - by phil65 - 2012-02-27, 18:37
[No subject] - by schumi2004 - 2012-02-29, 23:30
[No subject] - by Memphiz - 2012-03-01, 11:02
[No subject] - by schumi2004 - 2012-03-01, 18:18
[No subject] - by Memphiz - 2012-03-01, 23:27
[No subject] - by schumi2004 - 2012-03-01, 23:53
[No subject] - by Memphiz - 2012-03-02, 10:32
[No subject] - by bobo1on1 - 2012-03-02, 17:03
[No subject] - by schumi2004 - 2012-03-02, 20:11
[No subject] - by phil65 - 2012-03-03, 04:56
[No subject] - by schumi2004 - 2012-03-03, 13:29
[No subject] - by bobo1on1 - 2012-03-03, 16:56
[No subject] - by phil65 - 2012-03-03, 18:27
[No subject] - by schumi2004 - 2012-03-03, 18:41
[No subject] - by beta-j - 2012-03-03, 23:57
[No subject] - by bobo1on1 - 2012-03-04, 00:49
[No subject] - by Memphiz - 2012-03-04, 03:11
[No subject] - by phil65 - 2012-03-04, 11:37
[No subject] - by beta-j - 2012-03-04, 13:58
RE: - by phil65 - 2012-03-12, 07:53
RE: - by beta-j - 2012-03-12, 10:56
RE: - by phil65 - 2012-03-13, 00:51
RE: - by beta-j - 2012-03-14, 13:14
[No subject] - by Memphiz - 2012-03-04, 14:50
[No subject] - by bobo1on1 - 2012-03-04, 17:31
[No subject] - by phil65 - 2012-03-04, 19:06
[No subject] - by Memphiz - 2012-03-05, 00:36
[No subject] - by beta-j - 2012-03-05, 11:13
[No subject] - by schumi2004 - 2012-03-05, 15:39
[No subject] - by bobo1on1 - 2012-03-05, 16:19
[No subject] - by beta-j - 2012-03-05, 16:21
[No subject] - by bobo1on1 - 2012-03-06, 04:16
[No subject] - by beta-j - 2012-03-06, 19:33
[No subject] - by bobo1on1 - 2012-03-06, 20:44
[No subject] - by Memphiz - 2012-03-07, 00:28
[No subject] - by beta-j - 2012-03-07, 21:28
[No subject] - by beta-j - 2012-03-07, 21:28
[No subject] - by bobo1on1 - 2012-03-07, 21:31
[No subject] - by beta-j - 2012-03-07, 21:36
[No subject] - by beta-j - 2012-03-09, 18:01
[No subject] - by smajor - 2012-03-09, 18:26
[No subject] - by bobo1on1 - 2012-03-09, 18:32
[No subject] - by regnets - 2012-03-09, 21:26
[No subject] - by beta-j - 2012-03-10, 12:08
RE: - by smajor - 2012-03-13, 11:27
RE: - by phil65 - 2012-03-13, 11:48
RE: - by George - 2012-03-13, 16:29
RE: - by phil65 - 2012-03-13, 16:54
RE: - by George - 2012-03-13, 19:47
Make/Install Errors - by BluechipJ - 2013-04-01, 02:29
RE: [RELEASE] Official XBMC boblight Addon - by hannemann - 2013-12-28, 21:21
Boblight preset values - by miraclemaker - 2014-05-11, 13:32


Logout Mark Read Team Forum Stats Members Help
[RELEASE] Official XBMC boblight Addon3
This forum uses Lukasz Tkacz MyBB addons.