diff --git a/packages/multimedia/hts-tvheadend/scripts/tvheadend_startup b/packages/addons/service/multimedia/hts-tvheadend/addon similarity index 88% rename from packages/multimedia/hts-tvheadend/scripts/tvheadend_startup rename to packages/addons/service/multimedia/hts-tvheadend/addon index 1137a8ea29..3e0ab9a67c 100755 --- a/packages/multimedia/hts-tvheadend/scripts/tvheadend_startup +++ b/packages/addons/service/multimedia/hts-tvheadend/addon @@ -20,6 +20,7 @@ # http://www.gnu.org/copyleft/gpl.html ################################################################################ -if [ ! $(pidof tvheadend) ];then - tvheadend -C -s -f -u root -g root -fi \ No newline at end of file +. config/options $1 + +mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/bin + cp -P $PKG_BUILD/build.Linux/tvheadend $ADDON_BUILD/$PKG_ADDON_ID/bin diff --git a/packages/multimedia/hts-tvheadend/build b/packages/addons/service/multimedia/hts-tvheadend/build similarity index 100% rename from packages/multimedia/hts-tvheadend/build rename to packages/addons/service/multimedia/hts-tvheadend/build diff --git a/packages/addons/service/multimedia/hts-tvheadend/changelog.txt b/packages/addons/service/multimedia/hts-tvheadend/changelog.txt new file mode 100644 index 0000000000..b7c99839b8 --- /dev/null +++ b/packages/addons/service/multimedia/hts-tvheadend/changelog.txt @@ -0,0 +1,2 @@ +0.99.1 +- initial version hts-tvheadend-90e3570 \ No newline at end of file diff --git a/packages/addons/service/multimedia/hts-tvheadend/icon/icon.png b/packages/addons/service/multimedia/hts-tvheadend/icon/icon.png new file mode 100644 index 0000000000..f0bb3997e7 Binary files /dev/null and b/packages/addons/service/multimedia/hts-tvheadend/icon/icon.png differ diff --git a/packages/multimedia/hts-tvheadend/meta b/packages/addons/service/multimedia/hts-tvheadend/meta similarity index 96% rename from packages/multimedia/hts-tvheadend/meta rename to packages/addons/service/multimedia/hts-tvheadend/meta index d9145c8059..b6192ae3a8 100644 --- a/packages/multimedia/hts-tvheadend/meta +++ b/packages/addons/service/multimedia/hts-tvheadend/meta @@ -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" diff --git a/packages/multimedia/hts-tvheadend/install b/packages/addons/service/multimedia/hts-tvheadend/source/default.py old mode 100755 new mode 100644 similarity index 73% rename from packages/multimedia/hts-tvheadend/install rename to packages/addons/service/multimedia/hts-tvheadend/source/default.py index b6d0d8667d..46f5973704 --- a/packages/multimedia/hts-tvheadend/install +++ b/packages/addons/service/multimedia/hts-tvheadend/source/default.py @@ -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) diff --git a/packages/addons/service/multimedia/hts-tvheadend/source/start.sh b/packages/addons/service/multimedia/hts-tvheadend/source/start.sh new file mode 100755 index 0000000000..c9e97d7869 --- /dev/null +++ b/packages/addons/service/multimedia/hts-tvheadend/source/start.sh @@ -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 diff --git a/packages/multimedia/hts-tvheadend/sleep.d/50_tvheadend b/packages/multimedia/hts-tvheadend/sleep.d/50_tvheadend deleted file mode 100755 index 91f3a2fb0e..0000000000 --- a/packages/multimedia/hts-tvheadend/sleep.d/50_tvheadend +++ /dev/null @@ -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 diff --git a/packages/multimedia/hts-tvheadend/udev.d/76-tvheadend.rules b/packages/multimedia/hts-tvheadend/udev.d/76-tvheadend.rules deleted file mode 100644 index 8e00208484..0000000000 --- a/packages/multimedia/hts-tvheadend/udev.d/76-tvheadend.rules +++ /dev/null @@ -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" diff --git a/projects/ATV/options b/projects/ATV/options index 5eab3ef318..ccc3da31a2 100644 --- a/projects/ATV/options +++ b/projects/ATV/options @@ -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, diff --git a/projects/Fusion/options b/projects/Fusion/options index 56e7637da7..d0654052b9 100644 --- a/projects/Fusion/options +++ b/projects/Fusion/options @@ -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, diff --git a/projects/Generic/options b/projects/Generic/options index 0ebfe1261b..b6041558d6 100644 --- a/projects/Generic/options +++ b/projects/Generic/options @@ -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, diff --git a/projects/ION/options b/projects/ION/options index b9c97ba1f9..686e01f069 100644 --- a/projects/ION/options +++ b/projects/ION/options @@ -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, diff --git a/projects/Intel/options b/projects/Intel/options index 856775cd5b..b0e9b8c4bb 100644 --- a/projects/Intel/options +++ b/projects/Intel/options @@ -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, diff --git a/scripts/image b/scripts/image index 767124d5eb..7602734010 100755 --- a/scripts/image +++ b/scripts/image @@ -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