adsfolio.pdf.rename_preview
Build a rename preview in a separate process for the desktop app.
The preview checks the identity of every tracked PDF. That reads and parses
each PDF, so it runs in the hidden adsfolio pdf rename-preview REQUEST
command instead of the window’s process. The worker writes a JSON result file
next to the request. A preview only plans renames, so the app may stop the
worker at any time.
- adsfolio.pdf.rename_preview.build_request(root, options, *, config_dir, result_path)[source]
Return a JSON-serializable rename preview request.
- Parameters:
root (pathlib.Path) – Library root to preview.
options (collections.abc.Mapping[str, Any]) – Keyword arguments for PdfRenamer.batch_rename. Paths must be strings or None.
config_dir (pathlib.Path) – The app’s configuration directory. The worker uses the same catalog.
result_path (pathlib.Path) – File that receives the result.
- Return type:
- adsfolio.pdf.rename_preview.main(request_path)[source]
Run the request in this process and write its result file.
- Parameters:
request_path (pathlib.Path)
- Return type:
- adsfolio.pdf.rename_preview.run_request(request)[source]
Plan renames without changing files and return a result payload.
- Returns:
plansholds[current, target]pairs.skippedandidentity_refusedmap filenames to reasons.invalidholds the message of a template or settings error.errorholds any other failure.- Return type:
- Parameters:
request (collections.abc.Mapping[str, Any])