Re: firefox cache Python

2008-02-20 Thread subeen
Searching for FF automation but still no luck.

Any other idea on how to locate the cache directory and then read the
directory ?

regards,
Subeen
http://love-python.blogspot.com/

On Feb 20, 3:20 am, Gabriel Genellina [EMAIL PROTECTED]
wrote:

 Search for firefox automation

 --
 Gabriel Genellina

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: firefox cache Python

2008-02-20 Thread mmayes
On Feb 20, 3:40 am, subeen [EMAIL PROTECTED] wrote:
 Searching for FF automation but still no luck.

 Any other idea on how to locate the cache directory and then read the
 directory ?

 regards,
 Subeenhttp://love-python.blogspot.com/

 On Feb 20, 3:20 am, Gabriel Genellina [EMAIL PROTECTED]
 wrote:



  Search for firefox automation

  --
  Gabriel Genellina

You can generally locate Firefox's cache (v2 and up) directory by
searching for a file named '_CACHE_MAP_':
Try something like:

-- code --

import sys
import os

searchFile = '_CACHE_MAP_'
cacheFolder = None
home = /Users/your-home-directory  # assuming *nix OS

for root, dirs, files in os.walk(home):
for x in files:
if x == searchFile:
cacheFolder = root
print cacheFolder

if cacheFolder == None: print Cache folder not found under that
directory.

-- end code --

The main cache data as far as URLs and such are located in 3 files,
which you can dump into a list:
cacheFiles = ['_CACHE_001_', '_CACHE_002_', '_CACHE_003_']

You can then read data into a string with something like:

all_cache = ''
for f in cacheFiles:
all_cache += open(cacheFolder + '/' + f, 'rb').read()   # '/' = 
*nix
OS dividor

The odd looking files that start with numbers are some sort of binary/
gzipped encoded files, which I'm still working on. Keep an eye on my
blog, I'll post a bunch of stuff on this soon, as I'm working on a
project for a class that deals with this stuff. Cheers!
-- 
http://mail.python.org/mailman/listinfo/python-list


firefox cache Python

2008-02-19 Thread subeen
Hi,

I have got into an interesting problem. Today I found that if I type
about:cache?device=disk (without the quotes) in the address bar of
firefox, it displays disk cache information. Now I am thinking to
write a Python program that will read this cache info. My initial idea
is to somehow save the page in a file and parse it. But how to save
the page without human intervention (pressing ctrl+s) :) ?

Hope I could make it clear what I am trying to do...

Any clue?

regards,
Subeen.
http://love-python.blogspot.com/
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: firefox cache Python

2008-02-19 Thread Gabriel Genellina
En Tue, 19 Feb 2008 17:44:57 -0200, subeen [EMAIL PROTECTED]  
escribió:

 I have got into an interesting problem. Today I found that if I type
 about:cache?device=disk (without the quotes) in the address bar of
 firefox, it displays disk cache information. Now I am thinking to
 write a Python program that will read this cache info. My initial idea
 is to somehow save the page in a file and parse it. But how to save
 the page without human intervention (pressing ctrl+s) :) ?

Search for firefox automation

-- 
Gabriel Genellina

-- 
http://mail.python.org/mailman/listinfo/python-list