refactor: simplify NFO handling, remove legacy services

- Drop nfo_factory, nfo_repair_service, nfo_service, series_manager_service
- Delete key_resolution_service, consolidate into folder_rename_service
- Remove bulk of NFO-related tests (coverage via integration tests)
- Streamline SeriesApp, background_loader, initialization services
- Add folder_rename_service to scheduler

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
2026-06-04 18:54:31 +02:00
parent 97caaf0d18
commit 21af502184
53 changed files with 175 additions and 16588 deletions

View File

@@ -516,7 +516,7 @@ class TestLoadNfoAndImages:
@pytest.mark.asyncio
async def test_load_nfo_creates_new_nfo(self, background_loader_service, mock_websocket_service):
"""Test creating new NFO file when it doesn't exist."""
"""Test creating new NFO file - NFO service removed, stub returns False."""
mock_db = AsyncMock()
mock_series = MagicMock()
mock_series.has_nfo = False
@@ -528,27 +528,18 @@ class TestLoadNfoAndImages:
year=2020
)
mock_nfo_service = AsyncMock()
mock_nfo_service.create_tvshow_nfo = AsyncMock(return_value="/anime/test_folder/tvshow.nfo")
mock_factory = MagicMock()
mock_factory.create = MagicMock(return_value=mock_nfo_service)
# NFO service removed, _load_nfo_and_images is now a stub that returns False
result = await background_loader_service._load_nfo_and_images(task, mock_db)
with patch("src.server.database.service.AnimeSeriesService") as mock_service_class, \
patch("src.server.services.background_loader_service.get_nfo_factory", return_value=mock_factory):
mock_service_class.get_by_key = AsyncMock(return_value=mock_series)
result = await background_loader_service._load_nfo_and_images(task, mock_db)
assert result is True
assert task.progress["nfo"] is True
assert task.progress["logo"] is True
assert task.progress["images"] is True
# Stub returns False since NFO service was removed
assert result is False
assert task.progress["nfo"] is False
assert task.progress["logo"] is False
assert task.progress["images"] is False
@pytest.mark.asyncio
async def test_load_nfo_uses_existing(self, background_loader_service):
"""Test using existing NFO file when it already exists."""
background_loader_service.series_app.nfo_service.has_nfo = MagicMock(return_value=True)
"""Test using existing NFO file - NFO service removed, stub returns False."""
mock_db = AsyncMock()
mock_series = MagicMock()
mock_series.has_nfo = True
@@ -559,13 +550,11 @@ class TestLoadNfoAndImages:
name="Test Series"
)
with patch("src.server.database.service.AnimeSeriesService") as mock_service_class:
mock_service_class.get_by_key = AsyncMock(return_value=mock_series)
result = await background_loader_service._load_nfo_and_images(task, mock_db)
# NFO service removed, _load_nfo_and_images is now a stub that returns False
result = await background_loader_service._load_nfo_and_images(task, mock_db)
# Stub returns False since NFO service was removed
assert result is False
assert task.progress["nfo"] is True
@pytest.mark.asyncio
async def test_load_nfo_without_nfo_service(self, background_loader_service):