Class: SycLink::Firefox
Overview
Importer for Firefox links
Constant Summary collapse
- QUERY_STRING =
Query strig to read links from the Firefox database places.sqlite
"select p.url, p.title, b.title, a.content, k.keyword, b_t.title from moz_bookmarks b left outer join moz_keywords k on b.keyword_id = k.id left outer join moz_items_annos a on a.item_id = b.id left outer join moz_bookmarks b_t on b.parent = b_t.id join moz_places p on p.id = b.fk where p.url like 'http%';"
Constants inherited from Importer
Instance Attribute Summary
Attributes inherited from Importer
Instance Method Summary collapse
-
#read ⇒ Object
Reads the links from the Firefox database places.sqlite.
-
#rows ⇒ Object
Returns row values in Arrays.
Methods inherited from Importer
Constructor Details
This class inherits a constructor from SycLink::Importer
Instance Method Details
#read ⇒ Object
Reads the links from the Firefox database places.sqlite
14 15 16 17 18 19 20 21 |
# File 'lib/syclink/firefox.rb', line 14 def read bookmark_file = Dir.glob(File.(path)).shift raise "Did not find file #{path}" unless bookmark_file db = SQLite3::Database.new(path) import = db.execute(QUERY_STRING) end |
#rows ⇒ Object
Returns row values in Arrays
24 25 26 27 28 29 30 31 32 |
# File 'lib/syclink/firefox.rb', line 24 def rows read.map do |row| a = row[0]; b = row[1]; c = row[2]; d = row[3]; e = row[4]; f = row[5] [a, b || c, (d || '').gsub("\n", ' '), [e, f].join(',').gsub(/^,|,$/, '')] end end |