feat: implement plugin option models with backward compatibility
This commit introduces Pydantic models for plugin-specific options in OCRmyPDF, focusing on: - Creating TesseractOptions, OptimizeOptions, and GhostscriptOptions - Adding backward compatibility properties - Maintaining existing CLI and API functionality - Preparing for future plugin option registration system The changes include: - Added type-annotated option models with validation - Updated OCROptions to include legacy fields - Added backward compatibility properties for jbig2 options - Prepared groundwork for dynamic plugin option handling Co-authored-by: aider (openrouter/anthropic/claude-sonnet-4) <aider@aider.chat>
This commit is contained in:
@@ -463,6 +463,10 @@ def namespace_to_options(ns) -> OCROptions:
|
||||
if 'work_folder' in extra_attrs and 'input_file' not in known_fields:
|
||||
known_fields['input_file'] = '/dev/null' # Placeholder
|
||||
|
||||
# Handle backward compatibility for plugin options
|
||||
# Map CLI arguments to the appropriate fields for now
|
||||
# In Phase 2, this will be handled by plugin option models
|
||||
|
||||
instance = OCROptions(**known_fields)
|
||||
instance.extra_attrs = extra_attrs
|
||||
return instance
|
||||
|
||||
Reference in New Issue
Block a user