feat: enhance entity testing with auto import releases functionality

This commit is contained in:
Sam Chau
2026-01-16 19:05:57 +10:30
parent d892b30be2
commit 656a3e3114
36 changed files with 3549 additions and 224 deletions

View File

@@ -14,18 +14,58 @@ servers:
tags:
- name: System
description: System health and status endpoints
- name: Entity Testing
description: Release parsing and custom format evaluation
- name: Arr
description: Arr instance library and release endpoints
paths:
/health:
$ref: './paths/system.yaml#/health'
/openapi.json:
$ref: './paths/system.yaml#/openapi'
/entity-testing/evaluate:
$ref: './paths/entity-testing.yaml#/evaluate'
/arr/library:
$ref: './paths/arr.yaml#/library'
/arr/releases:
$ref: './paths/arr.yaml#/releases'
components:
schemas:
# Common
ComponentStatus:
$ref: './schemas/common.yaml#/ComponentStatus'
HealthStatus:
$ref: './schemas/common.yaml#/HealthStatus'
# Health
HealthResponse:
$ref: './schemas/health.yaml#/HealthResponse'
# Entity Testing
MediaType:
$ref: './schemas/entity-testing.yaml#/MediaType'
ParsedInfo:
$ref: './schemas/entity-testing.yaml#/ParsedInfo'
ReleaseInput:
$ref: './schemas/entity-testing.yaml#/ReleaseInput'
ReleaseEvaluation:
$ref: './schemas/entity-testing.yaml#/ReleaseEvaluation'
EvaluateRequest:
$ref: './schemas/entity-testing.yaml#/EvaluateRequest'
EvaluateResponse:
$ref: './schemas/entity-testing.yaml#/EvaluateResponse'
# Arr
ArrType:
$ref: './schemas/arr.yaml#/ArrType'
LibraryMovieItem:
$ref: './schemas/arr.yaml#/LibraryMovieItem'
LibrarySeriesItem:
$ref: './schemas/arr.yaml#/LibrarySeriesItem'
LibraryResponse:
$ref: './schemas/arr.yaml#/LibraryResponse'
GroupedRelease:
$ref: './schemas/arr.yaml#/GroupedRelease'
ReleasesResponse:
$ref: './schemas/arr.yaml#/ReleasesResponse'
ErrorResponse:
$ref: './schemas/arr.yaml#/ErrorResponse'

103
docs/api/v1/paths/arr.yaml Normal file
View File

@@ -0,0 +1,103 @@
library:
get:
operationId: getLibrary
summary: Get Arr instance library
description: |
Fetches the movie or series library from an Arr instance.
Returns a simplified list suitable for selection/matching.
- For Radarr: Returns movies with id, title, year, and tmdbId
- For Sonarr: Returns series with id, title, year, tvdbId, and available seasons
tags:
- Arr
parameters:
- name: instanceId
in: query
required: true
schema:
type: integer
description: Arr instance ID
responses:
'200':
description: Library items
content:
application/json:
schema:
$ref: '../schemas/arr.yaml#/LibraryResponse'
'400':
description: Invalid or missing instanceId
content:
application/json:
schema:
$ref: '../schemas/arr.yaml#/ErrorResponse'
'404':
description: Instance not found
content:
application/json:
schema:
$ref: '../schemas/arr.yaml#/ErrorResponse'
'500':
description: Failed to fetch library
content:
application/json:
schema:
$ref: '../schemas/arr.yaml#/ErrorResponse'
releases:
get:
operationId: getReleases
summary: Search for releases
description: |
Triggers an interactive search on an Arr instance and returns grouped/deduplicated results.
For Radarr: Searches for releases for the specified movie.
For Sonarr: Searches for season pack releases for the specified series and season.
Results are grouped by title, combining information from multiple indexers.
tags:
- Arr
parameters:
- name: instanceId
in: query
required: true
schema:
type: integer
description: Arr instance ID
- name: itemId
in: query
required: true
schema:
type: integer
description: Movie ID (Radarr) or Series ID (Sonarr)
- name: season
in: query
required: false
schema:
type: integer
default: 1
description: Season number for Sonarr searches (defaults to 1)
responses:
'200':
description: Release search results
content:
application/json:
schema:
$ref: '../schemas/arr.yaml#/ReleasesResponse'
'400':
description: Invalid or missing parameters
content:
application/json:
schema:
$ref: '../schemas/arr.yaml#/ErrorResponse'
'404':
description: Instance not found
content:
application/json:
schema:
$ref: '../schemas/arr.yaml#/ErrorResponse'
'500':
description: Failed to fetch releases
content:
application/json:
schema:
$ref: '../schemas/arr.yaml#/ErrorResponse'

View File

@@ -0,0 +1,33 @@
evaluate:
post:
operationId: evaluateReleases
summary: Evaluate releases against custom formats
description: |
Parses release titles and evaluates them against all custom formats in the specified database.
This endpoint:
- Parses each release title to extract metadata (resolution, source, languages, etc.)
- Matches regex patterns using .NET-compatible regex via the parser service
- Evaluates each release against all custom formats in the database
- Returns which custom formats match each release
Results are cached for performance - repeated requests with the same titles will be faster.
tags:
- Entity Testing
requestBody:
required: true
content:
application/json:
schema:
$ref: '../schemas/entity-testing.yaml#/EvaluateRequest'
responses:
'200':
description: Evaluation results
content:
application/json:
schema:
$ref: '../schemas/entity-testing.yaml#/EvaluateResponse'
'400':
description: Invalid request (missing databaseId or releases)
'500':
description: Database cache not available

View File

@@ -0,0 +1,150 @@
ArrType:
type: string
enum:
- radarr
- sonarr
description: Type of Arr instance
# Library endpoint types
LibraryMovieItem:
type: object
required:
- id
- title
- year
- tmdbId
properties:
id:
type: integer
description: Radarr movie ID
title:
type: string
description: Movie title
year:
type: integer
description: Release year
tmdbId:
type: integer
description: TMDB ID
LibrarySeriesItem:
type: object
required:
- id
- title
- year
- tvdbId
- seasons
properties:
id:
type: integer
description: Sonarr series ID
title:
type: string
description: Series title
year:
type: integer
description: First air year
tvdbId:
type: integer
description: TVDB ID
seasons:
type: array
items:
type: integer
description: Available season numbers (excludes specials)
LibraryRadarrResponse:
type: object
required:
- type
- items
properties:
type:
type: string
enum:
- radarr
items:
type: array
items:
$ref: '#/LibraryMovieItem'
LibrarySonarrResponse:
type: object
required:
- type
- items
properties:
type:
type: string
enum:
- sonarr
items:
type: array
items:
$ref: '#/LibrarySeriesItem'
LibraryResponse:
oneOf:
- $ref: '#/LibraryRadarrResponse'
- $ref: '#/LibrarySonarrResponse'
description: Library response varies by instance type
# Releases endpoint types
GroupedRelease:
type: object
required:
- title
- size
- languages
- indexers
- flags
properties:
title:
type: string
description: Release title
size:
type: integer
description: Release size in bytes
languages:
type: array
items:
type: string
description: Languages detected in the release
indexers:
type: array
items:
type: string
description: Indexers where this release was found
flags:
type: array
items:
type: string
description: Release flags (e.g., freeleech, internal)
ReleasesResponse:
type: object
required:
- type
- rawCount
- releases
properties:
type:
$ref: '#/ArrType'
rawCount:
type: integer
description: Total number of raw releases before grouping
releases:
type: array
items:
$ref: '#/GroupedRelease'
description: Grouped and deduplicated releases
ErrorResponse:
type: object
required:
- error
properties:
error:
type: string
description: Error message

View File

@@ -0,0 +1,114 @@
MediaType:
type: string
enum:
- movie
- series
description: Type of media
ParsedInfo:
type: object
required:
- source
- resolution
- modifier
- languages
- year
properties:
source:
type: string
description: Detected source (e.g., bluray, webdl, webrip)
resolution:
type: string
description: Detected resolution (e.g., 1080p, 2160p)
modifier:
type: string
description: Quality modifier (e.g., remux, none)
languages:
type: array
items:
type: string
description: Detected languages
releaseGroup:
type: string
nullable: true
description: Detected release group
year:
type: integer
description: Detected year
edition:
type: string
nullable: true
description: Detected edition (e.g., Director's Cut)
releaseType:
type: string
nullable: true
description: Release type for series (single_episode, season_pack, etc.)
ReleaseInput:
type: object
required:
- id
- title
- type
properties:
id:
type: integer
description: Release ID
title:
type: string
description: Release title to parse and evaluate
type:
$ref: '#/MediaType'
ReleaseEvaluation:
type: object
required:
- releaseId
- title
- cfMatches
properties:
releaseId:
type: integer
description: Release ID
title:
type: string
description: Release title
parsed:
$ref: '#/ParsedInfo'
nullable: true
description: Parsed release info (null if parsing failed)
cfMatches:
type: object
additionalProperties:
type: boolean
description: Map of custom format ID to whether it matches
EvaluateRequest:
type: object
required:
- databaseId
- releases
properties:
databaseId:
type: integer
description: Database ID to use for custom format evaluation
releases:
type: array
items:
$ref: '#/ReleaseInput'
description: Releases to evaluate
EvaluateResponse:
type: object
required:
- parserAvailable
- evaluations
properties:
parserAvailable:
type: boolean
description: Whether the parser service is available
evaluations:
type: array
items:
$ref: '#/ReleaseEvaluation'
description: Evaluation results for each release