Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Readers > More E-Book Readers > iRex

Notices

Reply
 
Thread Tools Search this Thread
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, 916 views)
rio is offline   Reply With Quote
Old 03-27-2008, 06:33 PM   #2
m-reader
Guru
m-reader rocks like Gibraltar!m-reader rocks like Gibraltar!m-reader rocks like Gibraltar!m-reader rocks like Gibraltar!m-reader rocks like Gibraltar!m-reader rocks like Gibraltar!m-reader rocks like Gibraltar!m-reader rocks like Gibraltar!m-reader rocks like Gibraltar!m-reader rocks like Gibraltar!m-reader rocks like Gibraltar!
 
Posts: 785
Karma: 100000
Join Date: Dec 2007
Device: Sony PRS-300. PRS-650, PRS-900, iPad2, Iconia A500, Irex Iliad (sold)
Well done mate, if there ever was a reason to install shell access on my iLiad, this is it!
m-reader is offline   Reply With Quote
Advert
Old 03-27-2008, 09:39 PM   #3
carandol
Evangelist
carandol ought to be getting tired of karma fortunes by now.carandol ought to be getting tired of karma fortunes by now.carandol ought to be getting tired of karma fortunes by now.carandol ought to be getting tired of karma fortunes by now.carandol ought to be getting tired of karma fortunes by now.carandol ought to be getting tired of karma fortunes by now.carandol ought to be getting tired of karma fortunes by now.carandol ought to be getting tired of karma fortunes by now.carandol ought to be getting tired of karma fortunes by now.carandol ought to be getting tired of karma fortunes by now.carandol ought to be getting tired of karma fortunes by now.
 
carandol's Avatar
 
Posts: 423
Karma: 2153430
Join Date: Dec 2007
Device: BeBook
This is excellent idea, I've been wondering how to download Guardian 24, but lack the programming knowledge...

However, I've given it a go, and there's something not working for me. I changed the path to /media/cf/newspapers/Guardian24/ to suit my iLiad. It seems to go online, and downloads a file with a correct datestamp, but when I try to load the file, the progress bar flashes and then stops with no result. Looking at the file from my linux PC, it shows as an empty file. I've checked my wifi connection, and it's definitely working, I've checked the Guardian 24 file online and it's definitely up, so I don't know what else to try. Any help much appreciated!
carandol is offline   Reply With Quote
Old 03-27-2008, 10:31 PM   #4
rio
Member
rio is on a distinguished road
 
Posts: 13
Karma: 56
Join Date: Mar 2008
Location: London
Device: iRex iLiad
Quote:
Originally Posted by carandol View Post
However, I've given it a go, and there's something not working for me. I changed the path to /media/cf/newspapers/Guardian24/ to suit my iLiad. It seems to go online, and downloads a file with a correct datestamp, but when I try to load the file, the progress bar flashes and then stops with no result. Looking at the file from my linux PC, it shows as an empty file. I've checked my wifi connection, and it's definitely working, I've checked the Guardian 24 file online and it's definitely up, so I don't know what else to try. Any help much appreciated!
What you describe happens when the file is not downloaded -- the folder and all the rest will still be created by the script, so it /looks/ like it's fine, but there's no content...

My guess is that the iliad did not manage to get an internet connection. I only tried with a wired connection, maybe that's a reason (although it should have worked anyway...).

Are you sure you configured your network connection on the iliad ? If you open mrxvt and type ifconfig what is shown ? and if you then manualltry try to initiate the internet connection (type "/usr/bin/wired.sh start" or /usr/bin/wireless.sh start) what is displayed ?
rio is offline   Reply With Quote
Old 03-27-2008, 10:39 PM   #5
ksira
Junior Member
ksira began at the beginning.
 
Posts: 7
Karma: 10
Join Date: Feb 2008
Device: Iliad
Hi, I hope I can help, but I just started playing around with wireless access.

I think you might try and specify the ssid and security when using wireless.sh

edit the run.sh line to:

Code:
$/usr/bin/wireless.sh start [network ssid] [encyrption] [key]
BTW the wired version worked fine for me.
ksira is offline   Reply With Quote
Advert
Old 03-28-2008, 09:33 AM   #6
carandol
Evangelist
carandol ought to be getting tired of karma fortunes by now.carandol ought to be getting tired of karma fortunes by now.carandol ought to be getting tired of karma fortunes by now.carandol ought to be getting tired of karma fortunes by now.carandol ought to be getting tired of karma fortunes by now.carandol ought to be getting tired of karma fortunes by now.carandol ought to be getting tired of karma fortunes by now.carandol ought to be getting tired of karma fortunes by now.carandol ought to be getting tired of karma fortunes by now.carandol ought to be getting tired of karma fortunes by now.carandol ought to be getting tired of karma fortunes by now.
 
carandol's Avatar
 
Posts: 423
Karma: 2153430
Join Date: Dec 2007
Device: BeBook
Afraid I don't have mrxvt installed (unless it comes as standard and I've not found it?). But iNewstand is definitely connecting, so it can't be a bad connection. I'll try adding ksira's line to the script, and if/when I have time, I'll look up mrxvt.
carandol is offline   Reply With Quote
Old 03-28-2008, 09:46 AM   #7
carandol
Evangelist
carandol ought to be getting tired of karma fortunes by now.carandol ought to be getting tired of karma fortunes by now.carandol ought to be getting tired of karma fortunes by now.carandol ought to be getting tired of karma fortunes by now.carandol ought to be getting tired of karma fortunes by now.carandol ought to be getting tired of karma fortunes by now.carandol ought to be getting tired of karma fortunes by now.carandol ought to be getting tired of karma fortunes by now.carandol ought to be getting tired of karma fortunes by now.carandol ought to be getting tired of karma fortunes by now.carandol ought to be getting tired of karma fortunes by now.
 
carandol's Avatar
 
Posts: 423
Karma: 2153430
Join Date: Dec 2007
Device: BeBook
Just tried ksira's line of code, and now it just sits there with the light flashing and the progress bars cycling. Perhaps I got the line wrong. Should it have been:
Code:
$/usr/bin/wireless.sh start mynetwork wep 12345678
or
Code:
$/usr/bin/wireless.sh start ssid mynetwork encryption wep key 12345678
?
carandol is offline   Reply With Quote
Old 03-28-2008, 10:01 AM   #8
cen
Connoisseur
cen doesn't littercen doesn't litter
 
Posts: 53
Karma: 140
Join Date: Mar 2008
Device: iRex iLiad (v1) / Sony Librie
Quote:
Originally Posted by carandol View Post
Just tried ksira's line of code, and now it just sits there with the light flashing and the progress bars cycling. Perhaps I got the line wrong. Should it have been:
Code:
$/usr/bin/wireless.sh start mynetwork wep 12345678
or
Code:
$/usr/bin/wireless.sh start ssid mynetwork encryption wep key 12345678
?
I believe if you are trying to put this into rio's script you will need to drop the $ and it should be:

/usr/bin/wireless.sh start mynetwork wep 12345678
cen is offline   Reply With Quote
Old 03-28-2008, 01:33 PM   #9
carandol
Evangelist
carandol ought to be getting tired of karma fortunes by now.carandol ought to be getting tired of karma fortunes by now.carandol ought to be getting tired of karma fortunes by now.carandol ought to be getting tired of karma fortunes by now.carandol ought to be getting tired of karma fortunes by now.carandol ought to be getting tired of karma fortunes by now.carandol ought to be getting tired of karma fortunes by now.carandol ought to be getting tired of karma fortunes by now.carandol ought to be getting tired of karma fortunes by now.carandol ought to be getting tired of karma fortunes by now.carandol ought to be getting tired of karma fortunes by now.
 
carandol's Avatar
 
Posts: 423
Karma: 2153430
Join Date: Dec 2007
Device: BeBook
Hmm, still no joy.
carandol is offline   Reply With Quote
Old 03-28-2008, 03:22 PM   #10
cen
Connoisseur
cen doesn't littercen doesn't litter
 
Posts: 53
Karma: 140
Join Date: Mar 2008
Device: iRex iLiad (v1) / Sony Librie
Quote:
Originally Posted by carandol View Post
Hmm, still no joy.
Does it work if you try it wired? This would give us an idea if it's a problem with the script or the wifi connection (via the script)

Last edited by cen; 03-28-2008 at 03:25 PM.
cen is offline   Reply With Quote
Old 03-28-2008, 05:42 PM   #11
cen
Connoisseur
cen doesn't littercen doesn't litter
 
Posts: 53
Karma: 140
Join Date: Mar 2008
Device: iRex iLiad (v1) / Sony Librie
Problem solved, assuming you had the same issue as me. The script fails if /media/cf/newspapers/Guardian24/ doesn't exist (and I never bothered to create it as I put the script elsewhere )

Updated code to create the root newspaper dir if it doesnt exist (mkdir -p)
To get the wifi working:
uncomment the following lines
#/usr/bin/wireless.sh start <SSID> <ENC_TYPE> <PASS>
#/usr/bin/wireless.sh stop

and replace <...> with your wifi details.

Code:
#!/bin/sh
export GUARDIAN_PATH=/media/cf/newspapers/Guardian24/
/usr/bin/wired.sh start
#/usr/bin/wireless.sh start <SSID> <ENC_TYPE> <PASS>
rm -rf $GUARDIAN_PATH/Guardian.pdf
mkdir -p $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

edit: sort of works, gets to 28% download of the PDF then stalls and craps out (but the PDF is created). YMMV

Last edited by cen; 03-28-2008 at 05:54 PM.
cen is offline   Reply With Quote
Old 03-29-2008, 11:01 AM   #12
carandol
Evangelist
carandol ought to be getting tired of karma fortunes by now.carandol ought to be getting tired of karma fortunes by now.carandol ought to be getting tired of karma fortunes by now.carandol ought to be getting tired of karma fortunes by now.carandol ought to be getting tired of karma fortunes by now.carandol ought to be getting tired of karma fortunes by now.carandol ought to be getting tired of karma fortunes by now.carandol ought to be getting tired of karma fortunes by now.carandol ought to be getting tired of karma fortunes by now.carandol ought to be getting tired of karma fortunes by now.carandol ought to be getting tired of karma fortunes by now.
 
carandol's Avatar
 
Posts: 423
Karma: 2153430
Join Date: Dec 2007
Device: BeBook
Still not having any luck. I can't test it wired, because I don't have a network cable. (I mean, what's the point of having a wifi network, then buying wires? ) Has anyone else got this to work with wifi?
carandol is offline   Reply With Quote
Old 03-29-2008, 12:38 PM   #13
cen
Connoisseur
cen doesn't littercen doesn't litter
 
Posts: 53
Karma: 140
Join Date: Mar 2008
Device: iRex iLiad (v1) / Sony Librie
Not sure how familiar you are with the command line but if you were to fire up a shell on the iLiad and cd into the get-guardian directory and issue the command sh -x run.sh This should give you a better idea of where it is going wrong.
cen is offline   Reply With Quote
Old 03-29-2008, 01:14 PM   #14
carandol
Evangelist
carandol ought to be getting tired of karma fortunes by now.carandol ought to be getting tired of karma fortunes by now.carandol ought to be getting tired of karma fortunes by now.carandol ought to be getting tired of karma fortunes by now.carandol ought to be getting tired of karma fortunes by now.carandol ought to be getting tired of karma fortunes by now.carandol ought to be getting tired of karma fortunes by now.carandol ought to be getting tired of karma fortunes by now.carandol ought to be getting tired of karma fortunes by now.carandol ought to be getting tired of karma fortunes by now.carandol ought to be getting tired of karma fortunes by now.
 
carandol's Avatar
 
Posts: 423
Karma: 2153430
Join Date: Dec 2007
Device: BeBook
Well, I'm familiar enough with the shell to do that, but not familiar enough to understand the results! Here's the output:

Code:
+ export GUARDIAN_PATH=/media/cf/newspapers/Guardian24/
+ GUARDIAN_PATH=/media/cf/newspapers/Guardian24/
+ /usr/bin/wired.sh start
run.sh: line 3: /usr/bin/wired.sh: No such file or directory
+ /usr/bin/wireless.sh start
run.sh: line 4: /usr/bin/wireless.sh: No such file or directory
+ rm -rf /media/cf/newspapers/Guardian24//Guardian.pdf
+ mkdir /media/cf/newspapers/Guardian24//Guardian.pdf
+++ date
++ echo Sat Mar 29 16:03:30 GMT 2008
+ echo '<?xml version="1.0" encoding="utf-8"?><package><metadata><dc-metadata><Title>The Guardian 24h edition</Title><Description>Downloaded: Sat Mar 29 16:03:30 GMT 2008</Description></dc-metadata><y-metadata><startpage>Guardian.pdf</startpage><image>icon.png</image><version>000</version></y-metadata></metadata></package>'
+ wget -O /media/cf/newspapers/Guardian24//Guardian.pdf/Guardian.pdf http://download.guardian.co.uk/g24/World.pdf
--16:03:30--  http://download.guardian.co.uk/g24/World.pdf
           => `/media/cf/newspapers/Guardian24//Guardian.pdf/Guardian.pdf'
Resolving download.guardian.co.uk... 77.91.249.32
Connecting to download.guardian.co.uk|77.91.249.32|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 255,185 (249K) [application/pdf]

100%[====================================>] 255,185      288.43K/s

16:03:31 (287.81 KB/s) - `/media/cf/newspapers/Guardian24//Guardian.pdf/Guardian.pdf' saved [255185/255185]

+ cp /media/cf/newspapers/Guardian24//get-guardian/icon.png /media/cf/newspapers/Guardian24//Guardian.pdf/icon.png
cp: cannot stat `/media/cf/newspapers/Guardian24//get-guardian/icon.png': No such file or directory
+ /usr/bin/wired.sh stop
run.sh: line 10: /usr/bin/wired.sh: No such file or directory
+ /usr/bin/wireless.sh stop
run.sh: line 11: /usr/bin/wireless.sh: No such file or directory
It's definitely downloading the file, but when I look at it, it's only 8kb and doesn't have the icon attached, just a black rectangle. Hopefully, someone will be able to figure out from this what's not working!
carandol is offline   Reply With Quote
Old 03-29-2008, 01:39 PM   #15
daudi
Addict
daudi has learned how to read e-booksdaudi has learned how to read e-booksdaudi has learned how to read e-booksdaudi has learned how to read e-booksdaudi has learned how to read e-booksdaudi has learned how to read e-booksdaudi has learned how to read e-booksdaudi has learned how to read e-books
 
Posts: 281
Karma: 904
Join Date: Oct 2007
Location: Kent, UK
Device: iRex iLiad, Psion 5MX, nokia n800
Just looking at this quickly:

i) Are you sure the manifest file is being created? You do not seem to be directing the output of the echo command to a file. I would have expected to see something like this at the end of the echo command
Code:
> manifest.xml
ii) You can see that the copy command is failing to find the icon to copy.

Can you look at the CF in a PC? Is it possible that the PDF has been downloaded okay and it in the subdirectory, but because there is no manifest file it won't open?
daudi is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
The Guardian, modified ajnorman Recipes 20 01-10-2014 12:02 PM
Automatic News Download brewjono Calibre 3 10-09-2010 09:49 AM
Automatic Index of Books Available for Download HarryT BBeB/LRF Books 6 09-11-2009 10:49 PM
The Guardian Reviews the DX poohbear_nc News 3 07-06-2009 10:33 AM
Automatic Daily Comic Strip Download Adam B. iRex 10 08-11-2007 06:33 AM


All times are GMT -4. The time now is 05:43 PM.


MobileRead.com is a privately owned, operated and funded community.