This commit is contained in:
douboer
2025-08-12 21:39:58 +08:00
parent fabd0225d6
commit 8873c70a60
11 changed files with 81 additions and 12 deletions

View File

@@ -1,3 +1,20 @@
"""
booklist_parse.py
-----------------
功能:
- 解析iBooks的Books.plist提取所有书籍元数据书名、作者、路径、时间等
- 解析BKLibrary.sqlite获取每本书的最近打开时间苹果时间戳基准2001-01-01
主要接口:
- parse_books_plist(plist_path):返回所有书籍元数据,结构为{bk_id: {...}}
- get_books_last_open(db_path):返回所有书籍最近打开时间,结构为{bk_id: {'last_open': 时间戳}}
依赖plistlib, collections, sqlite3, os, datetime
典型用法:
booksinfo = parse_books_plist('./data/Books.plist')
books_open = get_books_last_open('data/BKLibrary.sqlite')
"""
import plistlib
from collections import defaultdict