Skip to content

Commit ccd0b0f

Browse files
committed
installable command line interface
1 parent ba35f63 commit ccd0b0f

7 files changed

Lines changed: 60 additions & 10 deletions

File tree

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
1-
# Visual and Acoustic recorder
1+
# python-recorder
22

33
Visual and Acoustic Odometry recorder using python. Devices: RealSense D435i
44
camera, RODE VideoMicNTG and smartLav+ microphones
55

6+
Framework
7+
8+
TODO ros
9+
610
# Setup
711

812
Clone this repository to your local machine. Detailed instructions about

pyproject.toml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
[tool.poetry]
2+
name = "python-recorder"
3+
version = "0.0.1"
4+
description = ""
5+
authors = ["Andreu Gimenez <esdandreu@gmail.com>"]
6+
readme = "README.md"
7+
license = "MIT"
8+
packages = [{include = "recorder"}]
9+
10+
[tool.poetry.scripts]
11+
recorder = "recorder.__main__:app"
12+
13+
[tool.poetry.dependencies]
14+
python = "^3.7"
15+
typer = {extras = ["all"], version = "^0.4.0"}
16+
PyInquirer = "^1.0.3"
17+
PyYAML = "^5.1"
18+
numpy = "^1.22.2"
19+
sounddevice = {version = "^0.4.4", optional = true}
20+
pyrealsense2 = {version = "^2.50.0", optional = true}
21+
Flask = {version = "^2.1.1", optional = true}
22+
23+
[tool.poetry.dev-dependencies]
24+
pytest = "^7.1.1"
25+
26+
[tool.poetry.extras]
27+
realsense = ["pyrealsense2"]
28+
microphone = ["sounddevice"]
29+
localhost = ["Flask"]
30+
all = ["pyrealsense2", "sounddevice", "Flask"]
31+
32+
[build-system]
33+
requires = ["poetry>=0.12"]
34+
build-backend = "poetry.masonry.api"

vao-recorder.py renamed to recorder/__main__.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -185,9 +185,13 @@ def test(
185185
output_folder = recorder(seconds=5)
186186

187187

188-
if __name__ == '__main__':
188+
def main():
189189
# Launch the command line application
190190
try:
191-
app()
191+
app(prog_name='recorder')
192192
except RuntimeError as e:
193-
typer.secho(str(e), fg='red')
193+
typer.secho(str(e), fg='red')
194+
195+
196+
if __name__ == '__main__':
197+
main()

recorder/config.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,10 @@
33

44
from typing import List
55
from pathlib import Path
6-
from datetime import datetime
76

8-
DEFAULT_CONFIG_PATH = Path.cwd() / 'vao-recorder.yaml'
7+
DEFAULT_CONFIG_PATH = Path.cwd() / 'python-recorder.yaml'
98

10-
DEFAULT_OUTPUT_FOLDER = Path.cwd() / 'output'
9+
DEFAULT_OUTPUT_FOLDER = Path.cwd() / 'recordings'
1110

1211

1312
class Config(dict):

recorder/device/__init__.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
from .device import Device
2-
from .microphone import Microphone
3-
from .realsense import RealSense
2+
try:
3+
from .microphone import Microphone
4+
except ImportError as e:
5+
class Microphone:
6+
def __init__(self, *args, **kwargs) -> None:
7+
raise e
8+
try:
9+
from .realsense import RealSense
10+
except ImportError as e:
11+
class RealSense:
12+
def __init__(self, *args, **kwargs) -> None:
13+
raise e
414

515
DEVICE_CLASSES = {repr(cls): cls for cls in Device.__subclasses__()}

recorder/device/device.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
from typing import Dict
44
from pathlib import Path
5-
from warnings import warn
65
from datetime import datetime
76
from abc import ABC, ABCMeta, abstractmethod
87

requirements.txt

-1.07 KB
Binary file not shown.

0 commit comments

Comments
 (0)