View Full Version : guardian newpaper down load script


dunryc
05-28-2011, 10:30 AM
sorry about the unimpressive post title I got my prs-350 a few weeks ago and thought i would post the script i use to down load the daily guardian newspaper as a pdf.

System is Ubuntu and it requires pdftk to run I would appreciate any comments that would help me improve this little script.

I run this as a cron job every morning Mon to Fri so if my sony is attached it automatically puts the newest version of the guardian on my device so i can read through it on the way to work

regards dunryc


#!/bin/bash
#check if the prs-350 is attached v9a usb
hal-find-by-capability --capability storage | grep Sony_PRS_350 > deviceattached

#check if the file deviceattached is empty if it is then sony reader is not plugged in

if [ -s deviceattached ]; then

echo "found your sony prs-350"
echo "entering directory"
echo " creating pdf "


#create the guauridan pdf

TODAY=`date +%Y_%m_%d`
wget -r -l1 -H -t1 -nd -N -np -A.pdf -erobots=off http://www.guardian.co.uk/g24
pdftk *.pdf cat output guardian
rm *.pdf
mv guardian guardian.pdf
cp -f guardian.pdf /media/READER/database/media/books
rm -f guardian.pdf

fi