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

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,371 +116,407 @@ 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
properties:
Metadata:
type: array
description: "An array of metadata items."
items:
type: object
required:
- ratingKey
- key
- guid
- slug
- studio
- type
- title
- librarySectionTitle
- librarySectionID
- 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"
key:
type: string
description: "The API key to access metadata details."
example: "/library/metadata/44288/children"
guid:
type: string
description: "The globally unique identifier for the item."
example: "plex://show/5d9c08254eefaa001f5d6dcb"
slug:
type: string
description: "A URL-friendly identifier for the item."
example: "better-call-saul"
studio:
type: string
description: "The studio that produced the content."
example: "Sony Pictures Television"
type:
type: string
description: "The type of content (e.g., show, movie)."
example: "show"
title:
type: string
description: "The title of the content."
example: "Better Call Saul"
librarySectionTitle:
type: string
description: "The title of the library section."
example: "TV Series "
librarySectionID:
type: integer
description: "The ID of the library section."
example: 2
librarySectionKey:
type: string
description: "The key of the library section."
example: "/library/sections/2"
contentRating:
type: string
description: "The content rating (e.g., TV-MA)."
example: "TV-MA"
summary:
type: string
description: "A summary of the content."
example: 'Before Saul Goodman, he was Jimmy McGill. And if you''re calling Jimmy, you''re in real trouble. The prequel to "Breaking Bad" follows small-time attorney, Jimmy McGill, as he transforms into Walter White''s morally challenged lawyer, Saul Goodman.'
index:
type: integer
description: "The index or order of the item."
example: 1
audienceRating:
type: number
format: float
description: "The audience rating for the content."
example: 8.7
viewCount:
type: integer
description: "The number of times the item has been viewed."
example: 4
skipCount:
type: integer
description: "The number of times the item has been skipped."
example: 1
lastViewedAt:
type: integer
description: "Unix timestamp of when the item was last viewed."
example: 1625764795
year:
type: integer
description: "The release year."
example: 2015
tagline:
type: string
description: "The tagline of the content."
example: "Make the call"
thumb:
type: string
description: "URL of the thumbnail image."
example: "/library/metadata/44288/thumb/1736487993"
art:
type: string
description: "URL of the art image."
example: "/library/metadata/44288/art/1736487993"
theme:
type: string
description: "URL of the theme image."
example: "/library/metadata/44288/theme/1736487993"
duration:
type: integer
description: "Duration of the content in milliseconds."
example: 2700000
originallyAvailableAt:
type: string
format: date
description: "The original release date."
example: "2015-02-08"
leafCount:
type: integer
description: "The total number of episodes (or leaves)."
example: 63
viewedLeafCount:
type: integer
description: "The number of episodes that have been viewed."
example: 4
childCount:
type: integer
description: "The number of child items."
example: 6
addedAt:
type: integer
description: "Unix timestamp when the item was added."
example: 1625505101
updatedAt:
type: integer
description: "Unix timestamp when the item was last updated."
example: 1736487993
audienceRatingImage:
type: string
description: "The URL for the audience rating image."
example: "themoviedb://image.rating"
Image:
type: array
description: "An array of image objects."
items:
type: object
required:
- alt
- type
- url
properties:
alt:
type: string
description: "Alternate text for the image."
example: "Better Call Saul"
type:
type: string
description: "The type of image (e.g., coverPoster, background, clearLogo)."
example: "coverPoster"
url:
type: string
description: "The URL of the image."
example: "/library/metadata/44288/thumb/1736487993"
UltraBlurColors:
- type: object
required:
- Metadata
properties:
Metadata:
type: array
description: "An array of metadata items."
items:
type: object
required:
- topLeft
- topRight
- bottomRight
- bottomLeft
- ratingKey
- key
- guid
- type
- title
- librarySectionTitle
- librarySectionID
- librarySectionKey
- contentRating
- summary
- audienceRating
- year
- thumb
- art
- duration
- originallyAvailableAt
- addedAt
- updatedAt
- audienceRatingImage
- Image
- UltraBlurColors
- Guid
- Rating
properties:
topLeft:
ratingKey:
type: string
description: "The top-left color value."
example: "11333a"
topRight:
description: "The rating key of the metadata item."
example: "44288"
parentRatingKey:
type: string
description: "The top-right color value."
example: "1d2721"
bottomRight:
description: "The rating key of the parent of this metadata item."
example: "48047"
grandparentRatingKey:
type: string
description: "The bottom-right color value."
example: "5c451d"
bottomLeft:
description: "The rating key of the grandparent of this metadata item."
example: "45520"
parentGuid:
type: string
description: "The bottom-left color value."
example: "372c10"
Genre:
type: array
description: "An array of genre tags."
items:
type: object
required:
- id
- filter
- tag
properties:
id:
type: integer
description: "The unique genre identifier."
example: 1057
filter:
type: string
description: "The filter string for the genre."
example: "genre=1057"
tag:
type: string
description: "The genre name."
example: "Crime"
Country:
type: array
description: "An array of country tags."
items:
type: object
required:
- id
- filter
- tag
properties:
id:
type: integer
description: "The unique country identifier."
example: 58591
filter:
type: string
description: "The filter string for the country."
example: "country=58591"
tag:
type: string
description: "The country name."
example: "United States of America"
Guid:
type: array
description: "An array of GUID objects."
items:
type: object
required:
- id
properties:
id:
type: string
description: "The GUID value."
example: "imdb://tt3032476"
Rating:
type: array
description: "An array of rating objects."
items:
type: object
required:
- image
- value
- type
properties:
image:
type: string
description: "The image or reference for the rating."
example: "imdb://image.rating"
value:
type: number
format: float
description: "The rating value."
example: 9.0
type:
type: string
description: "The type of rating (e.g., audience, critic)."
example: "audience"
Role:
type: array
description: "An array of role objects."
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"
Similar:
type: array
description: "An array of similar content objects."
items:
type: object
required:
- id
- filter
- tag
properties:
id:
type: integer
description: "The unique similar item identifier."
example: 26
filter:
type: string
description: "The filter string for similar items."
example: "similar=26"
tag:
type: string
description: "The tag or title of the similar content."
example: "Breaking Bad"
Location:
type: array
description: "An array of location objects."
items:
type: object
required:
- path
properties:
path:
type: string
description: "The file path for the location."
example: "/TV Shows/Better Call Saul"
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."
example: "/library/metadata/44288/children"
guid:
type: string
description: "The globally unique identifier for the item."
example: "plex://show/5d9c08254eefaa001f5d6dcb"
slug:
type: string
description: "A URL-friendly identifier for the item."
example: "better-call-saul"
studio:
type: string
description: "The studio that produced the content."
example: "Sony Pictures Television"
type:
type: string
description: "The type of content (e.g., show, movie)."
example: "show"
title:
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."
example: "TV Series "
librarySectionID:
type: integer
description: "The ID of the library section."
example: 2
librarySectionKey:
type: string
description: "The key of the library section."
example: "/library/sections/2"
contentRating:
type: string
description: "The content rating (e.g., TV-MA)."
example: "TV-MA"
summary:
type: string
description: "A summary of the content."
example: 'Before Saul Goodman, he was Jimmy McGill. And if you''re calling Jimmy, you''re in real trouble. The prequel to "Breaking Bad" follows small-time attorney, Jimmy McGill, as he transforms into Walter White''s morally challenged lawyer, Saul Goodman.'
index:
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
description: "The audience rating for the content."
example: 8.7
viewCount:
type: integer
description: "The number of times the item has been viewed."
example: 4
skipCount:
type: integer
description: "The number of times the item has been skipped."
example: 1
lastViewedAt:
type: integer
description: "Unix timestamp of when the item was last viewed."
example: 1625764795
year:
type: integer
description: "The release year."
example: 2015
tagline:
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."
example: "/library/metadata/44288/thumb/1736487993"
art:
type: string
description: "URL of the art image."
example: "/library/metadata/44288/art/1736487993"
theme:
type: string
description: "URL of the theme image."
example: "/library/metadata/44288/theme/1736487993"
duration:
type: integer
description: "Duration of the content in milliseconds."
example: 2700000
originallyAvailableAt:
type: string
format: date
description: "The original release date."
example: "2015-02-08"
leafCount:
type: integer
description: "The total number of episodes (or leaves)."
example: 63
viewedLeafCount:
type: integer
description: "The number of episodes that have been viewed."
example: 4
childCount:
type: integer
description: "The number of child items."
example: 6
addedAt:
type: integer
description: "Unix timestamp when the item was added."
example: 1625505101
updatedAt:
type: integer
description: "Unix timestamp when the item was last updated."
example: 1736487993
audienceRatingImage:
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."
items:
type: object
required:
- alt
- type
- url
properties:
alt:
type: string
description: "Alternate text for the image."
example: "Better Call Saul"
type:
type: string
description: "The type of image (e.g., coverPoster, background, clearLogo)."
example: "coverPoster"
url:
type: string
description: "The URL of the image."
example: "/library/metadata/44288/thumb/1736487993"
UltraBlurColors:
type: object
required:
- topLeft
- topRight
- bottomRight
- bottomLeft
properties:
topLeft:
type: string
description: "The top-left color value."
example: "11333a"
topRight:
type: string
description: "The top-right color value."
example: "1d2721"
bottomRight:
type: string
description: "The bottom-right color value."
example: "5c451d"
bottomLeft:
type: string
description: "The bottom-left color value."
example: "372c10"
Genre:
type: array
description: "An array of genre tags."
items:
type: object
required:
- id
- filter
- tag
properties:
id:
type: integer
description: "The unique genre identifier."
example: 1057
filter:
type: string
description: "The filter string for the genre."
example: "genre=1057"
tag:
type: string
description: "The genre name."
example: "Crime"
Country:
type: array
description: "An array of country tags."
items:
type: object
required:
- id
- filter
- tag
properties:
id:
type: integer
description: "The unique country identifier."
example: 58591
filter:
type: string
description: "The filter string for the country."
example: "country=58591"
tag:
type: string
description: "The country name."
example: "United States of America"
Guid:
type: array
description: "An array of GUID objects."
items:
type: object
required:
- id
properties:
id:
type: string
description: "The GUID value."
example: "imdb://tt3032476"
Rating:
type: array
description: "An array of rating objects."
items:
type: object
required:
- image
- value
- type
properties:
image:
type: string
description: "The image or reference for the rating."
example: "imdb://image.rating"
value:
type: number
format: float
description: "The rating value."
example: 9.0
type:
type: string
description: "The type of rating (e.g., audience, critic)."
example: "audience"
Role:
type: array
description: "An array of Actor roles."
items:
$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."
items:
type: object
required:
- id
- filter
- tag
properties:
id:
type: integer
description: "The unique similar item identifier."
example: 26
filter:
type: string
description: "The filter string for similar items."
example: "similar=26"
tag:
type: string
description: "The tag or title of the similar content."
example: "Breaking Bad"
Location:
type: array
description: "An array of location objects."
items:
type: object
required:
- path
properties:
path:
type: string
description: "The file path for the location."
example: "/TV Shows/Better Call Saul"
"400":
$ref: "../../../../responses/400.yaml"
"401":