MCPcopy Create free account
hub / github.com/OpenRaiser/PaperFlow / _persist_pdf_file

Function _persist_pdf_file

agents/reading-agent/main.py:1955–1976  ·  view source on GitHub ↗
(
    source_pdf_path: str,
    paper: Dict[str, Any],
    pdf_url: str = "",
    user_id: Optional[str] = None,
)

Source from the content-addressed store, hash-verified

1953
1954
1955def _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
1979def _obsidian_daily_note_path(report_path: Path, paper: Dict[str, Any]) -> Optional[Path]:

Callers 1

Calls 2

_resolve_configured_dirFunction · 0.85
_paper_file_stemFunction · 0.85

Tested by

no test coverage detected