From 2c28ba890e3f03b0cd2f8d7dd4cfc52e3e8b3b26 Mon Sep 17 00:00:00 2001 From: "B. Stack" Date: Sat, 1 Apr 2023 22:43:02 -0400 Subject: WIP: handle 17-row Firefox moz_places, but icons are broken right now --- mbbmlib.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/mbbmlib.py b/mbbmlib.py index 0d000ef..55b7e61 100644 --- a/mbbmlib.py +++ b/mbbmlib.py @@ -7,6 +7,7 @@ # Purpose: Add favicons to bookmarks in exported html file # History: # 2022-03-05 fix even more UTF-8 crap +# 2023-04-01 add bare 17-row Firefox moz_places support. Still need to follow probably origin_id to moz_origins to the icons file to moz_icons? # Usage: # main command is export_bookmarks_to_html. # Reference: @@ -335,11 +336,17 @@ class Bookmark: bid, btype, parent, fk, position, title, keyword_id, folder_type, dateAdded, lastModified, guid, syncStatus, syncChangeCounter = row db_bookmarks.append(db_bookmark(bid, btype, parent, fk, position, title, keyword_id, folder_type, dateAdded, lastModified, guid, syncStatus, syncChangeCounter)) for row in raw_places: + #print(f"DEBUG: len(row): {len(row)}, row: {row}") if (len(row)) == 15: # LibreWolf, observed 2021-12-02 has no column for favicon_id. pid, url, title, rev_host, visit_count, hidden, typed, frecency, last_visit_date, guid, foreign_count, url_hash, description, preview_image_url, origin_id = row favicon_id = 0 + elif len(row) == 17: + # Firefox probably 111.0, observed 2023-04-01 added a new row + pid, url, title, rev_host, visit_count, hidden, typed, frecency, last_visit_date, guid, foreign_count, url_hash, description, preview_image_url, origin_id, site_name, recalc_frecency = row + favicon_id = 0 else: + # 16 rows? pid, url, title, rev_host, visit_count, hidden, typed, favicon_id, frecency, last_visit_date, guid, foreign_count, url_hash, description, preview_image_url, origin_id = row db_places.append(db_place(pid, url, title, rev_host, visit_count, hidden, typed, favicon_id, frecency, last_visit_date, guid, foreign_count, url_hash, description, preview_image_url, origin_id)) @@ -470,7 +477,7 @@ class db_bookmark: return encoded class db_place: - def __init__(self,pid,url,title,rev_host,visit_count,hidden,typed,favicon_id,frecency,last_visit_date,guid,foreign_count,url_hash,description,preview_image_url,origin_id): + def __init__(self,pid,url,title,rev_host,visit_count,hidden,typed,favicon_id,frecency,last_visit_date,guid,foreign_count,url_hash,description,preview_image_url,origin_id,recalc_frecency=None): self.pid = pid self.url = url self.title = title @@ -487,6 +494,7 @@ class db_place: self.description = description self.preview_image_url = preview_image_url self.origin_id = origin_id + self.recalc_frecency = recalc_frecency class db_icon: def __init__(self,iid,icon_url,fixed_icon_url,width,root,color,expire_ms,data): -- cgit