maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Nokia N800 (https://talk.maemo.org/forumdisplay.php?f=25)
-   -   How do I stay offline? (https://talk.maemo.org/showthread.php?t=5940)

jaymzz 2007-04-20 16:06

How do I stay offline?
 
New N800 owner here... so there might be an easy answer to this one...

I've searched and searched but I can find it... I have cached HTML I'd like to read offline, but neither the internal browser nor Minemo is able to go from one page to another without the N800 prompting me to go back online. This gets old fast.

I can always use Plucker and FBReader like I did with my Palm but the results I get caching real web files are much better. I just need to get rid of the "Exit offline mode?" prompts!

Texrat 2007-04-20 17:48

Re: How do I stay offline?
 
Yeah, the Opera browser needs a "work offline" setting.

gsagers 2007-04-20 18:20

Re: How do I stay offline?
 
Agreed, it does need a better offline mode, but I haven't experienced this problem. If it's feasible (i.e., these are the same documents you access over and over), it may be worth stripping out the outside links. I have a set of HTML files, with only internal links between them, and it doesn't prompt me to go back online. If you're using wget to download pages, the -k switch makes links between pages of a site local, but I don't think it strips external links.

If it's a one-time spidering, it may not be worth the trouble.

jaymzz 2007-04-20 19:16

Re: How do I stay offline?
 
Thanks - I am using -k in wget and I haven't seen any outside links on any of the pages - certainly have not clicked on anything. Even a local HTML file seems to trigger it. It's odd that it happens in Minimo too. If I solve it I will definitely post!

gsagers 2007-04-20 21:37

Re: How do I stay offline?
 
By external links I also meant images, css, javascript, flash, or any embedded element in the HTML that calls an outside server. Such things may not be downloaded by wget, depending on your other parameters, but would trigger a lookup by opera/minimo as it looks through the pages. A quick way for a first check would be to search for .com/.net/.org/.edu, etc., in the HTML source of the page, and make sure no such tags appear. I just double-checked the html files I have and they definitely have no embedded images that aren't in the form "img src="file.jpg"" rather than "img src=www.domain.com/file.jpg", etc.

jaymzz 2007-04-22 20:27

Re: How do I stay offline?
 
Indeed there is some server content remaining on some pages. I found that if I removed it from individual pages by hand the N800 stops asking to go online. Score!

I could not find a way to make wget stop adding outside links... not without causing it download the entire Internet anyway (at least it seemed that way - I stopped at half a gig). I like the idea of the N800 doing the download autonomously (not possible with Plucker) and I see sed is available in xterm, so my next go is going to be to try to find some way to pipe the files into it for processing, or to post process them in a script.

If I can find enough interesting RSS feeds that might do as well. The default reader isn't bad but I have found no way to ask it to cache everything, which is what I would need for offline reading.

A "Work offline" mode would be so much easier!

jaymzz 2007-04-23 00:16

Working prototype
 
I was able to write a script that works in both Debian Etch and on the N800 with xterm and wget installed.

Here's a snippet. This assumes a "pages" subdirectory holding all the requested pages.

Code:

cd pages

wget -nv -r -p -k -l 5 http://www.guardian.co.uk/pda/avantgo/
wget -nv -r -p -k -l 5 http://news.bbc.co.uk/low/english/pda/default.htm
# add more as you like,...

for f in `find . -name '*.htm*'` ; do
        # unresolved links to file links
        sed 's/http:\/\//file:\/\//' "$f" > "$f.tmp"
        mv -f "$f.tmp" "$f"
done

cd ..

I first retrieve the pages, then use sed to replace "http://" with "file://". This is an imperfect solution as the browser does try to find them, so the page never really finishes "loading." A more clever solution would be to be to remove the entire tag.

A rudimentary index.html gives me one place to access all the links.
HTML Code:

<h2>World News</h2>
<A HREF="./pages/www.guardian.co.uk/pda/avantgo/index.html">Guardian Unlimited</A><br>
<a href="./pages/news.bbc.co.uk/low/english/pda/default.htm">BBC News</a><br>
<!-- add more -->

I just have to keep it in sync with the script.

I can't say how happy I am that this device can do this. I've been hanging on to a Palm T3 that's been falling apart for three years now waiting for a suitable successor. I never thought it'd be called an "Internet Tablet"! :)

TA-t3 2007-04-24 08:05

Re: How do I stay offline?
 
The great thing is that you can script properly on the N800.. with that, there are almost no limits to what you can do, given some ideas an imagination.

Now, if there just was an N800 port of Perl available, as I'm must more proficient(sp?) with Perl than Python.. I've been using the 770 port but it's not ideal because there are some dependency problems.

luketoh 2007-04-24 09:20

Re: How do I stay offline?
 
Perl isn't in the N800? I think I recently ran a Perl script and it seemed to work....

Wanna double check?

TA-t3 2007-04-25 16:19

Re: How do I stay offline?
 
If you have it it's probably because of canola, IIRC.. there's some rudimentary Perl package which gets sucked in with it. It works, but not all modules (the last time I tried).


All times are GMT. The time now is 16:36.

vBulletin® Version 3.8.8