'update'
This commit is contained in:
@@ -6,12 +6,15 @@ annotationdata.py
|
||||
- 提供parse_location辅助函数,解析笔记定位信息。
|
||||
- 返回结构化的annotations数据,便于后续章节定位与导出。
|
||||
|
||||
依赖:config.py 统一管理路径和配置项。
|
||||
|
||||
主要接口:
|
||||
- get_annotations(db_path, bookid=None):返回所有或指定assetid的笔记,结构为{assetid: {uuid: {...}}}
|
||||
- parse_location(location):解析ZANNOTATIONLOCATION,返回(idref, filepos)
|
||||
|
||||
依赖:sqlite3, collections, re, os, datetime
|
||||
"""
|
||||
import config
|
||||
|
||||
import sqlite3
|
||||
from collections import defaultdict
|
||||
@@ -34,7 +37,7 @@ def parse_location(location):
|
||||
filepos = matches[1] if len(matches) > 1 else None
|
||||
return idref, filepos
|
||||
|
||||
def get_annotations(db_path='./data/AEAnnotation.sqlite', bookid=None):
|
||||
def get_annotations(db_path=config.LOCAL_ANNOTATION_DB, bookid=None):
|
||||
# 检查WAL模式相关文件
|
||||
base = db_path.rsplit('.', 1)[0]
|
||||
wal_path = base + '.sqlite-wal'
|
||||
|
||||
Reference in New Issue
Block a user