mirror of
https://github.com/LibreELEC/LibreELEC.tv.git
synced 2025-08-05 17:07:49 +00:00
tvheadend: implement posibility to start / stop addon from addon manager with enable / disable addon option
This commit is contained in:
parent
5aa0f6561a
commit
8f549f0911
@ -23,8 +23,8 @@
|
||||
. config/options $1
|
||||
|
||||
mkdir -p $ADDON_BUILD/$PKG_ADDON_ID
|
||||
cp -PR $PKG_DIR/config/settings.xml* $ADDON_BUILD/$PKG_ADDON_ID/settings-default.xml
|
||||
cp -PR $PKG_DIR/config/xmltv-config* $ADDON_BUILD/$PKG_ADDON_ID/xmltv-config
|
||||
cp -PR $PKG_DIR/config/settings.xml $ADDON_BUILD/$PKG_ADDON_ID/settings-default.xml
|
||||
cp -PR $PKG_DIR/config/xmltv-config $ADDON_BUILD/$PKG_ADDON_ID/xmltv-config
|
||||
|
||||
mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/bin
|
||||
cp -P $PKG_BUILD/build.Linux/tvheadend $ADDON_BUILD/$PKG_ADDON_ID/bin
|
||||
|
@ -24,6 +24,7 @@
|
||||
|
||||
ADDON_DIR="$HOME/.xbmc/addons/service.multimedia.hts-tvheadend"
|
||||
ADDON_HOME="$HOME/.xbmc/userdata/addon_data/service.multimedia.hts-tvheadend"
|
||||
ADDON_BIN="tvheadend"
|
||||
LOG_FILE="$ADDON_HOME/service.log"
|
||||
ADDON_SETTINGS="$ADDON_HOME/settings.xml"
|
||||
XMLTV_FILE="$ADDON_DIR/bin/tv_grab_file"
|
||||
@ -39,14 +40,10 @@ if [ ! -f "$XMLTV_SETTINGS_FILE" ]; then
|
||||
cp $ADDON_DIR/xmltv-config $XMLTV_SETTINGS_FILE
|
||||
fi
|
||||
|
||||
if [ ! -f "$XMLTV_FILE" ]; then
|
||||
chmod +x $XMLTV_FILE
|
||||
fi
|
||||
|
||||
TVHEADEND_ARG="-f -C -s -u root -g root -c $ADDON_HOME"
|
||||
TVHEADEND_ARG="-f -C -s -u root -g video -c $ADDON_HOME"
|
||||
|
||||
mkdir -p $ADDON_HOME
|
||||
if [ ! $(pidof tvheadend) ];then
|
||||
if [ ! $(pidof $ADDON_BIN) ]; then
|
||||
# start userspace DVB driver/addon
|
||||
for driver_dvb in $(find /storage/.xbmc/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)}')
|
||||
@ -55,5 +52,5 @@ mkdir -p $ADDON_HOME
|
||||
. $driver_dvb
|
||||
done
|
||||
|
||||
tvheadend $TVHEADEND_ARG &>$LOG_FILE
|
||||
fi
|
||||
$ADDON_BIN $TVHEADEND_ARG &>$LOG_FILE
|
||||
fi
|
29
packages/addons/service/multimedia/hts-tvheadend/source/bin/tvheadend.stop
Executable file
29
packages/addons/service/multimedia/hts-tvheadend/source/bin/tvheadend.stop
Executable file
@ -0,0 +1,29 @@
|
||||
#!/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_BIN="tvheadend"
|
||||
|
||||
if [ $(pidof $ADDON_BIN) ];then
|
||||
killall $ADDON_BIN
|
||||
fi
|
@ -18,15 +18,22 @@
|
||||
# http://www.gnu.org/copyleft/gpl.html
|
||||
################################################################################
|
||||
|
||||
import os
|
||||
import sys
|
||||
import xbmcaddon
|
||||
import xbmc, xbmcaddon, time, os, subprocess
|
||||
|
||||
__scriptname__ = "HTS TVheadend Service"
|
||||
__author__ = "OpenELEC"
|
||||
__url__ = "http://www.openelec.tv"
|
||||
__settings__ = xbmcaddon.Addon(id='service.multimedia.hts-tvheadend')
|
||||
__cwd__ = __settings__.getAddonInfo('path')
|
||||
__path__ = xbmc.translatePath( os.path.join( __cwd__, 'bin', "tvheadend.service") )
|
||||
__start__ = xbmc.translatePath( os.path.join( __cwd__, 'bin', "tvheadend.start") )
|
||||
__stop__ = xbmc.translatePath( os.path.join( __cwd__, 'bin', "tvheadend.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)
|
||||
|
@ -31,14 +31,14 @@ case "$1" in
|
||||
progress "Shutting down HTS TVHeadend for suspending..."
|
||||
mkdir -p "$LOCKDIR"
|
||||
touch "$LOCKDIR/$LOCKFILE"
|
||||
killall tvheadend
|
||||
tvheadend.stop
|
||||
fi
|
||||
;;
|
||||
|
||||
thaw|resume)
|
||||
if [ -f "$LOCKDIR/$LOCKFILE" ];then
|
||||
progress "Restarting HTS TVHeadend for wakeup..."
|
||||
tvheadend.service
|
||||
tvheadend.start
|
||||
rm -rf "$LOCKDIR/$LOCKFILE"
|
||||
fi
|
||||
;;
|
||||
|
Loading…
x
Reference in New Issue
Block a user