Skip to content

Commit

Permalink
sora-python-sdk-samples から移動
Browse files Browse the repository at this point in the history
  • Loading branch information
voluntas committed Mar 20, 2024
1 parent 249e3e6 commit 7913c23
Show file tree
Hide file tree
Showing 19 changed files with 1,207 additions and 6 deletions.
3 changes: 3 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"recommendations": ["charliermarsh.ruff", "ms-python.mypy-type-checker"]
}
14 changes: 8 additions & 6 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
{
"python.analysis.typeCheckingMode": "basic",
"python.analysis.autoImportCompletions": true,
"python.analysis.diagnosticSeverityOverrides": {
"reportMissingImports": "none",
"reportUnusedImport": "information"
},
"[python]": {
"editor.formatOnSave": true,
"editor.formatOnSaveMode": "file",
"editor.defaultFormatter": "charliermarsh.ruff",
"editor.autoIndent": "full",
"editor.codeActionsOnSave": {
"source.organizeImports": "explicit"
},
"editor.defaultFormatter": "charliermarsh.ruff"
"source.fixAll.ruff": "always",
"source.organizeImports.ruff": "explicit"
}
},
"[cpp]": {
"editor.formatOnSave": true
Expand Down Expand Up @@ -119,7 +123,5 @@
},
"C_Cpp.errorSquiggles": "disabled",
// nanobind 周りでエラーが消えないので全部消す
"editor.tabSize": 2,
"python.analysis.typeCheckingMode": "off",
"cSpell.words": ["dtype", "imshow", "samplerate", "sounddevice"]
"editor.tabSize": 2
}
13 changes: 13 additions & 0 deletions examples/.env.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# コマンドライン引数 もしくは 環境変数での指定が必須なパラメーター
# SORA_SIGNALING_URLS カンマ区切りで複数指定可能
SORA_SIGNALING_URLS=wss://1.example.com./signaling,wss://2.example.com/signaling
SORA_CHANNEL_ID=sora
SORA_METADATA='{"access_token": "secret"}'

# オプション設定
# SORA_VIDEO_CODEC_TYPE=vp9
# SORA_VIDEO_BIT_RATE=500
# SORA_CAMERA_ID=0
# SORA_VIDEO_WIDTH=640
# SORA_VIDEO_HEIGHT=480
# SORA_MESSAGING_LABEL=#sora-devtools
7 changes: 7 additions & 0 deletions examples/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.venv
.ruff_cache
.mypy_cache
*.pyc
__pycache__
.env*
!.env.template
1 change: 1 addition & 0 deletions examples/.python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.8.18
59 changes: 59 additions & 0 deletions examples/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# Python Sora SDK サンプル集

## About Shiguredo's open source software

We will not respond to PRs or issues that have not been discussed on Discord. Also, Discord is only available in Japanese.

Please read https://github.com/shiguredo/oss/blob/master/README.en.md before use.

## 時雨堂のオープンソースソフトウェアについて

利用前に https://github.com/shiguredo/oss をお読みください。

## サンプルコードの実行方法

[Rye](https://github.com/mitsuhiko/rye) というパッケージマネージャーを利用しています。

Linux と macOS の場合は `curl -sSf https://rye-up.com/get | bash` でインストール可能です。
Windows は https://rye-up.com/ の Installation Instructions を確認してください。

### 依存パッケージのビルド

```console
$ rye sync
```

### サンプルコードの実行

```console
$ rye run media_recvonly --signaling-urls wss://1.example.com/signaling wss://2.example.com/signaling --channel-id sora
```

### コマンドラインの代わりに環境変数を利用する

```console
$ cp .env.template .env
# .env に必要な変数を設定してください。
$ rye run media_recvonly
```

## ライセンス

Apache License 2.0

```
Copyright 2023-2024, tnoho (Original Author)
Copyright 2023-2024, Shiguredo Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
```
41 changes: 41 additions & 0 deletions examples/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
[project]
name = "sora-sdk-samples"
version = "2024.1.0"
description = "Sora Python SDK Samples"
authors = [{ name = "Shiguredo Inc." }]
dependencies = [
"opencv-python~=4.9.0.80",
"opencv-python-headless~=4.9.0.80",
"sounddevice~=0.4.6",
"sora-sdk>=2024.1.0",
"mediapipe~=0.10.1",
"python-dotenv>=1.0.1",
]
readme = "README.md"
requires-python = ">= 3.8"

[project.scripts]
media_sendonly = "media.sendonly:sendonly"
media_recvonly = "media.recvonly:recvonly"
messaging_sendrecv = "messaging.sendrecv:sendrecv"
messaging_sendonly = "messaging.sendonly:sendonly"
messaging_recvonly = "messaging.recvonly:recvonly"
hideface_sender = "ml.hideface_sender:hideface_sender"

[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"

[tool.rye]
managed = true
dev-dependencies = ["ruff>=0.3.0", "mypy>=1.8.0"]

[tool.hatch.metadata]
allow-direct-references = true

[tool.hatch.build.targets.wheel]
packages = ["src/media", "src/messaging", "src/ml"]

[tool.ruff]
line-length = 100
indent-width = 4
76 changes: 76 additions & 0 deletions examples/requirements-dev.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# generated by rye
# use `rye lock` or `rye sync` to update this lockfile
#
# last locked with the following flags:
# pre: false
# features: []
# all-features: false
# with-sources: false

-e file:.
absl-py==1.4.0
# via mediapipe
attrs==23.1.0
# via mediapipe
cffi==1.15.1
# via sounddevice
contourpy==1.1.0
# via matplotlib
cycler==0.11.0
# via matplotlib
flatbuffers==23.5.26
# via mediapipe
fonttools==4.40.0
# via matplotlib
importlib-resources==5.12.0
# via matplotlib
kiwisolver==1.4.4
# via matplotlib
matplotlib==3.7.2
# via mediapipe
mediapipe==0.10.1
# via sora-sdk-samples
mypy==1.8.0
mypy-extensions==1.0.0
# via mypy
numpy==1.24.4
# via contourpy
# via matplotlib
# via mediapipe
# via opencv-contrib-python
# via opencv-python
# via opencv-python-headless
opencv-contrib-python==4.8.0.74
# via mediapipe
opencv-python==4.9.0.80
# via sora-sdk-samples
opencv-python-headless==4.9.0.80
# via sora-sdk-samples
packaging==23.1
# via matplotlib
pillow==10.0.0
# via matplotlib
protobuf==3.20.3
# via mediapipe
pycparser==2.21
# via cffi
pyparsing==3.0.9
# via matplotlib
python-dateutil==2.8.2
# via matplotlib
python-dotenv==1.0.1
# via sora-sdk-samples
ruff==0.3.0
six==1.16.0
# via python-dateutil
sora-sdk==2024.1.0
# via sora-sdk-samples
sounddevice==0.4.6
# via mediapipe
# via sora-sdk-samples
tomli==2.0.1
# via mypy
typing-extensions==4.10.0
# via mypy
zipp==3.17.0
# via importlib-resources
68 changes: 68 additions & 0 deletions examples/requirements.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# generated by rye
# use `rye lock` or `rye sync` to update this lockfile
#
# last locked with the following flags:
# pre: false
# features: []
# all-features: false
# with-sources: false

-e file:.
absl-py==1.4.0
# via mediapipe
attrs==23.1.0
# via mediapipe
cffi==1.15.1
# via sounddevice
contourpy==1.1.0
# via matplotlib
cycler==0.11.0
# via matplotlib
flatbuffers==23.5.26
# via mediapipe
fonttools==4.40.0
# via matplotlib
importlib-resources==5.12.0
# via matplotlib
kiwisolver==1.4.4
# via matplotlib
matplotlib==3.7.2
# via mediapipe
mediapipe==0.10.1
# via sora-sdk-samples
numpy==1.24.4
# via contourpy
# via matplotlib
# via mediapipe
# via opencv-contrib-python
# via opencv-python
# via opencv-python-headless
opencv-contrib-python==4.8.0.74
# via mediapipe
opencv-python==4.9.0.80
# via sora-sdk-samples
opencv-python-headless==4.9.0.80
# via sora-sdk-samples
packaging==23.1
# via matplotlib
pillow==10.0.0
# via matplotlib
protobuf==3.20.3
# via mediapipe
pycparser==2.21
# via cffi
pyparsing==3.0.9
# via matplotlib
python-dateutil==2.8.2
# via matplotlib
python-dotenv==1.0.1
# via sora-sdk-samples
six==1.16.0
# via python-dateutil
sora-sdk==2024.1.0
# via sora-sdk-samples
sounddevice==0.4.6
# via mediapipe
# via sora-sdk-samples
zipp==3.17.0
# via importlib-resources
Empty file added examples/src/media/__init__.py
Empty file.
Loading

0 comments on commit 7913c23

Please sign in to comment.