Package: kupfer Version: 0+v208-5.1 Severity: normal Tags: patch Dear Maintainer,
Kupfer 0+v208-5 includes a patch to replace the reading of json bookmark files with sqlite places file. The patch however did not remove logic meant to look for the json file, which makes it fail in more recent versions of iceweasel. Attached is a more complete json -> sqlite patch. Cheers Itaï -- System Information: Debian Release: stretch/sid APT prefers unstable APT policy: (500, 'unstable') Architecture: amd64 (x86_64) Foreign Architectures: i386 Kernel: Linux 4.0.0-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 Init: systemd (via /run/systemd/system) Versions of packages kupfer depends on: ii dbus 1.8.18-1 ii python-dbus 1.2.0-2+b3 ii python-gobject 3.14.0-1 ii python-gtk2 2.24.0-4 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 4.0-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
From: Itaï BEN YAACOV <can...@free.fr> Subject: Fix the error when reading firefox bookmark files * Read firefox bookmarks from places.sqlite Bug-Debian: http://bugs.debian.org/749067 Last-Update: 2014-06-07 Index: kupfer-0+v208/kupfer/plugin/firefox.py =================================================================== --- kupfer-0+v208.orig/kupfer/plugin/firefox.py +++ kupfer-0+v208/kupfer/plugin/firefox.py @@ -65,12 +65,14 @@ 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""" + 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] def _get_ffx2_bookmarks(self, fpath): """Parse Firefox' bookmarks.html""" @@ -88,25 +90,16 @@ class BookmarksSource (AppLeafContentMix else: self._history = [] - # now try reading JSON bookmark backups, + # now try reading sqlite places file # with html bookmarks as backup - dirloc = firefox_support.get_firefox_home_file("bookmarkbackups") - fpath = None - if dirloc: - files = os.listdir(dirloc) - if files: - latest_file = (files.sort() or files)[-1] - fpath = os.path.join(dirloc, latest_file) - - if fpath and os.path.splitext(fpath)[-1].lower() == ".json": + fpath = firefox_support.get_firefox_home_file("places.sqlite") + if fpath: try: - json_bookmarks = list(self._get_ffx3_bookmarks(fpath)) - except Exception: - # Catch JSON parse errors - # different exception for cjson and json + sqlite3_bookmarks = self._get_ffx3_bookmarks(fpath) + except sqlite3.Error: self.output_exc() else: - return itertools.chain(self._history, json_bookmarks) + return itertools.chain(self._history, sqlite3_bookmarks) fpath = firefox_support.get_firefox_home_file("bookmarks.html") if fpath: