diff --git a/packages/addons/service/multimedia/boblightd/changelog.txt b/packages/addons/service/multimedia/boblightd/changelog.txt index 4709b5211b..338cbc3a10 100644 --- a/packages/addons/service/multimedia/boblightd/changelog.txt +++ b/packages/addons/service/multimedia/boblightd/changelog.txt @@ -1,3 +1,7 @@ +2.0.5 +- add possibilty to start / stop addon from addon manager with enable / disable +- restart boblightd on sleep / resume + 2.0.4 - Fixed so that boblightd will not start it's already running diff --git a/packages/addons/service/multimedia/boblightd/meta b/packages/addons/service/multimedia/boblightd/meta index 30ff8bd564..4c55357e7f 100644 --- a/packages/addons/service/multimedia/boblightd/meta +++ b/packages/addons/service/multimedia/boblightd/meta @@ -19,8 +19,8 @@ ################################################################################ PKG_NAME="boblightd" -PKG_VERSION="2.0.4" -PKG_REV="4" +PKG_VERSION="2.0.5" +PKG_REV="5" PKG_ARCH="any" PKG_LICENSE="GPL" PKG_SITE="http://code.google.com/p/boblight" diff --git a/packages/addons/service/multimedia/boblightd/source/bin/boblightd.service b/packages/addons/service/multimedia/boblightd/source/bin/boblightd.start similarity index 66% rename from packages/addons/service/multimedia/boblightd/source/bin/boblightd.service rename to packages/addons/service/multimedia/boblightd/source/bin/boblightd.start index ff8696492d..201db21e76 100755 --- a/packages/addons/service/multimedia/boblightd/source/bin/boblightd.service +++ b/packages/addons/service/multimedia/boblightd/source/bin/boblightd.start @@ -37,30 +37,41 @@ BOBLIGHT_CONFIG="$ADDON_HOME/boblight.conf" # Flag file to start boblight-x11 daemon BOBLIGHT_X11="$ADDON_HOME/boblight.X11" +LOCKDIR="/var/lock/" +LOCKFILE="boblightd.disabled" + export LD_LIBRARY_PATH="$ADDON_DIR/lib:$LD_LIBRARY_PATH" cp -R $ADDON_DIR/config/*.sample $ADDON_HOME > $LOG_FILE 2>&1 -if [ ! "$(pidof boblightd)" ]; then - if [ -e $BOBLIGHT_CONFIG ]; then - - # Make sure the xserver has started up - wait_for_xorg - - # Start the boblight daemon - boblightd -c $BOBLIGHT_CONFIG -f >> $LOG_FILE 2>&1 - - fi +if [ -f "$LOCKDIR/$LOCKFILE" ] ; then + rm -rf "$LOCKDIR/$LOCKFILE" fi -if [ ! "$(pidof boblight-X11)" ]; then - if [ -e $BOBLIGHT_X11 ]; then - - # Make sure the xserver has started up - wait_for_xorg - - # Start the boblight daemon - boblight-X11 -f >> $LOG_FILE 2>&1 - - fi +if [ -f "$BOBLIGHT_CONFIG" ] ; then + if [ ! "$(pidof boblightd)" ]; then + while [ true ] ; do + if [ -f "$LOCKDIR/$LOCKFILE" ] ; then + break + fi + # Make sure the xserver has started up + wait_for_xorg + # Start the boblight daemon + boblightd -c $BOBLIGHT_CONFIG >> $LOG_FILE 2>&1 + done & + fi + + if [ -e $BOBLIGHT_X11 ]; then + if [ ! "$(pidof boblight-X11)" ]; then + while [ true ] ; do + if [ -f "$LOCKDIR/$LOCKFILE" ] ; then + break + fi + # Make sure the xserver has started up + wait_for_xorg + # Start the boblight daemon + boblight-X11 >> $LOG_FILE 2>&1 + done & + fi + fi fi diff --git a/packages/addons/service/multimedia/boblightd/source/bin/boblightd.stop b/packages/addons/service/multimedia/boblightd/source/bin/boblightd.stop new file mode 100644 index 0000000000..d66b87b31e --- /dev/null +++ b/packages/addons/service/multimedia/boblightd/source/bin/boblightd.stop @@ -0,0 +1,37 @@ +#!/bin/sh + +################################################################################ +# This file is part of OpenELEC - http://www.openelec.tv +# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) +# +# This Program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# This Program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with OpenELEC.tv; see the file COPYING. If not, write to +# the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA. +# http://www.gnu.org/copyleft/gpl.html +################################################################################ + +. /etc/profile + +LOCKDIR="/var/lock/" +LOCKFILE="boblightd.disabled" + +mkdir -p "$LOCKDIR" +touch "$LOCKDIR/$LOCKFILE" + +if [ "$(pidof boblightd)" ];then + killall -9 boblightd +fi + +if [ "$(pidof boblight-X11)" ];then + killall -9 boblight-X11 +fi diff --git a/packages/addons/service/multimedia/boblightd/source/default.py b/packages/addons/service/multimedia/boblightd/source/default.py index 5e96c3e79a..54748996aa 100644 --- a/packages/addons/service/multimedia/boblightd/source/default.py +++ b/packages/addons/service/multimedia/boblightd/source/default.py @@ -21,12 +21,23 @@ import os import sys import xbmcaddon +import time +import subprocess __scriptname__ = "Boblightd" __author__ = "OpenELEC" __url__ = "http://www.openelec.tv" __settings__ = xbmcaddon.Addon(id='service.multimedia.boblightd') __cwd__ = __settings__.getAddonInfo('path') -__path__ = xbmc.translatePath( os.path.join( __cwd__, 'bin', "boblightd.service") ) +__start__ = xbmc.translatePath( os.path.join( __cwd__, 'bin', "boblightd.start") ) +__stop__ = xbmc.translatePath( os.path.join( __cwd__, 'bin', "boblightd.stop") ) -os.system(__path__) +#make binary files executable in adson bin folder +subprocess.Popen("chmod -R +x " + __cwd__ + "/bin/*" , shell=True, close_fds=True) + +subprocess.Popen(__start__, shell=True, close_fds=True) + +while (not xbmc.abortRequested): + time.sleep(0.250) + +subprocess.Popen(__stop__, shell=True, close_fds=True) diff --git a/packages/addons/service/multimedia/boblightd/source/sleep.d/boblightd.power b/packages/addons/service/multimedia/boblightd/source/sleep.d/boblightd.power new file mode 100644 index 0000000000..34e79c356c --- /dev/null +++ b/packages/addons/service/multimedia/boblightd/source/sleep.d/boblightd.power @@ -0,0 +1,34 @@ +#!/bin/sh + +################################################################################ +# This file is part of OpenELEC - http://www.openelec.tv +# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) +# +# This Program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# This Program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with OpenELEC.tv; see the file COPYING. If not, write to +# the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA. +# http://www.gnu.org/copyleft/gpl.html +################################################################################ + +. /etc/profile + +case "$1" in + hibernate|suspend) + boblightd.stop + ;; + thaw|resume) + xbmc-send --host=127.0.0.1 -a "XBMC.RunScript(service.multimedia.boblightd)" & + ;; + *) exit $NA + ;; +esac