Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion library_manager/utils/path_safety.py
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand All @@ -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:
Expand Down
5 changes: 4 additions & 1 deletion library_manager/worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Loading