Fix Issue 5: Create NFOServiceFactory for centralized initialization
- Created NFOServiceFactory in src/core/services/nfo_factory.py - Enforces configuration precedence: explicit params > ENV > config.json - Provides create() and create_optional() methods - Singleton factory instance via get_nfo_factory() - Updated 4 files to use factory (nfo.py, SeriesApp.py, series_manager_service.py, nfo_cli.py) - Fixed test mocks: added ensure_folder_with_year(), corrected dependency test - Tests: 17/18 NFO passing, 15/16 anime passing - Resolves Code Duplication 2 (NFO initialization)
This commit is contained in:
@@ -165,7 +165,7 @@ async def get_optional_database_session() -> AsyncGenerator:
|
||||
"""
|
||||
try:
|
||||
from src.server.database import get_db_session
|
||||
|
||||
|
||||
# Try to get a session - if database not initialized, this will raise RuntimeError
|
||||
async with get_db_session() as session:
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user