(butler)
Butler is the task manager of the Plex Media Server Ecosystem.
- get_butler_tasks - Get Butler tasks
- start_all_tasks - Start all Butler tasks
- stop_all_tasks - Stop all Butler tasks
- start_task - Start a single Butler task
- stop_task - Stop a single Butler task
Returns a list of butler tasks
from plex_api_client import PlexAPI
with PlexAPI(
access_token="<YOUR_API_KEY_HERE>",
) as plex_api:
res = plex_api.butler.get_butler_tasks()
assert res.object is not None
# Handle response
print(res.object)
Parameter | Type | Required | Description |
---|---|---|---|
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
operations.GetButlerTasksResponse
Error Type | Status Code | Content Type |
---|---|---|
errors.GetButlerTasksBadRequest | 400 | application/json |
errors.GetButlerTasksUnauthorized | 401 | application/json |
errors.SDKError | 4XX, 5XX | */* |
This endpoint will attempt to start all Butler tasks that are enabled in the settings. Butler tasks normally run automatically during a time window configured on the server's Settings page but can be manually started using this endpoint. Tasks will run with the following criteria:
- Any tasks not scheduled to run on the current day will be skipped.
- If a task is configured to run at a random time during the configured window and we are outside that window, the task will start immediately.
- If a task is configured to run at a random time during the configured window and we are within that window, the task will be scheduled at a random time within the window.
- If we are outside the configured window, the task will start immediately.
from plex_api_client import PlexAPI
with PlexAPI(
access_token="<YOUR_API_KEY_HERE>",
) as plex_api:
res = plex_api.butler.start_all_tasks()
assert res is not None
# Handle response
print(res)
Parameter | Type | Required | Description |
---|---|---|---|
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
operations.StartAllTasksResponse
Error Type | Status Code | Content Type |
---|---|---|
errors.StartAllTasksBadRequest | 400 | application/json |
errors.StartAllTasksUnauthorized | 401 | application/json |
errors.SDKError | 4XX, 5XX | */* |
This endpoint will stop all currently running tasks and remove any scheduled tasks from the queue.
from plex_api_client import PlexAPI
with PlexAPI(
access_token="<YOUR_API_KEY_HERE>",
) as plex_api:
res = plex_api.butler.stop_all_tasks()
assert res is not None
# Handle response
print(res)
Parameter | Type | Required | Description |
---|---|---|---|
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
operations.StopAllTasksResponse
Error Type | Status Code | Content Type |
---|---|---|
errors.StopAllTasksBadRequest | 400 | application/json |
errors.StopAllTasksUnauthorized | 401 | application/json |
errors.SDKError | 4XX, 5XX | */* |
This endpoint will attempt to start a single Butler task that is enabled in the settings. Butler tasks normally run automatically during a time window configured on the server's Settings page but can be manually started using this endpoint. Tasks will run with the following criteria:
- Any tasks not scheduled to run on the current day will be skipped.
- If a task is configured to run at a random time during the configured window and we are outside that window, the task will start immediately.
- If a task is configured to run at a random time during the configured window and we are within that window, the task will be scheduled at a random time within the window.
- If we are outside the configured window, the task will start immediately.
from plex_api_client import PlexAPI
from plex_api_client.models import operations
with PlexAPI(
access_token="<YOUR_API_KEY_HERE>",
) as plex_api:
res = plex_api.butler.start_task(task_name=operations.TaskName.CLEAN_OLD_BUNDLES)
assert res is not None
# Handle response
print(res)
Parameter | Type | Required | Description |
---|---|---|---|
task_name |
operations.TaskName | ✔️ | the name of the task to be started. |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
Error Type | Status Code | Content Type |
---|---|---|
errors.StartTaskBadRequest | 400 | application/json |
errors.StartTaskUnauthorized | 401 | application/json |
errors.SDKError | 4XX, 5XX | */* |
This endpoint will stop a currently running task by name, or remove it from the list of scheduled tasks if it exists. See the section above for a list of task names for this endpoint.
from plex_api_client import PlexAPI
from plex_api_client.models import operations
with PlexAPI(
access_token="<YOUR_API_KEY_HERE>",
) as plex_api:
res = plex_api.butler.stop_task(task_name=operations.PathParamTaskName.BACKUP_DATABASE)
assert res is not None
# Handle response
print(res)
Parameter | Type | Required | Description |
---|---|---|---|
task_name |
operations.PathParamTaskName | ✔️ | The name of the task to be started. |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
Error Type | Status Code | Content Type |
---|---|---|
errors.StopTaskBadRequest | 400 | application/json |
errors.StopTaskUnauthorized | 401 | application/json |
errors.SDKError | 4XX, 5XX | */* |