bolle
Aktives Mitglied
- Mitglied seit
- 10 Apr 2006
- Beiträge
- 1,437
- Punkte für Reaktionen
- 0
- Punkte
- 36
so hiermal die refresh.sh
Aber sollte alles passen.
Code:
#!/bin/sh
# refresh infoframe image
# config
localpath="/var/tmp/infoframe"
serverscript="http://xxxxx.de/infoframe/index.php"
samsung_ip_address="192.168.178.21"
samsung_rss_id="189888xxxx"
# try 3 times to download picture until error is displayed
tries=1
while true
do
# download new picture
wget "$serverscript?$1" -O $localpath/tmp.jpg
# do some checks (error/warning string in file? downloaded file should be at least 10k of size?)
# if error occured we do a next try
err=0
warn=0
filesize=0
if [ -f $localpath/tmp.jpg ]
then
err=`grep -i 'error' $localpath/tmp.jpg | wc -l`
warn=`grep -i 'warning' $localpath/tmp.jpg | wc -l`
filesize=`du $localpath/tmp.jpg | cut -f1`
fi
# process checking result
if [ $err == 0 ] && [ $warn == 0 ] && [ $filesize -ge 10 ]
then
mv $localpath/tmp.jpg $localpath/info.jpg
break
else
if [ $tries -ge 3 ]
then
date +%d-%m-%Y_%H-%M-%S >> $localpath/download.log
echo "*** ERROR OR WARNING FOUND: filesize= $filesize ***" >> $localpath/download.log
rm $localpath/tmp.jpg 2> /dev/null
cp $localpath/error.jpg $localpath/info.jpg
break
else
# just wait some seconds, then try again
tries=$(expr $tries + 1)
sleep 5
fi
fi
done
# Samsung SPF-83v specific tasks
# ===============================
# disable and enable picture cache for this rss feed to make immediately refresh possible
wget -s "http://$samsung_ip_address:5050/configuration/storage.htm?CheckRssNameId=$samsung_rss_id&Checked=false"
wget -s "http://$samsung_ip_address:5050/configuration/storage.htm?CheckRssNameId=$samsung_rss_id&Checked=true"
# force samsung picture frame to immediately refresh picture by simulate clicking on "next" in web interface
wget -s "http://$samsung_ip_address:5050/configuration/photo_frame.htm?next"
Aber sollte alles passen.