hts-tvheadend: convert to addon

Signed-off-by: Stephan Raue <stephan@openelec.tv>
This commit is contained in:
Stephan Raue 2011-05-28 20:29:29 +02:00
parent 26bfcfea0f
commit 352deea8ef
15 changed files with 107 additions and 108 deletions

View File

@ -20,6 +20,7 @@
# http://www.gnu.org/copyleft/gpl.html
################################################################################
if [ ! $(pidof tvheadend) ];then
tvheadend -C -s -f -u root -g root
fi
. config/options $1
mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/bin
cp -P $PKG_BUILD/build.Linux/tvheadend $ADDON_BUILD/$PKG_ADDON_ID/bin

View File

@ -0,0 +1,2 @@
0.99.1
- initial version hts-tvheadend-90e3570

Binary file not shown.

After

Width:  |  Height:  |  Size: 71 KiB

View File

@ -29,9 +29,11 @@ PKG_URL="$OPENELEC_SRC/${PKG_NAME}-${PKG_VERSION}.tar.bz2"
PKG_DEPENDS="libiconv avahi"
PKG_BUILD_DEPENDS="toolchain libiconv avahi"
PKG_PRIORITY="optional"
PKG_SECTION="multimedia"
PKG_SECTION="service/multimedia"
PKG_SHORTDESC="hts-tvheadend: a TV streaming server for Linux supporting DVB-S, DVB-S2, DVB-C, DVB-T, ATSC, IPTV, and Analog video (V4L) as input sources."
PKG_LONGDESC="HTS-Tvheadend is a TV streaming server for Linux supporting DVB-S, DVB-S2, DVB-C, DVB-T, ATSC, IPTV, and Analog video (V4L) as input sources. It also comes with a powerful and easy to use web interface both used for configuration and day-to-day operations, such as searching the EPG and scheduling recordings. Even so, the most notable feature of Tvheadend is how easy it is to set up: Install it, navigate to the web user interface, drill into the TV adapters tab, select your current location and Tvheadend will start scanning channels and present them to you in just a few minutes"
PKG_IS_ADDON="no"
PKG_IS_ADDON="yes"
PKG_ADDON_TYPE="xbmc.service"
PKG_AUTORECONF="no"

View File

@ -1,5 +1,3 @@
#!/bin/sh
################################################################################
# This file is part of OpenELEC - http://www.openelec.tv
# Copyright (C) 2009-2011 Stephan Raue (stephan@openelec.tv)
@ -20,13 +18,20 @@
# http://www.gnu.org/copyleft/gpl.html
################################################################################
. config/options $1
import xbmc, time, os, subprocess
mkdir -p $INSTALL/usr/bin
cp -P $PKG_BUILD/build.Linux/tvheadend $INSTALL/usr/bin
dir = os.path.realpath(os.path.dirname(__file__))
script = 'start.sh'
mkdir -p $INSTALL/etc/pm/sleep.d
cp $PKG_DIR/sleep.d/* $INSTALL/etc/pm/sleep.d
launcher = os.path.join(dir, script)
app = '/storage/.xbmc/addons/service.multimedia.hts-tvheadend/bin/tvheadend'
mkdir -p $INSTALL/lib/udev
cp $PKG_DIR/scripts/tvheadend_startup $INSTALL/lib/udev
os.chmod(launcher, 0755)
os.chmod(app, 0755)
args = [launcher, str(os.getpid()), app]
p = subprocess.Popen(args)
print p.pid
p.wait()
os.exit(1)

View File

@ -0,0 +1,83 @@
#!/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
################################################################################
XBMC_PID=$1
APP=$2
SCRIPT_DIR=$(dirname `readlink -f $0`)
ADDON_HOME="$HOME/.xbmc/userdata/addon_data/service.multimedia.hts-tvheadend"
PATH="${PATH}:${SCRIPT_DIR}/bin"
LOG_FILE="${ADDON_HOME}/service.log"
cleanup() {
local EXIT_STATUS=$1
if [ -n "${EXIT_STATUS}" ];then
EXIT_STATUS=0
fi
kill -15 "${APP_PID}"
exit $EXIT_STATUS;
}
# trap signals for clean shutdown
trap cleanup 1 2 3 15
launch_app() {
local PID
eval "${APP} ${ARG} &>${LOG_FILE} &"
APP_PID=$!
}
pid_is_running() {
local PID=${1}
for IPID in `ps -o pid | sed 's/[A-Za-z]//g' | sed 's/\ //g'`;do
if [ ${IPID} -eq ${PID} ];then
return 0
fi
done
return 1
}
app_prep() {
mkdir -p $ADDON_HOME
ARG="-C -s -u root -g root -c $ADDON_HOME"
}
main() {
app_prep
launch_app "${APP}"
pid_is_running "${XBMC_PID}"
XBMC_RUNNING=$?
pid_is_running "${APP_PID}"
APP_RUNNING=$?
while [ $XBMC_RUNNING -eq 0 -a ${APP_RUNNING} -eq 0 ]; do
sleep 1
pid_is_running "${XBMC_PID}"
XBMC_RUNNING=$?
pid_is_running "${APP_PID}"
APP_RUNNING=$?
done
}
main
cleanup

View File

@ -1,48 +0,0 @@
#!/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="tvheadend"
case "$1" in
hibernate|suspend)
if [ $(pidof tvheadend) ];then
progress "Shutting down HTS TVHeadend for suspending..."
mkdir -p "$LOCKDIR"
touch "$LOCKDIR/$LOCKFILE"
killall tvheadend
fi
;;
thaw|resume)
if [ -f "$LOCKDIR/$LOCKFILE" ];then
progress "Restarting HTS TVHeadend for wakeup..."
tvheadend -C -s -f -u root -g root
rm -rf "$LOCKDIR/$LOCKFILE"
fi
;;
*) exit $NA
;;
esac

View File

@ -1,30 +0,0 @@
################################################################################
# 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
################################################################################
# only does something with adding "dvb" subsystem devices.
ACTION!="add|remove", GOTO="end"
SUBSYSTEM!="dvb", GOTO="end"
ENV{DVB_DEVICE_TYPE}!="frontend", GOTO="end"
# Start TVHeadend if dvb frontend is starting
ACTION=="add", RUN+="/lib/udev/tvheadend_startup"
ACTION=="remove", RUN+="/usr/bin/killall tvheadend"
LABEL="end"

View File

@ -116,9 +116,6 @@
# (DVD decryption support in XBMC) (yes / no)
DVDCSS_SUPPORT="yes"
# build and install Tvheadend TV server (yes / no)
TVHEADEND="yes"
# additional drivers to install:
# bcm_sta: Broadcom STA WLAN Driver
# Space separated list is supported,

View File

@ -116,9 +116,6 @@
# (DVD decryption support in XBMC) (yes / no)
DVDCSS_SUPPORT="yes"
# build and install Tvheadend TV server (yes / no)
TVHEADEND="yes"
# additional drivers to install:
# bcm_sta: Broadcom STA WLAN Driver
# Space separated list is supported,

View File

@ -116,9 +116,6 @@
# (DVD decryption support in XBMC) (yes / no)
DVDCSS_SUPPORT="yes"
# build and install Tvheadend TV server (yes / no)
TVHEADEND="yes"
# additional drivers to install:
# bcm_sta: Broadcom STA WLAN Driver
# Space separated list is supported,

View File

@ -116,9 +116,6 @@
# (DVD decryption support in XBMC) (yes / no)
DVDCSS_SUPPORT="yes"
# build and install Tvheadend TV server (yes / no)
TVHEADEND="yes"
# additional drivers to install:
# bcm_sta: Broadcom STA WLAN Driver
# Space separated list is supported,

View File

@ -116,9 +116,6 @@
# (DVD decryption support in XBMC) (yes / no)
DVDCSS_SUPPORT="yes"
# build and install Tvheadend TV server (yes / no)
TVHEADEND="yes"
# additional drivers to install:
# bcm_sta: Broadcom STA WLAN Driver
# Space separated list is supported,

View File

@ -100,7 +100,6 @@ mkdir -p $INSTALL
# Multimedia support
[ ! "$MEDIACENTER" = "no" ] && $SCRIPTS/install mediacenter
[ "$TVHEADEND" = "yes" ] && $SCRIPTS/install hts-tvheadend
# Automounter support
[ "$UDISKS" = "yes" ] && $SCRIPTS/install udisks