unbewusst.sein
7/6/2008 9:01:00 AM
Jeremy Hinegardner <jeremy@hinegardner.org> wrote:
> > favicons are stored there as blob.
>
> Then yup, firefox 3 bookmarks file can be accessed via amalgalite now it look
> like. That's very cool.
meta info about that :
Table: moz_favicons
==========================================
Column : expiration
|..........default_value :
|.....declared_data_type : LONG
|collation_sequence_name : BINARY
|....not_null_constraint : false
|............primary_key : false
|.........auto_increment : false
Column : url
|..........default_value :
|.....declared_data_type : LONGVARCHAR
|collation_sequence_name : BINARY
|....not_null_constraint : false
|............primary_key : false
|.........auto_increment : false
Column : mime_type
|..........default_value :
|.....declared_data_type : VARCHAR(32)
|collation_sequence_name : BINARY
|....not_null_constraint : false
|............primary_key : false
|.........auto_increment : false
Column : id
|..........default_value :
|.....declared_data_type : INTEGER
|collation_sequence_name : BINARY
|....not_null_constraint : false
|............primary_key : true
|.........auto_increment : false
Column : data
|..........default_value :
|.....declared_data_type : BLOB
|collation_sequence_name : BINARY
|....not_null_constraint : false
|............primary_key : false
|.........auto_increment : false
I'll try to extract those icons and build an html page with <img
src='data...' /> to learn with.
I get the first one, saved to file, using :
#! /usr/bin/env ruby
require 'rubygems'
require 'amalgalite'
require 'rexml/document'
require 'net/http'
require 'uri'
db=Amalgalite::Database.new( "places.sqlite" )
all_rows=db.execute( "SELECT url, mime_type, data FROM moz_favicons" )
blob_row = all_rows.first
puts blob_row['url']
puts blob_row['mime_type']
uri = URI.parse(blob_row['url'])
p "uri.host = #{uri.host}, uri.port = #{uri.port}, uri.scheme =
#{uri.scheme}, uri.path = #{uri.path}"
puts "#{uri.host}_#{File.basename(uri.path)}"
blob_row['data'].write_to_file( "#{uri.host}_#{File.basename(uri.path)}"
) if !blob_row['data'].nil?
works great !
now, i need that blob as a string to base64 encode it and make use of :
<img
src='data:#{blob_row['mime_type']};base64,#{Base64.b64encode(blob_row['d
ata'].to_string_io.read)}' />
for the time of posting i get no output from #to_string_io.read ?
--
Une Bévue