Skip to content

Commit 5e767fa

Browse files
committed
debug multiple recordings with one listener
1 parent 9d9c279 commit 5e767fa

2 files changed

Lines changed: 7 additions & 3 deletions

File tree

recorder/__main__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,6 @@ def record(
156156
seconds: int = typer.Argument(None, help="Number of seconds to record"),
157157
config_path: Optional[Path] = DEFAULT_CONFIG_PATH_OPTION,
158158
output_folder: Optional[Path] = DEFAULT_OUTPUT_FOLDER_OPTION,
159-
# TODO pass kwargs to listener. Or make subcommands for each listener
160159
):
161160
config = get_config(config_path)
162161
recorder = Recorder(config, output_folder)
@@ -170,6 +169,7 @@ def listen(
170169
listener_class: str = LISTENER_CLASS_ARGUMENT,
171170
config_path: Optional[Path] = DEFAULT_CONFIG_PATH_OPTION,
172171
output_folder: Optional[Path] = DEFAULT_OUTPUT_FOLDER_OPTION,
172+
# TODO pass kwargs to listener. Or make subcommands for each listener
173173
):
174174
config = get_config(config_path)
175175
recorder = Recorder(config, output_folder)

recorder/recorder.py

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

33
from time import sleep
44
from pathlib import Path
5+
from copy import deepcopy
56
from typing import Optional
67
from typer import progressbar
78
from datetime import datetime
@@ -33,14 +34,17 @@ def __init__(
3334
be fully initialized and an additionall call to `setup` will be
3435
required.
3536
"""
36-
self.config = config
37+
self.input_config = config
38+
self.config = deepcopy(self.input_config)
3739
# Initialize the output folder
3840
self.output_folder = output_folder
3941
self.output_folder.mkdir(parents=True, exist_ok=True)
4042
if setup_name is not False:
4143
self.setup(setup_name)
4244

43-
def setup(self, name: Optional[str] = None):
45+
def setup(self, name: Optional[str] = None, reset_config: bool = True):
46+
if reset_config:
47+
self.config = deepcopy(self.input_config)
4448
# Initialize next recording output
4549
if not name:
4650
name = datetime.now().strftime('date_%Y-%m-%d;time_%H-%M-%S')

0 commit comments

Comments
 (0)