Migrate from Poetry and pyenv to uv
This commit is contained in:
@@ -0,0 +1,103 @@
|
||||
# `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`](../../src/core/nfo.py)
|
||||
|
||||
## Classes
|
||||
|
||||
### `NfoData`
|
||||
|
||||
*class · line 20*
|
||||
|
||||
```python
|
||||
class NfoData:
|
||||
```
|
||||
|
||||
The bits of a movie `.nfo` Curator uses.
|
||||
|
||||
#### `NfoData.field_values`
|
||||
|
||||
*method · line 31*
|
||||
|
||||
```python
|
||||
field_values(name: str) -> list[str]
|
||||
```
|
||||
|
||||
Values for a tag-schema source field (genres/countries/year/rating).
|
||||
|
||||
## Functions
|
||||
|
||||
### `find_nfo`
|
||||
|
||||
*function · line 44*
|
||||
|
||||
```python
|
||||
find_nfo(video_path: Path) -> Optional[Path]
|
||||
```
|
||||
|
||||
Locate the `.nfo` for a movie: sibling `<stem>.nfo` or `movie.nfo`.
|
||||
|
||||
### `_texts`
|
||||
|
||||
*function · line 56*
|
||||
|
||||
```python
|
||||
_texts(root: ET.Element, tag: str) -> list[str]
|
||||
```
|
||||
|
||||
All non-empty stripped texts of the child elements called `tag`.
|
||||
|
||||
### `_parse_rating`
|
||||
|
||||
*function · line 60*
|
||||
|
||||
```python
|
||||
_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*
|
||||
|
||||
```python
|
||||
_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*
|
||||
|
||||
```python
|
||||
_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*
|
||||
|
||||
```python
|
||||
read_nfo(video_path: Path) -> Optional[NfoData]
|
||||
```
|
||||
|
||||
Read the movie's `.nfo` into `NfoData`, or None if absent/broken.
|
||||
Reference in New Issue
Block a user