diff --git a/library_manager/utils/path_safety.py b/library_manager/utils/path_safety.py index c61624e..9cb8910 100644 --- a/library_manager/utils/path_safety.py +++ b/library_manager/utils/path_safety.py @@ -321,6 +321,10 @@ def find_existing_author_folder(lib_path, target_author) -> Optional[str]: Prevents duplicate folders like "James S.A. Corey" vs "James S. A. Corey" or "Alistair MacLean" vs "Alistair Maclean". + Args: + lib_path: Path to library directory to search for existing author folders. + target_author: Author name to match against existing folders. + Matching strategies (in order): 1. Exact normalized match (case-insensitive, whitespace-collapsed) 2. Standardized initials match (both through standardize_initials()) @@ -339,7 +343,7 @@ def find_existing_author_folder(lib_path, target_author) -> Optional[str]: # List only top-level directories existing_dirs = [d.name for d in lib.iterdir() if d.is_dir()] except OSError as e: - logger.debug(f"Error listing library directory {lib_path}: {e}") + logger.warning(f"Error listing library directory {lib_path}: {e}") return None if not existing_dirs: diff --git a/library_manager/worker.py b/library_manager/worker.py index 52ef1b4..1e63a0f 100644 --- a/library_manager/worker.py +++ b/library_manager/worker.py @@ -145,7 +145,10 @@ def process_all_queue( Args: config: Configuration dict - get_db: Function to get database connection + get_db: Function to get database connection. Returns a new + sqlite3 connection each call (standard Flask-SQLite pattern). + Safe to call multiple times in the same scope - each call + gets its own connection, no shared state. load_config: Function to reload config is_circuit_open: Function to check circuit breaker status get_circuit_breaker: Function to get circuit breaker state diff --git a/requirements.txt b/requirements.txt index 03b8cb2..a15273a 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,4 @@ +# Requires Python 3.9+ (Path.is_relative_to() used in pipeline layers) flask>=2.0.0 requests>=2.25.0 mutagen>=1.45.0