first version makes this patch http://www.dream-multimedia-tv…age=Thread&threadID=12534
/usr/script/python_patcher.sh
(chmod 755)
Bash
#!/bin/sh
# MartiniB #
#
# 2010.04.17 - add EPG FULL_DESCRIPTION to services list(EventName.py)
# 2010.04.17 - remove " if EPG EventName stards and ends with it(EventName.py)
# 2010.04.14 - add orbital position to selected service name(ServiceName.py)
#
pyFilesPath="/usr/lib/enigma2/python/"
pyFilesToPatch="
"Components/Converter/EventName.py"
"Components/Converter/ServiceName.py"
"
foo="$0"
shTMP=${foo%.*}".tmp"
shTXT=${foo%.*}".txt"
n="\n"
t="\t"
t3="\t\t\t"
t4="\t\t\t\t"
t5="\t\t\t\t\t"
comment0="\#"
comment1="\# -"
comment2="\# +"
AddSedLine () {
echo s#"$oldstr".*#"$comment1"\&"$n$comment2$n$newstr$n$comment2"\ END#>>"$pyFilesPath$pyFile".sed
}
PatchPy () {
if [ -e "$pyFilesPath$pyFile".sed ]; then
rm -f "$pyFilesPath$pyFile".sed
fi
case $pyFile in
"Components/Converter/EventName.py")
Check=`grep "^[[:space:]]ID\ =\ 3" $pyFilesPath$pyFile`
if [ "$Check" ]; then
newstr="$t"FULL_DESCRIPTION\ =\ 3"$n$t"ID\ =\ 4
oldstr="$t"ID\ =\ 3
AddSedLine
Check=`grep "^[[:space:]][[:space:]]elif type == \"ID\":" $pyFilesPath$pyFile`
if [ "$Check" ]; then
newstr="$t$t"elif\ type\ ==\ \"FullDescription\":
newstr="$newstr$n$t3"self.type\ =\ self.FULL_DESCRIPTION
newstr="$newstr$n$t$t"elif\ type\ ==\ \"ID\"\ :
oldstr="$t$t"elif\ type\ ==\ \"ID\":
AddSedLine
fi
Check=`grep "^[[:space:]][[:space:]][[:space:]]return\ event.getEventName\(\)" $pyFilesPath$pyFile`
if [ "$Check" ]; then
newstr="$t3"nstr\ =\ event.getEventName\(\)
newstr="$newstr$n$t3"if\ nstr[0:1]\ ==\ \'\\\\\"\'\ and\ nstr[-1]\ ==\ \'\\\\\"\':
newstr="$newstr$n$t4"nstr\ =\ nstr[1:len\(nstr\)-1]
newstr="$newstr$n$t3"return\ nstr
oldstr="$t3"return\ event.getEventName\(\)
AddSedLine
fi
Check=`grep "^[[:space:]][[:space:]]elif\ self.type\ ==\ self.ID:" $pyFilesPath$pyFile`
if [ "$Check" ]; then
newstr="$t$t"elif\ self.type\ ==\ self.FULL_DESCRIPTION:
newstr="$newstr$n$t3"desc\ =\ event.getShortDescription\(\)\ or\ \"\"
newstr="$newstr$n$t3"if\ desc\ !=\ \"\":
newstr="$newstr$n$t4"desc\ =\ desc\ +\ \'\\\\n\\\\n\'
newstr="$newstr$n$t3"desc\ =\ desc\ +\ event.getExtendedDescription\(\)\ or\ \"\"
newstr="$newstr$n$t3"return\ desc
newstr="$newstr$n$t$t"elif\ self.type\ ==\ self.ID\ :
oldstr="$t$t"elif\ self.type\ ==\ self.ID:
AddSedLine
fi
fi
;;
"Components/Converter/ServiceName.py")
Check=`grep "^[[:space:]][[:space:]][[:space:]]return\ name\.replace(.*" $pyFilesPath$pyFile`
if [ "$Check" -a ! `echo "$Check"| grep " + "| sed s/.*\ +\ //` ]; then
newstr="$t4"refstr\ =\ self.getServiceInfoValue\(info,\ iServiceInformation.sServiceref,\ ref\).split\(\':\'\)
newstr="$newstr$n$t4"namespace\ =\ int\(refstr\[6\],\ 16\)\ \>\>\ 16
newstr="$newstr$n$t4"namespace_u\ =\ namespace
newstr="$newstr$n$t3"else:
newstr="$newstr$n$t4"namespace\ =\ service.getData\(4\)\ \>\>\ 16
newstr="$newstr$n$t4"namespace_u\ =\ service.getUnsignedData\(4\)\ \>\>\ 16
newstr="$newstr$n$t3"if\ namespace_u\ \<\ 0:
newstr="$newstr$n$t4"namespace\ +=\ 3600
newstr="$newstr$n$t3"if\ namespace_u\ ==\ 0xFFFF:\ "$comment0"Cable
newstr="$newstr$n$t4"orbposstr\ =\ \"\"\ "$comment0"\"\ \(dvb-c\)\"
newstr="$newstr$n$t3"elif\ namespace_u\ ==\ 0xEEEE:\ "$comment0"Terrestrial
newstr="$newstr$n$t4"orbposstr\ =\ \"\"\ "$comment0"\"\ \(dvb-t\)\"
newstr="$newstr$n$t3"else:
newstr="$newstr$n$t4"if\ namespace\ \>\ 1800:
newstr="$newstr$n$t5"orbposstr\ =\ \"\ \(%.0f%s\)\"\ %\ \(\(3600\ -\ namespace\ +\ 4\)\ \/\ 10,\ \"W\"\)
newstr="$newstr$n$t4"else:
newstr="$newstr$n$t5"orbposstr\ =\ \"\ \(%.0f%s\)\"\ %\ \(\(namespace\ +\ 4\)\ \/\ 10,\ \"E\"\)
newstr="$newstr$n$t3"return\ name.replace\(\'\\\\xc2\\\\x86\',\ \'\'\).replace\(\'\\\\xc2\\\\x87\',\ \'\'\)\ +\ orbposstr
oldstr="$t3"return\ name\.replace\(
AddSedLine
fi
;;
esac
if [ -e "$pyFilesPath$pyFile".sed ]; then
echo patching $pyFilesPath$pyFile
sed -f "$pyFilesPath$pyFile".sed "$pyFilesPath$pyFile">"$pyFilesPath$pyFile".tmp
if [ -s "$pyFilesPath$pyFile".tmp ]; then
mv "$pyFilesPath$pyFile".tmp "$pyFilesPath$pyFile"
else
echo ErRoR - Zero len "$pyFilesPath$pyFile".tmp
fi
fi
}
UpdateMD5list () {
MD5_CRNT=`md5sum $pyFilesPath$pyFile| awk {'print $1'}`
current=`grep " $pyFile " $shTXT| tail -1`
if [ "$current" ]; then
rm -f "$shTMP"
sed s#.*" $pyFile ".*## $shTXT| sed '/^$/d'>"$shTMP"
mv "$shTMP" "$shTXT"
fi
echo "$MD5_CRNT $pyFile "`date +%Y.%m.%d.\ %H:%M:%S`>>"$shTXT"
}
for pyFile in $pyFilesToPatch; do
if [ -e $pyFilesPath$pyFile ]; then
if [ ! -e "$shTXT" ]; then echo "000 $pyFile 000">"$shTXT"; fi
MD5_OLD=`grep " $pyFile " "$shTXT"| awk {'print $1'}`
MD5_CRNT=`md5sum $pyFilesPath$pyFile| awk {'print $1'}`
if [ ! "$MD5_OLD" = "$MD5_CRNT" ]; then
cp $pyFilesPath$pyFile $pyFilesPath$pyFile"_orig_"`date +%y%m%d`
PatchPy
UpdateMD5list
fi
fi
done
exit 0
Alles anzeigen
i call script from my own /etc/rc3.d>S90UserInit (propably will be enough run once after OnlineUpdate, but i dont know how)
(chmod 755)
Bash
#!/bin/sh
[ ! -e /usr/bin ] && mkdir /usr/bin
[ ! -e /usr/keys ] && mkdir /usr/keys
[ ! -e /usr/script ] && mkdir /usr/script
[ ! -e /var/bin ] && ln -s /usr/bin /var/
[ ! -e /var/keys ] && ln -s /usr/keys /var/
[ ! -e /var/script ] && ln -s /usr/script /var/
[ -e /usr/script/python_patcher.sh ] && /usr/script/python_patcher.sh
[ -e /usr/script/skin_patcher.sh ] && /usr/script/skin_patcher.sh
#echo "# Generated by $0">/var/etc/resolv.conf
#echo "nameserver 86.63.180.2">>/var/etc/resolv.conf
#echo "nameserver 195.2.96.2">>/var/etc/resolv.conf
#echo "nameserver 10.0.10.251">>/var/etc/resolv.conf
#echo "nameserver 10.0.10.253">>/var/etc/resolv.conf
#route add SrvDSL gw 10.0.10.253
route add SrvDSL gw 10.0.10.251
#/var/script/reboot_timer.sh 0500 &
#automount --ghost --timeout=1 /autofs file /etc/auto.hotplug
#mount -t nfs -o tcp,rw,nolock,rsize=8192,wsize=8192 10.0.10.99:/mnt/bigdisk /media/net/bigdisk
exit 0
Alles anzeigen