mirror of
https://github.com/LibreELEC/LibreELEC.tv.git
synced 2025-07-31 22:47:51 +00:00
Merge branch 'master' of github.com:OpenELEC/OpenELEC.tv
This commit is contained in:
commit
dfd5e2fd95
@ -23,9 +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
|
||||
cp -P $BUILD/w_scan-[0-9]*/w_scan $ADDON_BUILD/$PKG_ADDON_ID/bin
|
||||
|
@ -1,3 +1,8 @@
|
||||
2.0.6
|
||||
- add possibilty to start / stop addon from addon manager with enable / disable
|
||||
- add possibility to browse filesystem for xmltv source file
|
||||
- start tvheadend in video user group
|
||||
|
||||
2.0.5
|
||||
- start userspace DVB drivers before Tvheadend
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
<settings>
|
||||
<setting id="XMLTV_LOCATION" value="" />
|
||||
<setting id="XMLTV_LOCATION_FILE" value="" />
|
||||
<setting id="XMLTV_LOCATION_WEB" value="http://" />
|
||||
<setting id="XMLTV_TYPE" value="NONE" />
|
||||
</settings>
|
||||
|
@ -20,7 +20,7 @@
|
||||
|
||||
PKG_NAME="hts-tvheadend"
|
||||
PKG_VERSION="fdf89b2"
|
||||
PKG_REV="5"
|
||||
PKG_REV="6"
|
||||
PKG_ARCH="any"
|
||||
PKG_LICENSE="GPL"
|
||||
PKG_SITE="http://www.lonelycoder.com/hts/tvheadend_overview.html"
|
||||
|
@ -25,7 +25,8 @@
|
||||
ADDON_HOME="$HOME/.xbmc/userdata/addon_data/service.multimedia.hts-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=`grep XMLTV_LOCATION $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"`
|
||||
|
||||
dflag=
|
||||
vflag=
|
||||
@ -33,10 +34,10 @@ cflag=
|
||||
|
||||
if [[ $# -lt 1 ]]; then
|
||||
if [ "$XMLTV_TYPE" = "FILE" ]; then
|
||||
cat "$XMLTV_LOCATION"
|
||||
cat "$XMLTV_LOCATION_FILE"
|
||||
exit 0
|
||||
elif [ "$XMLTV_TYPE" = "WEB" ]; then
|
||||
wget -qO - "$XMLTV_LOCATION"
|
||||
wget -qO - "$XMLTV_LOCATION_WEB"
|
||||
exit 0
|
||||
fi
|
||||
fi
|
||||
|
@ -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)
|
||||
|
@ -1,10 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
|
||||
<strings>
|
||||
|
||||
<!-- SABnzbd-Suite -->
|
||||
<!-- HTS TVHEADEND -->
|
||||
<string id="1000">XMLTV</string>
|
||||
<string id="1011">XMLTV configuration</string>
|
||||
<string id="1011">XMLTV source type</string>
|
||||
<string id="1012">XMLTV location</string>
|
||||
<string id="1012">XMLTV File location</string>
|
||||
<string id="1013">XMLTV Web location</string>
|
||||
|
||||
</strings>
|
||||
|
@ -6,6 +6,7 @@
|
||||
<setting label="1010" type="lsep"/>
|
||||
<setting type="sep" />
|
||||
<setting id="XMLTV_TYPE" type="labelenum" label="1011" values="NONE|FILE|WEB" sort="yes" default="NONE"/>
|
||||
<setting id="XMLTV_LOCATION" type="text" label="1012" default="" enable="!eq(-1,1)"/>
|
||||
<setting id="XMLTV_LOCATION_FILE" type="file" label="1012" default="" enable="eq(-1,0)"/>
|
||||
<setting id="XMLTV_LOCATION_WEB" type="text" label="1013" default="http://" enable="eq(-2,2)"/>
|
||||
</category>
|
||||
</settings>
|
||||
|
@ -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
|
||||
;;
|
||||
|
@ -0,0 +1,71 @@
|
||||
From e6bf089bbf486c9879d3abc5ce31a99b67558ea7 Mon Sep 17 00:00:00 2001
|
||||
From: Memphiz <memphis@machzwo.de>
|
||||
Date: Sat, 11 Feb 2012 17:28:52 +0100
|
||||
Subject: [PATCH] [fix] - let the scripts react on the abortRequest before
|
||||
killing them
|
||||
|
||||
---
|
||||
xbmc/interfaces/python/XBPyThread.cpp | 18 ++++++++++++++++++
|
||||
xbmc/interfaces/python/XBPyThread.h | 2 ++
|
||||
2 files changed, 20 insertions(+), 0 deletions(-)
|
||||
|
||||
diff --git a/xbmc/interfaces/python/XBPyThread.cpp b/xbmc/interfaces/python/XBPyThread.cpp
|
||||
index c9f0a12..d3c616f 100644
|
||||
--- a/xbmc/interfaces/python/XBPyThread.cpp
|
||||
+++ b/xbmc/interfaces/python/XBPyThread.cpp
|
||||
@@ -375,6 +375,13 @@ void XBPyThread::Process()
|
||||
PyThreadState_Swap(NULL);
|
||||
PyEval_ReleaseLock();
|
||||
|
||||
+ //set stopped event - this allows ::stop to run and kill remaining threads
|
||||
+ //this event has to be fired without holding m_pExecuter->m_critSection
|
||||
+ //before
|
||||
+ //Also the GIL (PyEval_AcquireLock) must not be held
|
||||
+ //if not obeyed there is still no deadlock because ::stop waits with timeout (smart one!)
|
||||
+ stoppedEvent.Set();
|
||||
+
|
||||
{ CSingleLock lock(m_pExecuter->m_critSection);
|
||||
m_threadState = NULL;
|
||||
}
|
||||
@@ -428,6 +435,17 @@ void XBPyThread::stop()
|
||||
if(!m || PyObject_SetAttrString(m, (char*)"abortRequested", PyBool_FromLong(1)))
|
||||
CLog::Log(LOGERROR, "XBPyThread::stop - failed to set abortRequested");
|
||||
|
||||
+ PyThreadState_Swap(old);
|
||||
+ PyEval_ReleaseLock();
|
||||
+
|
||||
+ if(!stoppedEvent.WaitMSec(5000))//let the script 5 secs for shut stuff down
|
||||
+ {
|
||||
+ CLog::Log(LOGERROR, "XBPyThread::stop - script didn't stop in proper time - lets kill it");
|
||||
+ }
|
||||
+
|
||||
+ //everything which didn't exit by now gets killed
|
||||
+ PyEval_AcquireLock();
|
||||
+ old = PyThreadState_Swap((PyThreadState*)m_threadState);
|
||||
for(PyThreadState* state = ((PyThreadState*)m_threadState)->interp->tstate_head; state; state = state->next)
|
||||
{
|
||||
Py_XDECREF(state->async_exc);
|
||||
diff --git a/xbmc/interfaces/python/XBPyThread.h b/xbmc/interfaces/python/XBPyThread.h
|
||||
index 2b83b52..55a6fbd 100644
|
||||
--- a/xbmc/interfaces/python/XBPyThread.h
|
||||
+++ b/xbmc/interfaces/python/XBPyThread.h
|
||||
@@ -23,6 +23,7 @@
|
||||
#define XBPYTHREAD_H_
|
||||
|
||||
#include "threads/Thread.h"
|
||||
+#include "threads/Event.h"
|
||||
#include "addons/IAddon.h"
|
||||
|
||||
class XBPython;
|
||||
@@ -42,6 +43,7 @@ class XBPyThread : public CThread
|
||||
|
||||
protected:
|
||||
XBPython *m_pExecuter;
|
||||
+ CEvent stoppedEvent;
|
||||
void *m_threadState;
|
||||
|
||||
char m_type;
|
||||
--
|
||||
1.7.5.4
|
||||
|
||||
|
@ -0,0 +1,71 @@
|
||||
From e6bf089bbf486c9879d3abc5ce31a99b67558ea7 Mon Sep 17 00:00:00 2001
|
||||
From: Memphiz <memphis@machzwo.de>
|
||||
Date: Sat, 11 Feb 2012 17:28:52 +0100
|
||||
Subject: [PATCH] [fix] - let the scripts react on the abortRequest before
|
||||
killing them
|
||||
|
||||
---
|
||||
xbmc/interfaces/python/XBPyThread.cpp | 18 ++++++++++++++++++
|
||||
xbmc/interfaces/python/XBPyThread.h | 2 ++
|
||||
2 files changed, 20 insertions(+), 0 deletions(-)
|
||||
|
||||
diff --git a/xbmc/interfaces/python/XBPyThread.cpp b/xbmc/interfaces/python/XBPyThread.cpp
|
||||
index c9f0a12..d3c616f 100644
|
||||
--- a/xbmc/interfaces/python/XBPyThread.cpp
|
||||
+++ b/xbmc/interfaces/python/XBPyThread.cpp
|
||||
@@ -375,6 +375,13 @@ void XBPyThread::Process()
|
||||
PyThreadState_Swap(NULL);
|
||||
PyEval_ReleaseLock();
|
||||
|
||||
+ //set stopped event - this allows ::stop to run and kill remaining threads
|
||||
+ //this event has to be fired without holding m_pExecuter->m_critSection
|
||||
+ //before
|
||||
+ //Also the GIL (PyEval_AcquireLock) must not be held
|
||||
+ //if not obeyed there is still no deadlock because ::stop waits with timeout (smart one!)
|
||||
+ stoppedEvent.Set();
|
||||
+
|
||||
{ CSingleLock lock(m_pExecuter->m_critSection);
|
||||
m_threadState = NULL;
|
||||
}
|
||||
@@ -428,6 +435,17 @@ void XBPyThread::stop()
|
||||
if(!m || PyObject_SetAttrString(m, (char*)"abortRequested", PyBool_FromLong(1)))
|
||||
CLog::Log(LOGERROR, "XBPyThread::stop - failed to set abortRequested");
|
||||
|
||||
+ PyThreadState_Swap(old);
|
||||
+ PyEval_ReleaseLock();
|
||||
+
|
||||
+ if(!stoppedEvent.WaitMSec(5000))//let the script 5 secs for shut stuff down
|
||||
+ {
|
||||
+ CLog::Log(LOGERROR, "XBPyThread::stop - script didn't stop in proper time - lets kill it");
|
||||
+ }
|
||||
+
|
||||
+ //everything which didn't exit by now gets killed
|
||||
+ PyEval_AcquireLock();
|
||||
+ old = PyThreadState_Swap((PyThreadState*)m_threadState);
|
||||
for(PyThreadState* state = ((PyThreadState*)m_threadState)->interp->tstate_head; state; state = state->next)
|
||||
{
|
||||
Py_XDECREF(state->async_exc);
|
||||
diff --git a/xbmc/interfaces/python/XBPyThread.h b/xbmc/interfaces/python/XBPyThread.h
|
||||
index 2b83b52..55a6fbd 100644
|
||||
--- a/xbmc/interfaces/python/XBPyThread.h
|
||||
+++ b/xbmc/interfaces/python/XBPyThread.h
|
||||
@@ -23,6 +23,7 @@
|
||||
#define XBPYTHREAD_H_
|
||||
|
||||
#include "threads/Thread.h"
|
||||
+#include "threads/Event.h"
|
||||
#include "addons/IAddon.h"
|
||||
|
||||
class XBPython;
|
||||
@@ -42,6 +43,7 @@ class XBPyThread : public CThread
|
||||
|
||||
protected:
|
||||
XBPython *m_pExecuter;
|
||||
+ CEvent stoppedEvent;
|
||||
void *m_threadState;
|
||||
|
||||
char m_type;
|
||||
--
|
||||
1.7.5.4
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user