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

Hi,

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 run.sh 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:

Code:
#!/bin/sh
export GUARDIAN_PATH=/media/card/newspapers/Guardian24/
/usr/bin/wired.sh start
/usr/bin/wireless.sh 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 http://download.guardian.co.uk/g24/World.pdf
cp $GUARDIAN_PATH/get-guardian/icon.png $GUARDIAN_PATH/Guardian.pdf/icon.png
/usr/bin/wired.sh stop
/usr/bin/wireless.sh stop
Attached Files
File Type: zip Guardian24.zip (5.4 KB, 561 views)
rio is offline   Reply With Quote