feat: bootstrap NAS music deduper
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import argparse
|
||||
from pathlib import Path
|
||||
|
||||
from .exact import exact_dedupe
|
||||
from .scanner import scan
|
||||
from .watcher import watch
|
||||
|
||||
|
||||
def main() -> None:
|
||||
p = argparse.ArgumentParser(prog="am-deduper")
|
||||
sub = p.add_subparsers(dest="cmd", required=True)
|
||||
for name in ("scan", "dedupe", "reconcile", "watch"):
|
||||
sp = sub.add_parser(name)
|
||||
sp.add_argument("root", type=Path)
|
||||
sp.add_argument("--db", type=Path, default=None)
|
||||
args = p.parse_args()
|
||||
db = args.db or (args.root / ".dedupe" / "dedupe.db")
|
||||
if args.cmd == "watch":
|
||||
watch(args.root, db)
|
||||
return
|
||||
if args.cmd in {"scan", "reconcile"}:
|
||||
print(f"indexed={scan(args.root, db)} db={db}")
|
||||
if args.cmd == "dedupe":
|
||||
scan(args.root, db)
|
||||
actions = exact_dedupe(db, args.root)
|
||||
print(f"hardlinked={len(actions)}")
|
||||
Reference in New Issue
Block a user