mirror of
https://github.com/LibreELEC/LibreELEC.tv.git
synced 2025-07-28 13:16:41 +00:00
sundtek-mediatv: added addon settings for modifying tuner type (DVB-C, DVB-T)
This commit is contained in:
parent
7b0b4eec6f
commit
2be7c80a01
@ -1,3 +1,5 @@
|
||||
3.0.3
|
||||
added addon settings for modifying tuner type (DVB-C, DVB-T)
|
||||
3.0.2
|
||||
added addon settings
|
||||
enable HW PID filter (enabled for RPi by default)
|
||||
|
32
packages/addons/driver/sundtek-mediatv/config/rc_key_enter
Normal file
32
packages/addons/driver/sundtek-mediatv/config/rc_key_enter
Normal file
@ -0,0 +1,32 @@
|
||||
0x01 KEY_SELECT
|
||||
0x02 KEY_3
|
||||
0x03 KEY_EXIT
|
||||
0x04 KEY_1
|
||||
0x05 KEY_5
|
||||
0x06 KEY_6
|
||||
0x07 KEY_CHANNELDOWN
|
||||
0x08 KEY_2
|
||||
0x09 KEY_CHANNELUP
|
||||
0x0a KEY_9
|
||||
0x0b KEY_ZOOM
|
||||
0x0c KEY_7
|
||||
0x0d KEY_8
|
||||
0x0e KEY_VOLUMEUP
|
||||
0x0f KEY_4
|
||||
0x10 KEY_BACK
|
||||
0x11 KEY_0
|
||||
0x12 KEY_ENTER
|
||||
0x13 KEY_VOLUMEDOWN
|
||||
0x14 KEY_RECORD
|
||||
0x15 KEY_STOP
|
||||
0x16 KEY_PLAY
|
||||
0x17 KEY_MUTE
|
||||
0x18 KEY_UP
|
||||
0x19 KEY_DOWN
|
||||
0x1a KEY_LEFT
|
||||
0x1b KEY_RIGHT
|
||||
0x1c KEY_RED
|
||||
0x1d KEY_GREEN
|
||||
0x1e KEY_YELLOW
|
||||
0x1f KEY_BLUE
|
||||
0x43 KEY_POWER
|
32
packages/addons/driver/sundtek-mediatv/config/rc_key_ok
Normal file
32
packages/addons/driver/sundtek-mediatv/config/rc_key_ok
Normal file
@ -0,0 +1,32 @@
|
||||
0x01 KEY_SELECT
|
||||
0x02 KEY_3
|
||||
0x03 KEY_EXIT
|
||||
0x04 KEY_1
|
||||
0x05 KEY_5
|
||||
0x06 KEY_6
|
||||
0x07 KEY_CHANNELDOWN
|
||||
0x08 KEY_2
|
||||
0x09 KEY_CHANNELUP
|
||||
0x0a KEY_9
|
||||
0x0b KEY_ZOOM
|
||||
0x0c KEY_7
|
||||
0x0d KEY_8
|
||||
0x0e KEY_VOLUMEUP
|
||||
0x0f KEY_4
|
||||
0x10 KEY_BACK
|
||||
0x11 KEY_0
|
||||
0x12 KEY_OK
|
||||
0x13 KEY_VOLUMEDOWN
|
||||
0x14 KEY_RECORD
|
||||
0x15 KEY_STOP
|
||||
0x16 KEY_PLAY
|
||||
0x17 KEY_MUTE
|
||||
0x18 KEY_UP
|
||||
0x19 KEY_DOWN
|
||||
0x1a KEY_LEFT
|
||||
0x1b KEY_RIGHT
|
||||
0x1c KEY_RED
|
||||
0x1d KEY_GREEN
|
||||
0x1e KEY_YELLOW
|
||||
0x1f KEY_BLUE
|
||||
0x43 KEY_POWER
|
Binary file not shown.
Before Width: | Height: | Size: 2.7 KiB After Width: | Height: | Size: 4.3 KiB |
@ -20,7 +20,7 @@
|
||||
|
||||
PKG_NAME="sundtek-mediatv"
|
||||
PKG_VERSION="3.0"
|
||||
PKG_REV="2"
|
||||
PKG_REV="3"
|
||||
PKG_ARCH="any"
|
||||
PKG_LICENSE="nonfree"
|
||||
PKG_SITE="http://support.sundtek.com/"
|
||||
|
@ -0,0 +1,172 @@
|
||||
"""
|
||||
################################################################################
|
||||
# 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.sundtek-mediatv')
|
||||
__cwd__ = __settings__.getAddonInfo('path')
|
||||
__mediaclient__ = xbmc.translatePath(os.path.join(__cwd__, 'bin', 'mediaclient'))
|
||||
__ld_preload__ = xbmc.translatePath(os.path.join(__cwd__, 'lib', 'libmediaclient.so'))
|
||||
__settings_xml__ = xbmc.translatePath(os.path.join(__cwd__, 'resources', 'settings.xml'))
|
||||
|
||||
__mediaclient_e__ = 'LD_PRELOAD=' + __ld_preload__ + ' ' + __mediaclient__ + ' -e'
|
||||
|
||||
# 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, serial number, type)
|
||||
tuners = []
|
||||
p = os.popen(__mediaclient_e__, "r")
|
||||
while 1:
|
||||
line = p.readline()
|
||||
if not line:
|
||||
break
|
||||
else:
|
||||
str = line.strip()
|
||||
if str.startswith('device '):
|
||||
name = str[str.find("[")+1:str.find("]")]
|
||||
tuners.append([name, 0, 's'])
|
||||
|
||||
if str.startswith('[SERIAL]:'):
|
||||
line = p.readline()
|
||||
str = line.strip()
|
||||
if str.startswith('ID:'):
|
||||
id = str.split(':');
|
||||
id = id[1].strip()
|
||||
tuners[len(tuners)-1] = [name, id, 's']
|
||||
|
||||
if str.startswith('[DVB-C]:'):
|
||||
tuners[len(tuners)-1] = [name, id, 'c']
|
||||
elif str.startswith('[DVB-T]:'):
|
||||
tuners[len(tuners)-1] = [name, id, 'c']
|
||||
elif str.startswith('[DVB-T2]:'):
|
||||
tuners[len(tuners)-1] = [name, id, 'c']
|
||||
|
||||
"""
|
||||
root ~ # mediaclient -e
|
||||
**** List of Media Hardware Devices ****
|
||||
device 0: [Sundtek MediaTV Pro (USB 2.0)] DVB-C, DVB-T, ANALOG-TV, FM-RADIO, REMOTE-CONTROL, OSS-AUDIO, RDS
|
||||
[BUS]:
|
||||
ID: 1-7
|
||||
[SERIAL]:
|
||||
ID: U110714145205
|
||||
[DVB-C]:
|
||||
FRONTEND: /dev/dvb/adapter0/frontend0
|
||||
DVR: /dev/dvb/adapter0/dvr0
|
||||
DMX: /dev/dvb/adapter0/demux0
|
||||
[DVB-T]:
|
||||
FRONTEND: /dev/dvb/adapter0/frontend0
|
||||
DVR: /dev/dvb/adapter0/dvr0
|
||||
DMX: /dev/dvb/adapter0/demux0
|
||||
[ANALOG-TV]:
|
||||
VIDEO0: /dev/video0
|
||||
VBI0: /dev/vbi0
|
||||
[FM-RADIO]:
|
||||
RADIO0: /dev/radio0
|
||||
RDS: /dev/rds0
|
||||
[REMOTECONTROL]:
|
||||
INPUT0: /dev/mediainput0
|
||||
[OSS]:
|
||||
OSS0: /dev/dsp0
|
||||
"""
|
||||
|
||||
######################################################################################################
|
||||
|
||||
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 in enumerate(tuners):
|
||||
tuner_name = tuner[0]
|
||||
tuner_serial = tuner[1]
|
||||
tuner_type = tuner[2]
|
||||
|
||||
node1 = xmldoc.createElement("setting")
|
||||
node1.setAttribute("id", 'ATTACHED_TUNER_' + tuner_serial + '_DVBMODE')
|
||||
node1.setAttribute("label", tuner_name + ", " + tuner_serial)
|
||||
node1.setAttribute("type", 'labelenum')
|
||||
|
||||
if (tuner_type == 's'):
|
||||
node1.setAttribute("default", 'DVB-S')
|
||||
node1.setAttribute("values", 'DVB-S')
|
||||
else:
|
||||
node1.setAttribute("default", 'DVB-C')
|
||||
node1.setAttribute("values", 'DVB-C|DVB-T')
|
||||
|
||||
node_cat.appendChild(node1)
|
||||
|
||||
node2 = xmldoc.createElement("setting")
|
||||
node2.setAttribute("id", 'ATTACHED_TUNER_' + tuner_serial + '_IRPROT')
|
||||
node2.setAttribute("label", '9020')
|
||||
node2.setAttribute("type", 'labelenum')
|
||||
node2.setAttribute("default", 'auto')
|
||||
node2.setAttribute("values", 'auto|RC5|NEC|RC6')
|
||||
node_cat.appendChild(node2)
|
||||
|
||||
node3 = xmldoc.createElement("setting")
|
||||
node3.setAttribute("id", 'ATTACHED_TUNER_' + tuner_serial + '_KEYMAP')
|
||||
node3.setAttribute("label", '9030')
|
||||
node3.setAttribute("type", 'text')
|
||||
node3.setAttribute("default", 'rc_key_ok')
|
||||
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.sundtek-mediatv').openSettings()
|
@ -46,7 +46,7 @@ else
|
||||
if [ -z "$entry_set" ]; then
|
||||
sed -i 's|^device_attach=.*|# device_attach not used anymore\n\n# enable HW PID filter\nuse_hwpidfilter=off\n\n# enable listening on network\nenablenetwork=off|g' $ADDON_HOME/sundtek.conf
|
||||
sed -i 's|^#first_adapter=.*|first_adapter=0|g' $ADDON_HOME/sundtek.conf
|
||||
|
||||
|
||||
sed -i 's|.*network tuner IP address (OpenELEC specific).*||g' $ADDON_HOME/sundtek.conf
|
||||
sed -i 's|.*network_tuner_ip=.*||g' $ADDON_HOME/sundtek.conf
|
||||
fi
|
||||
@ -95,6 +95,7 @@ if [ ! -f $ADDON_DIR/bin/mediasrv ]; then
|
||||
# enable HW PID filter on RPi by default
|
||||
sed -i 's|^use_hwpidfilter=.*|use_hwpidfilter=on|g' $ADDON_DIR/config/sundtek.conf
|
||||
sed -i 's|^use_hwpidfilter=.*|use_hwpidfilter=on|g' $ADDON_HOME/sundtek.conf
|
||||
sed -i 's|.*id="ENABLE_HW_PID_FILTER".*|<setting id="ENABLE_HW_PID_FILTER" value="true" />|' $ADDON_DIR/settings-default.xml
|
||||
sed -i 's|.*id="ENABLE_HW_PID_FILTER".*|<setting id="ENABLE_HW_PID_FILTER" value="true" />|' $ADDON_SETTINGS
|
||||
else
|
||||
logger -t Sundtek "### Unsupported architecture ###"
|
||||
@ -214,7 +215,7 @@ if [ -z "$(pidof mediasrv)" ]; then
|
||||
# remove empty lines at the end of file
|
||||
sed -i '${/^$/d;}' $SUNDTEK_CONF_TMP
|
||||
# add entries
|
||||
echo "[NETWORK]" >>$SUNDTEK_CONF_TMP
|
||||
echo -e "\n[NETWORK]" >>$SUNDTEK_CONF_TMP
|
||||
for dev in $(seq 0 $DEVICE1_NUM); do
|
||||
echo "device=$DEVICE1_IP:$dev" >>$SUNDTEK_CONF_TMP
|
||||
done
|
||||
@ -247,6 +248,53 @@ if [ -z "$(pidof mediasrv)" ]; then
|
||||
sed -i '${/^$/d;}' $SUNDTEK_CONF_TMP
|
||||
fi
|
||||
|
||||
if [ "$ENABLE_TUNER_TYPES" = "true" ]; then
|
||||
# get tuner serial numbers
|
||||
SERIALS=$(cat /var/config/sundtek-addon.conf | sed -n 's|^ATTACHED_TUNER_\(.*\)_DVBMODE=.*|\1|gp' | sort | uniq)
|
||||
. /var/config/sundtek-addon.conf
|
||||
|
||||
for SERIAL in ${SERIALS[@]}; do
|
||||
DVBMODE=$(eval echo \$ATTACHED_TUNER_${SERIAL}_DVBMODE)
|
||||
IRPROT=$(eval echo \$ATTACHED_TUNER_${SERIAL}_IRPROT)
|
||||
KEYMAP=$(eval echo \$ATTACHED_TUNER_${SERIAL}_KEYMAP)
|
||||
|
||||
if [ "$DVBMODE" = "DVB-T" ]; then
|
||||
# only set DVB-T because default is DVB-C (and DVB-S is not set either)
|
||||
DVBMODE="DVBT"
|
||||
else
|
||||
DVBMODE=""
|
||||
fi
|
||||
|
||||
[ "$IRPROT" = "NEC" -o "$IRPROT" = "auto" ] && IRPROT=""
|
||||
|
||||
KEYMAP_FILE="$ADDON_HOME/$KEYMAP"
|
||||
[ ! -f $KEYMAP_FILE ] && KEYMAP_FILE=""
|
||||
|
||||
# remove setttings for this tuner
|
||||
awk -v val="[$SERIAL]" '$0 == val {flag=1; next} /^ir_protocol=|^rcmap=|^initial_dvb_mode=|^#|^$/{if (flag==1) next} /.*/{flag=0; print}' $SUNDTEK_CONF_TMP >${SUNDTEK_CONF_TMP}-types
|
||||
mv ${SUNDTEK_CONF_TMP}-types $SUNDTEK_CONF_TMP
|
||||
echo "" >>$SUNDTEK_CONF_TMP
|
||||
# remove empty lines at the end of file
|
||||
sed -i '${/^$/d;}' $SUNDTEK_CONF_TMP
|
||||
|
||||
ADDNEW=true
|
||||
if [ -n "$DVBMODE" ]; then
|
||||
[ $ADDNEW = true ] && ADDNEW=false && echo -e "\n[$SERIAL]" >>$SUNDTEK_CONF_TMP
|
||||
echo "initial_dvb_mode=$DVBMODE" >>$SUNDTEK_CONF_TMP
|
||||
fi
|
||||
if [ -n "$IRPROT" ]; then
|
||||
[ $ADDNEW = true ] && ADDNEW=false && echo -e "\n[$SERIAL]" >>$SUNDTEK_CONF_TMP
|
||||
echo "ir_protocol=$IRPROT" >>$SUNDTEK_CONF_TMP
|
||||
fi
|
||||
if [ -n "$KEYMAP_FILE" ]; then
|
||||
[ $ADDNEW = true ] && ADDNEW=false && echo -e "\n[$SERIAL]" >>$SUNDTEK_CONF_TMP
|
||||
echo "rcmap=$KEYMAP_FILE" >>$SUNDTEK_CONF_TMP
|
||||
fi
|
||||
|
||||
echo "" >>$SUNDTEK_CONF_TMP
|
||||
done
|
||||
fi
|
||||
|
||||
md5_1=$(md5sum -b $SUNDTEK_CONF_TMP | awk '{print $1}')
|
||||
md5_2=$(md5sum -b $ADDON_HOME/sundtek.conf | awk '{print $1}')
|
||||
if [ "$md5_1" != "$md5_2" ]; then
|
||||
|
161
packages/addons/driver/sundtek-mediatv/source/bin/xmlpp.py
Normal file
161
packages/addons/driver/sundtek-mediatv/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)
|
@ -3,11 +3,12 @@
|
||||
<string id="1000">General</string>
|
||||
<string id="1011">Auto update binary driver</string>
|
||||
<string id="1012">Enable analog TV</string>
|
||||
<string id="1014">Extra settle time</string>
|
||||
<string id="1014">Extra delay [sec]</string>
|
||||
<string id="1015">Run user script</string>
|
||||
<string id="1030">Enable hardware PID filter</string>
|
||||
<string id="1035">Enable IR receiver</string>
|
||||
<string id="1040">Lowest adapter number (/dev/dvb/adapterX/)</string>
|
||||
|
||||
<string id="2000">Networking</string>
|
||||
<string id="2005">Share local tuner over network</string>
|
||||
<string id="2010">Use network shared tuners</string>
|
||||
@ -21,4 +22,10 @@
|
||||
<string id="2051"> # of tuners</string>
|
||||
<string id="2060">Server 5 IP address</string>
|
||||
<string id="2061"> # of tuners</string>
|
||||
|
||||
<string id="9000">Tuner settings</string>
|
||||
<string id="9005">Enable modifying settings</string>
|
||||
<string id="9010">Refresh...</string>
|
||||
<string id="9020"> IR protocol</string>
|
||||
<string id="9030"> keymap filename</string>
|
||||
</strings>
|
||||
|
@ -1,7 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
|
||||
<settings>
|
||||
<category label="1000" >
|
||||
<setting label="" type="lsep" />
|
||||
<setting type="sep" />
|
||||
<setting id="AUTO_UPDATE" type="bool" label="1011" default="false" />
|
||||
<setting id="ANALOG_TV" type="bool" label="1012" default="false" enable="false" />
|
||||
@ -12,7 +11,6 @@
|
||||
<setting id="LOWEST_ADAPTER_NUM" type="number" label="1040" default="0" />
|
||||
</category>
|
||||
<category label="2000" >
|
||||
<setting label="" type="lsep" />
|
||||
<setting type="sep" />
|
||||
<setting id="ALLOW_NET_USE" type="bool" label="2005" default="false" />
|
||||
<setting id="USE_NET_TUNERS" type="bool" label="2010" default="false" />
|
||||
@ -27,4 +25,9 @@
|
||||
<setting id="DEVICE5_IP" type="ipaddress" label="2060" default="" visible="eq(-9,true)" />
|
||||
<setting id="DEVICE5_NUM" type="labelenum" label="2061" default="1" values="1|5|4|3|2" visible="eq(-10,true)" />
|
||||
</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.sundtek-mediatv/bin/refresh-tuners.py, false)" />
|
||||
</category>
|
||||
</settings>
|
||||
|
Loading…
x
Reference in New Issue
Block a user