Merge branch 'master' of github.com:OpenELEC/OpenELEC.tv into openelec-3.0

This commit is contained in:
Stephan Raue 2013-03-24 15:45:40 +01:00
commit 3771c8eb3a
25 changed files with 647 additions and 332 deletions

View File

@ -24,3 +24,4 @@
mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/config/
cp -P $PKG_DIR/config/* $ADDON_BUILD/$PKG_ADDON_ID/config/
cp -P $PKG_DIR/settings-default.xml $ADDON_BUILD/$PKG_ADDON_ID/

View File

@ -1,23 +1,20 @@
3.0.3
improved python script for modifying tuners
3.0.2
- added addon settings for
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
- addon is used to start userspace program
bump addon version
binary files are stored with OpenELEC image
addon is used to start userspace program
2.1.3
- bump addon version for new kernel
bump addon version for new kernel
2.1.2
- dvbhdhomerun upgraded to 0.0.10
dvbhdhomerun upgraded to 0.0.10
2.1.1
- rebuild for addon version 2.1
rebuild for addon version 2.1
2.0.1
- starting userspace DVB drivers from Tvheadend/VDR
starting userspace DVB drivers from Tvheadend/VDR
2.0.0
- initial version of HDHomeRun driver
initial version of HDHomeRun driver

View File

@ -20,7 +20,7 @@
PKG_NAME="hdhomerun"
PKG_VERSION="3.0"
PKG_REV="2"
PKG_REV="3"
PKG_ARCH="any"
PKG_LICENSE="GPL"
PKG_SITE="http://www.silicondust.com/products/hdhomerun/dvbt/"

View File

@ -1,125 +0,0 @@
"""
################################################################################
# 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()

View File

@ -2,7 +2,7 @@
################################################################################
# This file is part of OpenELEC - http://www.openelec.tv
# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv)
# Copyright (C) 2009-2013 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
@ -67,7 +67,7 @@ if [ -z "$(pidof userhdhomerun)" ]; then
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
sed -i -e ':a' -e '/^\n*$/{$d;N;};/\n$/ba' $DVBHDHOMERUN_CONF_TMP
ADDNEW=true
if [ -n "$DVBMODE" ]; then
@ -86,6 +86,23 @@ if [ -z "$(pidof userhdhomerun)" ]; then
echo "" >>$DVBHDHOMERUN_CONF_TMP
done
# remove logging from libhdhomerun library
awk -v val="[libhdhomerun]" '$0 == val {flag=1; next} /^enable=|^logfile=|^#|^$/{if (flag==1) next} /.*/{flag=0; print}' $DVBHDHOMERUN_CONF_TMP >${DVBHDHOMERUN_CONF_TMP}-log
mv ${DVBHDHOMERUN_CONF_TMP}-log $DVBHDHOMERUN_CONF_TMP
echo "" >>$DVBHDHOMERUN_CONF_TMP
# remove empty lines at the end of file
sed -i -e ':a' -e '/^\n*$/{$d;N;};/\n$/ba' $DVBHDHOMERUN_CONF_TMP
if [ "$LIBHDHOMERUN_LOG" = "true" ]; then
cat >>$DVBHDHOMERUN_CONF_TMP << EOF
[libhdhomerun]
enable=true
logfile=/var/log/dvbhdhomerun_libhdhomerun.log
EOF
fi
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

View File

@ -1,6 +1,6 @@
################################################################################
# This file is part of OpenELEC - http://www.openelec.tv
# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv)
# Copyright (C) 2009-2013 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
@ -21,3 +21,16 @@
import os
import sys
import xbmcaddon
__settings__ = xbmcaddon.Addon(id = 'driver.dvb.hdhomerun')
__cwd__ = __settings__.getAddonInfo('path')
__resources_lib__ = xbmc.translatePath(os.path.join(__cwd__, 'resources', 'lib'))
__settings_xml__ = xbmc.translatePath(os.path.join(__cwd__, 'resources', 'settings.xml'))
__hdhomerun_log__ = '/var/log/dvbhdhomerun.log'
if __name__ == "__main__" and len(sys.argv) == 2 and sys.argv[1] == 'refresh_tuners':
sys.path.append(__resources_lib__)
from functions import refresh_hdhomerun_tuners
refresh_hdhomerun_tuners(__settings_xml__, __hdhomerun_log__)
__settings__.openSettings()

View File

@ -3,10 +3,11 @@
<string id="1000">General</string>
<string id="1020">Pre wait time [sec]</string>
<string id="1030">Post wait time [sec]</string>
<string id="1040">Enable libhdhomerun logging</string>
<string id="9000">Tuner settings</string>
<string id="9005">Enable modifying settings</string>
<string id="9010">Refresh...</string>
<string id="9010">Refresh tuners... (press me)</string>
<string id="9020"> use full name</string>
<string id="9030"> disabled</string>
</strings>

View File

@ -0,0 +1,272 @@
################################################################################
# This file is part of OpenELEC - http://www.openelec.tv
# Copyright (C) 2009-2013 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
################################################################################
import os
import sys
import shutil
import xmlpp
from xml.dom import minidom
__sundtek_userspace__ = '/storage/.xbmc/userdata/addon_data/driver.dvb.sundtek-mediatv/'
######################################################################################################
# backup setting.xml file only if backup doesn't exist
def settings_backup(settings_xml):
try:
with open(settings_xml + '_orig') as f: pass
except IOError as e:
shutil.copyfile(settings_xml, settings_xml + '_orig')
######################################################################################################
# restore setting.xml file from backup
def settings_restore(settings_xml):
try:
shutil.copyfile(settings_xml + '_orig', settings_xml)
except IOError as e:
print 'Error restoring file:', settings_xml
######################################################################################################
# get hdhomerun supported devices on a system (only name like 101ADD2B-0)
def get_devices_hdhomerun(hdhomerun_log):
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 hdhomerun log file', hdhomerun_log
return tuners
"""
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
"""
######################################################################################################
# get sundtek supported devices on a system (name, serial number, type)
def get_devices_sundtek(mediaclient_e):
tuners = []
try:
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']
except IOError:
print 'Error getting sundtek tuners info'
return tuners
"""
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: U110763295205
[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
"""
######################################################################################################
# parse settings.xml file
def parse_settings(settings_xml):
try:
xmldoc = minidom.parse(settings_xml)
category = xmldoc.getElementsByTagName('category')
return xmldoc
except Exception as inst:
print 'Error parse settings file', settings_xml
return None
######################################################################################################
# remove all nodes with id started with ATTACHED_TUNER_
def remove_old_tuners(xmldoc):
category = xmldoc.getElementsByTagName('category')
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 hdhomerun tuners
def add_hdhomerun(xmldoc, node_cat, tuners):
for ix, tuner in enumerate(tuners):
tuner_var = tuner.replace('-', '_')
node1 = xmldoc.createElement("setting")
node1.setAttribute("id", 'ATTACHED_TUNER_' + tuner_var + '_DVBMODE')
node1.setAttribute("label", tuner)
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_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_var + '_DISABLE')
node3.setAttribute("label", '9030')
node3.setAttribute("type", 'bool')
node3.setAttribute("default", 'false')
node_cat.appendChild(node3)
# for tuner
######################################################################################################
# add new sundtek tuners
def add_sundtek(xmldoc, node_cat, tuners):
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", 'file')
node3.setAttribute("mask", '*.map')
node3.setAttribute("default", __sundtek_userspace__)
node_cat.appendChild(node3)
# for tuner
######################################################################################################
# add new ATTACHED_TUNER_ nodes for available tuners
def add_new_tuners(xmldoc, tuners, which):
category = xmldoc.getElementsByTagName('category')
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'):
if which == 'hdhomerun':
add_hdhomerun(xmldoc, node_cat, tuners)
break
elif which == 'sundtek':
add_sundtek(xmldoc, node_cat, tuners)
break
######################################################################################################
# save settings.xml file back
def save_settings(settings_xml, xmldoc):
try:
outputfile = open(settings_xml, 'w')
xmlpp.pprint(xmldoc.toxml(), output = outputfile, indent=2)
outputfile.close()
except IOError:
print 'Error saving file:', settings_xml
settings_restore(settings_xml)
######################################################################################################
# refresh hdhomerun tuners in settings.xml file
def refresh_hdhomerun_tuners(settings_xml, hdhomerun_log):
settings_backup(settings_xml)
tuners = get_devices_hdhomerun(hdhomerun_log)
xmldoc = parse_settings(settings_xml)
if xmldoc == None:
print 'No hdhomerun tuners found'
else:
remove_old_tuners(xmldoc)
add_new_tuners(xmldoc, tuners, 'hdhomerun')
save_settings(settings_xml, xmldoc)
######################################################################################################
# refresh sundtek tuners in settings.xml file
def refresh_sundtek_tuners(settings_xml, mediaclient_e):
settings_backup(settings_xml)
tuners = get_devices_sundtek(mediaclient_e)
xmldoc = parse_settings(settings_xml)
if xmldoc == None:
print 'No sundtek tuners found'
else:
remove_old_tuners(xmldoc)
add_new_tuners(xmldoc, tuners, 'sundtek')
save_settings(settings_xml, xmldoc)

View File

@ -4,10 +4,11 @@
<setting type="sep" />
<setting id="PRE_WAIT" type="number" label="1020" default="2" />
<setting id="POST_WAIT" type="number" label="1030" default="1" />
<setting id="LIBHDHOMERUN_LOG" type="bool" label="1040" default="false" />
</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)" />
<setting label="9010" option="close" type="action" action="RunScript($ID, refresh_tuners)" />
</category>
</settings>

View File

@ -1,3 +1,5 @@
3.0.4
improved python script for modifying tuners
3.0.3
added addon settings for modifying tuner type (DVB-C, DVB-T)
3.0.2

View File

@ -20,7 +20,7 @@
PKG_NAME="sundtek-mediatv"
PKG_VERSION="3.0"
PKG_REV="3"
PKG_REV="4"
PKG_ARCH="any"
PKG_LICENSE="nonfree"
PKG_SITE="http://support.sundtek.com/"

View File

@ -1,172 +0,0 @@
"""
################################################################################
# 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()

View File

@ -2,7 +2,7 @@
################################################################################
# This file is part of OpenELEC - http://www.openelec.tv
# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv)
# Copyright (C) 2009-2013 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
@ -56,6 +56,9 @@ if [ ! -f "$ADDON_SETTINGS" ]; then
cp $ADDON_DIR/settings-default.xml $ADDON_SETTINGS
fi
[ ! -f $ADDON_HOME/rc_key_enter.map ] && mv $ADDON_HOME/rc_key_enter $ADDON_HOME/rc_key_enter.map
[ ! -f $ADDON_HOME/rc_key_ok.map ] && mv $ADDON_HOME/rc_key_ok $ADDON_HOME/rc_key_ok.map
mkdir -p /var/config
cat "$ADDON_SETTINGS" | awk -F\" '{print $2"=\""$4"\""}' | sed '/^=/d' > /var/config/sundtek-addon.conf
. /var/config/sundtek-addon.conf
@ -131,7 +134,7 @@ if [ ! -f $ADDON_HOME/driver-version.txt ]; then
fi
# enable to install same addon package version again
rm -f /storage/.xbmc/addons/packages/driver.dvb.sundtek*
#rm -f /storage/.xbmc/addons/packages/driver.dvb.sundtek*
# add alias for /opt/bin/mediaclient
alias_set="$(grep libmediaclient.so /storage/.profile 2>/dev/null)"
@ -213,7 +216,7 @@ if [ -z "$(pidof mediasrv)" ]; then
mv ${SUNDTEK_CONF_TMP}-net $SUNDTEK_CONF_TMP
echo "" >>$SUNDTEK_CONF_TMP
# remove empty lines at the end of file
sed -i '${/^$/d;}' $SUNDTEK_CONF_TMP
sed -i -e ':a' -e '/^\n*$/{$d;N;};/\n$/ba' $SUNDTEK_CONF_TMP
# add entries
echo -e "\n[NETWORK]" >>$SUNDTEK_CONF_TMP
for dev in $(seq 0 $DEVICE1_NUM); do
@ -245,7 +248,7 @@ if [ -z "$(pidof mediasrv)" ]; then
mv ${SUNDTEK_CONF_TMP}-net $SUNDTEK_CONF_TMP
echo "" >>$SUNDTEK_CONF_TMP
# remove empty lines at the end of file
sed -i '${/^$/d;}' $SUNDTEK_CONF_TMP
sed -i -e ':a' -e '/^\n*$/{$d;N;};/\n$/ba' $SUNDTEK_CONF_TMP
fi
if [ "$ENABLE_TUNER_TYPES" = "true" ]; then
@ -267,15 +270,14 @@ if [ -z "$(pidof mediasrv)" ]; then
[ "$IRPROT" = "NEC" -o "$IRPROT" = "auto" ] && IRPROT=""
KEYMAP_FILE="$ADDON_HOME/$KEYMAP"
[ ! -f $KEYMAP_FILE ] && KEYMAP_FILE=""
[ ! -f $KEYMAP ] && KEYMAP=""
# 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
sed -i -e ':a' -e '/^\n*$/{$d;N;};/\n$/ba' $SUNDTEK_CONF_TMP
ADDNEW=true
if [ -n "$DVBMODE" ]; then
@ -286,9 +288,9 @@ if [ -z "$(pidof mediasrv)" ]; 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
if [ -n "$KEYMAP" ]; then
[ $ADDNEW = true ] && ADDNEW=false && echo -e "\n[$SERIAL]" >>$SUNDTEK_CONF_TMP
echo "rcmap=$KEYMAP_FILE" >>$SUNDTEK_CONF_TMP
echo "rcmap=$KEYMAP" >>$SUNDTEK_CONF_TMP
fi
echo "" >>$SUNDTEK_CONF_TMP

View File

@ -1,6 +1,6 @@
################################################################################
# This file is part of OpenELEC - http://www.openelec.tv
# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv)
# Copyright (C) 2009-2013 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
@ -21,3 +21,18 @@
import os
import sys
import xbmcaddon
__settings__ = xbmcaddon.Addon(id = 'driver.dvb.sundtek-mediatv')
__cwd__ = __settings__.getAddonInfo('path')
__resources_lib__ = xbmc.translatePath(os.path.join(__cwd__, 'resources', 'lib'))
__settings_xml__ = xbmc.translatePath(os.path.join(__cwd__, 'resources', 'settings.xml'))
__mediaclient__ = xbmc.translatePath(os.path.join(__cwd__, 'bin', 'mediaclient'))
__ld_preload__ = xbmc.translatePath(os.path.join(__cwd__, 'lib', 'libmediaclient.so'))
__mediaclient_e__ = 'LD_PRELOAD=' + __ld_preload__ + ' ' + __mediaclient__ + ' -e'
if __name__ == "__main__" and len(sys.argv) == 2 and sys.argv[1] == 'refresh_tuners':
sys.path.append(__resources_lib__)
from functions import refresh_sundtek_tuners
refresh_sundtek_tuners(__settings_xml__, __mediaclient_e__)
__settings__.openSettings()

View File

@ -25,7 +25,7 @@
<string id="9000">Tuner settings</string>
<string id="9005">Enable modifying settings</string>
<string id="9010">Refresh...</string>
<string id="9010">Refresh tuners... (press me)</string>
<string id="9020"> IR protocol</string>
<string id="9030"> keymap filename</string>
</strings>

View File

@ -0,0 +1,272 @@
################################################################################
# This file is part of OpenELEC - http://www.openelec.tv
# Copyright (C) 2009-2013 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
################################################################################
import os
import sys
import shutil
import xmlpp
from xml.dom import minidom
__sundtek_userspace__ = '/storage/.xbmc/userdata/addon_data/driver.dvb.sundtek-mediatv/'
######################################################################################################
# backup setting.xml file only if backup doesn't exist
def settings_backup(settings_xml):
try:
with open(settings_xml + '_orig') as f: pass
except IOError as e:
shutil.copyfile(settings_xml, settings_xml + '_orig')
######################################################################################################
# restore setting.xml file from backup
def settings_restore(settings_xml):
try:
shutil.copyfile(settings_xml + '_orig', settings_xml)
except IOError as e:
print 'Error restoring file:', settings_xml
######################################################################################################
# get hdhomerun supported devices on a system (only name like 101ADD2B-0)
def get_devices_hdhomerun(hdhomerun_log):
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 hdhomerun log file', hdhomerun_log
return tuners
"""
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
"""
######################################################################################################
# get sundtek supported devices on a system (name, serial number, type)
def get_devices_sundtek(mediaclient_e):
tuners = []
try:
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']
except IOError:
print 'Error getting sundtek tuners info'
return tuners
"""
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: U110763295205
[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
"""
######################################################################################################
# parse settings.xml file
def parse_settings(settings_xml):
try:
xmldoc = minidom.parse(settings_xml)
category = xmldoc.getElementsByTagName('category')
return xmldoc
except Exception as inst:
print 'Error parse settings file', settings_xml
return None
######################################################################################################
# remove all nodes with id started with ATTACHED_TUNER_
def remove_old_tuners(xmldoc):
category = xmldoc.getElementsByTagName('category')
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 hdhomerun tuners
def add_hdhomerun(xmldoc, node_cat, tuners):
for ix, tuner in enumerate(tuners):
tuner_var = tuner.replace('-', '_')
node1 = xmldoc.createElement("setting")
node1.setAttribute("id", 'ATTACHED_TUNER_' + tuner_var + '_DVBMODE')
node1.setAttribute("label", tuner)
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_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_var + '_DISABLE')
node3.setAttribute("label", '9030')
node3.setAttribute("type", 'bool')
node3.setAttribute("default", 'false')
node_cat.appendChild(node3)
# for tuner
######################################################################################################
# add new sundtek tuners
def add_sundtek(xmldoc, node_cat, tuners):
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", 'file')
node3.setAttribute("mask", '*.map')
node3.setAttribute("default", __sundtek_userspace__)
node_cat.appendChild(node3)
# for tuner
######################################################################################################
# add new ATTACHED_TUNER_ nodes for available tuners
def add_new_tuners(xmldoc, tuners, which):
category = xmldoc.getElementsByTagName('category')
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'):
if which == 'hdhomerun':
add_hdhomerun(xmldoc, node_cat, tuners)
break
elif which == 'sundtek':
add_sundtek(xmldoc, node_cat, tuners)
break
######################################################################################################
# save settings.xml file back
def save_settings(settings_xml, xmldoc):
try:
outputfile = open(settings_xml, 'w')
xmlpp.pprint(xmldoc.toxml(), output = outputfile, indent=2)
outputfile.close()
except IOError:
print 'Error saving file:', settings_xml
settings_restore(settings_xml)
######################################################################################################
# refresh hdhomerun tuners in settings.xml file
def refresh_hdhomerun_tuners(settings_xml, hdhomerun_log):
settings_backup(settings_xml)
tuners = get_devices_hdhomerun(hdhomerun_log)
xmldoc = parse_settings(settings_xml)
if xmldoc == None:
print 'No hdhomerun tuners found'
else:
remove_old_tuners(xmldoc)
add_new_tuners(xmldoc, tuners, 'hdhomerun')
save_settings(settings_xml, xmldoc)
######################################################################################################
# refresh sundtek tuners in settings.xml file
def refresh_sundtek_tuners(settings_xml, mediaclient_e):
settings_backup(settings_xml)
tuners = get_devices_sundtek(mediaclient_e)
xmldoc = parse_settings(settings_xml)
if xmldoc == None:
print 'No sundtek tuners found'
else:
remove_old_tuners(xmldoc)
add_new_tuners(xmldoc, tuners, 'sundtek')
save_settings(settings_xml, xmldoc)

View File

@ -28,6 +28,6 @@
<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)" />
<setting label="9010" option="close" type="action" action="RunScript($ID, refresh_tuners)" />
</category>
</settings>

View File

@ -36,6 +36,7 @@ cmake -DCMAKE_TOOLCHAIN_FILE=$CMAKE_CONF \
-DWEBIF=1 \
-DWITH_DEBUG=0 \
-DOPTIONAL_INCLUDE_DIR=$SYSROOT_PREFIX/usr/include \
-DSTATIC_LIBUSB=1 \
..
make

View File

@ -1,3 +1,6 @@
3.0.9
- update to oscam-8568
3.0.8
- update to oscam-8469
- update to pcsc-lite-1.8.8

View File

@ -20,8 +20,8 @@
################################################################################
PKG_NAME="oscam"
PKG_VERSION="8469"
PKG_REV="8"
PKG_VERSION="8568"
PKG_REV="9"
PKG_ARCH="any"
PKG_LICENSE="GPL"
PKG_SITE="http://www.streamboard.tv/oscam/wiki"
@ -32,6 +32,7 @@ PKG_PRIORITY="optional"
PKG_SECTION="service/softcam"
PKG_SHORTDESC="oscam: OSCam is Open Source Conditional Access Modul."
PKG_LONGDESC="OSCam is Open Source Conditional Access Modul."
PKG_DISCLAIMER="using oscam may be illegal in your country. if in doubt, do not install"
PKG_IS_ADDON="yes"
PKG_ADDON_TYPE="xbmc.service"

View File

@ -0,0 +1,14 @@
diff --git a/sshconnect2.c b/sshconnect2.c
index d6af0b9..22c0aa6 100644
--- a/sshconnect2.c
+++ b/sshconnect2.c
@@ -1320,8 +1320,7 @@ load_identity_file(char *filename, int userprovided)
struct stat st;
if (stat(filename, &st) < 0) {
- (userprovided ? logit : debug3)("no such identity: %s: %s",
- filename, strerror(errno));
+ debug3("no such identity: %s", filename);
return NULL;
}
private = key_load_private_type(KEY_UNSPEC, filename, "", NULL, &perm_ok);