fix: always repair NFO via update_tvshow_nfo so plot is written
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
"""Centralized initialization service for application startup and setup."""
|
||||
import asyncio
|
||||
from pathlib import Path
|
||||
from typing import Callable, Optional
|
||||
|
||||
@@ -381,13 +382,16 @@ async def perform_nfo_repair_scan(background_loader=None) -> None:
|
||||
|
||||
Runs on every application startup (not guarded by a run-once DB flag).
|
||||
Checks each subfolder of ``settings.anime_directory`` for a ``tvshow.nfo``
|
||||
and queues a repair via *background_loader* when required tags are absent
|
||||
or empty, or runs repairs inline when no loader is provided.
|
||||
and calls ``NfoRepairService.repair_series`` for every file with absent or
|
||||
empty required tags. Repairs are fired as independent asyncio tasks so
|
||||
they do not block the startup sequence.
|
||||
|
||||
The ``background_loader`` parameter is accepted for backwards-compatibility
|
||||
but is no longer used — repairs always go through ``update_tvshow_nfo`` so
|
||||
that the TMDB overview (plot) and all other required tags are written.
|
||||
|
||||
Args:
|
||||
background_loader: Optional BackgroundLoaderService. When provided,
|
||||
deficient series are queued non-blocking. When None, repairs
|
||||
execute inline (useful in tests).
|
||||
background_loader: Unused. Kept to avoid breaking call-sites.
|
||||
"""
|
||||
from src.core.services.nfo_factory import NFOServiceFactory
|
||||
from src.core.services.nfo_repair_service import NfoRepairService, nfo_needs_repair
|
||||
@@ -420,14 +424,13 @@ async def perform_nfo_repair_scan(background_loader=None) -> None:
|
||||
series_name = series_dir.name
|
||||
if nfo_needs_repair(nfo_path):
|
||||
queued += 1
|
||||
if background_loader is not None:
|
||||
await background_loader.add_series_loading_task(
|
||||
key=series_name,
|
||||
folder=series_name,
|
||||
name=series_name,
|
||||
)
|
||||
else:
|
||||
await repair_service.repair_series(series_dir, series_name)
|
||||
# Always repair via update_tvshow_nfo so that missing fields such
|
||||
# as `plot` are fetched from TMDB. Fire as an asyncio task to
|
||||
# avoid blocking the startup loop.
|
||||
asyncio.create_task(
|
||||
repair_service.repair_series(series_dir, series_name),
|
||||
name=f"nfo_repair:{series_name}",
|
||||
)
|
||||
|
||||
logger.info(
|
||||
"NFO repair scan complete: %d of %d series queued for repair",
|
||||
|
||||
Reference in New Issue
Block a user