Add NFO Pydantic models with comprehensive validation

- Create TVShowNFO, ActorInfo, RatingInfo, ImageInfo models
- Add validation for dates (YYYY-MM-DD), URLs, IMDB IDs
- Support all Kodi/XBMC standard fields
- Include nested models for ratings, actors, images
- Comprehensive unit tests with 61 tests
- Test coverage: 95.16% (exceeds 95% requirement)
- All tests passing
This commit is contained in:
2026-01-11 20:17:18 +01:00
parent 65b116c39f
commit 5e8815d143
4 changed files with 892 additions and 75 deletions

View File

@@ -112,81 +112,6 @@ For each task completed:
### 🎬 NFO Metadata Integration
#### Task 2: Create NFO Models and Schemas
**Priority:** High
**Estimated Time:** 3-4 hours
Create Pydantic models for NFO metadata based on Kodi/XBMC standard.
**Implementation Steps:**
1. **Create NFO Models Module** (`src/core/entities/nfo_models.py`)
```python
# Create Pydantic models for:
- TVShowNFO: Main tvshow.nfo structure
- ActorInfo: Actor/cast information
- RatingInfo: Rating information (TMDB, IMDB, etc.)
- ImageInfo: Thumbnail, fanart, logos
```
2. **Model Fields (based on scraper/tvshow.nfo example):**
- Basic: title, originaltitle, showtitle, year, plot, runtime
- IDs: tmdbid, imdbid, tvdbid
- Status: premiered, status, genre, studio
- Media: thumb (poster URLs), fanart (fanart URLs), clearlogo (logo URLs)
- Local Media: local poster.jpg, logo.png, fanart.jpg paths
- Cast: actor list with name, role, thumb
- Additional: mpaa, country, tag
**Note:** NFO files should reference both remote TMDB URLs and local file paths for media:
```xml
<thumb aspect="poster">https://image.tmdb.org/t/p/original/...</thumb>
<thumb aspect="logo">https://image.tmdb.org/t/p/original/...</thumb>
<fanart>
<thumb>https://image.tmdb.org/t/p/original/...</thumb>
</fanart>
```
3. **Add Validation:**
- Date format validation (YYYY-MM-DD)
- URL validation for image paths
- Required vs optional fields
- Default values where appropriate
**Acceptance Criteria:**
- [ ] NFO models created with comprehensive field coverage
- [ ] Models match Kodi/XBMC standard format
- [ ] Pydantic validation works correctly
- [ ] Can serialize to/from dict
- [ ] Type hints throughout
- [ ] Test coverage > 95% for models
**Testing Requirements:**
- Test all model fields with valid data
- Test required vs optional field validation
- Test date format validation (YYYY-MM-DD)
- Test URL validation for image paths
- Test invalid data rejection
- Test default values
- Test serialization to dict
- Test deserialization from dict
- Test nested model validation (ActorInfo, RatingInfo, etc.)
- Test edge cases (empty strings, None values, special characters)
- Use parametrized tests for multiple scenarios
**Files to Create:**
- `src/core/entities/nfo_models.py`
- `tests/unit/test_nfo_models.py`
---
#### Task 3: Adapt Scraper Code for NFO Generation
**Priority:** High