From a0e3dac16f5b94914879e52c6f1e538fa00f299b Mon Sep 17 00:00:00 2001 From: CroneKorkN Date: Fri, 30 May 2025 19:54:06 +0200 Subject: [PATCH] wip --- create_chunks.py | 12 +----------- process_chunks.py | 2 +- 2 files changed, 2 insertions(+), 12 deletions(-) diff --git a/create_chunks.py b/create_chunks.py index a08ceb1..313aa31 100755 --- a/create_chunks.py +++ b/create_chunks.py @@ -10,15 +10,6 @@ SOURCE = "pulse" # funktioniert mit PulseAudio os.makedirs(OUTDIR, exist_ok=True) -def get_next_section_start(now): - hour = now.hour - next_boundary = (hour // 3 + 1) * 3 - if next_boundary >= 24: - next_time = now.replace(day=now.day, hour=0, minute=0, second=0, microsecond=0) + datetime.timedelta(days=1) - else: - next_time = now.replace(hour=next_boundary, minute=0, second=0, microsecond=0) - return next_time - def record_section(): tz = pytz.timezone("Europe/Berlin") now = datetime.datetime.now(tz) @@ -26,8 +17,7 @@ def record_section(): filename = os.path.join(OUTDIR, f"{timestamp}.flac") print(f"🎙️ Starte Aufnahme: {filename}") - next_start = get_next_section_start(now) - duration_seconds = int((next_start - now).total_seconds()) + duration_seconds = DURATION # Feste Dauer von 3 Stunden cmd = [ "ffmpeg", diff --git a/process_chunks.py b/process_chunks.py index 0ff70ff..0600e4c 100755 --- a/process_chunks.py +++ b/process_chunks.py @@ -65,7 +65,7 @@ def process_chunk(filename): clip = data[clip_start:clip_end] chunk_start_str = os.path.splitext(filename)[0] - chunk_start_dt = datetime.strptime(chunk_start_str, "%Y%m%d-%H%M") + chunk_start_dt = datetime.strptime(chunk_start_str, "%Y%m%d-%H%M%S") event_offset = (i - padding_before) / samplerate event_time_dt = chunk_start_dt + datetime.timedelta(seconds=event_offset) event_time = event_time_dt.strftime("%Y%m%d-%H%M%S")