dev: 增加相似度检查

This commit is contained in:
Julian Freeman
2024-07-19 16:34:27 -04:00
parent 24e2184659
commit 5feaa5f3b3
6 changed files with 149 additions and 12 deletions

View File

@@ -9,7 +9,9 @@ columns_d = {
"opt": Column("opt", DataType.TEXT),
"url": Column("url", DataType.BLOB),
"notes": Column("notes", DataType.BLOB),
"path": Column("path", DataType.BLOB, nullable=False),
"uuid": Column("uuid", DataType.TEXT, nullable=False),
"filepath": Column("filepath", DataType.BLOB, nullable=False),
"path": Column("path", DataType.BLOB),
}
all_columns = [
@@ -20,6 +22,8 @@ all_columns = [
columns_d["opt"],
columns_d["url"],
columns_d["notes"],
columns_d["uuid"],
columns_d["filepath"],
columns_d["path"],
]
@@ -29,3 +33,9 @@ query_columns = [
columns_d["username"],
columns_d["url"],
]
# 从数据库中读取 UUID 和 文件路径分析相似度
sim_columns = [
columns_d["uuid"],
columns_d["filepath"],
]

View File

@@ -41,7 +41,9 @@ def read_kps_to_db(kps_file: str | PathLike[str], password: str,
extract_otp(entry.otp),
blob_fy(trim_str(entry.url)),
blob_fy(entry.notes),
blob_fy("::".join([kps_file] + entry.path[:-1])),
str(entry.uuid),
blob_fy(kps_file),
blob_fy("::".join(entry.path[:-1])),
])
sqh.insert_into(table_name, all_columns[1:], values)