Rudimentary support for --refaire

This commit is contained in:
2026-04-01 22:20:11 +02:00
parent c1524a99c3
commit 95db769751
6 changed files with 155 additions and 46 deletions
+18 -7
View File
@@ -2,8 +2,12 @@ import sys
import shutil
from pathlib import Path
def sync_annotated(dir_arg):
bgnot_dir = Path(dir_arg) / "BGnot"
def sync_annotated(dir_arg, refaire):
if not refaire:
bgnot_dir = Path(dir_arg) / "BGnot"
else:
bgnot_dir = Path(dir_arg) / "BRnot"
annotated_dir = Path.home() / "SyncCopies" / "Annotées"
if not annotated_dir.is_dir():
@@ -22,9 +26,16 @@ def sync_annotated(dir_arg):
print("copying ", pdf_file, " to ", dest_file)
shutil.copy2(pdf_file, dest_file)
if __name__ == "__main__":
if len(sys.argv) < 2:
print("Usage: python script.py <dir>")
sys.exit(1)
import argparse
sync_annotated(sys.argv[1])
if __name__ == "__main__":
parser = argparse.ArgumentParser(description="Move to tablette folder.")
parser.add_argument("dir", help="The directory to process")
parser.add_argument("--refaire", action="store_true", help="Process only copies/labels defined in refaire.json")
args = parser.parse_args()
root_dir = args.dir
sync_annotated(root_dir, args.refaire)