mirror of
https://github.com/LibreELEC/LibreELEC.tv.git
synced 2025-07-29 13:46:49 +00:00
hdhomerun: added addon settings for modifying tuner type (DVB-C, DVB-T, ATSC) and setting delays
This commit is contained in:
parent
2be7c80a01
commit
6a9d95d161
@ -1,3 +1,7 @@
|
||||
3.0.2
|
||||
- added addon settings for
|
||||
modifying tuner type (DVB-C, DVB-T, ATSC)
|
||||
setting delays
|
||||
3.0.1
|
||||
- bump addon version
|
||||
- binary files are stored with OpenELEC image
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 4.7 KiB After Width: | Height: | Size: 35 KiB |
@ -20,7 +20,7 @@
|
||||
|
||||
PKG_NAME="hdhomerun"
|
||||
PKG_VERSION="3.0"
|
||||
PKG_REV="1"
|
||||
PKG_REV="2"
|
||||
PKG_ARCH="any"
|
||||
PKG_LICENSE="GPL"
|
||||
PKG_SITE="http://www.silicondust.com/products/hdhomerun/dvbt/"
|
||||
@ -31,8 +31,6 @@ PKG_PRIORITY="optional"
|
||||
PKG_SECTION="driver/dvb"
|
||||
PKG_SHORTDESC="A linux DVB driver for the HDHomeRun (http://www.silicondust.com)."
|
||||
PKG_LONGDESC="A linux DVB driver for the HDHomeRun (http://www.silicondust.com)."
|
||||
|
||||
PKG_AUTORECONF="no"
|
||||
|
||||
PKG_IS_ADDON="yes"
|
||||
PKG_ADDON_TYPE="xbmc.python.script"
|
||||
|
4
packages/addons/driver/hdhomerun/settings-default.xml
Normal file
4
packages/addons/driver/hdhomerun/settings-default.xml
Normal file
@ -0,0 +1,4 @@
|
||||
<settings>
|
||||
<setting id="PRE_WAIT" value="2" />
|
||||
<setting id="POST_WAIT" value="1" />
|
||||
</settings>
|
28
packages/addons/driver/hdhomerun/source/bin/hdhomerun.start
Normal file
28
packages/addons/driver/hdhomerun/source/bin/hdhomerun.start
Normal file
@ -0,0 +1,28 @@
|
||||
#!/bin/sh
|
||||
|
||||
################################################################################
|
||||
# This file is part of OpenELEC - http://www.openelec.tv
|
||||
# Copyright (C) 2009-2012 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, 51 Franklin Street, Suite 500, Boston, MA 02110, USA.
|
||||
# http://www.gnu.org/copyleft/gpl.html
|
||||
################################################################################
|
||||
|
||||
. /etc/profile
|
||||
|
||||
ADDON_DIR="$HOME/.xbmc/addons/driver.dvb.hdhomerun"
|
||||
|
||||
logger -t Hdhomerun "### Hdhomerun manual start ###"
|
||||
. $ADDON_DIR/bin/userspace-driver.sh
|
26
packages/addons/driver/hdhomerun/source/bin/hdhomerun.stop
Normal file
26
packages/addons/driver/hdhomerun/source/bin/hdhomerun.stop
Normal file
@ -0,0 +1,26 @@
|
||||
#!/bin/sh
|
||||
|
||||
################################################################################
|
||||
# This file is part of OpenELEC - http://www.openelec.tv
|
||||
# Copyright (C) 2009-2012 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, 51 Franklin Street, Suite 500, Boston, MA 02110, USA.
|
||||
# http://www.gnu.org/copyleft/gpl.html
|
||||
################################################################################
|
||||
|
||||
. /etc/profile
|
||||
|
||||
logger -t Hdhomerun "### Hdhomerun manual stop ###"
|
||||
killall userhdhomerun
|
125
packages/addons/driver/hdhomerun/source/bin/refresh-tuners.py
Normal file
125
packages/addons/driver/hdhomerun/source/bin/refresh-tuners.py
Normal file
@ -0,0 +1,125 @@
|
||||
"""
|
||||
################################################################################
|
||||
# This file is part of OpenELEC - http://www.openelec.tv
|
||||
# Copyright (C) 2009-2013 Stephan Raue (stephan@openelec.tv)
|
||||
# Copyright (C) 2013 ultraman/vpeter
|
||||
#
|
||||
# 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, 51 Franklin Street, Suite 500, Boston, MA 02110, USA.
|
||||
# http://www.gnu.org/copyleft/gpl.html
|
||||
################################################################################
|
||||
"""
|
||||
|
||||
import os
|
||||
import sys
|
||||
import shutil
|
||||
import xmlpp
|
||||
import xbmcaddon
|
||||
|
||||
from xml.dom import minidom
|
||||
from array import array
|
||||
|
||||
__settings__ = xbmcaddon.Addon(id='driver.dvb.hdhomerun')
|
||||
__cwd__ = __settings__.getAddonInfo('path')
|
||||
__settings_xml__ = xbmc.translatePath(os.path.join(__cwd__, 'resources', 'settings.xml'))
|
||||
|
||||
__hdhomerun_log__ = '/var/log/dvbhdhomerun.log'
|
||||
|
||||
# make backup settings only once
|
||||
try:
|
||||
with open(__settings_xml__ + '_orig') as f: pass
|
||||
except IOError as e:
|
||||
shutil.copyfile(__settings_xml__, __settings_xml__ + '_orig')
|
||||
|
||||
######################################################################################################
|
||||
|
||||
# get supported devices on a system (name)
|
||||
tuners = []
|
||||
try:
|
||||
for line in open(__hdhomerun_log__, 'r'):
|
||||
line = line.strip()
|
||||
if line.startswith('Registered tuner'):
|
||||
name = line.split(':');
|
||||
name = name[2].strip()
|
||||
tuners.append(name)
|
||||
except IOError:
|
||||
print 'Error reading log file ', __hdhomerun_log__
|
||||
|
||||
"""
|
||||
root ~ # grep "Registered tuner" /var/log/dvbhdhomerun.log
|
||||
Registered tuner, id from kernel: 0 name: 101ADD2B-0
|
||||
Registered tuner, id from kernel: 1 name: 101ADD2B-1
|
||||
Registered tuner, id from kernel: 2 name: 1031D75A-0
|
||||
Registered tuner, id from kernel: 3 name: 1031D75A-1
|
||||
"""
|
||||
|
||||
######################################################################################################
|
||||
|
||||
xmldoc = minidom.parse(__settings_xml__)
|
||||
category = xmldoc.getElementsByTagName('category')
|
||||
|
||||
# remove all nodes with id started with ATTACHED_TUNER_
|
||||
for node_cat in category:
|
||||
setting = node_cat.getElementsByTagName('setting')
|
||||
for node_set in setting :
|
||||
if 'id' in node_set.attributes.keys() and not node_set.getAttribute('id').find('ATTACHED_TUNER_'):
|
||||
node_set.parentNode.removeChild(node_set)
|
||||
|
||||
# add new ATTACHED_TUNER_ nodes for available tuners
|
||||
for node_cat in category:
|
||||
setting = node_cat.getElementsByTagName('setting')
|
||||
for node_set in setting :
|
||||
if 'label' in node_set.attributes.keys() and '9010' in node_set.getAttribute('label'):
|
||||
for ix, tuner_name in enumerate(tuners):
|
||||
tuner_name_var = tuner_name.replace('-', '_')
|
||||
|
||||
node1 = xmldoc.createElement("setting")
|
||||
node1.setAttribute("id", 'ATTACHED_TUNER_' + tuner_name_var + '_DVBMODE')
|
||||
node1.setAttribute("label", tuner_name)
|
||||
node1.setAttribute("type", 'labelenum')
|
||||
node1.setAttribute("default", 'auto')
|
||||
node1.setAttribute("values", 'auto|ATSC|DVB-C|DVB-T')
|
||||
node_cat.appendChild(node1)
|
||||
|
||||
node2 = xmldoc.createElement("setting")
|
||||
node2.setAttribute("id", 'ATTACHED_TUNER_' + tuner_name_var + '_FULLNAME')
|
||||
node2.setAttribute("label", '9020')
|
||||
node2.setAttribute("type", 'bool')
|
||||
node2.setAttribute("default", 'false')
|
||||
node_cat.appendChild(node2)
|
||||
|
||||
node3 = xmldoc.createElement("setting")
|
||||
node3.setAttribute("id", 'ATTACHED_TUNER_' + tuner_name_var + '_DISABLE')
|
||||
node3.setAttribute("label", '9030')
|
||||
node3.setAttribute("type", 'bool')
|
||||
node3.setAttribute("default", 'false')
|
||||
node_cat.appendChild(node3)
|
||||
|
||||
# for tuner
|
||||
break
|
||||
|
||||
######################################################################################################
|
||||
|
||||
# save file back
|
||||
try:
|
||||
outputfile=open(__settings_xml__, 'w')
|
||||
xmlpp.pprint(xmldoc.toxml(), output=outputfile, indent=2)
|
||||
outputfile.close()
|
||||
except IOError:
|
||||
print 'Error writing file ', __settings_xml__
|
||||
|
||||
######################################################################################################
|
||||
|
||||
# dialog is closed already so just open settings again
|
||||
xbmcaddon.Addon(id='driver.dvb.hdhomerun').openSettings()
|
86
packages/addons/driver/hdhomerun/source/bin/userspace-driver.sh
Executable file → Normal file
86
packages/addons/driver/hdhomerun/source/bin/userspace-driver.sh
Executable file → Normal file
@ -24,6 +24,11 @@
|
||||
|
||||
ADDON_DIR="$HOME/.xbmc/addons/driver.dvb.hdhomerun"
|
||||
ADDON_HOME="$HOME/.xbmc/userdata/addon_data/driver.dvb.hdhomerun"
|
||||
ADDON_SETTINGS="$ADDON_HOME/settings.xml"
|
||||
|
||||
# modules are not automatically loaded
|
||||
modprobe dvb_hdhomerun
|
||||
modprobe dvb_hdhomerun_fe
|
||||
|
||||
mkdir -p $ADDON_HOME
|
||||
|
||||
@ -31,31 +36,84 @@ if [ ! -f "$ADDON_HOME/dvbhdhomerun.sample" ]; then
|
||||
cp $ADDON_DIR/config/* $ADDON_HOME/
|
||||
fi
|
||||
|
||||
if [ ! -f "$ADDON_SETTINGS" ]; then
|
||||
cp $ADDON_DIR/settings-default.xml $ADDON_SETTINGS
|
||||
fi
|
||||
|
||||
mkdir -p /var/config
|
||||
cat "$ADDON_SETTINGS" | awk -F\" '{print $2"=\""$4"\""}' | sed '/^=/d' > /var/config/hdhomerun-addon.conf
|
||||
. /var/config/hdhomerun-addon.conf
|
||||
|
||||
if [ -z "$(pidof userhdhomerun)" ]; then
|
||||
if [ "$ENABLE_TUNER_TYPES" = "true" ]; then
|
||||
DVBHDHOMERUN_CONF_TMP=/tmp/dvbhdhomerun.conf
|
||||
touch $ADDON_HOME/dvbhdhomerun.conf
|
||||
cp $ADDON_HOME/dvbhdhomerun.conf $DVBHDHOMERUN_CONF_TMP
|
||||
|
||||
# get tuner serial numbers
|
||||
SERIALS=$(cat /var/config/hdhomerun-addon.conf | sed -n 's|^ATTACHED_TUNER_\(.*\)_\(.*\)_DVBMODE=.*|\1-\2|gp' | sort | uniq)
|
||||
. /var/config/hdhomerun-addon.conf
|
||||
|
||||
for SERIAL in ${SERIALS[@]}; do
|
||||
SERIAL_VAR=$(echo $SERIAL | sed 's|-|_|')
|
||||
DVBMODE=$(eval echo \$ATTACHED_TUNER_${SERIAL_VAR}_DVBMODE)
|
||||
FULLNAME=$(eval echo \$ATTACHED_TUNER_${SERIAL_VAR}_FULLNAME)
|
||||
DISABLE=$(eval echo \$ATTACHED_TUNER_${SERIAL_VAR}_DISABLE)
|
||||
|
||||
[ "$DVBMODE" = "auto" ] && DVBMODE=""
|
||||
|
||||
# remove setttings for this tuner
|
||||
awk -v val="[$SERIAL]" '$0 == val {flag=1; next} /^tuner_type=|^use_full_name=|^disable=|^#|^$/{if (flag==1) next} /.*/{flag=0; print}' $DVBHDHOMERUN_CONF_TMP >${DVBHDHOMERUN_CONF_TMP}-types
|
||||
mv ${DVBHDHOMERUN_CONF_TMP}-types $DVBHDHOMERUN_CONF_TMP
|
||||
echo "" >>$DVBHDHOMERUN_CONF_TMP
|
||||
# remove empty lines at the end of file
|
||||
sed -i '${/^$/d;}' $DVBHDHOMERUN_CONF_TMP
|
||||
|
||||
ADDNEW=true
|
||||
if [ -n "$DVBMODE" ]; then
|
||||
[ $ADDNEW = true ] && ADDNEW=false && echo "[$SERIAL]" >>$DVBHDHOMERUN_CONF_TMP
|
||||
echo "tuner_type=$DVBMODE" >>$DVBHDHOMERUN_CONF_TMP
|
||||
fi
|
||||
if [ "$FULLNAME" = "true" ]; then
|
||||
[ $ADDNEW = true ] && ADDNEW=false && echo "[$SERIAL]" >>$DVBHDHOMERUN_CONF_TMP
|
||||
echo "use_full_name=true" >>$DVBHDHOMERUN_CONF_TMP
|
||||
fi
|
||||
if [ "$DISABLE" = "true" ]; then
|
||||
[ $ADDNEW = true ] && ADDNEW=false && echo "[$SERIAL]" >>$DVBHDHOMERUN_CONF_TMP
|
||||
echo "disable=true" >>$DVBHDHOMERUN_CONF_TMP
|
||||
fi
|
||||
|
||||
echo "" >>$DVBHDHOMERUN_CONF_TMP
|
||||
done
|
||||
|
||||
md5_1=$(md5sum -b $DVBHDHOMERUN_CONF_TMP | awk '{print $1}')
|
||||
md5_2=$(md5sum -b $ADDON_HOME/dvbhdhomerun.conf | awk '{print $1}')
|
||||
if [ "$md5_1" != "$md5_2" ]; then
|
||||
# file changed - copy to addon home
|
||||
cp $DVBHDHOMERUN_CONF_TMP $ADDON_HOME/dvbhdhomerun.conf
|
||||
fi
|
||||
fi
|
||||
|
||||
rm -f /tmp/dvbhdhomerun
|
||||
if [ -f $ADDON_HOME/dvbhdhomerun.conf ]; then
|
||||
ln -s $ADDON_HOME/dvbhdhomerun.conf /tmp/dvbhdhomerun
|
||||
fi
|
||||
|
||||
# modules are not automatically loaded
|
||||
modprobe dvb_hdhomerun
|
||||
modprobe dvb_hdhomerun_fe
|
||||
usleep 2000000
|
||||
[ -z "$PRE_WAIT" ] && PRE_WAIT=0
|
||||
PRE_WAIT=$(( $PRE_WAIT *1 ))
|
||||
[ -z "$POST_WAIT" ] && POST_WAIT=0
|
||||
POST_WAIT=$(( $POST_WAIT *1 ))
|
||||
|
||||
# could be useful
|
||||
if [ -f $ADDON_HOME/pre-wait.sh ]; then
|
||||
sh $ADDON_HOME/pre-wait.sh
|
||||
fi
|
||||
logger -t HDHomeRun "### Pre wait for $PRE_WAIT sec ###"
|
||||
sleep $PRE_WAIT
|
||||
|
||||
mkdir -p /var/log/
|
||||
rm -f /var/log/dvbhdhomerun.log
|
||||
|
||||
userhdhomerun -f
|
||||
# how much time should we wait?
|
||||
usleep 1000000
|
||||
if [ -f $ADDON_HOME/post-wait.sh ]; then
|
||||
sh $ADDON_HOME/post-wait.sh
|
||||
fi
|
||||
|
||||
logger -t HDHomeRun "### Post wait for $POST_WAIT sec ###"
|
||||
sleep $POST_WAIT
|
||||
|
||||
# save adapter names in background
|
||||
(
|
||||
@ -67,3 +125,5 @@ if [ -z "$(pidof userhdhomerun)" ]; then
|
||||
fi
|
||||
)&
|
||||
fi
|
||||
|
||||
logger -t HDHomeRun "### HDHomeRun ready ###"
|
||||
|
161
packages/addons/driver/hdhomerun/source/bin/xmlpp.py
Normal file
161
packages/addons/driver/hdhomerun/source/bin/xmlpp.py
Normal file
@ -0,0 +1,161 @@
|
||||
"""Pretty print an XML document.
|
||||
|
||||
LICENCE:
|
||||
Copyright (c) 2008, Fredrik Ekholdt
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
* Neither the name of Fredrik Ekholdt nor the names of its contributors may be used to
|
||||
endorse or promote products derived from this software without specific prior
|
||||
written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE."""
|
||||
|
||||
import sys as _sys
|
||||
import re as _re
|
||||
|
||||
def _usage(this_file):
|
||||
return """SYNOPSIS: pretty print an XML document
|
||||
USAGE: python %s <filename> \n""" % this_file
|
||||
|
||||
def _pprint_line(indent_level, line, width=100, output=_sys.stdout):
|
||||
if line.strip():
|
||||
start = ""
|
||||
number_chars = 0
|
||||
for l in range(indent_level):
|
||||
start = start + " "
|
||||
number_chars = number_chars + 1
|
||||
try:
|
||||
elem_start = _re.findall("(\<\W{0,1}\w+:\w+) ?", line)[0]
|
||||
elem_finished = _re.findall("([?|\]\]/]*\>)", line)[0]
|
||||
#should not have *
|
||||
attrs = _re.findall("(\S*?\=\".*?\")", line)
|
||||
output.write(start + elem_start)
|
||||
number_chars = len(start + elem_start)
|
||||
for attr in attrs:
|
||||
if (attrs.index(attr) + 1) == len(attrs):
|
||||
number_chars = number_chars + len(elem_finished)
|
||||
if (number_chars + len(attr) + 1) > width:
|
||||
output.write("\n")
|
||||
for i in range(len(start + elem_start) + 1):
|
||||
output.write(" ")
|
||||
number_chars = len(start + elem_start) + 1
|
||||
else:
|
||||
output.write(" ")
|
||||
number_chars = number_chars + 1
|
||||
output.write(attr)
|
||||
number_chars = number_chars + len(attr)
|
||||
output.write(elem_finished + "\n")
|
||||
except IndexError:
|
||||
#give up pretty print this line
|
||||
output.write(start + line + "\n")
|
||||
|
||||
|
||||
def _pprint_elem_content(indent_level, line, output=_sys.stdout):
|
||||
if line.strip():
|
||||
for l in range(indent_level):
|
||||
output.write(" ")
|
||||
output.write(line + "\n")
|
||||
|
||||
def _get_next_elem(data):
|
||||
start_pos = data.find("<")
|
||||
end_pos = data.find(">") + 1
|
||||
retval = data[start_pos:end_pos]
|
||||
stopper = retval.rfind("/")
|
||||
if stopper < retval.rfind("\""):
|
||||
stopper = -1
|
||||
single = (stopper > -1 and ((retval.find(">") - stopper) < (stopper - retval.find("<"))))
|
||||
|
||||
ignore_excl = retval.find("<!") > -1
|
||||
ignore_question = retval.find("<?") > -1
|
||||
|
||||
if ignore_excl:
|
||||
cdata = retval.find("<![CDATA[") > -1
|
||||
if cdata:
|
||||
end_pos = data.find("]]>")
|
||||
if end_pos > -1:
|
||||
end_pos = end_pos + len("]]>")
|
||||
|
||||
elif ignore_question:
|
||||
end_pos = data.find("?>") + len("?>")
|
||||
ignore = ignore_excl or ignore_question
|
||||
|
||||
no_indent = ignore or single
|
||||
|
||||
#print retval, end_pos, start_pos, stopper > -1, no_indent
|
||||
return start_pos, \
|
||||
end_pos, \
|
||||
stopper > -1, \
|
||||
no_indent
|
||||
|
||||
def get_pprint(xml, indent=4, width=80):
|
||||
"""Returns the pretty printed xml """
|
||||
class out:
|
||||
output = ""
|
||||
|
||||
def write(self, string):
|
||||
self.output += string
|
||||
out = out()
|
||||
pprint(xml, output=out, indent=indent, width=width)
|
||||
|
||||
return out.output
|
||||
|
||||
|
||||
def pprint(xml, output=_sys.stdout, indent=4, width=80):
|
||||
"""Pretty print xml.
|
||||
Use output to select output stream. Default is sys.stdout
|
||||
Use indent to select indentation level. Default is 4 """
|
||||
data = xml
|
||||
indent_level = 0
|
||||
start_pos, end_pos, is_stop, no_indent = _get_next_elem(data)
|
||||
while ((start_pos > -1 and end_pos > -1)):
|
||||
_pprint_elem_content(indent_level, data[:start_pos].strip(),
|
||||
output=output)
|
||||
data = data[start_pos:]
|
||||
if is_stop and not no_indent:
|
||||
indent_level = indent_level - indent
|
||||
_pprint_line(indent_level,
|
||||
data[:end_pos - start_pos],
|
||||
width=width,
|
||||
output=output)
|
||||
data = data[end_pos - start_pos:]
|
||||
if not is_stop and not no_indent :
|
||||
indent_level = indent_level + indent
|
||||
|
||||
if not data:
|
||||
break
|
||||
else:
|
||||
start_pos, end_pos, is_stop, no_indent = _get_next_elem(data)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
if "-h" in _sys.argv or "--help" in _sys.argv:
|
||||
_sys.stderr.write(_usage(_sys.argv[0]))
|
||||
_sys.exit(1)
|
||||
if len(_sys.argv) < 2:
|
||||
_sys.stderr.write(_usage(_sys.argv[0]))
|
||||
_sys.exit(1)
|
||||
else:
|
||||
filename = _sys.argv[1]
|
||||
fh = open(filename)
|
||||
|
||||
pprint(fh.read(), output=_sys.stdout, indent=4, width=80)
|
0
packages/addons/driver/hdhomerun/source/default.py
Executable file → Normal file
0
packages/addons/driver/hdhomerun/source/default.py
Executable file → Normal file
@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
|
||||
<strings>
|
||||
<string id="1000">General</string>
|
||||
<string id="1020">Pre wait time [sec]</string>
|
||||
<string id="1030">Post wait time [sec]</string>
|
||||
|
||||
<string id="9000">Tuner settings</string>
|
||||
<string id="9005">Enable modifying settings</string>
|
||||
<string id="9010">Refresh...</string>
|
||||
<string id="9020"> use full name</string>
|
||||
<string id="9030"> disabled</string>
|
||||
</strings>
|
@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
|
||||
<settings>
|
||||
<category label="1000" >
|
||||
<setting type="sep" />
|
||||
<setting id="PRE_WAIT" type="number" label="1020" default="2" />
|
||||
<setting id="POST_WAIT" type="number" label="1030" default="1" />
|
||||
</category>
|
||||
<category label="9000">
|
||||
<setting type="sep" />
|
||||
<setting id="ENABLE_TUNER_TYPES" type="bool" label="9005" default="true" />
|
||||
<setting label="9010" option="close" type="action" action="RunScript(/storage/.xbmc/addons/driver.dvb.hdhomerun/bin/refresh-tuners.py, false)" />
|
||||
</category>
|
||||
</settings>
|
8
packages/addons/driver/hdhomerun/source/sleep.d/hdhomerun.power
Executable file → Normal file
8
packages/addons/driver/hdhomerun/source/sleep.d/hdhomerun.power
Executable file → Normal file
@ -23,22 +23,22 @@
|
||||
. /etc/profile
|
||||
|
||||
LOCKDIR="/var/lock/"
|
||||
LOCKFILE="hdhomerun"
|
||||
LOCKFILE="$LOCKDIR/hdhomerun"
|
||||
|
||||
case "$1" in
|
||||
hibernate|suspend)
|
||||
if [ -n "$(pidof userhdhomerun)" ]; then
|
||||
progress "Shutting down HDHomeRun driver for suspending..."
|
||||
mkdir -p "$LOCKDIR"
|
||||
touch "$LOCKDIR/$LOCKFILE"
|
||||
touch "$LOCKFILE"
|
||||
killall userhdhomerun
|
||||
fi
|
||||
;;
|
||||
|
||||
thaw|resume)
|
||||
if [ -f "$LOCKDIR/$LOCKFILE" ]; then
|
||||
if [ -f "$LOCKFILE" ]; then
|
||||
# driver started within Tvheadend/VDR
|
||||
rm -rf "$LOCKDIR/$LOCKFILE"
|
||||
rm -f "$LOCKFILE"
|
||||
fi
|
||||
;;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user