Package: kupfer
Version: 0+v208-3
Severity: normal
Tags: patch

Dear Maintainer,

Since iceweasel 29 kupfer no longer reads the bookmark file.
For a while it was looking for backup files even though
bookmarks were stored in places.sqlite.  Included patch adapts
functionality already present for reading history to reading
bookmarks.

Cheers,
Itai



-- System Information:
Debian Release: jessie/sid
  APT prefers unstable
  APT policy: (600, 'unstable')
Architecture: amd64 (x86_64)

Kernel: Linux 3.14-1-amd64 (SMP w/4 CPU cores)
Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages kupfer depends on:
ii  dbus              1.8.2-1
ii  python-dbus       1.2.0-2+b2
ii  python-gobject    3.12.1-1
ii  python-gtk2       2.24.0-3+b1
ii  python-keybinder  0.3.0-3
ii  python-xdg        0.25-4
pn  python:any        <none>

Versions of packages kupfer recommends:
ii  python-keyring  3.8-1
ii  python-wnck     2.32.0+dfsg-3

Versions of packages kupfer suggests:
pn  python-cjson     <none>
pn  python-gdata     <none>
pn  python-qrencode  <none>

-- no debconf information
Description: <short summary of the patch>
 TODO: Put a short summary on the line above and replace this paragraph
 with a longer explanation of this change. Complete the meta-information
 with other relevant fields (see below for details). To make it easier, the
 information below has been extracted from the changelog. Adjust it or drop
 it.
 .
 kupfer (0+v208-3.1) unstable; urgency=medium
 .
   * Non-maintainer upload.
   * Read firefox bookmarks from places.sqlite
Author: Itaï BEN YAACOV <[email protected]>

---
The information above should follow the Patch Tagging Guidelines, please
checkout http://dep.debian.net/deps/dep3/ to learn about the format. Here
are templates for supplementary fields that you might want to add:

Origin: <vendor|upstream|other>, <url of original patch>
Bug: <url in upstream bugtracker>
Bug-Debian: http://bugs.debian.org/<bugnumber>
Bug-Ubuntu: https://launchpad.net/bugs/<bugnumber>
Forwarded: <no|not-needed|url proving that it has been forwarded>
Reviewed-By: <name and email of someone who approved the patch>
Last-Update: <YYYY-MM-DD>

--- kupfer-0+v208.orig/kupfer/plugin/firefox.py
+++ kupfer-0+v208/kupfer/plugin/firefox.py
@@ -65,12 +65,21 @@ class BookmarksSource (AppLeafContentMix
 			self.output_exc()
 
 	def _get_ffx3_bookmarks(self, fpath):
-		"""Parse Firefox' .json bookmarks backups"""
-		from kupfer.plugin import firefox3_support
-		self.output_debug("Parsing", fpath)
-		bookmarks = firefox3_support.get_bookmarks(fpath)
-		for book in bookmarks:
-			yield UrlLeaf(book["uri"], book["title"])
+		"""Query the firefox places bookmark database"""
+		fpath = firefox_support.get_firefox_home_file("places.sqlite")
+		if not (fpath and os.path.isfile(fpath)):
+			return
+		try:
+			self.output_debug("Reading bookmarks from", fpath)
+			with closing(sqlite3.connect(fpath, timeout=1)) as conn:
+				c = conn.cursor()
+				c.execute("""SELECT moz_places.url, moz_bookmarks.title
+				             FROM moz_places, moz_bookmarks
+                                             WHERE moz_places.id = moz_bookmarks.fk""")
+				return [UrlLeaf(url, title) for url, title in c]
+		except sqlite3.Error:
+			# Something is wrong with the database
+			self.output_exc()
 
 	def _get_ffx2_bookmarks(self, fpath):
 		"""Parse Firefox' bookmarks.html"""

Reply via email to