Merge branch 'oscam-service-fix' of git://github.com/stefansaraev/OpenELEC.tv

This commit is contained in:
Stephan Raue 2012-02-29 22:04:33 +01:00
commit b847cfb866
5 changed files with 75 additions and 10 deletions

View File

@ -1,3 +1,6 @@
2.0.2
- add possibilty to start / stop addon from addon manager with enable / disable
2.0.1
- enable libusb support for smartcard support

View File

@ -21,7 +21,7 @@
PKG_NAME="oscam"
PKG_VERSION="6136"
PKG_REV="1"
PKG_REV="2"
PKG_ARCH="any"
PKG_LICENSE="GPL"
PKG_SITE="http://streamboard.gmc.to/wiki/index.php/OSCam/en"

View File

@ -21,8 +21,15 @@
# http://www.gnu.org/copyleft/gpl.html
################################################################################
. /etc/profile
LOCKDIR="/var/lock/"
LOCKFILE="oscam.disabled"
# Check if process is already running
if [ ! $(pidof oscam) ]; then
# use "$(pidof)" instead of $(pidof). otherwise 'if' statement will fail
# because oscam spawns at least one 'extra' process
if [ ! "$(pidof oscam)" ]; then
ADDON_DIR="$HOME/.xbmc/addons/service.softcam.oscam"
ADDON_HOME="$HOME/.xbmc/userdata/addon_data/service.softcam.oscam"
@ -65,10 +72,14 @@ if [ ! $(pidof oscam) ]; then
touch $ADDON_CONF_USER
# Restart process if it terminates.
(
while true; do
oscam $OSCAM_ARG > /dev/null 2>&1
usleep 250000
done
)&
if [ -f "$LOCKDIR/$LOCKFILE" ] ; then
rm -rf "$LOCKDIR/$LOCKFILE"
fi
while [ true ] ; do
if [ -f "$LOCKDIR/$LOCKFILE" ] ; then
break
fi
oscam $OSCAM_ARG > /dev/null 2>&1
sleep 1
done &
fi

View File

@ -0,0 +1,35 @@
#!/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
LOCKDIR="/var/lock/"
LOCKFILE="oscam.disabled"
# use "$(pidof)" instead of $(pidof). otherwise 'if' statement will fail
# because oscam spawns at least one 'extra' process
if [ "$(pidof oscam)" ];then
mkdir -p "$LOCKDIR"
touch "$LOCKDIR/$LOCKFILE"
killall -9 oscam
fi

View File

@ -19,6 +19,22 @@
# http://www.gnu.org/copyleft/gpl.html
################################################################################
import xbmc, time, os, subprocess
import xbmc, time, os, subprocess, xbmcaddon
os.system("oscam.service")
__scriptname__ = "OSCAM Service"
__author__ = "OpenELEC"
__url__ = "http://www.openelec.tv"
__settings__ = xbmcaddon.Addon(id='service.softcam.oscam')
__cwd__ = __settings__.getAddonInfo('path')
__start__ = xbmc.translatePath( os.path.join( __cwd__, 'bin', "oscam.start") )
__stop__ = xbmc.translatePath( os.path.join( __cwd__, 'bin', "oscam.stop") )
#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)