diff --git a/packages/addons/service/tvheadend/changelog.txt b/packages/addons/service/tvheadend/changelog.txt new file mode 100644 index 0000000000..2907dab344 --- /dev/null +++ b/packages/addons/service/tvheadend/changelog.txt @@ -0,0 +1,2 @@ +7.0.100 +- initial LibreELEC version \ No newline at end of file diff --git a/packages/addons/service/tvheadend/icon/icon.png b/packages/addons/service/tvheadend/icon/icon.png new file mode 100644 index 0000000000..8512183f04 Binary files /dev/null and b/packages/addons/service/tvheadend/icon/icon.png differ diff --git a/packages/addons/service/tvheadend/package.mk b/packages/addons/service/tvheadend/package.mk new file mode 100644 index 0000000000..7a3b152dfc --- /dev/null +++ b/packages/addons/service/tvheadend/package.mk @@ -0,0 +1,80 @@ +################################################################################ +# This file is part of OpenELEC - http://www.openelec.tv +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# +# OpenELEC 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 of the License, or +# (at your option) any later version. +# +# OpenELEC 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. If not, see . +################################################################################ + +PKG_NAME="tvheadend" +PKG_VERSION="7f3fb87" +PKG_VERSION_NUMBER="4.0.9" +PKG_REV="100" +PKG_ARCH="any" +PKG_LICENSE="GPL" +PKG_SITE="http://www.tvheadend.org" +PKG_URL="https://github.com/tvheadend/tvheadend/archive/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain curl libdvbcsa libressl Python:host" +PKG_PRIORITY="optional" +PKG_SECTION="service.multimedia" +PKG_SHORTDESC="Tvheadend (Version: $PKG_VERSION_NUMBER): is a TV streaming server for Linux." +PKG_LONGDESC="Tvheadend (Version: $PKG_VERSION_NUMBER): is a TV streaming server for Linux supporting DVB-S, DVB-S2, DVB-C, DVB-T, ATSC, IPTV,SAT>IP." + +PKG_IS_ADDON="yes" +PKG_ADDON_NAME="Tvheadend" +PKG_ADDON_TYPE="xbmc.service" +PKG_AUTORECONF="no" +PKG_ADDON_REPOVERSION="7.0" + +post_unpack() { + sed -e 's/VER="0.0.0~unknown"/VER="'$PKG_VERSION_NUMBER' ~ LibreELEC Tvh-addon v'$PKG_ADDON_REPOVERSION'.'$PKG_REV'"/g' -i $PKG_BUILD/support/version +} + +pre_build_target() { + mkdir -p $PKG_BUILD/.$TARGET_NAME + cp -RP $PKG_BUILD/* $PKG_BUILD/.$TARGET_NAME + export CROSS_COMPILE=$TARGET_PREFIX +} + +configure_target() { + ./configure --prefix=/usr \ + --arch=$TARGET_ARCH \ + --cpu=$TARGET_CPU \ + --cc=$TARGET_CC \ + --enable-hdhomerun_client \ + --enable-hdhomerun_static \ + --disable-avahi \ + --disable-libav \ + --enable-inotify \ + --enable-epoll \ + --disable-uriparser \ + --enable-tvhcsa \ + --enable-bundle \ + --enable-dvbcsa \ + --disable-dbus_1 \ + --python=$ROOT/$TOOLCHAIN/bin/python +} + +post_make_target() { + $CC -O -fbuiltin -fomit-frame-pointer -fPIC -shared -o capmt_ca.so src/extra/capmt_ca.c -ldl +} + +makeinstall_target() { + : # nothing to do here +} + +addon() { + mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/bin + cp -P $PKG_BUILD/.$TARGET_NAME/build.linux/tvheadend $ADDON_BUILD/$PKG_ADDON_ID/bin + cp -P $PKG_BUILD/.$TARGET_NAME/capmt_ca.so $ADDON_BUILD/$PKG_ADDON_ID/bin +} diff --git a/packages/addons/service/tvheadend/patches/tvheadend-remove-Werror.patch b/packages/addons/service/tvheadend/patches/tvheadend-remove-Werror.patch new file mode 100644 index 0000000000..142fe05e94 --- /dev/null +++ b/packages/addons/service/tvheadend/patches/tvheadend-remove-Werror.patch @@ -0,0 +1,15 @@ +diff --git a/Makefile b/Makefile +index ddcc47e..0087a6c 100644 +--- a/Makefile ++++ b/Makefile +@@ -28,7 +28,7 @@ PROG := $(BUILDDIR)/tvheadend + # + + CFLAGS += -g -O2 -Wunused-result +-CFLAGS += -Wall -Werror -Wwrite-strings -Wno-deprecated-declarations ++CFLAGS += -Wall -Wwrite-strings -Wno-deprecated-declarations + CFLAGS += -Wmissing-prototypes + CFLAGS += -fms-extensions -funsigned-char -fno-strict-aliasing + CFLAGS += -D_FILE_OFFSET_BITS=64 +-- +1.7.2.5 diff --git a/packages/addons/service/tvheadend/source/bin/tv_grab_file b/packages/addons/service/tvheadend/source/bin/tv_grab_file new file mode 100755 index 0000000000..f657f57421 --- /dev/null +++ b/packages/addons/service/tvheadend/source/bin/tv_grab_file @@ -0,0 +1,40 @@ +#!/bin/sh + +################################################################################ +# This file is part of OpenELEC - http://www.openelec.tv +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# +# OpenELEC 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 of the License, or +# (at your option) any later version. +# +# OpenELEC 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. If not, see . +################################################################################ + +. /etc/profile + +ADDON_HOME="$HOME/.kodi/userdata/addon_data/service.multimedia.tvheadend" +ADDON_SETTINGS="$ADDON_HOME/settings.xml" +XMLTV_TYPE=`grep XMLTV_TYPE $ADDON_SETTINGS | awk '{print $3 }' | sed -e "s,value=,," -e "s,\",,g"` +XMLTV_LOCATION_FILE=`grep XMLTV_LOCATION_FILE $ADDON_SETTINGS | awk '{print $3 }' | sed -e "s,value=,," -e "s,\",,g"` +XMLTV_LOCATION_WEB=`grep XMLTV_LOCATION_WEB $ADDON_SETTINGS | awk '{print $3 }' | sed -e "s,value=,," -e "s,\",,g"` +XMLTV_LOCATION_SCRIPT=`grep XMLTV_LOCATION_SCRIPT $ADDON_SETTINGS | awk '{print $3 }' | sed -e "s,value=,," -e "s,\",,g"` + +if [ "$XMLTV_TYPE" = "FILE" ]; then + cat "$XMLTV_LOCATION_FILE" + exit 0 +elif [ "$XMLTV_TYPE" = "SCRIPT" ]; then + if [ -e "$XMLTV_LOCATION_SCRIPT" ] ; then + exec "$XMLTV_LOCATION_SCRIPT" + fi +elif [ "$XMLTV_TYPE" = "WEB" ]; then + wget -qO - "$XMLTV_LOCATION_WEB" + exit 0 +fi diff --git a/packages/addons/service/tvheadend/source/bin/tvheadend.start b/packages/addons/service/tvheadend/source/bin/tvheadend.start new file mode 100755 index 0000000000..2eb857700e --- /dev/null +++ b/packages/addons/service/tvheadend/source/bin/tvheadend.start @@ -0,0 +1,93 @@ +#!/bin/sh + +################################################################################ +# This file is part of OpenELEC - http://www.openelec.tv +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# +# OpenELEC 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 of the License, or +# (at your option) any later version. +# +# OpenELEC 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. If not, see . +################################################################################ + +. /etc/profile + +oe_setup_addon service.multimedia.tvheadend + +ADDON_SETTINGS="$ADDON_HOME/settings.xml" +XMLTV_FILE="$ADDON_DIR/bin/tv_grab_file" +XMLTV_SETTINGS_DIR="$ADDON_HOME/xmltv" +XMLTV_SETTINGS_FILE="$XMLTV_SETTINGS_DIR/config" +DVR_SETTINGS_DIR="$ADDON_HOME/dvr" +DVR_SETTINGS_FILE="$DVR_SETTINGS_DIR/config" +DVR_DIR="$HOME/recordings" +TIMESHIFT_SETTINGS_DIR="$ADDON_HOME/timeshift" +TIMESHIFT_SETTINGS_FILE="$TIMESHIFT_SETTINGS_DIR/config" +TIMESHIFT_DIR="$ADDON_HOME/cache/timeshift" + +chmod a+x $ADDON_DIR/bin/* + +if [ "$WORKAROUND_SLEEP" == "true" ] ; then + sleep $WORKAROUND_SLEEP_TIME +fi + +if [ ! -f "$XMLTV_SETTINGS_FILE" ]; then + mkdir -p $XMLTV_SETTINGS_DIR + if [ -f $ADDON_DIR/xmltv-config ]; then + cp $ADDON_DIR/xmltv-config $XMLTV_SETTINGS_FILE + fi +fi + +if [ ! -f "$DVR_SETTINGS_FILE" ]; then + mkdir -p $DVR_DIR + mkdir -p $DVR_SETTINGS_DIR + if [ -f $ADDON_DIR/dvr-config ]; then + cp $ADDON_DIR/dvr-config $DVR_SETTINGS_FILE + fi +fi + +if [ ! -f "$TIMESHIFT_SETTINGS_FILE" ]; then + mkdir -p $TIMESHIFT_DIR + mkdir -p $TIMESHIFT_SETTINGS_DIR + if [ -f $ADDON_DIR/timeshift-config ]; then + cp $ADDON_DIR/timeshift-config $TIMESHIFT_SETTINGS_FILE + fi +fi + +if [ "$DEBUG" = "yes" ]; then + TVHEADEND_ARG="-B -C -s -u root -g video -c $ADDON_HOME" +else + TVHEADEND_ARG="-B -C -u root -g video -c $ADDON_HOME" +fi + +# start userspace DVB driver/addon +for driver_dvb in $(find /storage/.kodi/addons/driver.dvb.*/bin/userspace-driver.sh -type f 2>/dev/null); do + driver_dvb_name=$(echo $driver_dvb | awk 'BEGIN {FS="/"} {printf("%s", $5)}') + logger -t Tvheadend "### Loading userspace DVB driver: $driver_dvb_name ###" + # use ". " because of variable export + . $driver_dvb +done + +if [ "$WAIT_FOR_FEINIT" == "true" ] ; then + while [ true ] ; do + if [ -e /dev/dvb/adapter$((NUM_ADAPTERS-1))/frontend0 ] ; then + break + fi + sleep 1 + done +fi + +if [ "$PRELOAD_CAPMT_CA" == "true" ] ; then + logger -t Tvheadend "### Preloading capmt_ca.so library ###" + LD_PRELOAD="$ADDON_DIR/bin/capmt_ca.so $LD_PRELOAD" exec tvheadend $TVHEADEND_ARG &>$ADDON_LOG_FILE +else + exec tvheadend $TVHEADEND_ARG &>$ADDON_LOG_FILE +fi diff --git a/packages/addons/service/tvheadend/source/default.py b/packages/addons/service/tvheadend/source/default.py new file mode 100644 index 0000000000..56d184d880 --- /dev/null +++ b/packages/addons/service/tvheadend/source/default.py @@ -0,0 +1,17 @@ +################################################################################ +# This file is part of OpenELEC - http://www.openelec.tv +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# +# OpenELEC 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 of the License, or +# (at your option) any later version. +# +# OpenELEC 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. If not, see . +################################################################################ diff --git a/packages/addons/service/tvheadend/source/dvr-config b/packages/addons/service/tvheadend/source/dvr-config new file mode 100644 index 0000000000..26b820aaa4 --- /dev/null +++ b/packages/addons/service/tvheadend/source/dvr-config @@ -0,0 +1,15 @@ +{ + "storage": "/storage/recordings", + "retention-days": 31, + "pre-extra-time": 0, + "post-extra-time": 0, + "day-dir": 0, + "channel-dir": 0, + "channel-in-title": 0, + "date-in-title": 0, + "time-in-title": 0, + "whitespace-in-title": 0, + "title-dir": 0, + "episode-in-title": 0, + "tag-files": 1 +} diff --git a/packages/addons/service/tvheadend/source/resources/language/English/strings.xml b/packages/addons/service/tvheadend/source/resources/language/English/strings.xml new file mode 100644 index 0000000000..cb11c7d0a0 --- /dev/null +++ b/packages/addons/service/tvheadend/source/resources/language/English/strings.xml @@ -0,0 +1,20 @@ + + + + + XMLTV + DVB + XMLTV configuration + XMLTV source type + XMLTV File location + XMLTV Web location + XMLTV Script location + DVB Configuration + Unload DVB mudules before suspend + Wait for frontend initialization + Number of adapters to wait for + Preload capmt_ca.so library + Delay the start of Tvheadend + time (s) + + diff --git a/packages/addons/service/tvheadend/source/resources/settings.xml b/packages/addons/service/tvheadend/source/resources/settings.xml new file mode 100644 index 0000000000..910ac2418f --- /dev/null +++ b/packages/addons/service/tvheadend/source/resources/settings.xml @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/packages/addons/service/tvheadend/source/settings-default.xml b/packages/addons/service/tvheadend/source/settings-default.xml new file mode 100644 index 0000000000..0f47b8e232 --- /dev/null +++ b/packages/addons/service/tvheadend/source/settings-default.xml @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/packages/addons/service/tvheadend/source/sleep.d/tvheadend.power b/packages/addons/service/tvheadend/source/sleep.d/tvheadend.power new file mode 100755 index 0000000000..50c83aea18 --- /dev/null +++ b/packages/addons/service/tvheadend/source/sleep.d/tvheadend.power @@ -0,0 +1,44 @@ +#!/bin/sh + +################################################################################ +# This file is part of OpenELEC - http://www.openelec.tv +# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) +# +# OpenELEC 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 of the License, or +# (at your option) any later version. +# +# OpenELEC 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. If not, see . +################################################################################ + +. /etc/profile + +oe_setup_addon service.multimedia.tvheadend + +SERVICE="service.multimedia.tvheadend" + +case "$1" in + pre) + if systemctl is-active "$SERVICE" &>/dev/null ; then + systemctl stop "$SERVICE" + for module in $REMOVE_MODULES ; do + rmmod $module + done + fi + ;; + post) + if systemctl is-enabled "$SERVICE" &>/dev/null ; then + for module in $REMOVE_MODULES ; do + modprobe $module + done + systemctl start "$SERVICE" + fi + ;; +esac diff --git a/packages/addons/service/tvheadend/source/system.d/service.multimedia.tvheadend.service b/packages/addons/service/tvheadend/source/system.d/service.multimedia.tvheadend.service new file mode 100644 index 0000000000..615d46f01a --- /dev/null +++ b/packages/addons/service/tvheadend/source/system.d/service.multimedia.tvheadend.service @@ -0,0 +1,14 @@ +[Unit] +Description=TVHeadend Service +After=network-online.service +Requires=network-online.service + +[Service] +ExecStart=/bin/sh -c "exec sh /storage/.kodi/addons/service.multimedia.tvheadend/bin/tvheadend.start" +TimeoutStopSec=2 +Restart=always +RestartSec=2 +StartLimitInterval=0 + +[Install] +WantedBy=kodi.target diff --git a/packages/addons/service/tvheadend/source/timeshift-config b/packages/addons/service/tvheadend/source/timeshift-config new file mode 100644 index 0000000000..ab43e9660c --- /dev/null +++ b/packages/addons/service/tvheadend/source/timeshift-config @@ -0,0 +1,9 @@ +{ + "enabled": 0, + "ondemand": 0, + "path": "/storage/.kodi/userdata/addon_data/service.multimedia.tvheadend/cache/timeshift", + "unlimited_period": 0, + "max_period": 3600, + "unlimited_size": 0, + "max_size": 1024 +} diff --git a/packages/addons/service/tvheadend/source/xmltv-config b/packages/addons/service/tvheadend/source/xmltv-config new file mode 100644 index 0000000000..7da27e36e0 --- /dev/null +++ b/packages/addons/service/tvheadend/source/xmltv-config @@ -0,0 +1,14 @@ +{ + "grabbers": [ + { + "path": "/storage/.kodi/addons/service.multimedia.tvheadend/bin/tv_grab_file", + "description": "tv_grag_file is a simple grabber that just read the ~/.xmltv/tv_grab_file.xmltv file", + "version": "0.1\n", + "mtime": 1318774706, + "capabilities": 1 + } + ], + "grab-interval": 12, + "grab-enabled": 1, + "current-grabber": "/storage/.kodi/addons/service.multimedia.tvheadend/bin/tv_grab_file" +}