Add German FSK rating support for NFO files

- Add optional fsk field to TVShowNFO model
- Implement TMDB content ratings API integration
- Add FSK extraction and mapping (FSK 0/6/12/16/18)
- Update XML generation to prefer FSK over MPAA
- Add nfo_prefer_fsk_rating config setting
- Add 31 comprehensive tests for FSK functionality
- All 112 NFO tests passing
This commit is contained in:
2026-01-17 22:13:34 +01:00
parent fd5e85d5ea
commit 22a41ba93f
10 changed files with 756 additions and 111 deletions

View File

@@ -14,6 +14,7 @@ from typing import Optional
from lxml import etree
from src.config.settings import settings
from src.core.entities.nfo_models import TVShowNFO
logger = logging.getLogger(__name__)
@@ -49,7 +50,13 @@ def generate_tvshow_nfo(tvshow: TVShowNFO, pretty_print: bool = True) -> str:
# Technical details
_add_element(root, "runtime", str(tvshow.runtime) if tvshow.runtime else None)
_add_element(root, "mpaa", tvshow.mpaa)
# Content rating - prefer FSK if available and configured
if getattr(settings, 'nfo_prefer_fsk_rating', True) and tvshow.fsk:
_add_element(root, "mpaa", tvshow.fsk)
else:
_add_element(root, "mpaa", tvshow.mpaa)
_add_element(root, "certification", tvshow.certification)
# Status and dates