OSC Module
osc module for Insta360 is based on Open Spherical Camera API specification.
Classes:
| Name | Description |
|---|---|
Client |
osc (open spherical camera) client to interact with the camera. |
Client
Client for interacting with the camera using osc API specification.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
host |
str
|
IP address of the camera. |
'192.168.42.1'
|
timeout_sec |
float
|
Timeout in seconds for requests. |
10.0
|
logger |
Logger | None
|
Logger for logging messages. |
None
|
Methods:
| Name | Description |
|---|---|
execute_command |
Execute a command on the camera. |
list_files |
List files on the camera. |
delete_files |
Delete files on the camera. |
download_file |
Download a file from the camera. |
delete_files(file_urls)
Delete files on the camera.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
file_urls |
list[str]
|
URLs of the files to delete. |
required |
Returns:
| Type | Description |
|---|---|
DeleteFilesResponse | ErrorResponse
|
Delete files response. |
Tip
file_urls can be obtained from ListFilesResponse.
download_file(file_url, save_path)
Download a file from the camera.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
file_url |
str
|
URL of the file to download. |
required |
save_path |
str
|
Path to save the file. |
required |
Returns:
| Type | Description |
|---|---|
bool
|
True if the download was successful, False otherwise. |
Tip
file_urls can be obtained from ListFilesResponse.
execute_command(body)
Execute a command on the camera.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
body |
dict
|
Command to execute as python dictionary. |
required |
Returns:
| Type | Description |
|---|---|
Response
|
Deserialized JSON response from the camera. |
Note
This method is used internally by other methods to execute commands on the camera.
list_files(file_type=ListFileType.ALL, start_position=0, entry_count=10, max_thumb_size=None)
List files on the camera.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
file_type |
ListFileType
|
Type of files to list. |
ALL
|
start_position |
int
|
Start position of the list. |
0
|
entry_count |
int
|
Number of entries to list after start position. |
10
|
max_thumb_size |
int | None
|
Maximum thumbnail size. |
None
|
Returns:
| Type | Description |
|---|---|
ListFilesResponse | ErrorResponse
|
List files response. |
Note
start_positionwill have no effect if the file type isListFileType.ALL- Less than 20 entries should be requested at a time to avoid large responses that camera may not be able to handle.
DeleteFilesResponse
Bases: OSCResponse
Model for delete files response.
Attributes:
| Name | Type | Description |
|---|---|---|
results |
DeleteFilesResults
|
Delete files results. |
DeleteFilesResults
Bases: BaseModel
Model for results of delete files response.
Attributes:
| Name | Type | Description |
|---|---|---|
fileUrls |
list[str]
|
List of file URLs. |
Entry
Bases: BaseModel
Model for file entries in list files response.
Attributes:
| Name | Type | Description |
|---|---|---|
name |
str
|
Name of the file. |
fileUrl |
str
|
URL of the file. |
localFileUrl |
str | None
|
Local URL of the file. |
size |
int
|
Size of the file. |
width |
int
|
Width of the file. |
height |
int
|
Height of the file. |
dateTimeZone |
str
|
Date time zone of the file. |
dateTime |
str | None
|
Date time of the file. |
thumbnailSize |
int | None
|
Thumbnail size of the file. |
isProcessed |
bool
|
Is the file processed. |
previewUrl |
str
|
URL of the preview. |
thumbnail |
Thumbnail
|
Thumbnail object. |
Error
Bases: BaseModel
Model for osc error.
Attributes:
| Name | Type | Description |
|---|---|---|
code |
str
|
Error code. |
message |
str
|
Error message. |
ErrorResponse
Bases: BaseModel
Model for osc error response.
Attributes:
| Name | Type | Description |
|---|---|---|
error |
Error
|
osc error. |
ListFileType
Bases: Enum
Enum for listing file types.
Attributes:
| Name | Type | Description |
|---|---|---|
IMAGE |
str
|
Image files. |
VIDEO |
str
|
Video files. |
ALL |
str
|
All files. |
ListFilesResponse
Bases: OSCResponse
Model for list files response.
Attributes:
| Name | Type | Description |
|---|---|---|
results |
ListFilesResults
|
List files results. |
ListFilesResults
Bases: BaseModel
Model for results of list files response.
Attributes:
| Name | Type | Description |
|---|---|---|
entries |
list[Entry]
|
List of file entries. |
totalEntries |
int
|
Total number of entries. |
OSCResponse
Bases: BaseModel
Model for list files response.
Attributes:
| Name | Type | Description |
|---|---|---|
name |
str
|
Name of the response. |
state |
str
|
State of the response. |
Thumbnail
Bases: BaseModel
Model for thumbnail of a file.
Attributes:
| Name | Type | Description |
|---|---|---|
base64 |
str | None
|
Base64 encoded thumbnail. |
content |
bytes | None
|
Decoded content of the thumbnail. |