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.
 
 
 
 
 
 

187 lines
14 KiB

#!/bin/sh
#
# RSS-Feeds
# by theobald123 , mod by bazi98
# Version: 2.1 Coolstream HD1
# alte Version by musicus
#
# rssnews.sh mit Rechten 755 nach /var/plugins/ kopieren
# benötigt shellexec
#-------------------------------------------------------------------------------------
# Eintragsbeispiel in shellexec.conf vom Flexmenü ohne (#)!
#MENU=RSS-NEWS
# ACTION=&Discountfan,/var/plugins/rssnews.sh "http://www.discountfan.de/rss.xml"
# ACTION=&Sport,/var/plugins/rssnews.sh "http://feeds.feedburner.com/SportTelegramm.xml"
# ACTION=&News,/var/plugins/rssnews.sh "http://www.morgenweb.de/rss/newsticker.xml"
# ACTION=&Ebay,/var/plugins/rssnews.sh "http://shop.ebay.de/i.html?_nkw=coolstream&_rss=1"
#ENDMENU
# für weitere Feeds die http-Adresse und die Beschreibung zwischen "&" und "," ändern
#-------------------------------------------------------------------------------------
# *************************************************************************************
# * 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; }
# *************************************************************************************
# * Zeichen ersetzen, HTML-Tags entfernen, Leerzeilen entfernen *
# *-----------------------------------------------------------------------------------*
# * Übergabeparameter : Eingabedatei Ausgabedatei *
# *************************************************************************************
Substitution ()
{
sed -e 's/ä/ä/g' -e 's/ä/ä/g' -e 's/ä/ä/g' -e 's/$#xe4;/ä/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/Ü/Ü/g' \
-e 's/à/a/g' -e 's/á/a/g' -e 's/â/a/g' -e 's/ã/a/g' -e 's/å/a/g' -e 's/æ/ae/g' \
-e 's/à/a/g' -e 's/á/a/g' -e 's/â/a/g' -e 's/ã/a/g' -e 's/å/a/g' -e 's/æ/ae/g' \
-e 's/À/A/g' -e 's/Á/A/g' -e 's/Â/A/g' -e 's/Ã/A/g' -e 's/Å/A/g' -e 's/Æ/AE/g' \
-e 's/À/A/g' -e 's/Á/A/g' -e 's/Â/A/g' -e 's/Ã/A/g' -e 's/Å/A/g' -e 's/Æ/AE/g' \
-e 's/ç/c/g' -e 's/ç/c/g' \
-e 's/Ç/C/g' -e 's/Ç/C/g' \
-e 's/è/e/g' -e 's/é/e/g' -e 's/ê/e/g' -e 's/ë/e/g' \
-e 's/è/e/g' -e 's/é/e/g' -e 's/ê/e/g' -e 's/ë/e/g' \
-e 's/È/E/g' -e 's/É/E/g' -e 's/Ê/E/g' -e 's/Ë/E/g' \
-e 's/È/E/g' -e 's/É/E/g' -e 's/Ê/E/g' -e 's/Ë/E/g' \
-e 's/ì/i/g' -e 's/í/i/g' -e 's/î/i/g' -e 's/ï/i/g' \
-e 's/ì/i/g' -e 's/í/i/g' -e 's/î/i/g' -e 's/ï/i/g' \
-e 's/Ì/I/g' -e 's/Í/I/g' -e 's/Î/I/g' -e 's/Ï/I/g' \
-e 's/Ì/I/g' -e 's/Í/I/g' -e 's/Î/I/g' -e 's/Ï/I/g' \
-e 's/ñ/n/g' -e 's/ñ/n/g' \
-e 's/Ñ/N/g' -e 's/Ñ/N/g' \
-e 's/ò/o/g' -e 's/ó/o/g' -e 's/ô/o/g' -e 's/õ/o/g' -e 's/ø/o/g' \
-e 's/ò/o/g' -e 's/ó/o/g' -e 's/ô/o/g' -e 's/õ/o/g' -e 's/ø/o/g' \
-e 's/Ò/O/g' -e 's/Ó/O/g' -e 's/Ô/O/g' -e 's/Õ/O/g' -e 's/Ø/O/g' \
-e 's/Ò/O/g' -e 's/Ó/O/g' -e 's/Ô/O/g' -e 's/Õ/O/g' -e 's/×/O/g' \
-e 's/ù/u/g' -e 's/ú/u/g' -e 's/û/u/g' \
-e 's/ù/u/g' -e 's/ú/u/g' -e 's/û/u/g' \
-e 's/ý/y/g' -e 's/ý/y/g' \
-e 's/Ù/U/g' -e 's/Ú/U/g' -e 's/Û/U/g' \
-e 's/Ø/U/g' -e 's/Ù/U/g' -e 's/Ú/U/g' \
-e 's/Ü/Y/g' -e 's/Ý/Y/g' \
-e 's/ß/ß/g' -e 's/ß/ß/g' -e 's/ß/ß/g' -e 's/ß/ß/g' \
-e 's/ss¡/+/g' -e 's/„//g' -e 's/“//g' \
-e 's/é/e/g' -e 's/é/e/g' -e 's/É/E/g' -e 's/á/a/g' -e 's/î/i/g' -e 's/ñ/n/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/"/\"/g' -e 's/„/\"/g' -e 's/“/\"/g' -e "s/'/\"/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/€/EUR/g' \
-e 's/<br>/ /g' \
-e 's/<[^>]*>//g' \
-e '/^[^0-9a-zA-Z!-\/]*$/d' \
$1 > $2
}
# *-----------------------------------------------------------------------------------*
# * RSS-Feed anfordern *
# *************************************************************************************
wget -O /tmp/rss.txt "$1"
echo $(cat /tmp/rss.txt) > /tmp/rss0.txt
# *-----------------------------------------------------------------------------------*
# * Feed-Inhalt extrahieren und Anzahl Items ermitteln *
# *************************************************************************************
sed -e 's/<\/channel>/\n<\/channel>\n/g' -e 's/<channel>/\n<channel>\n/g' \
-e 's/<\/image>/\n<\/image>\n/g' -e 's/<image>/\n<image>\n/g' \
-e 's/<\/item>/\n<\/item>\n/g' -e 's/<item>/\n<item>\n/g' \
-e 's/<\!\[CDATA\[//g' -e 's/\]\]>//g' /tmp/rss0.txt > /tmp/rss1.txt
sed -n -e "/<channel>/,/<\/channel>/ p" /tmp/rss1.txt > /tmp/rss2.txt
sed -e "/<image>/,/<\/image>/ d" /tmp/rss2.txt > /tmp/rss3.txt
sed -e 's/<\/description>/<\/description>\n/g' \
-e 's/<description>/\n|description| /g' \
-e 's/<\/title>/<\/title>\n/g' \
-e 's/\"//g' \
-e 's/<title>/\n|title| /g' /tmp/rss3.txt > /tmp/rss4.txt
Substitution /tmp/rss4.txt /tmp/rss5.txt
sed -n -e "/^|description|/ p" -n -e "/^|title|/ p" /tmp/rss5.txt > /tmp/rss6.txt
Zeilen=`sed -n -e "/^|title|/ =" /tmp/rss6.txt`
Parameter $Zeilen
Zeilen=$pn
# *-----------------------------------------------------------------------------------*
# * Script für Zeilenumbruch und Newsausgabe *
# * Eigene Formatierung für Ebay-Artikel enthalten *
# *-----------------------------------------------------------------------------------*
echo "#!/bin/sh" > /tmp/wrap.sh
echo "" >> /tmp/wrap.sh
echo "echo \$2 > /tmp/wrap.txt" >> /tmp/wrap.sh
echo "ebay=\`sed -n -e \"/| Zur Liste der beobachteten Artikel hinzufügen/ =\" /tmp/wrap.txt\`" >> /tmp/wrap.sh
echo "astra1=\`sed -n -e \"/Service-Typ:/ =\" /tmp/wrap.txt\`" >> /tmp/wrap.sh
echo "astra2=\`sed -n -e \"/Orbitalposition:/ =\" /tmp/wrap.txt\`" >> /tmp/wrap.sh
echo "astra3=\`sed -n -e \"/Transponder-Nummer:/ =\" /tmp/wrap.txt\`" >> /tmp/wrap.sh
echo "if [ -n \$astra1 -a -n \$astra2 -a -n \$astra3 ]; then" >> /tmp/wrap.sh
echo " sed -e 's/Standard:/\nStandard:/g' -e 's/Sprache:/\nSprache:/g' -e 's/Orbitalposition:/\nOrbitalposition:/g' -e 's/Transponder-Nummer:/\nTransponder-Nummer:/g' -e 's/Frequenz (MHz):/\nFrequenz (MHz):/g' -e 's/Service Website:/\nService Website:/g' /tmp/wrap.txt > /tmp/wrap3.txt" >> /tmp/wrap.sh
echo "else" >> /tmp/wrap.sh
echo " if [ \"\$ebay\" != \"\" ]; then" >> /tmp/wrap.sh
echo " sed -e 's/Angebotsende:/\nAngebotsende:/g' -e 's/Sofort-Kaufen/\nSofort-Kaufen/g' -e 's/Jetzt bieten/\nJetzt bieten/g' /tmp/wrap.txt > /tmp/wrap1.txt" >> /tmp/wrap.sh
echo " sed -e \"/Jetzt bieten |/ d\" /tmp/wrap1.txt > /tmp/wrap2.txt" >> /tmp/wrap.sh
echo " sed -e \"/Sofort-Kaufen |/ d\" /tmp/wrap2.txt > /tmp/wrap3.txt" >> /tmp/wrap.sh
echo " else" >> /tmp/wrap.sh
echo " sed -e 's/.\{55\} /&\n/g' /tmp/wrap.txt > /tmp/wrap3.txt" >> /tmp/wrap.sh
echo " fi" >> /tmp/wrap.sh
echo "fi" >> /tmp/wrap.sh
echo "echo FONT=/share/fonts/neutrino.ttf > /tmp/wrap4.txt" >> /tmp/wrap.sh
echo "echo FONTSIZE=28 >> /tmp/wrap4.txt" >> /tmp/wrap.sh
echo "echo HIGHT=480 >> /tmp/wrap4.txt" >> /tmp/wrap.sh
echo "echo WIDTH=800 >> /tmp/wrap4.txt" >> /tmp/wrap.sh
echo "echo LINESPP=15 >> /tmp/wrap4.txt" >> /tmp/wrap.sh
echo "echo MENU= >> /tmp/wrap4.txt" >> /tmp/wrap.sh
echo "echo COMMENT=\$1 >> /tmp/wrap4.txt" >> /tmp/wrap.sh
echo "echo COMMENT=* >> /tmp/wrap4.txt" >> /tmp/wrap.sh
echo "sed -e 's/^/COMMENT= /g' /tmp/wrap3.txt >> /tmp/wrap4.txt" >> /tmp/wrap.sh
echo "echo ENDMENU >> /tmp/wrap4.txt" >> /tmp/wrap.sh
echo "shellexec /tmp/wrap4.txt" >> /tmp/wrap.sh
echo "" >> /tmp/wrap.sh
echo "rm /tmp/wrap*.txt" >> /tmp/wrap.sh
echo "exit 0;" >> /tmp/wrap.sh
chmod 755 /tmp/wrap.sh
# *-----------------------------------------------------------------------------------*
# * Aufbau der Datei für Shellexec *
# *-----------------------------------------------------------------------------------*
title=`sed -n -e "1 s/|title| // p" /tmp/rss6.txt`
echo FONT=/share/fonts/neutrino.ttf > /tmp/rssconfig.conf
echo FONTSIZE=24 >> /tmp/rssconfig.conf
echo HIGHT=480 >> /tmp/rssconfig.conf
echo WIDTH=800 >> /tmp/rssconfig.conf
echo LINESPP=15 >> /tmp/rssconfig.conf
echo MENU=$title >> /tmp/rssconfig.conf
count=2;ind1=3;ind2=4;
while [ "$count" -le "$Zeilen" ]; do
a1=`sed -n -e "$ind1 s/|title| // p" /tmp/rss6.txt`
a2=`sed -n -e "$ind2 s/|description| // p" /tmp/rss6.txt`
count=`expr "$count" + 1`; ind1=`expr "$ind1" + 2`; ind2=`expr "$ind2" + 2`;
echo "ACTION=&'$a1',/tmp/wrap.sh '$a1' '$a2'" >> /tmp/rssconfig.conf
done
echo "ENDMENU" >> /tmp/rssconfig.conf
# *-----------------------------------------------------------------------------------*
# * Ausgabe auf Bildschirm *
# *-----------------------------------------------------------------------------------*
shellexec /tmp/rssconfig.conf
# *-----------------------------------------------------------------------------------*
# * temporäre Dateien löschen *
# *-----------------------------------------------------------------------------------*
rm /tmp/rss*
rm /tmp/wrap.sh
exit 0;