added some unit tests

This commit is contained in:
JasonLandbridge
2025-02-06 23:30:53 +01:00
parent b126cde00c
commit d627cff7bb
4 changed files with 5338 additions and 358 deletions

331
src/models/Media-data.yaml Normal file
View File

@@ -0,0 +1,331 @@
type: array
description: "An array of media file data items."
items:
type: object
required:
- id
- duration
- bitrate
- width
- height
- aspectRatio
- audioChannels
- audioCodec
- videoCodec
- videoResolution
- container
- videoFrameRate
- videoProfile
- hasVoiceActivity
- Part
properties:
id:
type: integer
description: "Unique media identifier."
example: 387322
duration:
type: integer
description: "Duration of the media in milliseconds."
example: 9610350
bitrate:
type: integer
description: "Bitrate in bits per second."
example: 25512
width:
type: integer
description: "Video width in pixels."
example: 3840
height:
type: integer
description: "Video height in pixels."
example: 1602
aspectRatio:
type: number
format: float
description: "Aspect ratio of the video."
example: 2.35
audioChannels:
type: integer
description: "Number of audio channels."
example: 6
audioCodec:
type: string
description: "Audio codec used."
example: "eac3"
videoCodec:
type: string
description: "Video codec used."
example: "hevc"
videoResolution:
type: string
description: "Video resolution (e.g., 4k)."
example: "4k"
container:
type: string
description: "File container type."
example: "mkv"
videoFrameRate:
type: string
description: "Frame rate of the video (e.g., 24p)."
example: "24p"
videoProfile:
type: string
description: "Video profile (e.g., main 10)."
example: "main 10"
hasVoiceActivity:
type: boolean
description: "Indicates whether voice activity is detected."
example: false
Part:
type: array
description: "An array of parts for this media item."
items:
type: object
required:
- id
- key
- duration
- file
- size
- container
- videoProfile
- Stream
properties:
accessible:
type: boolean
description: "Indicates if the part is accessible."
example: true
exists:
type: boolean
description: "Indicates if the part exists."
example: true
id:
type: integer
description: "Unique part identifier."
example: 418385
key:
type: string
description: "Key to access this part."
example: "/library/parts/418385/1735864239/file.mkv"
indexes:
type: string
example: "sd"
duration:
type: integer
description: "Duration of the part in milliseconds."
example: 9610350
file:
type: string
description: "File path for the part."
example: "/mnt/Movies_1/W/Wicked (2024).mkv"
size:
type: integer
description: "File size in bytes."
example: 30649952104
container:
type: string
description: "Container format of the part."
example: "mkv"
videoProfile:
type: string
description: "Video profile for the part."
example: "main 10"
Stream:
type: array
description: "An array of streams for this part."
items:
type: object
required:
- id
- streamType
- codec
- index
- bitrate
- language
- languageTag
- languageCode
- displayTitle
- extendedDisplayTitle
properties:
id:
type: integer
description: "Unique stream identifier."
example: 1002625
streamType:
type: integer
description: "Stream type (1=video, 2=audio, 3=subtitle)."
example: 1
default:
type: boolean
description: "Indicates if this stream is default."
example: true
codec:
type: string
description: "Codec used by the stream."
example: "hevc"
index:
type: integer
description: "Index of the stream."
example: 0
bitrate:
type: integer
description: "Bitrate of the stream."
example: 24743
language:
type: string
description: "Language of the stream."
example: "English"
languageTag:
type: string
description: "Language tag (e.g., en)."
example: "en"
languageCode:
type: string
description: "ISO language code."
example: "eng"
DOVIBLCompatID:
type: integer
description: "Dolby Vision BL compatibility ID."
example: 1
DOVIBLPresent:
type: boolean
description: "Indicates if Dolby Vision BL is present."
example: true
DOVIELPresent:
type: boolean
description: "Indicates if Dolby Vision EL is present."
example: false
DOVILevel:
type: integer
description: "Dolby Vision level."
example: 6
DOVIPresent:
type: boolean
description: "Indicates if Dolby Vision is present."
example: true
DOVIProfile:
type: integer
description: "Dolby Vision profile."
example: 8
DOVIRPUPresent:
type: boolean
description: "Indicates if Dolby Vision RPU is present."
example: true
DOVIVersion:
type: string
description: "Dolby Vision version."
example: "1.0"
bitDepth:
type: integer
description: "Bit depth of the video stream."
example: 10
chromaLocation:
type: string
description: "Chroma sample location."
example: "topleft"
chromaSubsampling:
type: string
description: "Chroma subsampling format."
example: "4:2:0"
codedHeight:
type: integer
description: "Coded video height."
example: 1608
codedWidth:
type: integer
description: "Coded video width."
example: 3840
colorPrimaries:
type: string
description: "Color primaries used."
example: "bt2020"
colorRange:
type: string
description: "Color range (e.g., tv)."
example: "tv"
colorSpace:
type: string
description: "Color space."
example: "bt2020nc"
colorTrc:
type: string
description: "Color transfer characteristics."
example: "smpte2084"
frameRate:
type: number
format: float
description: "Frame rate of the stream."
example: 23.976
height:
type: integer
description: "Height of the video stream."
example: 1602
level:
type: integer
description: "Video level."
example: 150
original:
type: boolean
description: "Indicates if this is the original stream."
example: true
hasScalingMatrix:
type: boolean
example: false
profile:
type: string
description: "Video profile."
example: "main 10"
scanType:
type: string
example: "progressive"
refFrames:
type: integer
description: "Number of reference frames."
example: 1
width:
type: integer
description: "Width of the video stream."
example: 3840
displayTitle:
type: string
description: "Display title for the stream."
example: "4K DoVi/HDR10 (HEVC Main 10)"
extendedDisplayTitle:
type: string
description: "Extended display title for the stream."
example: "4K DoVi/HDR10 (HEVC Main 10)"
selected:
type: boolean
description: "Indicates if this stream is selected (applicable for audio streams)."
example: true
forced:
type: boolean
example: true
channels:
type: integer
description: "Number of audio channels (for audio streams)."
example: 6
audioChannelLayout:
type: string
description: "Audio channel layout."
example: "5.1(side)"
samplingRate:
type: integer
description: "Sampling rate for the audio stream."
example: 48000
canAutoSync:
type: boolean
description: "Indicates if the stream can auto-sync."
example: false
hearingImpaired:
type: boolean
description: "Indicates if the stream is for the hearing impaired."
example: true
dub:
type: boolean
description: "Indicates if the stream is a dub."
example: true
title:
type: string
description: "Optional title for the stream (e.g., language variant)."
example: "SDH"

View File

@@ -0,0 +1,31 @@
type: object
required:
- id
- filter
- tag
- tagKey
properties:
id:
type: integer
description: "The unique role identifier."
example: 109501
filter:
type: string
description: "The filter string for the role."
example: "actor=109501"
tag:
type: string
description: "The actor's name."
example: "Bob Odenkirk"
tagKey:
type: string
description: "A key associated with the actor tag."
example: "5d77683254f42c001f8c3f69"
role:
type: string
description: "The character name or role."
example: "Jimmy McGill"
thumb:
type: string
description: "URL for the role thumbnail image."
example: "https://metadata-static.plex.tv/f/people/f2ca7b474cc984efbdd5c503a096285a.jpg"

View File

@@ -7,6 +7,97 @@ get:
operationId: get-media-meta-data
parameters:
- $ref: "../../../../parameters/library/rating-key.yaml"
- name: includeConcerts
in: query
description: "Include concerts data if set to true."
required: false
schema:
type: boolean
example: true
- name: includeExtras
in: query
description: "Include extra content (e.g. bonus features)."
required: false
schema:
type: boolean
example: true
- name: includeOnDeck
in: query
description: "Include on-deck items."
required: false
schema:
type: boolean
example: true
- name: includePopularLeaves
in: query
description: "Include popular leaves (episodes/chapters)."
required: false
schema:
type: boolean
example: true
- name: includePreferences
in: query
description: "Include preferences information."
required: false
schema:
type: boolean
example: true
- name: includeReviews
in: query
description: "Include reviews for the content."
required: false
schema:
type: boolean
example: true
- name: includeChapters
in: query
description: "Include chapter details."
required: false
schema:
type: boolean
example: true
- name: includeStations
in: query
description: "Include station data."
required: false
schema:
type: boolean
example: true
- name: includeExternalMedia
in: query
description: "Include external media data."
required: false
schema:
type: boolean
example: true
- name: asyncAugmentMetadata
in: query
description: "Trigger asynchronous metadata augmentation."
required: false
schema:
type: boolean
example: true
- name: asyncCheckFiles
in: query
description: "Trigger asynchronous file checking."
required: false
schema:
type: boolean
example: true
- name: asyncRefreshAnalysis
in: query
description: "Trigger asynchronous refresh of analysis."
required: false
schema:
type: boolean
example: true
- name: asyncRefreshLocalMediaAgent
in: query
description: "Trigger asynchronous refresh of the local media agent."
required: false
schema:
type: boolean
example: true
responses:
"200":
description: The metadata of the library item.
@@ -25,7 +116,9 @@ get:
- $ref: "../../../../models/media-container/library-section-uuid.yaml"
- $ref: "../../../../models/media-container/media-tag-prefix.yaml"
- $ref: "../../../../models/media-container/media-tag-version.yaml"
type: object
- type: object
required:
- Metadata
properties:
Metadata:
type: array
@@ -36,8 +129,6 @@ get:
- ratingKey
- key
- guid
- slug
- studio
- type
- title
- librarySectionTitle
@@ -45,38 +136,52 @@ get:
- librarySectionKey
- contentRating
- summary
- index
- audienceRating
- viewCount
- skipCount
- lastViewedAt
- year
- tagline
- thumb
- art
- theme
- duration
- originallyAvailableAt
- leafCount
- viewedLeafCount
- childCount
- addedAt
- updatedAt
- audienceRatingImage
- Image
- UltraBlurColors
- Genre
- Country
- Guid
- Rating
- Role
- Similar
- Location
properties:
ratingKey:
type: string
description: "The rating key of the metadata item."
example: "44288"
parentRatingKey:
type: string
description: "The rating key of the parent of this metadata item."
example: "48047"
grandparentRatingKey:
type: string
description: "The rating key of the grandparent of this metadata item."
example: "45520"
parentGuid:
type: string
description: "A GUID identifying the parent entity (e.g., season) for the item."
example: "plex://season/618b89208dde18df707ad15c"
grandparentGuid:
type: string
description: "A GUID identifying the grandparent entity (e.g., show)."
example: "plex://show/5e16253691c20300412003a8"
grandparentSlug:
type: string
description: "A URL-friendly identifier (slug) for the grandparent entity."
example: "alice-in-borderland-2020"
grandparentKey:
type: string
description: "A key identifying the grandparent metadata in the library."
example: "/library/metadata/45520"
parentKey:
type: string
description: "A key identifying the parent metadata in the library."
example: "/library/metadata/48047"
key:
type: string
description: "The API key to access metadata details."
@@ -101,6 +206,10 @@ get:
type: string
description: "The title of the content."
example: "Better Call Saul"
originalTitle:
type: string
description: "The original title of the content."
example: "Wicked: Part I"
librarySectionTitle:
type: string
description: "The title of the library section."
@@ -125,6 +234,14 @@ get:
type: integer
description: "The index or order of the item."
example: 1
grandparentTitle:
type: string
description: "The title of the grandparent entity (typically the show's title)."
example: "Alice in Borderland"
parentTitle:
type: string
description: "The title of the parent entity (typically the season's title)."
example: "Season 2"
audienceRating:
type: number
format: float
@@ -150,6 +267,12 @@ get:
type: string
description: "The tagline of the content."
example: "Make the call"
chapterSource:
type: string
example: "media"
primaryExtraKey:
type: string
example: "/library/metadata/134704"
thumb:
type: string
description: "URL of the thumbnail image."
@@ -195,6 +318,25 @@ get:
type: string
description: "The URL for the audience rating image."
example: "themoviedb://image.rating"
parentIndex:
type: integer
description: "The index number of the parent entity, which could indicate its order or position."
example: 2
parentThumb:
type: string
description: "The URL of the parent's thumbnail image."
example: "/library/metadata/48047/thumb/1671800243"
grandparentThumb:
type: string
description: "The URL of the grandparent's thumbnail image."
example: "/library/metadata/45520/thumb/1736488003"
grandparentArt:
type: string
description: "The URL of the grandparent's art image."
example: "/library/metadata/45520/art/1736488003"
Media:
allOf:
- $ref: "../../../../models/Media-data.yaml"
Image:
type: array
description: "An array of image objects."
@@ -322,40 +464,25 @@ get:
example: "audience"
Role:
type: array
description: "An array of role objects."
description: "An array of Actor roles."
items:
type: object
required:
- id
- filter
- tag
- tagKey
- role
properties:
id:
type: integer
description: "The unique role identifier."
example: 109501
filter:
type: string
description: "The filter string for the role."
example: "actor=109501"
tag:
type: string
description: "The actor's name."
example: "Bob Odenkirk"
tagKey:
type: string
description: "A key associated with the actor tag."
example: "5d77683254f42c001f8c3f69"
role:
type: string
description: "The character name or role."
example: "Jimmy McGill"
thumb:
type: string
description: "URL for the role thumbnail image."
example: "https://metadata-static.plex.tv/f/people/f2ca7b474cc984efbdd5c503a096285a.jpg"
$ref: "../../../../models/meta-data/role.yaml"
Director:
type: array
description: "An array of Director roles."
items:
$ref: "../../../../models/meta-data/role.yaml"
Writer:
type: array
description: "An array of Writer roles."
items:
$ref: "../../../../models/meta-data/role.yaml"
Producer:
type: array
description: "An array of Writer roles."
items:
$ref: "../../../../models/meta-data/role.yaml"
Similar:
type: array
description: "An array of similar content objects."

File diff suppressed because it is too large Load Diff