(
source_pdf_path: str,
paper: Dict[str, Any],
pdf_url: str = "",
user_id: Optional[str] = None,
)
| 1953 | |
| 1954 | |
| 1955 | def _persist_pdf_file( |
| 1956 | source_pdf_path: str, |
| 1957 | paper: Dict[str, Any], |
| 1958 | pdf_url: str = "", |
| 1959 | user_id: Optional[str] = None, |
| 1960 | ) -> Optional[str]: |
| 1961 | source_path = Path(source_pdf_path).expanduser() |
| 1962 | if not source_path.exists(): |
| 1963 | return None |
| 1964 | target_dir = _resolve_configured_dir( |
| 1965 | "PAPERFLOW_PDF_DIR", |
| 1966 | "data/exports", |
| 1967 | paper, |
| 1968 | user_id=user_id, |
| 1969 | category="pdf", |
| 1970 | ) |
| 1971 | target_path = target_dir / f"{_paper_file_stem(paper)}.pdf" |
| 1972 | if source_path.resolve() != target_path.resolve(): |
| 1973 | target_path.parent.mkdir(parents=True, exist_ok=True) |
| 1974 | shutil.copyfile(source_path, target_path) |
| 1975 | print(f" Saved PDF: {target_path}") |
| 1976 | return str(target_path) |
| 1977 | |
| 1978 | |
| 1979 | def _obsidian_daily_note_path(report_path: Path, paper: Dict[str, Any]) -> Optional[Path]: |
no test coverage detected