mirror of
https://github.com/LukeHagar/plex-sdk-docs.git
synced 2025-12-08 20:47:46 +00:00
Initial Commit
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
## Get Search Results
|
||||
|
||||
This will search the database for the string provided.
|
||||
@@ -0,0 +1,7 @@
|
||||
{/* Autogenerated DO NOT EDIT */}
|
||||
##### `query` *{`str`}*
|
||||
The search query string to use
|
||||
<br/>
|
||||
**Example:** `110`
|
||||
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
{/* Autogenerated DO NOT EDIT */}
|
||||
import GetSearchResultsResponse from "/content/types/models/operations/get_search_results_response/python.mdx"
|
||||
import Collapsible from "/src/components/Collapsible";
|
||||
import Labels from "/src/lib/labels";
|
||||
|
||||
##### *{`operations.GetSearchResultsResponse`}*
|
||||
<Collapsible defaultOpen openLabel={Labels.showProperties} closeLabel={Labels.hideProperties}>
|
||||
<GetSearchResultsResponse/>
|
||||
</Collapsible>
|
||||
|
||||
|
||||
@@ -0,0 +1,124 @@
|
||||
|
||||
<CH.Code>
|
||||
```python GetSearchResults.py
|
||||
import sdk
|
||||
from sdk.models import operations
|
||||
|
||||
s = sdk.SDK(
|
||||
access_token="<YOUR_API_KEY_HERE>",
|
||||
)
|
||||
|
||||
|
||||
res = s.search.get_search_results(query='110')
|
||||
|
||||
if res.object is not None:
|
||||
# handle response
|
||||
pass
|
||||
```
|
||||
---
|
||||
|
||||
```json Example Response
|
||||
{
|
||||
"MediaContainer": {
|
||||
"size": 26,
|
||||
"identifier": "com.plexapp.plugins.library",
|
||||
"mediaTagPrefix": "/system/bundle/media/flags/",
|
||||
"mediaTagVersion": 1680021154,
|
||||
"Metadata": [
|
||||
{
|
||||
"allowSync": false,
|
||||
"librarySectionID": 1,
|
||||
"librarySectionTitle": "Movies",
|
||||
"librarySectionUUID": "322a231a-b7f7-49f5-920f-14c61199cd30",
|
||||
"personal": false,
|
||||
"sourceTitle": "Hera",
|
||||
"ratingKey": 10398,
|
||||
"key": "/library/metadata/10398",
|
||||
"guid": "plex://movie/5d7768284de0ee001fcc8f52",
|
||||
"studio": "Paramount",
|
||||
"type": "movie",
|
||||
"title": "Mission: Impossible",
|
||||
"contentRating": "PG-13",
|
||||
"summary": "When Ethan Hunt the leader of a crack espionage team whose perilous operation has gone awry with no explanation discovers that a mole has penetrated the CIA he's surprised to learn that he's the No. 1 suspect. To clear his name Hunt now must ferret out the real double agent and in the process even the score.",
|
||||
"rating": 6.6,
|
||||
"audienceRating": 7.1,
|
||||
"year": 1996,
|
||||
"tagline": "Expect the impossible.",
|
||||
"thumb": "/library/metadata/10398/thumb/1679505055",
|
||||
"art": "/library/metadata/10398/art/1679505055",
|
||||
"duration": 6612628,
|
||||
"originallyAvailableAt": "1996-05-22T00:00:00Z",
|
||||
"addedAt": 1589234571,
|
||||
"updatedAt": 1679505055,
|
||||
"audienceRatingImage": "rottentomatoes://image.rating.upright",
|
||||
"chapterSource": "media",
|
||||
"primaryExtraKey": "/library/metadata/10501",
|
||||
"ratingImage": "rottentomatoes://image.rating.ripe",
|
||||
"Media": [
|
||||
{
|
||||
"id": 26610,
|
||||
"duration": 6612628,
|
||||
"bitrate": 4751,
|
||||
"width": 1916,
|
||||
"height": 796,
|
||||
"aspectRatio": 2.35,
|
||||
"audioChannels": 6,
|
||||
"audioCodec": "aac",
|
||||
"videoCodec": "hevc",
|
||||
"videoResolution": 1080,
|
||||
"container": "mkv",
|
||||
"videoFrameRate": "24p",
|
||||
"audioProfile": "lc",
|
||||
"videoProfile": "main 10",
|
||||
"Part": [
|
||||
{
|
||||
"id": 26610,
|
||||
"key": "/library/parts/26610/1589234571/file.mkv",
|
||||
"duration": 6612628,
|
||||
"file": "/movies/Mission Impossible (1996)/Mission Impossible (1996) Bluray-1080p.mkv",
|
||||
"size": 3926903851,
|
||||
"audioProfile": "lc",
|
||||
"container": "mkv",
|
||||
"videoProfile": "main 10"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"Genre": [
|
||||
{
|
||||
"tag": "Action"
|
||||
}
|
||||
],
|
||||
"Director": [
|
||||
{
|
||||
"tag": "Brian De Palma"
|
||||
}
|
||||
],
|
||||
"Writer": [
|
||||
{
|
||||
"tag": "David Koepp"
|
||||
}
|
||||
],
|
||||
"Country": [
|
||||
{
|
||||
"tag": "United States of America"
|
||||
}
|
||||
],
|
||||
"Role": [
|
||||
{
|
||||
"tag": "Tom Cruise"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"Provider": [
|
||||
{
|
||||
"key": "/system/search",
|
||||
"title": "Local Network",
|
||||
"type": "mixed"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
```
|
||||
</CH.Code>
|
||||
@@ -0,0 +1,12 @@
|
||||
import CurlHeader from './_header.mdx';
|
||||
import SDKHeader from './_header.mdx';
|
||||
import OperationHeader from '/src/components/OperationHeader';
|
||||
|
||||
###### *Search*
|
||||
|
||||
<OperationHeader
|
||||
sdkHeader={<SDKHeader />}
|
||||
curlHeader={<CurlHeader />}
|
||||
/>
|
||||
|
||||
{/* render operation */}
|
||||
@@ -0,0 +1,14 @@
|
||||
## Perform Search
|
||||
|
||||
This endpoint performs a search across all library sections, or a single section, and returns matches as hubs, split up by type. It performs spell checking, looks for partial matches, and orders the hubs based on quality of results. In addition, based on matches, it will return other related matches (e.g. for a genre match, it may return movies in that genre, or for an actor match, movies with that actor).
|
||||
|
||||
In the response's items, the following extra attributes are returned to further describe or disambiguate the result:
|
||||
|
||||
- `reason`: The reason for the result, if not because of a direct search term match; can be either:
|
||||
- `section`: There are multiple identical results from different sections.
|
||||
- `originalTitle`: There was a search term match from the original title field (sometimes those can be very different or in a foreign language).
|
||||
- `<hub identifier>`: If the reason for the result is due to a result in another hub, the source hub identifier is returned. For example, if the search is for "dylan" then Bob Dylan may be returned as an artist result, an a few of his albums returned as album results with a reason code of `artist` (the identifier of that particular hub). Or if the search is for "arnold", there might be movie results returned with a reason of `actor`
|
||||
- `reasonTitle`: The string associated with the reason code. For a section reason, it'll be the section name; For a hub identifier, it'll be a string associated with the match (e.g. `Arnold Schwarzenegger` for movies which were returned because the search was for "arnold").
|
||||
- `reasonID`: The ID of the item associated with the reason for the result. This might be a section ID, a tag ID, an artist ID, or a show ID.
|
||||
|
||||
This request is intended to be very fast, and called as the user types.
|
||||
@@ -0,0 +1,17 @@
|
||||
{/* Autogenerated DO NOT EDIT */}
|
||||
##### `query` *{`str`}*
|
||||
The query term
|
||||
<br/>
|
||||
**Example:** `arnold`
|
||||
|
||||
---
|
||||
##### `section_id` *{`Optional[float]`}*
|
||||
This gives context to the search, and can result in re\-ordering of search result hubs
|
||||
|
||||
---
|
||||
##### `limit` *{`Optional[float]`}*
|
||||
The number of items to return per hub
|
||||
<br/>
|
||||
**Example:** `5`
|
||||
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
{/* Autogenerated DO NOT EDIT */}
|
||||
import PerformSearchResponse from "/content/types/models/operations/perform_search_response/python.mdx"
|
||||
import Collapsible from "/src/components/Collapsible";
|
||||
import Labels from "/src/lib/labels";
|
||||
|
||||
##### *{`operations.PerformSearchResponse`}*
|
||||
<Collapsible defaultOpen openLabel={Labels.showProperties} closeLabel={Labels.hideProperties}>
|
||||
<PerformSearchResponse/>
|
||||
</Collapsible>
|
||||
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
|
||||
<CH.Code>
|
||||
```python PerformSearch.py
|
||||
import sdk
|
||||
from sdk.models import operations
|
||||
|
||||
s = sdk.SDK(
|
||||
access_token="<YOUR_API_KEY_HERE>",
|
||||
)
|
||||
|
||||
|
||||
res = s.search.perform_search(query='arnold', section_id=2975.34, limit=5)
|
||||
|
||||
if res.status_code == 200:
|
||||
# handle response
|
||||
pass
|
||||
```
|
||||
---
|
||||
|
||||
```json Example Response
|
||||
{
|
||||
"errors": [
|
||||
{
|
||||
"code": 1001,
|
||||
"message": "User could not be authenticated",
|
||||
"status": 401
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
</CH.Code>
|
||||
@@ -0,0 +1,12 @@
|
||||
import CurlHeader from './_header.mdx';
|
||||
import SDKHeader from './_header.mdx';
|
||||
import OperationHeader from '/src/components/OperationHeader';
|
||||
|
||||
###### *Search*
|
||||
|
||||
<OperationHeader
|
||||
sdkHeader={<SDKHeader />}
|
||||
curlHeader={<CurlHeader />}
|
||||
/>
|
||||
|
||||
{/* render operation */}
|
||||
@@ -0,0 +1,6 @@
|
||||
## Perform Voice Search
|
||||
|
||||
This endpoint performs a search specifically tailored towards voice or other imprecise input which may work badly with the substring and spell-checking heuristics used by the `/hubs/search` endpoint.
|
||||
It uses a [Levenshtein distance](https://en.wikipedia.org/wiki/Levenshtein_distance) heuristic to search titles, and as such is much slower than the other search endpoint.
|
||||
Whenever possible, clients should limit the search to the appropriate type.
|
||||
Results, as well as their containing per-type hubs, contain a `distance` attribute which can be used to judge result quality.
|
||||
@@ -0,0 +1,17 @@
|
||||
{/* Autogenerated DO NOT EDIT */}
|
||||
##### `query` *{`str`}*
|
||||
The query term
|
||||
<br/>
|
||||
**Example:** `dead+poop`
|
||||
|
||||
---
|
||||
##### `section_id` *{`Optional[float]`}*
|
||||
This gives context to the search, and can result in re\-ordering of search result hubs
|
||||
|
||||
---
|
||||
##### `limit` *{`Optional[float]`}*
|
||||
The number of items to return per hub
|
||||
<br/>
|
||||
**Example:** `5`
|
||||
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
{/* Autogenerated DO NOT EDIT */}
|
||||
import PerformVoiceSearchResponse from "/content/types/models/operations/perform_voice_search_response/python.mdx"
|
||||
import Collapsible from "/src/components/Collapsible";
|
||||
import Labels from "/src/lib/labels";
|
||||
|
||||
##### *{`operations.PerformVoiceSearchResponse`}*
|
||||
<Collapsible defaultOpen openLabel={Labels.showProperties} closeLabel={Labels.hideProperties}>
|
||||
<PerformVoiceSearchResponse/>
|
||||
</Collapsible>
|
||||
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
|
||||
<CH.Code>
|
||||
```python PerformVoiceSearch.py
|
||||
import sdk
|
||||
from sdk.models import operations
|
||||
|
||||
s = sdk.SDK(
|
||||
access_token="<YOUR_API_KEY_HERE>",
|
||||
)
|
||||
|
||||
|
||||
res = s.search.perform_voice_search(query='dead+poop', section_id=8917.73, limit=5)
|
||||
|
||||
if res.status_code == 200:
|
||||
# handle response
|
||||
pass
|
||||
```
|
||||
---
|
||||
|
||||
```json Example Response
|
||||
{
|
||||
"errors": [
|
||||
{
|
||||
"code": 1001,
|
||||
"message": "User could not be authenticated",
|
||||
"status": 401
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
</CH.Code>
|
||||
@@ -0,0 +1,12 @@
|
||||
import CurlHeader from './_header.mdx';
|
||||
import SDKHeader from './_header.mdx';
|
||||
import OperationHeader from '/src/components/OperationHeader';
|
||||
|
||||
###### *Search*
|
||||
|
||||
<OperationHeader
|
||||
sdkHeader={<SDKHeader />}
|
||||
curlHeader={<CurlHeader />}
|
||||
/>
|
||||
|
||||
{/* render operation */}
|
||||
@@ -0,0 +1,22 @@
|
||||
import PerformSearch from "./perform_search/perform_search.mdx";
|
||||
import PerformVoiceSearch from "./perform_voice_search/perform_voice_search.mdx";
|
||||
import GetSearchResults from "./get_search_results/get_search_results.mdx";
|
||||
|
||||
## Search
|
||||
API Calls that perform search operations with Plex Media Server
|
||||
|
||||
|
||||
### Available Operations
|
||||
|
||||
* [Perform Search](/python/search/perform_search) - Perform a search
|
||||
* [Perform Voice Search](/python/search/perform_voice_search) - Perform a voice search
|
||||
* [Get Search Results](/python/search/get_search_results) - Get Search Results
|
||||
|
||||
---
|
||||
<PerformSearch />
|
||||
|
||||
---
|
||||
<PerformVoiceSearch />
|
||||
|
||||
---
|
||||
<GetSearchResults />
|
||||
Reference in New Issue
Block a user