feat: Add settings module
- Add configuration for parallel processing - Add optimization settings (optipng level, trim padding) - Support environment variable overrides - Add temporary directory prefix setting
This commit is contained in:
+18
@@ -0,0 +1,18 @@
|
||||
"""Configuration settings for the PDF Musical Score Cleaner."""
|
||||
|
||||
import os
|
||||
import multiprocessing
|
||||
|
||||
# Number of parallel processes to use for operations that support parallelization
|
||||
# Defaults to number of CPU cores - 1, but never less than 1
|
||||
DEFAULT_PARALLEL_PROCESSES = max(1, multiprocessing.cpu_count() - 1)
|
||||
|
||||
# Can be overridden by environment variable
|
||||
PARALLEL_PROCESSES = int(os.getenv('NOTES_CLEANER_PARALLEL_PROCESSES', DEFAULT_PARALLEL_PROCESSES))
|
||||
|
||||
# Optimization settings
|
||||
OPTIPNG_OPTIMIZATION_LEVEL = int(os.getenv('NOTES_CLEANER_OPTIPNG_LEVEL', '7')) # 0-7, higher = better compression but slower
|
||||
TRIM_PADDING_PIXELS = int(os.getenv('NOTES_CLEANER_TRIM_PADDING', '20')) # Padding around content after trimming
|
||||
|
||||
# Temporary directory settings
|
||||
TEMP_DIR_PREFIX = 'notes_cleaner_'
|
||||
Reference in New Issue
Block a user