Skip to content

armgit / peach

Public Imported from GitHub
0

Peach: Local-first video metadata scraper and media manager.

fix: 支持仅导入 Takeout 历史

Peach local maintenance3fa84df6613b
diff --git a/README.md b/README.md
index dea04d7be..92721b316 100644
--- a/README.md
+++ b/README.md
@@ -125,9 +125,12 @@ Chrome 历史已清理但 Google Takeout 仍在时,显式增加 ZIP。脚本
并按「同 URL、同秒的最大出现次数」与所有既有来源跨源去重;不会把 ZIP 解压到磁盘:
```powershell
-python scripts/taste_history.py refresh --takeout ~/Downloads/takeout-YYYYMMDD-001.zip
+python scripts/taste_history.py refresh --takeout ~/Downloads/takeout-YYYYMMDD-001.zip --takeout-only
```
+去掉 `--takeout-only` 会在同一次运行中先刷新当前浏览器数据库;浏览器正在使用历史库时,
+恢复旧导出建议保留该参数。
+
只用已有源库重新分析,或限制到某个时间点以后:
```powershell
diff --git a/scripts/taste_history.py b/scripts/taste_history.py
index 47c7ae3ea..7a1b36bf8 100644
--- a/scripts/taste_history.py
+++ b/scripts/taste_history.py
@@ -30,6 +30,11 @@ def _parser() -> argparse.ArgumentParser:
metavar="ZIP",
help="显式导入 Google Takeout ZIP;可重复指定",
)
+ parser.add_argument(
+ "--takeout-only",
+ action="store_true",
+ help="只导入 --takeout,不自动读取当前浏览器数据库",
+ )
parser.add_argument(
"--source",
action="append",
@@ -59,7 +64,9 @@ def main() -> int:
missing_takeouts = [path for path in takeouts if not path.is_file()]
if missing_takeouts:
raise SystemExit(f"Takeout 不存在:{missing_takeouts[0]}")
- sources = discover_history_sources() + _explicit_sources(args.source)
+ if args.takeout_only and (args.action != "refresh" or not takeouts or args.source):
+ raise SystemExit("--takeout-only 仅可与 refresh、--takeout 一起使用,且不能同时指定 --source")
+ sources = [] if args.takeout_only else discover_history_sources() + _explicit_sources(args.source)
unique = {(source.browser, source.profile, source.path.resolve()): source for source in sources}
sources = list(unique.values())
if args.action == "discover":