adsfolio.pdf.recheck_worker
Run one library’s automatic identifier recheck in a separate process.
The desktop app writes a JSON request file and starts the hidden
adsfolio pdf recheck-worker REQUEST command. The worker writes a JSON
result file next to the request and exits. A separate process keeps PDF
parsing off the window’s Python interpreter, so scrolling stays smooth.
The app asks the worker to stop by creating the request’s cancel file. The worker checks for that file between steps, saves its progress, and exits.
- adsfolio.pdf.recheck_worker.build_request(root, identify_settings, rename_settings, recursive, *, ads_enabled, retry_remembered, config_dir, cancel_path, result_path)[source]
Return a JSON-serializable request for one library recheck.
- Parameters:
root (pathlib.Path) – Library root to check.
identify_settings (adsfolio.pdf.identify_settings.IdentifySettings) – Effective settings for this library.
rename_settings (adsfolio.pdf.rename_settings.RenameSettings) – Effective settings for this library.
recursive (bool) – Whether the check includes subdirectories.
ads_enabled (bool) – Whether the worker may contact ADS when a token exists.
retry_remembered (bool) – Check again the PDFs whose earlier check failed.
config_dir (pathlib.Path) – The app’s configuration directory. The worker uses the same catalog.
cancel_path (pathlib.Path) – File whose existence asks the worker to stop.
result_path (pathlib.Path) – File that receives the result.
- Return type:
- adsfolio.pdf.recheck_worker.has_external_providers(settings)[source]
Return whether the settings include a supported non-ADS provider.
- Parameters:
- Return type:
- adsfolio.pdf.recheck_worker.main(request_path)[source]
Run the request in this process and write its result file.
- Returns:
0when the result file exists. The result reports check failures.- Return type:
- Parameters:
request_path (pathlib.Path)
- adsfolio.pdf.recheck_worker.root_is_accessible(root)[source]
Return whether a library directory can be read and traversed.
- Parameters:
root (pathlib.Path)
- Return type:
- adsfolio.pdf.recheck_worker.run_request(request, cancelled)[source]
Run one recheck and return a JSON-serializable result payload.
- Parameters:
request (collections.abc.Mapping[str, Any]) – Request from build_request.
cancelled (collections.abc.Callable[[], bool]) – Cooperative cancellation check.
- Returns:
{"result": ..., "error": ...}.resultis None when the check did not run, for example after an early cancel or without a usable provider.- Return type:
- adsfolio.pdf.recheck_worker.write_result(path, payload)[source]
Write a result file atomically, so the app never reads a partial file.
- Parameters:
path (pathlib.Path)
payload (collections.abc.Mapping[str, Any])
- Return type:
None