When TMDB returns an empty German (de-DE) overview for anime (e.g.
Basilisk), the NFO plot tag was missing. Now both create and update
paths call _enrich_details_with_fallback() which fetches the English
(en-US) overview as a fallback.
Additionally, the <plot> XML element is always written (even when
empty) via the always_write parameter on _add_element(), ensuring
consistent NFO structure regardless of creation path.
Changes:
- nfo_service.py: add _enrich_details_with_fallback() method, call it
in create_tvshow_nfo and update_tvshow_nfo
- nfo_generator.py: add always_write param to _add_element(), use it
for <plot> tag
- test_nfo_service.py: add TestEnrichDetailsWithFallback with 4 tests
- Implemented comprehensive test suite for NFO service
- 73 unit tests covering:
- FSK rating extraction from German content ratings
- Year extraction from series names with parentheses
- TMDB to NFO model conversion
- NFO file creation with TMDB integration
- NFO file updates with media refresh
- Media file downloads (poster, logo, fanart)
- NFO ID parsing (TMDB, TVDB, IMDb)
- Edge cases for empty data, malformed XML, missing fields
- Configuration options (image sizes, auto-create)
- File cleanup and close operations
Coverage: 90.65% (target: 80%+)
- Statements covered: 202/222
- Branches covered: 79/88
Test results: All 73 tests passing
- Mocked TMDB API client and image downloader
- Used AsyncMock for async operations
- Tested both success and error paths
- Verified concurrent operations work correctly
- Validated XML parsing and ID extraction
- Add 23 new unit tests for media downloads in test_nfo_service.py
- Create test_nfo_integration.py with 10 integration tests
- Test all media download scenarios (poster/logo/fanart)
- Test various image sizes and configurations
- Test concurrent NFO operations
- Test error handling and edge cases
- All 44 NFO service tests passing
- All 10 integration tests passing