Files

2.2 KiB
Raw Permalink Blame History

src/core/nfo.py

NFO reader — Curator's metadata source after ČSFD.

Jellyfin (configured to save metadata into the media folders) writes a Kodi-style .nfo next to each movie plus artwork. Curator only reads it — to drive the miniDLNA genre tree and to fill the year/rating used by folder grouping. It never writes NFO (Jellyfin owns that).

For a flat pool file Title (rok) [tmdbid].mkv the sidecar is Title (rok) [tmdbid].nfo; a per-movie folder may instead hold movie.nfo. Both are found. Missing or unparsable NFO → None (the movie simply has no genres until Jellyfin has scanned it).

Source: src/core/nfo.py

Classes

NfoData

class · line 20

class NfoData:

The bits of a movie .nfo Curator uses.

NfoData.field_values

method · line 31

field_values(name: str) -> list[str]

Values for a tag-schema source field (genres/countries/year/rating).

Functions

find_nfo

function · line 44

find_nfo(video_path: Path) -> Optional[Path]

Locate the .nfo for a movie: sibling <stem>.nfo or movie.nfo.

_texts

function · line 56

_texts(root: ET.Element, tag: str) -> list[str]

All non-empty stripped texts of the child elements called tag.

_parse_rating

function · line 60

_parse_rating(root: ET.Element) -> Optional[int]

Read a 0–10 NFO rating and scale it to 0–100 (to match the old bands).

_parse_tmdb_id

function · line 74

_parse_tmdb_id(root: ET.Element) -> Optional[int]

The TMDb id from a Kodi NFO: a <uniqueid type="tmdb"> element, or a legacy <tmdbid> element. None if neither holds a number.

_parse_csfd_url

function · line 82

_parse_csfd_url(root: ET.Element) -> Optional[str]

A ČSFD film URL from the NFO, if any.

Czech Kodi scrapers record ČSFD as <uniqueid type="csfd"> (a bare id or a full URL) or a legacy <csfdid> / <csfd> element. A bare id is expanded to https://www.csfd.cz/film/<id>/.

read_nfo

function · line 105

read_nfo(video_path: Path) -> Optional[NfoData]

Read the movie's .nfo into NfoData, or None if absent/broken.