Files

50 lines
1.3 KiB
Python

#!/usr/bin/env python3
"""
MISF VOB — OneDrive / Planner face-sheet download.
Usage:
python run_download.py
python run_download.py --limit 2
python run_download.py --facility "Amaya Healthcare"
python run_download.py --resume
python run_download.py --keep-browser
"""
from __future__ import annotations
import sys
import traceback
from pathlib import Path
ROOT = Path(__file__).resolve().parent
SRC = ROOT / "src"
if str(SRC) not in sys.path:
sys.path.insert(0, str(SRC))
from planner_download import build_arg_parser, run_download_workflow # noqa: E402
def main() -> int:
try:
args = build_arg_parser().parse_args()
run_download_workflow(
facility_limit=max(0, args.limit),
facility_name=args.facility.strip() or None,
resume=args.resume,
keep_browser=args.keep_browser,
screenshot_on_error=args.screenshot and not args.no_screenshot,
)
return 0
except KeyboardInterrupt:
print("\nCancelled by user.")
return 130
except SystemExit as exc:
return int(exc.code) if exc.code is not None else 0
except Exception:
traceback.print_exc()
print("\nRun failed. See traceback above.", file=sys.stderr)
return 1
if __name__ == "__main__":
raise SystemExit(main())