106 lines
2.0 KiB
Markdown
106 lines
2.0 KiB
Markdown
# `src/core/jellyfin.py`
|
|
|
|
Jellyfin server API client — thin, hybrid integration.
|
|
|
|
The NFO + artwork on disk stay authoritative (Jellyfin writes and reads them);
|
|
this client only does what the disk can't: **trigger a library scan** and **read
|
|
back what Jellyfin currently sees** (to verify the pool against it). Connection
|
|
details come from `.env` — `JELLYFIN_URL` and `JELLYFIN_API_KEY` (created in
|
|
the Jellyfin dashboard). Everything degrades gracefully when they are missing.
|
|
|
|
Source: [`src/core/jellyfin.py`](../../src/core/jellyfin.py)
|
|
|
|
## Classes
|
|
|
|
### `JellyfinMovie`
|
|
|
|
*class · line 25*
|
|
|
|
```python
|
|
class JellyfinMovie:
|
|
```
|
|
|
|
A movie as Jellyfin currently sees it (for verification).
|
|
|
|
### `JellyfinError`
|
|
|
|
*class · line 35*
|
|
|
|
```python
|
|
class JellyfinError(RuntimeError):
|
|
```
|
|
|
|
A Jellyfin request could not be completed (no config, network, status).
|
|
|
|
## Functions
|
|
|
|
### `base_url`
|
|
|
|
*function · line 39*
|
|
|
|
```python
|
|
base_url() -> Optional[str]
|
|
```
|
|
|
|
The configured Jellyfin base URL (no trailing slash), or None.
|
|
|
|
### `api_key`
|
|
|
|
*function · line 45*
|
|
|
|
```python
|
|
api_key() -> Optional[str]
|
|
```
|
|
|
|
The configured Jellyfin API key, or None.
|
|
|
|
### `api_available`
|
|
|
|
*function · line 51*
|
|
|
|
```python
|
|
api_available() -> bool
|
|
```
|
|
|
|
True when both the Jellyfin URL and API key are configured.
|
|
|
|
### `_request`
|
|
|
|
*function · line 56*
|
|
|
|
```python
|
|
_request(method: str, path: str, params: Optional[dict]=None, timeout: Optional[int]=None) -> requests.Response
|
|
```
|
|
|
|
Send one authenticated request to the Jellyfin server (`X-Emby-Token` header). Raises `JellyfinError` when the URL/key are missing or the server can't be reached.
|
|
|
|
### `server_version`
|
|
|
|
*function · line 74*
|
|
|
|
```python
|
|
server_version(timeout: Optional[int]=None) -> str
|
|
```
|
|
|
|
Return the Jellyfin server version (a quick connectivity check).
|
|
|
|
### `scan_all`
|
|
|
|
*function · line 80*
|
|
|
|
```python
|
|
scan_all() -> None
|
|
```
|
|
|
|
Trigger a scan of all Jellyfin libraries (picks up on-disk changes).
|
|
|
|
### `fetch_movies`
|
|
|
|
*function · line 85*
|
|
|
|
```python
|
|
fetch_movies() -> list[JellyfinMovie]
|
|
```
|
|
|
|
Read every movie Jellyfin currently has, with its TMDb id and path.
|