MCPcopy
hub / github.com/jarun/buku / mergedb

Method mergedb

buku.py:3123–3161  ·  view source on GitHub ↗

Merge bookmarks from another buku database file. Parameters ---------- path : str Path to DB file to merge. Returns ------- bool True on success, False on failure.

(self, path)

Source from the content-addressed store, hash-verified

3121 return True
3122
3123 def mergedb(self, path):
3124 """Merge bookmarks from another buku database file.
3125
3126 Parameters
3127 ----------
3128 path : str
3129 Path to DB file to merge.
3130
3131 Returns
3132 -------
3133 bool
3134 True on success, False on failure.
3135 """
3136
3137 try:
3138 # Connect to input DB
3139 indb_conn = sqlite3.connect('file:%s?mode=ro' % path, uri=True)
3140
3141 indb_cur = indb_conn.cursor()
3142 indb_cur.execute('SELECT * FROM bookmarks')
3143 except Exception as e:
3144 LOGERR(e)
3145 return False
3146
3147 resultset = indb_cur.fetchall()
3148 if resultset:
3149 with self.lock:
3150 for row in bookmark_vars(resultset):
3151 self.add_rec(row.url, row.title, row.tags_raw, row.desc, row.flags, True, False)
3152
3153 self.conn.commit()
3154
3155 try:
3156 indb_cur.close()
3157 indb_conn.close()
3158 except Exception:
3159 pass
3160
3161 return True
3162
3163 def tnyfy_url(
3164 self,

Callers 1

importdbMethod · 0.95

Calls 2

add_recMethod · 0.95
closeMethod · 0.80

Tested by

no test coverage detected