mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2026-07-12 12:21:34 +00:00
Fixing LibraryItem polymorphism
This commit is contained in:
parent
85586315f7
commit
0ffc6fbad9
2 changed files with 192 additions and 309 deletions
|
|
@ -1656,29 +1656,45 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"oldFolderId": {
|
||||
"type": "string",
|
||||
"description": "The ID of folders created on server version 2.2.23 and before.",
|
||||
"format": "fol_[a-z0-9]{18}",
|
||||
"example": "fol_o78uaoeuh78h6aoeif"
|
||||
},
|
||||
"newFolderId": {
|
||||
"type": "string",
|
||||
"description": "The folder ID for any folders added after 2.3.0.",
|
||||
"format": "uuid",
|
||||
"example": "e4bb1afb-4a4f-4dd6-8be0-e615d233185b"
|
||||
},
|
||||
"folderId": {
|
||||
"type": "string",
|
||||
"anyOf": [
|
||||
{
|
||||
"$ref": "#/components/schemas/oldFolderId"
|
||||
},
|
||||
{
|
||||
"$ref": "#/components/schemas/newFolderId"
|
||||
}
|
||||
]
|
||||
},
|
||||
"folder": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {
|
||||
"description": "The ID of the folder. (Read Only)",
|
||||
"type": "string",
|
||||
"example": "fol_bev1zuxhb0j0s1wehr"
|
||||
"$ref": "#/components/schemas/folderId"
|
||||
},
|
||||
"fullPath": {
|
||||
"description": "The path on the server for the folder. (Read Only)",
|
||||
"type": "string",
|
||||
"example": "/podcasts"
|
||||
},
|
||||
"libraryId": {
|
||||
"oneOf": [
|
||||
"libraryId": [
|
||||
{
|
||||
"$ref": "#/components/schemas/oldLibraryId"
|
||||
},
|
||||
{
|
||||
"$ref": "#/components/schemas/newLibraryId"
|
||||
"$ref": "#/components/schemas/libraryId"
|
||||
}
|
||||
]
|
||||
},
|
||||
],
|
||||
"addedAt": {
|
||||
"description": "The time (in ms since POSIX epoch) when the folder was added. (Read Only)",
|
||||
"type": "integer",
|
||||
|
|
@ -1686,14 +1702,6 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"mediaType": {
|
||||
"type": "string",
|
||||
"description": "The type of media, will be book or podcast.",
|
||||
"enum": [
|
||||
"book",
|
||||
"podcast"
|
||||
]
|
||||
},
|
||||
"oldLibraryId": {
|
||||
"type": "string",
|
||||
"description": "The ID of the libraries created on server version 2.2.23 and before.",
|
||||
|
|
@ -1855,7 +1863,7 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"libraryItem": {
|
||||
"libraryItemBase": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {
|
||||
|
|
@ -1865,21 +1873,14 @@
|
|||
},
|
||||
"ino": {
|
||||
"description": "The inode of the library item.",
|
||||
"type": "string"
|
||||
"type": "string",
|
||||
"format": "[0-9]*"
|
||||
},
|
||||
"libraryId": {
|
||||
"oneOf": [
|
||||
{
|
||||
"$ref": "#/components/schemas/oldLibraryId"
|
||||
},
|
||||
{
|
||||
"$ref": "#/components/schemas/newLibraryId"
|
||||
}
|
||||
]
|
||||
"$ref": "#/components/schemas/libraryId"
|
||||
},
|
||||
"folderId": {
|
||||
"description": "The ID of the folder the library item is in.",
|
||||
"type": "string"
|
||||
"$ref": "#/components/schemas/folderId"
|
||||
},
|
||||
"path": {
|
||||
"description": "The path of the library item on the server.",
|
||||
|
|
@ -1913,14 +1914,6 @@
|
|||
"description": "The time (in ms since POSIX epoch) when the library item was last updated. (Read Only)",
|
||||
"type": "integer"
|
||||
},
|
||||
"lastScan": {
|
||||
"description": "The time (in ms since POSIX epoch) when the library item was last scanned. Will be null if the server has not yet scanned the library item.",
|
||||
"type": "integer"
|
||||
},
|
||||
"scanVersion": {
|
||||
"description": "The version of the scanner when last scanned. Will be null if it has not been scanned.",
|
||||
"type": "string"
|
||||
},
|
||||
"isMissing": {
|
||||
"description": "Whether the library item was scanned and no longer exists.",
|
||||
"type": "boolean"
|
||||
|
|
@ -1933,17 +1926,32 @@
|
|||
{
|
||||
"$ref": "#/components/schemas/mediaType"
|
||||
}
|
||||
],
|
||||
"media": {
|
||||
"description": "The media of the library item.",
|
||||
"oneOf": [
|
||||
]
|
||||
}
|
||||
},
|
||||
"libraryItem": {
|
||||
"type": "object",
|
||||
"description": "A single item on the server, like a book or podcast.",
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/components/schemas/book"
|
||||
"$ref": "#/components/schemas/libraryItemBase"
|
||||
},
|
||||
{
|
||||
"$ref": "#/components/schemas/podcast"
|
||||
}
|
||||
]
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"folderId": {
|
||||
"$ref": "#/components/schemas/folderId"
|
||||
},
|
||||
"lastScan": {
|
||||
"description": "The time (in ms since POSIX epoch) when the library item was last scanned. Will be null if the server has not yet scanned the library item.",
|
||||
"type": "integer"
|
||||
},
|
||||
"scanVersion": {
|
||||
"description": "The version of the scanner when last scanned. Will be null if it has not been scanned.",
|
||||
"type": "string"
|
||||
},
|
||||
"media": {
|
||||
"$ref": "#/components/schemas/media"
|
||||
},
|
||||
"libraryFiles": {
|
||||
"description": "The files of the library item.",
|
||||
|
|
@ -1953,222 +1961,48 @@
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"libraryItemMinified": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {
|
||||
"description": "The ID of the library item.",
|
||||
"type": "string",
|
||||
"example": "li_8gch9ve09orgn4fdz8"
|
||||
},
|
||||
"ino": {
|
||||
"description": "The inode of the library item.",
|
||||
"type": "string",
|
||||
"example": "649641337522215266"
|
||||
},
|
||||
"libraryId": {
|
||||
"oneOf": [
|
||||
"description": "A single item on the server, like a book or podcast. Minified media format.",
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/components/schemas/oldLibraryId"
|
||||
"$ref": "#/components/schemas/libraryItemBase"
|
||||
},
|
||||
{
|
||||
"$ref": "#/components/schemas/newLibraryId"
|
||||
}
|
||||
]
|
||||
},
|
||||
"folderId": {
|
||||
"description": "The ID of the folder the library item is in.",
|
||||
"type": "string",
|
||||
"example": "fol_bev1zuxhb0j0s1wehr"
|
||||
},
|
||||
"path": {
|
||||
"description": "The path of the library item on the server.",
|
||||
"type": "string",
|
||||
"example": "/audiobooks/Terry Goodkind/Sword of Truth/Wizards First Rule"
|
||||
},
|
||||
"relPath": {
|
||||
"description": "The path, relative to the library folder, of the library item.",
|
||||
"type": "string",
|
||||
"example": "Terry Goodkind/Sword of Truth/Wizards First Rule"
|
||||
},
|
||||
"isFile": {
|
||||
"description": "Whether the library item is a single file in the root of the library folder.",
|
||||
"type": "boolean",
|
||||
"example": false
|
||||
},
|
||||
"mtimeMs": {
|
||||
"description": "The time (in ms since POSIX epoch) when the library item was last modified on disk.",
|
||||
"type": "integer",
|
||||
"example": 1650621074299
|
||||
},
|
||||
"ctimeMs": {
|
||||
"description": "The time (in ms since POSIX epoch) when the library item status was changed on disk.",
|
||||
"type": "integer",
|
||||
"example": 1650621074299
|
||||
},
|
||||
"birthtimeMs": {
|
||||
"description": "The time (in ms since POSIX epoch) when the library item was created on disk. Will be 0 if unknown.",
|
||||
"type": "integer",
|
||||
"example": 0
|
||||
},
|
||||
"addedAt": {
|
||||
"description": "The time (in ms since POSIX epoch) when the library item was added to the library.",
|
||||
"type": "integer",
|
||||
"example": 1650621073750
|
||||
},
|
||||
"updatedAt": {
|
||||
"description": "The time (in ms since POSIX epoch) when the library item was last updated. (Read Only)",
|
||||
"type": "integer",
|
||||
"example": 1650621110769
|
||||
},
|
||||
"isMissing": {
|
||||
"description": "Whether the library item was scanned and no longer exists.",
|
||||
"type": "boolean",
|
||||
"example": false
|
||||
},
|
||||
"isInvalid": {
|
||||
"description": "Whether the library item was scanned and no longer has media files.",
|
||||
"type": "boolean",
|
||||
"example": false
|
||||
},
|
||||
"mediaType": [
|
||||
{
|
||||
"$ref": "#/components/schemas/mediaType"
|
||||
}
|
||||
],
|
||||
"media": {
|
||||
"description": "The media of the library item.",
|
||||
"type": "object",
|
||||
"additionalProperties": {
|
||||
"oneOf": [
|
||||
{
|
||||
"$ref": "#/components/schemas/bookMinified"
|
||||
},
|
||||
{
|
||||
"$ref": "#/components/schemas/podcastMinified"
|
||||
"properties": {
|
||||
"media": {
|
||||
"$ref": "#/components/schemas/mediaMinified"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"numFiles": {
|
||||
"description": "The number of library files for the library item.",
|
||||
"type": "integer",
|
||||
"example": 2
|
||||
},
|
||||
"size": {
|
||||
"description": "The total size (in bytes) of the library item.",
|
||||
"type": "integer",
|
||||
"example": 268990279
|
||||
}
|
||||
}
|
||||
},
|
||||
"libraryItemExpanded": {
|
||||
"type": "object",
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/components/schemas/libraryItemBase"
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {
|
||||
"description": "The ID of the library item.",
|
||||
"type": "string",
|
||||
"example": "li_8gch9ve09orgn4fdz8"
|
||||
},
|
||||
"ino": {
|
||||
"description": "The inode of the library item.",
|
||||
"type": "string",
|
||||
"example": "649641337522215266"
|
||||
},
|
||||
"libraryId": {
|
||||
"oneOf": [
|
||||
{
|
||||
"$ref": "#/components/schemas/oldLibraryId"
|
||||
},
|
||||
{
|
||||
"$ref": "#/components/schemas/newLibraryId"
|
||||
}
|
||||
]
|
||||
},
|
||||
"folderId": {
|
||||
"description": "The ID of the folder the library item is in.",
|
||||
"type": "string",
|
||||
"example": "fol_bev1zuxhb0j0s1wehr"
|
||||
},
|
||||
"path": {
|
||||
"description": "The path of the library item on the server.",
|
||||
"type": "string",
|
||||
"example": "/audiobooks/Terry Goodkind/Sword of Truth/Wizards First Rule"
|
||||
},
|
||||
"relPath": {
|
||||
"description": "The path, relative to the library folder, of the library item.",
|
||||
"type": "string",
|
||||
"example": "Terry Goodkind/Sword of Truth/Wizards First Rule"
|
||||
},
|
||||
"isFile": {
|
||||
"description": "Whether the library item is a single file in the root of the library folder.",
|
||||
"type": "boolean",
|
||||
"example": false
|
||||
},
|
||||
"mtimeMs": {
|
||||
"description": "The time (in ms since POSIX epoch) when the library item was last modified on disk.",
|
||||
"type": "integer",
|
||||
"example": 1650621074299
|
||||
},
|
||||
"ctimeMs": {
|
||||
"description": "The time (in ms since POSIX epoch) when the library item status was changed on disk.",
|
||||
"type": "integer",
|
||||
"example": 1650621074299
|
||||
},
|
||||
"birthtimeMs": {
|
||||
"description": "The time (in ms since POSIX epoch) when the library item was created on disk. Will be 0 if unknown.",
|
||||
"type": "integer",
|
||||
"example": 0
|
||||
},
|
||||
"addedAt": {
|
||||
"description": "The time (in ms since POSIX epoch) when the library item was added to the library.",
|
||||
"type": "integer",
|
||||
"example": 1650621073750
|
||||
},
|
||||
"updatedAt": {
|
||||
"description": "The time (in ms since POSIX epoch) when the library item was last updated. (Read Only)",
|
||||
"type": "integer",
|
||||
"example": 1650621110769
|
||||
"$ref": "#/components/schemas/folderId"
|
||||
},
|
||||
"lastScan": {
|
||||
"description": "The time (in ms since POSIX epoch) when the library item was last scanned. Will be null if the server has not yet scanned the library item.",
|
||||
"type": "integer",
|
||||
"example": 1651830827825
|
||||
"type": "integer"
|
||||
},
|
||||
"scanVersion": {
|
||||
"description": "The version of the scanner when last scanned. Will be null if it has not been scanned.",
|
||||
"type": "string",
|
||||
"example": "2.0.21"
|
||||
"type": "string"
|
||||
},
|
||||
"isMissing": {
|
||||
"description": "Whether the library item was scanned and no longer exists.",
|
||||
"type": "boolean",
|
||||
"example": false
|
||||
},
|
||||
"isInvalid": {
|
||||
"description": "Whether the library item was scanned and no longer has media files.",
|
||||
"type": "boolean",
|
||||
"example": false
|
||||
},
|
||||
"mediaType": [
|
||||
{
|
||||
"$ref": "#/components/schemas/mediaType"
|
||||
}
|
||||
],
|
||||
"media": {
|
||||
"description": "The media of the library item.",
|
||||
"type": "object",
|
||||
"additionalProperties": {
|
||||
"oneOf": [
|
||||
{
|
||||
"$ref": "#/components/schemas/bookExpanded"
|
||||
},
|
||||
{
|
||||
"$ref": "#/components/schemas/podcastExpanded"
|
||||
}
|
||||
]
|
||||
}
|
||||
"$ref": "#/components/schemas/mediaExpanded"
|
||||
},
|
||||
"libraryFiles": {
|
||||
"description": "The files of the library item.",
|
||||
|
|
@ -2183,6 +2017,8 @@
|
|||
"example": 268990279
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"book": {
|
||||
"type": "object",
|
||||
|
|
@ -2353,6 +2189,47 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"mediaType": {
|
||||
"type": "string",
|
||||
"description": "The type of media, will be book or podcast.",
|
||||
"enum": [
|
||||
"book",
|
||||
"podcast"
|
||||
]
|
||||
},
|
||||
"media": {
|
||||
"description": "The media of the library item.",
|
||||
"oneOf": [
|
||||
{
|
||||
"$ref": "#/components/schemas/book"
|
||||
},
|
||||
{
|
||||
"$ref": "#/components/schemas/podcast"
|
||||
}
|
||||
]
|
||||
},
|
||||
"mediaMinified": {
|
||||
"description": "The minified media of the library item.",
|
||||
"oneOf": [
|
||||
{
|
||||
"$ref": "#/components/schemas/bookMinified"
|
||||
},
|
||||
{
|
||||
"$ref": "#/components/schemas/podcastMinified"
|
||||
}
|
||||
]
|
||||
},
|
||||
"mediaExpanded": {
|
||||
"description": "The expanded media of the library item.",
|
||||
"oneOf": [
|
||||
{
|
||||
"$ref": "#/components/schemas/bookExpanded"
|
||||
},
|
||||
{
|
||||
"$ref": "#/components/schemas/podcastExpanded"
|
||||
}
|
||||
]
|
||||
},
|
||||
"podcast": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
|
|
|
|||
|
|
@ -66,17 +66,19 @@ const { filePathToPOSIX, getFileTimestampsWithIno } = require('../utils/fileUtil
|
|||
* description: A single item on the server, like a book or podcast.
|
||||
* allOf:
|
||||
* - $ref : '#/components/schemas/libraryItemBase'
|
||||
* - folderId:
|
||||
* - $ref : '#/components/schemas/folderId'
|
||||
* - lastScan:
|
||||
* - type: object
|
||||
* properties:
|
||||
* folderId:
|
||||
* $ref : '#/components/schemas/folderId'
|
||||
* lastScan:
|
||||
* description: The time (in ms since POSIX epoch) when the library item was last scanned. Will be null if the server has not yet scanned the library item.
|
||||
* type: integer
|
||||
* - scanVersion:
|
||||
* scanVersion:
|
||||
* description: The version of the scanner when last scanned. Will be null if it has not been scanned.
|
||||
* type: string
|
||||
* - media:
|
||||
* - $ref: '#/components/schemas/media'
|
||||
* - libraryFiles:
|
||||
* media:
|
||||
* $ref: '#/components/schemas/media'
|
||||
* libraryFiles:
|
||||
* description: The files of the library item.
|
||||
* type: array
|
||||
* items:
|
||||
|
|
@ -86,28 +88,32 @@ const { filePathToPOSIX, getFileTimestampsWithIno } = require('../utils/fileUtil
|
|||
* description: A single item on the server, like a book or podcast. Minified media format.
|
||||
* allOf:
|
||||
* - $ref : '#/components/schemas/libraryItemBase'
|
||||
* - media:
|
||||
* - $ref: '#/components/schemas/mediaMinified'
|
||||
* - type: object
|
||||
* properties:
|
||||
* media:
|
||||
* $ref: '#/components/schemas/mediaMinified'
|
||||
* libraryItemExpanded:
|
||||
* type: object
|
||||
* allOf:
|
||||
* - $ref : '#/components/schemas/libraryItemBase'
|
||||
* - folderId:
|
||||
* - $ref : '#/components/schemas/folderId'
|
||||
* - lastScan:
|
||||
* - type: object
|
||||
* properties:
|
||||
* folderId:
|
||||
* $ref : '#/components/schemas/folderId'
|
||||
* lastScan:
|
||||
* description: The time (in ms since POSIX epoch) when the library item was last scanned. Will be null if the server has not yet scanned the library item.
|
||||
* type: integer
|
||||
* - scanVersion:
|
||||
* scanVersion:
|
||||
* description: The version of the scanner when last scanned. Will be null if it has not been scanned.
|
||||
* type: string
|
||||
* - media:
|
||||
* - $ref: '#/components/schemas/mediaExpanded'
|
||||
* - libraryFiles:
|
||||
* media:
|
||||
* $ref: '#/components/schemas/mediaExpanded'
|
||||
* libraryFiles:
|
||||
* description: The files of the library item.
|
||||
* type: array
|
||||
* items:
|
||||
* $ref: '#/components/schemas/libraryFile'
|
||||
* - size:
|
||||
* size:
|
||||
* description: The total size (in bytes) of the library item.
|
||||
* type: integer
|
||||
* example: 268990279
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue