View Single Post
Old 03-27-2008, 06:13 PM   #1
rio is on a distinguished road
Posts: 13
Karma: 56
Join Date: Mar 2008
Location: London
Device: iRex iLiad
The Guardian 24 automatic download


I received my iliad this week and started playing a bit with it...
One thing I wanted was to download automatically the 24h pdf edition of the guardian (a UK newspaper), so I wrote a small script that do just that.

The script starts a network connection, delete any previous downloaded pdf, download the last online pdf from the guardian website, create a folder for the iliad, a manifest (to show an icon and the date of the download), and the stop the network connection.

To install this, download the attached zip, decompress it on your MMC card in newspaper, go in the Guardian24 folder, click on the "Guardian UK" item... and it should just work! (of course you need the shell access for that)

If you want to use it elsewhere, you need to edit the script, and modify the GUARDIAN_PATH variable to point to the location of your choice.

Note that adapting the script to any other resource is trivial, so have fun.

Here is the script itself:

export GUARDIAN_PATH=/media/card/newspapers/Guardian24/
/usr/bin/ start
/usr/bin/ start
rm -rf $GUARDIAN_PATH/Guardian.pdf
mkdir $GUARDIAN_PATH/Guardian.pdf
echo "<?xml version=\"1.0\" encoding=\"utf-8\"?><package><metadata><dc-metadata><Title>The Guardian 24h edition</Title><Description>Downloaded: `echo \`date\``</Description></dc-metadata><y-metadata><startpage>Guardian.pdf</startpage><image>icon.png</image><version>000</version></y-metadata></metadata></package>" > $GUARDIAN_PATH/Guardian.pdf/manifest.xml
wget -O $GUARDIAN_PATH/Guardian.pdf/Guardian.pdf
cp $GUARDIAN_PATH/get-guardian/icon.png $GUARDIAN_PATH/Guardian.pdf/icon.png
/usr/bin/ stop
/usr/bin/ stop
Attached Files
File Type: zip (5.4 KB, 622 views)
rio is offline   Reply With Quote