You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

128 lines
6.4 KiB

8 years ago
#!/bin/sh
# Boerse Plugin
# by theobald123 for coolstream
# VERSION=1.3
# *************************************************************************************
# * Datenzeile in einzelne Parameter aufteilen *
# *-----------------------------------------------------------------------------------*
# * �bergabeparameter : Datenzeile *
# *************************************************************************************
Parameter ()
{ pn=$#;p1=$1;p2=$2;p3=$3;p4=$4;p5=$5;p6=$6;p7=$7;p8=$8;p9=$9;p10=$10; }
# *************************************************************************************
# * exit-Steuerung *
# *************************************************************************************
Beenden ()
{
if [ $? = 0 ]; then
break
fi
}
# *************************************************************************************
# * Zeichen ersetzen, HTML-Tags entfernen, Leerzeilen entfernen *
# *-----------------------------------------------------------------------------------*
# * �bergabeparameter : Eingabedatei Ausgabedatei *
# *************************************************************************************
Substitution ()
{
sed -e 's/ä/�/g' -e 's/ä/�/g' -e 's/ä/�/g' \
-e 's/ö/�/g' -e 's/ö/�/g' -e 's/ö/�/g' \
-e 's/ü/�/g' -e 's/ü/�/g' -e 's/ü/�/g' \
-e 's/Ä/�/g' -e 's/Ä/�/g' -e 's/Ä/�/g' \
-e 's/Ö/�/g' -e 's/Ö/�/g' -e 's/Ö/�/g' \
-e 's/Ü/�/g' -e 's/Ü/�/g' -e 's/Ü/�/g' \
-e 's/ß/�/g' -e 's/ß/�/g' -e 's/ß/�/g' \
-e 's/ss�/+/g' \
-e 's/�/e/g' -e 's/é/e/g' \
-e 's/0/0/g' -e 's/1/1/g' -e 's/2/2/g' -e 's/3/3/g' -e 's/4/4/g' -e 's/5/5/g' -e 's/6/6/g' -e 's/7/7/g' -e 's/8/8/g' -e 's/9/9/g' \
-e 's/A/A/g' -e 's/B/B/g' -e 's/C/C/g' -e 's/D/D/g' -e 's/E/E/g' -e 's/F/F/g' -e 's/G/G/g' -e 's/H/H/g' -e 's/I/I/g' -e 's/J/J/g' -e 's/K/K/g' -e 's/L/L/g' -e 's/M/M/g' -e 's/N/N/g' -e 's/O/O/g' -e 's/P/P/g' -e 's/Q/Q/g' -e 's/R/R/g' -e 's/S/S/g' -e 's/T/T/g' -e 's/U/U/g' -e 's/V/V/g' -e 's/W/W/g' -e 's/X/X/g' -e 's/Y/Y/g' -e 's/Z/Z/g' \
-e 's/a/a/g' -e 's/b/b/g' -e 's/c/c/g' -e 's/d/d/g' -e 's/e/e/g' -e 's/f/f/g' -e 's/g/g/g' -e 's/h/h/g' -e 's/i/i/g' -e 's/j/j/g' -e 's/k/k/g' -e 's/l/l/g' -e 's/m/m/g' -e 's/n/n/g' -e 's/o/o/g' -e 's/p/p/g' -e 's/q/q/g' -e 's/r/r/g' -e 's/s/s/g' -e 's/t/t/g' -e 's/u/u/g' -e 's/v/v/g' -e 's/w/w/g' -e 's/x/x/g' -e 's/y/y/g' -e 's/z/z/g' \
-e 's/°/�/g' -e 's/°/�/g' \
-e 's/&/\&/g' \
-e 's/>/>/g' \
-e 's/&lt;/</g' \
-e 's/&nbsp;/ /g' \
-e 's/&plusmn;/+\/-/g' \
-e 's/&euro;/EUR/g' \
-e 's/<br>/ /g' \
-e 's/<[^>]*>//g' \
-e '/^[^0-9a-zA-Z!-\/]*$/d' \
$1 > $2
}
while :; do
# *-----------------------------------------------------------------------------------*
# * Index anfordern *
# *-----------------------------------------------------------------------------------*
auswahl=1
while :; do
msgbox title="Indexauswahl" size=28 order=1 msg="~cBitte ausw~ahlen!" select="DAX,SDAX,MDAX,TecDAX" default=$auswahl
auswahl=$?
case $auswahl in
1)
Index=159096
;;
2)
Index=159191
;;
3)
Index=159090
;;
4)
Index=158375
;;
*)
exit
;;
esac
wget -O /tmp/boerse.txt "http://kurse.boerse.ard.de/ard/indizes_einzelkurs_uebersicht.htn?u=5534156&i=$Index&sektion=einzelwerte"
Substitution /tmp/boerse.txt /tmp/boerse1.txt
# *-----------------------------------------------------------------------------------*
# * Daten ausw�hlen und Liste aufbauen *
# *-----------------------------------------------------------------------------------*
Anfang=`sed -n -e "/Bezeichnung/ =" /tmp/boerse1.txt`; Anfang=`expr "$Anfang" + 1`
Ende=`sed -n -e "/Performance/ =" /tmp/boerse1.txt`; Parameter $Ende; Ende=$p2
tab1=$Anfang; tab2=`expr "$Anfang" + 1`; tab3=`expr "$Anfang" + 2`; tab4=`expr "$Anfang" + 3`; tab5=`expr "$Anfang" + 4`; tab6=`expr "$Anfang" + 5`; step=7
a1=`sed -n -e "$tab1"p /tmp/boerse1.txt`; a1=`echo $a1` # Bezeichnung
a2=`sed -n -e "$tab2"p /tmp/boerse1.txt`; a2=`echo $a2` # aktuell
Head="$a1 : $a2"
tab1=`expr "$tab1" + $step`; tab2=`expr "$tab2" + $step`; tab3=`expr "$tab3" + $step`; tab4=`expr "$tab4" + $step`; tab5=`expr "$tab5" + $step`; tab6=`expr "$tab6" + $step`
while [ "$tab6" -lt "$Ende" ]; do
count=1
echo ~T0100Bezeichnung~T0500aktuell~T0650+/-~T0750%~T0850Zeit~T0950Umsatz in EUR > /tmp/boerse2.txt
while [ $count -le 10 -a "$tab6" -le "$Ende" ]; do
a1=`sed -n -e "$tab1"p /tmp/boerse1.txt`; a1=`echo $a1` # Bezeichnung
a2=`sed -n -e "$tab2"p /tmp/boerse1.txt`; a2=`echo $a2` # aktuell
a3=`sed -n -e "$tab3"p /tmp/boerse1.txt`; a3=`echo $a3` # +/-
a4=`sed -n -e "$tab4"p /tmp/boerse1.txt`; a4=`echo $a4` # %
a5=`sed -n -e "$tab5"p /tmp/boerse1.txt`; a5=`echo $a5` # Zeit
a6=`sed -n -e "$tab6"p /tmp/boerse1.txt`; a6=`echo $a6` # Umsatz
echo ~T0100$a1~T0500$a2~T0650$a3~T0750$a4~T0850$a5~T0950$a6 >> /tmp/boerse2.txt
count=`expr "$count" + 1`
tab1=`expr "$tab1" + $step`; tab2=`expr "$tab2" + $step`; tab3=`expr "$tab3" + $step`; tab4=`expr "$tab4" + $step`; tab5=`expr "$tab5" + $step`; tab6=`expr "$tab6" + $step`
done
# *-----------------------------------------------------------------------------------*
# * Daten ausgeben (Framebuffer) *
# *-----------------------------------------------------------------------------------*
if [ $tab6 -le $Ende ] ; then
msgbox title="$Head" size=26 timeout=180 msg=/tmp/boerse2.txt
else
msgbox title="$Head" size=26 timeout=180 popup=/tmp/boerse2.txt
fi
Beenden
done
done
done
# *-----------------------------------------------------------------------------------*
# * TMP-Dateien loeschen *
# *-----------------------------------------------------------------------------------*
rm /tmp/boerse*.txt