wip
This commit is contained in:
parent
b5ed39434a
commit
a0e3dac16f
2 changed files with 2 additions and 12 deletions
|
@ -10,15 +10,6 @@ SOURCE = "pulse" # funktioniert mit PulseAudio
|
||||||
|
|
||||||
os.makedirs(OUTDIR, exist_ok=True)
|
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():
|
def record_section():
|
||||||
tz = pytz.timezone("Europe/Berlin")
|
tz = pytz.timezone("Europe/Berlin")
|
||||||
now = datetime.datetime.now(tz)
|
now = datetime.datetime.now(tz)
|
||||||
|
@ -26,8 +17,7 @@ def record_section():
|
||||||
filename = os.path.join(OUTDIR, f"{timestamp}.flac")
|
filename = os.path.join(OUTDIR, f"{timestamp}.flac")
|
||||||
print(f"🎙️ Starte Aufnahme: {filename}")
|
print(f"🎙️ Starte Aufnahme: {filename}")
|
||||||
|
|
||||||
next_start = get_next_section_start(now)
|
duration_seconds = DURATION # Feste Dauer von 3 Stunden
|
||||||
duration_seconds = int((next_start - now).total_seconds())
|
|
||||||
|
|
||||||
cmd = [
|
cmd = [
|
||||||
"ffmpeg",
|
"ffmpeg",
|
||||||
|
|
|
@ -65,7 +65,7 @@ def process_chunk(filename):
|
||||||
clip = data[clip_start:clip_end]
|
clip = data[clip_start:clip_end]
|
||||||
|
|
||||||
chunk_start_str = os.path.splitext(filename)[0]
|
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_offset = (i - padding_before) / samplerate
|
||||||
event_time_dt = chunk_start_dt + datetime.timedelta(seconds=event_offset)
|
event_time_dt = chunk_start_dt + datetime.timedelta(seconds=event_offset)
|
||||||
event_time = event_time_dt.strftime("%Y%m%d-%H%M%S")
|
event_time = event_time_dt.strftime("%Y%m%d-%H%M%S")
|
||||||
|
|
Loading…
Reference in a new issue