Complete Task 8: Database Support for NFO Status
- Added 5 NFO tracking fields to AnimeSeries model - Fields: has_nfo, nfo_created_at, nfo_updated_at, tmdb_id, tvdb_id - Added 3 service methods to AnimeService for NFO operations - Methods: update_nfo_status, get_series_without_nfo, get_nfo_statistics - SQLAlchemy auto-migration (no manual migration needed) - Backward compatible with existing data - 15 new tests added (19/19 passing) - Tests: database models, service methods, integration queries
This commit is contained in:
109
docs/API.md
109
docs/API.md
@@ -813,8 +813,9 @@ Source: [src/server/api/nfo.py](../src/server/api/nfo.py#L1-L684)
|
||||
These endpoints manage tvshow.nfo metadata files and associated media (poster, logo, fanart) for anime series. NFO files use Kodi/XBMC format and are scraped from TMDB API.
|
||||
|
||||
**Prerequisites:**
|
||||
- TMDB API key must be configured in settings
|
||||
- NFO service returns 503 if API key not configured
|
||||
|
||||
- TMDB API key must be configured in settings
|
||||
- NFO service returns 503 if API key not configured
|
||||
|
||||
### GET /api/nfo/{serie_id}/check
|
||||
|
||||
@@ -823,9 +824,11 @@ Check if NFO file and media files exist for a series.
|
||||
**Authentication:** Required
|
||||
|
||||
**Path Parameters:**
|
||||
- `serie_id` (string): Series identifier
|
||||
|
||||
- `serie_id` (string): Series identifier
|
||||
|
||||
**Response (200 OK):**
|
||||
|
||||
```json
|
||||
{
|
||||
"serie_id": "one-piece",
|
||||
@@ -844,9 +847,10 @@ Check if NFO file and media files exist for a series.
|
||||
```
|
||||
|
||||
**Errors:**
|
||||
- `401 Unauthorized` - Not authenticated
|
||||
- `404 Not Found` - Series not found
|
||||
- `503 Service Unavailable` - TMDB API key not configured
|
||||
|
||||
- `401 Unauthorized` - Not authenticated
|
||||
- `404 Not Found` - Series not found
|
||||
- `503 Service Unavailable` - TMDB API key not configured
|
||||
|
||||
Source: [src/server/api/nfo.py](../src/server/api/nfo.py#L90-L147)
|
||||
|
||||
@@ -857,9 +861,11 @@ Create NFO file and download media for a series.
|
||||
**Authentication:** Required
|
||||
|
||||
**Path Parameters:**
|
||||
- `serie_id` (string): Series identifier
|
||||
|
||||
- `serie_id` (string): Series identifier
|
||||
|
||||
**Request Body:**
|
||||
|
||||
```json
|
||||
{
|
||||
"serie_name": "One Piece",
|
||||
@@ -872,14 +878,16 @@ Create NFO file and download media for a series.
|
||||
```
|
||||
|
||||
**Fields:**
|
||||
- `serie_name` (string, optional): Series name for TMDB search (defaults to folder name)
|
||||
- `year` (integer, optional): Series year to help narrow TMDB search
|
||||
- `download_poster` (boolean, default: true): Download poster.jpg
|
||||
- `download_logo` (boolean, default: true): Download logo.png
|
||||
- `download_fanart` (boolean, default: true): Download fanart.jpg
|
||||
- `overwrite_existing` (boolean, default: false): Overwrite existing NFO
|
||||
|
||||
- `serie_name` (string, optional): Series name for TMDB search (defaults to folder name)
|
||||
- `year` (integer, optional): Series year to help narrow TMDB search
|
||||
- `download_poster` (boolean, default: true): Download poster.jpg
|
||||
- `download_logo` (boolean, default: true): Download logo.png
|
||||
- `download_fanart` (boolean, default: true): Download fanart.jpg
|
||||
- `overwrite_existing` (boolean, default: false): Overwrite existing NFO
|
||||
|
||||
**Response (200 OK):**
|
||||
|
||||
```json
|
||||
{
|
||||
"serie_id": "one-piece",
|
||||
@@ -898,10 +906,11 @@ Create NFO file and download media for a series.
|
||||
```
|
||||
|
||||
**Errors:**
|
||||
- `401 Unauthorized` - Not authenticated
|
||||
- `404 Not Found` - Series not found
|
||||
- `409 Conflict` - NFO already exists (use `overwrite_existing: true`)
|
||||
- `503 Service Unavailable` - TMDB API error or key not configured
|
||||
|
||||
- `401 Unauthorized` - Not authenticated
|
||||
- `404 Not Found` - Series not found
|
||||
- `409 Conflict` - NFO already exists (use `overwrite_existing: true`)
|
||||
- `503 Service Unavailable` - TMDB API error or key not configured
|
||||
|
||||
Source: [src/server/api/nfo.py](../src/server/api/nfo.py#L150-L240)
|
||||
|
||||
@@ -912,12 +921,15 @@ Update existing NFO file with fresh TMDB data.
|
||||
**Authentication:** Required
|
||||
|
||||
**Path Parameters:**
|
||||
- `serie_id` (string): Series identifier
|
||||
|
||||
- `serie_id` (string): Series identifier
|
||||
|
||||
**Query Parameters:**
|
||||
- `download_media` (boolean, default: true): Re-download media files
|
||||
|
||||
- `download_media` (boolean, default: true): Re-download media files
|
||||
|
||||
**Response (200 OK):**
|
||||
|
||||
```json
|
||||
{
|
||||
"serie_id": "one-piece",
|
||||
@@ -936,9 +948,10 @@ Update existing NFO file with fresh TMDB data.
|
||||
```
|
||||
|
||||
**Errors:**
|
||||
- `401 Unauthorized` - Not authenticated
|
||||
- `404 Not Found` - Series or NFO not found (use create endpoint)
|
||||
- `503 Service Unavailable` - TMDB API error
|
||||
|
||||
- `401 Unauthorized` - Not authenticated
|
||||
- `404 Not Found` - Series or NFO not found (use create endpoint)
|
||||
- `503 Service Unavailable` - TMDB API error
|
||||
|
||||
Source: [src/server/api/nfo.py](../src/server/api/nfo.py#L243-L325)
|
||||
|
||||
@@ -949,9 +962,11 @@ Get NFO file XML content for a series.
|
||||
**Authentication:** Required
|
||||
|
||||
**Path Parameters:**
|
||||
- `serie_id` (string): Series identifier
|
||||
|
||||
- `serie_id` (string): Series identifier
|
||||
|
||||
**Response (200 OK):**
|
||||
|
||||
```json
|
||||
{
|
||||
"serie_id": "one-piece",
|
||||
@@ -963,8 +978,9 @@ Get NFO file XML content for a series.
|
||||
```
|
||||
|
||||
**Errors:**
|
||||
- `401 Unauthorized` - Not authenticated
|
||||
- `404 Not Found` - Series or NFO not found
|
||||
|
||||
- `401 Unauthorized` - Not authenticated
|
||||
- `404 Not Found` - Series or NFO not found
|
||||
|
||||
Source: [src/server/api/nfo.py](../src/server/api/nfo.py#L328-L397)
|
||||
|
||||
@@ -975,9 +991,11 @@ Get media files status for a series.
|
||||
**Authentication:** Required
|
||||
|
||||
**Path Parameters:**
|
||||
- `serie_id` (string): Series identifier
|
||||
|
||||
- `serie_id` (string): Series identifier
|
||||
|
||||
**Response (200 OK):**
|
||||
|
||||
```json
|
||||
{
|
||||
"has_poster": true,
|
||||
@@ -990,8 +1008,9 @@ Get media files status for a series.
|
||||
```
|
||||
|
||||
**Errors:**
|
||||
- `401 Unauthorized` - Not authenticated
|
||||
- `404 Not Found` - Series not found
|
||||
|
||||
- `401 Unauthorized` - Not authenticated
|
||||
- `404 Not Found` - Series not found
|
||||
|
||||
Source: [src/server/api/nfo.py](../src/server/api/nfo.py#L400-L447)
|
||||
|
||||
@@ -1002,9 +1021,11 @@ Download missing media files for a series.
|
||||
**Authentication:** Required
|
||||
|
||||
**Path Parameters:**
|
||||
- `serie_id` (string): Series identifier
|
||||
|
||||
- `serie_id` (string): Series identifier
|
||||
|
||||
**Request Body:**
|
||||
|
||||
```json
|
||||
{
|
||||
"download_poster": true,
|
||||
@@ -1014,6 +1035,7 @@ Download missing media files for a series.
|
||||
```
|
||||
|
||||
**Response (200 OK):**
|
||||
|
||||
```json
|
||||
{
|
||||
"has_poster": true,
|
||||
@@ -1026,9 +1048,10 @@ Download missing media files for a series.
|
||||
```
|
||||
|
||||
**Errors:**
|
||||
- `401 Unauthorized` - Not authenticated
|
||||
- `404 Not Found` - Series or NFO not found (NFO required for TMDB ID)
|
||||
- `503 Service Unavailable` - TMDB API error
|
||||
|
||||
- `401 Unauthorized` - Not authenticated
|
||||
- `404 Not Found` - Series or NFO not found (NFO required for TMDB ID)
|
||||
- `503 Service Unavailable` - TMDB API error
|
||||
|
||||
Source: [src/server/api/nfo.py](../src/server/api/nfo.py#L450-L519)
|
||||
|
||||
@@ -1039,6 +1062,7 @@ Batch create NFO files for multiple series.
|
||||
**Authentication:** Required
|
||||
|
||||
**Request Body:**
|
||||
|
||||
```json
|
||||
{
|
||||
"serie_ids": ["one-piece", "naruto", "bleach"],
|
||||
@@ -1049,12 +1073,14 @@ Batch create NFO files for multiple series.
|
||||
```
|
||||
|
||||
**Fields:**
|
||||
- `serie_ids` (array of strings): Series identifiers to process
|
||||
- `download_media` (boolean, default: true): Download media files
|
||||
- `skip_existing` (boolean, default: true): Skip series with existing NFOs
|
||||
- `max_concurrent` (integer, 1-10, default: 3): Number of concurrent operations
|
||||
|
||||
- `serie_ids` (array of strings): Series identifiers to process
|
||||
- `download_media` (boolean, default: true): Download media files
|
||||
- `skip_existing` (boolean, default: true): Skip series with existing NFOs
|
||||
- `max_concurrent` (integer, 1-10, default: 3): Number of concurrent operations
|
||||
|
||||
**Response (200 OK):**
|
||||
|
||||
```json
|
||||
{
|
||||
"total": 3,
|
||||
@@ -1088,8 +1114,9 @@ Batch create NFO files for multiple series.
|
||||
```
|
||||
|
||||
**Errors:**
|
||||
- `401 Unauthorized` - Not authenticated
|
||||
- `503 Service Unavailable` - TMDB API key not configured
|
||||
|
||||
- `401 Unauthorized` - Not authenticated
|
||||
- `503 Service Unavailable` - TMDB API key not configured
|
||||
|
||||
Source: [src/server/api/nfo.py](../src/server/api/nfo.py#L522-L634)
|
||||
|
||||
@@ -1100,6 +1127,7 @@ Get list of series without NFO files.
|
||||
**Authentication:** Required
|
||||
|
||||
**Response (200 OK):**
|
||||
|
||||
```json
|
||||
{
|
||||
"total_series": 150,
|
||||
@@ -1124,8 +1152,9 @@ Get list of series without NFO files.
|
||||
```
|
||||
|
||||
**Errors:**
|
||||
- `401 Unauthorized` - Not authenticated
|
||||
- `503 Service Unavailable` - TMDB API key not configured
|
||||
|
||||
- `401 Unauthorized` - Not authenticated
|
||||
- `503 Service Unavailable` - TMDB API key not configured
|
||||
|
||||
Source: [src/server/api/nfo.py](../src/server/api/nfo.py#L637-L684)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user