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:

dict[str, Any]

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:

int

adsfolio.pdf.rename_preview.run_request(request)[source]

Plan renames without changing files and return a result payload.

Returns:

plans holds [current, target] pairs. skipped and identity_refused map filenames to reasons. invalid holds the message of a template or settings error. error holds any other failure.

Return type:

dict

Parameters:

request (collections.abc.Mapping[str, Any])