mirror of
https://github.com/LukeHagar/plexpy.git
synced 2025-12-06 04:20:52 +00:00
Media
(media)
Overview
API Calls interacting with Plex Media Server Media
Available Operations
- mark_played - Mark Media Played
- mark_unplayed - Mark Media Unplayed
- update_play_progress - Update Media Play Progress
mark_played
This will mark the provided media key as Played.
Example Usage
import plex_api
s = plex_api.PlexAPI(
access_token="<YOUR_API_KEY_HERE>",
x_plex_client_identifier='Postman',
)
res = s.media.mark_played(key=59398)
if res is not None:
# handle response
pass
Parameters
| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
key |
float | ✔️ | The media key to mark as played | 59398 |
Response
Errors
| Error Object | Status Code | Content Type |
|---|---|---|
| errors.MarkPlayedResponseBody | 401 | application/json |
| errors.SDKError | 4xx-5xx | / |
mark_unplayed
This will mark the provided media key as Unplayed.
Example Usage
import plex_api
s = plex_api.PlexAPI(
access_token="<YOUR_API_KEY_HERE>",
x_plex_client_identifier='Postman',
)
res = s.media.mark_unplayed(key=59398)
if res is not None:
# handle response
pass
Parameters
| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
key |
float | ✔️ | The media key to mark as Unplayed | 59398 |
Response
operations.MarkUnplayedResponse
Errors
| Error Object | Status Code | Content Type |
|---|---|---|
| errors.MarkUnplayedResponseBody | 401 | application/json |
| errors.SDKError | 4xx-5xx | / |
update_play_progress
This API command can be used to update the play progress of a media item.
Example Usage
import plex_api
s = plex_api.PlexAPI(
access_token="<YOUR_API_KEY_HERE>",
x_plex_client_identifier='Postman',
)
res = s.media.update_play_progress(key='<value>', time=6900.91, state='<value>')
if res is not None:
# handle response
pass
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
key |
str | ✔️ | the media key |
time |
float | ✔️ | The time, in milliseconds, used to set the media playback progress. |
state |
str | ✔️ | The playback state of the media item. |
Response
operations.UpdatePlayProgressResponse
Errors
| Error Object | Status Code | Content Type |
|---|---|---|
| errors.UpdatePlayProgressResponseBody | 401 | application/json |
| errors.SDKError | 4xx-5xx | / |