Skip to content

Commit

Permalink
Hero 12 Support
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions committed Sep 13, 2023
1 parent ad8f642 commit 924fa6d
Show file tree
Hide file tree
Showing 114 changed files with 17,012 additions and 8,605 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/github-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,10 @@ jobs:
shell: bash
run: sudo apt-get update && sudo apt install -y graphviz

- name: Set up Python 3.10.6
- name: Set up Python 3.11.4
uses: actions/setup-python@v2
with:
python-version: 3.10.6
python-version: 3.11.4

- name: Restore cached pip environment
uses: actions/cache@v2
Expand All @@ -76,8 +76,8 @@ jobs:
working-directory: ./source/demos/python/sdk_wireless_camera_control/
run: |
python -m pip install --upgrade pip wheel
pip install nox==2022.8.7
pip install nox-poetry==1.0.1
pip install nox==2023.4.22
pip install nox-poetry==1.0.3
pip install poetry
- name: Build Sphinx Documentation
Expand Down Expand Up @@ -133,7 +133,7 @@ jobs:
if [[ ${{ github.repository }} == gopro/OpenGoPro ]]; then
make build
else
make build BUILD_HOST_URL=${{ secrets.STAGING_GH_PAGES_SITE }} BUILD_BASE_URL='\"\"'
make build BUILD_HOST_URL=${{ secrets.STAGING_GH_PAGES_SITE }} BUILD_BASE_URL="\'\'"
fi
- name: Deploy to Github Pages
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/python_sdk_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
strategy:
matrix:
os: [windows-latest, macos-latest, ubuntu-latest]
python-version: ["3.9", "3.10"]
python-version: ["3.9", "3.10", "3.11"]
include:
- os: ubuntu-latest
path: ~/.cache/pip
Expand Down Expand Up @@ -49,8 +49,8 @@ jobs:
working-directory: ./demos/python/sdk_wireless_camera_control/
run: |
python -m pip install --upgrade pip wheel
pip install nox==2022.8.7
pip install nox-poetry==1.0.1
pip install nox==2023.4.22
pip install nox-poetry==1.0.3
pip install poetry
- name: Perform checks (format, types, lint, docstrings, unit tests, docs, safety)
Expand Down
1 change: 1 addition & 0 deletions demos/python/sdk_wireless_camera_control/.gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
**/*.crt
**/temp
.reports/

Expand Down
2 changes: 1 addition & 1 deletion demos/python/sdk_wireless_camera_control/.python-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.10.8
3.11.4
31 changes: 17 additions & 14 deletions demos/python/sdk_wireless_camera_control/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ Complete documentation can be found on [Open GoPro](https://gopro.github.io/Open
- BLE implemented using [bleak](https://pypi.org/project/bleak/)
- Wi-Fi controller provided in the Open GoPro package (loosely based on the [Wireless Library](https://pypi.org/project/wireless/)
- Supports all commands, settings, and statuses from the [Open GoPro API](https://gopro.github.io/OpenGoPro/)
- [Asyncio](https://docs.python.org/3/library/asyncio.html) based
- Automatically handles connection maintenance:
- manage camera ready / encoding
- periodically sends keep alive signals
Expand All @@ -41,7 +42,7 @@ Complete documentation can be found on [Open GoPro](https://gopro.github.io/Open

## Installation

> Note! This package requires Python >= 3.8 and < 3.11
> Note! This package requires Python >= 3.8 and < 3.12
The minimal install to use the Open GoPro library and the CLI demos is:

Expand All @@ -61,21 +62,23 @@ To automatically connect to GoPro device via BLE and WiFI, set the preset, set v
video, and download all files:

```python
import time
import asyncio
from open_gopro import WirelessGoPro, Params

with WirelessGoPro() as gopro:
gopro.ble_command.load_preset(Params.Preset.CINEMATIC)
gopro.ble_setting.resolution.set(Params.Resolution.RES_4K)
gopro.ble_setting.fps.set(Params.FPS.FPS_30)
gopro.ble_command.set_shutter(Params.Shutter.ON)
time.sleep(2) # Record for 2 seconds
gopro.ble_command.set_shutter(Params.Shutter.OFF)

# Download all of the files from the camera
media_list = [x["n"] for x in gopro.wifi_command.get_media_list().flatten
for file in media_list:
gopro.wifi_command.download_file(camera_file=file)
async def main():
async with WirelessGoPro() as gopro:
await gopro.ble_setting.resolution.set(Params.Resolution.RES_4K)
await gopro.ble_setting.fps.set(Params.FPS.FPS_30)
await gopro.ble_command.set_shutter(shutter=Params.Toggle.ENABLE)
await asyncio.sleep(2) # Record for 2 seconds
await gopro.ble_command.set_shutter(shutter=Params.Toggle.DISABLE)

# Download all of the files from the camera
media_list = (await gopro.http_command.get_media_list()).data.files
for item in media_list:
await gopro.http_command.download_file(camera_file=item.filename)

asyncio.run(main())
```

And much more!
Expand Down
4 changes: 2 additions & 2 deletions demos/python/sdk_wireless_camera_control/TODO.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@
- [ ] Refactor commands / parsers so that setting / status parsers (i.e. enums) can be accessed from class, not instance
- This is already done for commands but needs to be for others
- [ ] Better handle kwargs that match base dict args in command as_dict methods
- [ ] Investigate worthiness of move to asyncio
- [ ] More test coverage
- [ ] Clean up artifacts after testing
- [ ] Clean up artifacts after testing. Or use temp directory.
- [ ] Make scalable for multiple simultaneous cameras
- [ ] Allow encoding = False for Set Livestream Mode. Requires tracking livestream state to not pend on encoding started after sending Set Shutter On

Expand Down Expand Up @@ -36,5 +35,6 @@
- [ ] Investigate MacOS delay after connecting WiFi
- [ ] More Linux testing
- [ ] Use descriptors for main driver access to OS-driver implementation
- [ ] Move to program language (C?) instead of EN-US


Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
71 changes: 56 additions & 15 deletions demos/python/sdk_wireless_camera_control/docs/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,11 @@ These should not be imported directly and instead should be accessed using the r
Base Types
----------

GoPro Enum
^^^^^^^^^^

.. autoclass:: open_gopro.enum.GoProEnum

BLE Setting
^^^^^^^^^^^

Expand Down Expand Up @@ -107,27 +112,27 @@ Message Bases
These are the base types that are used to implement version-specific API's. These are published for reference
but the end user should never need to use these directly.

.. autoclass:: open_gopro.interface.Message
.. autoclass:: open_gopro.communicator_interface.Message
:show-inheritance:

.. autoclass:: open_gopro.interface.HttpMessage
.. autoclass:: open_gopro.communicator_interface.HttpMessage
:show-inheritance:

.. autoclass:: open_gopro.interface.BleMessage
.. autoclass:: open_gopro.communicator_interface.BleMessage
:show-inheritance:

.. autoclass:: open_gopro.interface.Messages
.. autoclass:: open_gopro.communicator_interface.Messages
:show-inheritance:

.. autoclass:: open_gopro.interface.BleMessages
.. autoclass:: open_gopro.communicator_interface.BleMessages
:show-inheritance:

.. autoclass:: open_gopro.interface.HttpMessages
.. autoclass:: open_gopro.communicator_interface.HttpMessages
:show-inheritance:

.. autoclass:: open_gopro.interface.MessageRules
.. autoclass:: open_gopro.communicator_interface.MessageRules

.. autoclass:: open_gopro.interface.RuleSignature
.. autoclass:: open_gopro.communicator_interface.RuleSignature

Parameters
----------
Expand All @@ -141,18 +146,52 @@ All of these parameters can be accessed via:
.. automodule:: open_gopro.api.params
:undoc-members:


Responses
=========

Generic common response container:

This can be imported via:

.. code-block:: python
from open_gopro import GoProResp
.. autoclass:: open_gopro.responses.GoProResp
.. autoclass:: open_gopro.models.response.GoProResp

Data Models
-----------

These are the various models that are returned in responses, used in commands, etc. They can be imported with:

.. code-block:: python
from open_gopro.models import ***
.. autopydantic_model:: open_gopro.models.media_list.MediaMetadata

.. autopydantic_model:: open_gopro.models.media_list.PhotoMetadata
:show-inheritance:

.. autopydantic_model:: open_gopro.models.media_list.VideoMetadata
:show-inheritance:

.. autopydantic_model:: open_gopro.models.media_list.MediaItem

.. autopydantic_model:: open_gopro.models.media_list.GroupedMediaItem
:show-inheritance:

.. autopydantic_model:: open_gopro.models.media_list.MediaFileSystem

.. autopydantic_model:: open_gopro.models.media_list.MediaList

.. autopydantic_model:: open_gopro.models.general.TzDstDateTime

.. autopydantic_model:: open_gopro.models.general.CameraInfo

.. autopydantic_model:: open_gopro.models.general.WebcamResponse

.. autopydantic_model:: open_gopro.models.general.SupportedOption

Constants
=========
Expand All @@ -179,15 +218,17 @@ Common Interface

.. autoclass:: open_gopro.gopro_base.GoProBase

.. autoclass:: open_gopro.interface.GoProBle
.. autoclass:: open_gopro.communicator_interface.GoProBle

.. autoclass:: open_gopro.communicator_interface.GoProHttp

.. autoclass:: open_gopro.interface.GoProHttp
.. autoclass:: open_gopro.communicator_interface.GoProWifi

.. autoclass:: open_gopro.interface.GoProWifi
.. autoclass:: open_gopro.communicator_interface.GoProWiredInterface

.. autoclass:: open_gopro.interface.GoProWiredInterface
.. autoclass:: open_gopro.communicator_interface.GoProWirelessInterface

.. autoclass:: open_gopro.interface.GoProWirelessInterface
.. autoclass:: open_gopro.communicator_interface.BaseGoProCommunicator


BLE Interface
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ Unreleased
----------
* Improve video viewer latency
* Improve BLE and HTTP setting documentation
* Add media list and metadata pydantic models

0.13.0 (February-24-2023)
-------------------------
Expand Down
35 changes: 14 additions & 21 deletions demos/python/sdk_wireless_camera_control/docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,9 @@
# This copyright was auto-generated on Wed, Sep 1, 2021 5:05:41 PM

from __future__ import annotations
import re
from datetime import date
from typing import Union, Optional

from darglint.docstring.docstring import Docstring
from darglint.docstring.sections import Sections
from sphinx.ext.napoleon.docstring import GoogleDocstring

from open_gopro import WirelessGoPro
from open_gopro.api.builders import (
HttpGetBinary,
HttpGetJsonCommand,
BleProtoCommand,
BleWriteCommand,
BleReadCommand,
RegisterUnregisterAll,
)
from open_gopro.interface import BleMessage, HttpMessage

gopro = WirelessGoPro(enable_wifi=False)

Expand All @@ -38,7 +23,8 @@
"sphinx.ext.autosectionlabel",
"sphinx.ext.graphviz",
"sphinx.ext.inheritance_diagram",
"sphinxemoji.sphinxemoji",
# "sphinxemoji.sphinxemoji", # https://github.com/sphinx-contrib/emojicodes/issues/42
"sphinxcontrib.autodoc_pydantic",
]
html_theme = "sphinx_rtd_theme"
html_context = {
Expand All @@ -50,6 +36,9 @@
autodoc_default_options = {
"members": True,
}
# https://autodoc-pydantic.readthedocs.io/en/stable/users/installation.html#configuration
autodoc_pydantic_model_show_json = True
autodoc_pydantic_settings_show_json = False

# The version info for the project you're documenting, acts as replacement
# for |version| and |release|, also used in various other places throughout
Expand Down Expand Up @@ -80,21 +69,25 @@
("py:class", "T_co"),
("py:class", "ExceptionHandler"),
("py:class", "datetime.datetime"),
("py:class", "open_gopro.responses.Parser"),
("py:class", "InitVar"),
("py:class", "open_gopro.models.parsers.Parser"),
("py:class", "abc.ABC"),
("py:class", "collections.abc.Iterable"),
]
nitpick_ignore_regex = [
(r"py:class", r".*proto\..+"), # TODO how should / can we handle protobuf documenting?
(r"py:class", r".*_pb2\..+"),
(r"py:class", r".+Type"),
(r"py:obj", r".+Type"),
(r"py:class", r".*Path"),
(r"py:class", r".*InitVar"),
(r"py:class", r".*UpdateCb"),
(r"py:class", r".*JsonDict"),
(r"py:class", r".*BleDevice"),
(r"py:class", r".*BleHandle"),
(r"py:class", r".*JsonParser"),
(r"py:class", r".*BytesParserBuilder"),
(r"py:class", r".*BytesParser"),
(r"py:class", r".*Parser"),
(r"py:class", r".*Builder"),
(r".*", r".*construct.*"),
(r".*", r".*response.T*"),
]

# This is the expected signature of the handler for this event, cf doc
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ Ready to contribute? Here's how to set up Open GoPro for local development.
Minimal Requirements
~~~~~~~~~~~~~~~~~~~~

* Python (>= 3.9, < 3.11)
* Python (>= 3.9, < 3.12)
* `Poetry <https://python-poetry.org/docs/#installation>`_ : Needed to install dependencies / development tasks

Additional Optional Requirements:
Expand Down Expand Up @@ -92,7 +92,7 @@ Steps

.. code-block:: console
$ poetry install --extras gui
$ poetry install --all-extras
#. Make your changes locally. When you're done making changes, check that your changes are:

Expand Down Expand Up @@ -127,7 +127,7 @@ Before you submit a pull request, check that it meets these guidelines:
$ poetry run poe docs
#. Modify the ``CHANGELOG.rst``.
#. The pull request should work for Python 3.8 - 3.10 on the following platforms:
#. The pull request should work for Python 3.8 - 3.12 on the following platforms:

- Windows 10, version 16299 (Fall Creators Update) and greater
- Linux distributions with BlueZ >= 5.43
Expand Down
2 changes: 1 addition & 1 deletion demos/python/sdk_wireless_camera_control/docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ For more information on the API, see the relevant documentation:
- `HTTP API <https://gopro.github.io/OpenGoPro/http>`_

.. warning::
This package requires Python >= version 3.9 and < 3.11
This package requires Python >= version 3.9 and < 3.12

Features
--------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ All of the demos use this and here is an example:
logger = setup_logging(__name__, Path("my_log.log"))
with WirelessGoPro() as gopro:
async with WirelessGoPro() as gopro:
logger.info("I'm logged!")
There are several other logging-related functions that extend and / or offer finer logging control.
Expand Down
Loading

0 comments on commit 924fa6d

Please sign in to comment.