Merge pull request #236 from stefansaraev/vdr-sleep-update

vdr-addon: add possibilty to start / stop addon from addon manager with enable / disable
This commit is contained in:
Stephan Raue 2012-02-26 11:08:49 -08:00
commit 3c755f1c0e
6 changed files with 67 additions and 8 deletions

View File

@ -1,3 +1,6 @@
2.0.7
- add possibilty to start / stop addon from addon manager with enable / disable
2.0.6
- enable unloading/loading dvb modules on suspend/resume

View File

@ -21,7 +21,7 @@
PKG_NAME="vdr-addon"
PKG_VERSION="2.0"
PKG_REV="6"
PKG_REV="7"
PKG_ARCH="any"
PKG_LICENSE="GPL"
PKG_SITE="http://www.openelec.tv"

View File

@ -0,0 +1,28 @@
#!/bin/sh
################################################################################
# This file is part of OpenELEC - http://www.openelec.tv
# Copyright (C) 2009-2011 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, 675 Mass Ave, Cambridge, MA 02139, USA.
# http://www.gnu.org/copyleft/gpl.html
################################################################################
. /etc/profile
if [ $(pidof vdr.bin) ];then
killall vdr.bin
fi

View File

@ -21,12 +21,23 @@
import os
import sys
import xbmcaddon
import time
import subprocess
__scriptname__ = "VDR Service"
__author__ = "OpenELEC"
__url__ = "http://www.openelec.tv"
__settings__ = xbmcaddon.Addon(id='service.multimedia.vdr-addon')
__cwd__ = __settings__.getAddonInfo('path')
__path__ = xbmc.translatePath( os.path.join( __cwd__, 'bin', "vdr.service") )
__start__ = xbmc.translatePath( os.path.join( __cwd__, 'bin', "vdr.start") )
__stop__ = xbmc.translatePath( os.path.join( __cwd__, 'bin', "vdr.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)

View File

@ -1,5 +1,25 @@
#!/bin/sh
################################################################################
# This file is part of OpenELEC - http://www.openelec.tv
# Copyright (C) 2009-2011 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, 675 Mass Ave, Cambridge, MA 02139, USA.
# http://www.gnu.org/copyleft/gpl.html
################################################################################
. /etc/profile
ADDON_HOME="$HOME/.xbmc/userdata/addon_data/service.multimedia.vdr-addon"
@ -11,19 +31,16 @@ if [ -f "$ADDON_CONFIG_DIR/vdr-sleep.conf" ]; then
if [ ! "$REMOVE_MODULES" == "" ] ; then
case "$1" in
hibernate|suspend)
killall -9 vdr.bin
# xbmc-send -a "Notification(suspend,unloading modules...)"
vdr.stop
for module in $REMOVE_MODULES ; do
rmmod -w $module
done
;;
thaw|resume)
# xbmc-send -a "Notification(resume,loading modules...)"
for module in $REMOVE_MODULES ; do
modprobe $module
done
# xbmc-send -a "Notification(resume,starting vdr service...)"
vdr.service
xbmc-send --host=127.0.0.1 -a "XBMC.RunScript(service.multimedia.vdr-addon)" &
;;
*) exit $NA
;;