From a39bcc80fc5a1f3dbe4b5b2c53b582bc1506016e Mon Sep 17 00:00:00 2001 From: Mikhail Zakharov Date: Tue, 26 Jul 2022 14:03:53 -0400 Subject: [PATCH] fix command line parameters rate and channels --- birdnetapp/app.py | 4 ++-- tests/test_main.py | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/birdnetapp/app.py b/birdnetapp/app.py index 6af9007..fe22a47 100644 --- a/birdnetapp/app.py +++ b/birdnetapp/app.py @@ -197,10 +197,10 @@ def process(self, ts, data, mdata): tic = time.time() mdata['week'] = ts.isocalendar()[1] data = np.frombuffer(data, dtype=np.int16) - data = data.reshape((-1, CHANNELS)) + data = data.reshape((-1, self.stream.channels)) with tempfile.NamedTemporaryFile(suffix='.wav') as tmp: fname = tmp.name - scipy.io.wavfile.write(fname, RATE, data) + scipy.io.wavfile.write(fname, self.stream.rate, data) res = self.sendRequest(HOST, PORT, fname, json.dumps(mdata)) up = self.upload_result(ts, fname, SAVEDIR, res) _LOGGER.debug(f'proces took: {time.time() - tic} seconds') diff --git a/tests/test_main.py b/tests/test_main.py index 5fe3526..78d7f36 100644 --- a/tests/test_main.py +++ b/tests/test_main.py @@ -21,6 +21,7 @@ class Args:pass class MocStream: channels = 2 periodsize = 48000 + rate = 48000 class DummyExecutor(Executor):