feat: name cut clips by wall-clock time; fix recording filename format

Cut downloads were named by byte offsets (`..._cut_740s-750s.flac`). They are
now named by the actual recording time the slice covers, e.g.
`20260523_22-31-30_22-32-30.flac` for a 22:31:30->22:32:30 cut of a recording
started at 22:00:00.

To make this reliable, the recording filename is now a fixed
`%Y%m%d_%H%M%S` start-time format (`FILENAME_FORMAT`) shared by isr.py and
web.py, replacing the user-configurable `filename_pattern` (web.py never reads
config.ini, so a custom pattern could not be parsed back). web.py parses the
start time out of the filename via `_recording_start()` and builds cut names
with `_cut_filename()`. The DATE column now also comes from the filename
(falling back to mtime only for non-standard names), since mtime is the last
write, not the start.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-06-11 14:30:30 +02:00
parent 2caf23f17d
commit 5e7620627b
7 changed files with 97 additions and 55 deletions
+4 -12
View File
@@ -17,13 +17,10 @@ output_directory = recordings
# Duration in minutes after which to split into a new file
split_minutes = 60
# Filename pattern with strftime format codes
# Examples:
# %Y%m%d_%H%M%S -> 20241216_143000.ext
# recording_%Y-%m-%d_%H%M -> recording_2024-12-16_1430.ext
# %Y/%m/%d/audio_%H%M%S -> 2024/12/16/audio_143000.ext (creates subdirs)
# Common codes: %Y=year, %m=month, %d=day, %H=hour, %M=minute, %S=second
filename_pattern = %Y%m%d_%H%M%S
# Recording filenames are fixed as <YYYYMMDD>_<HHMMSS>.<ext> (the start time,
# e.g. 20241216_143000.flac). This is not configurable: the web UI parses the
# start time back out of the filename to show the date and to name cut clips
# with real wall-clock times.
# Maximum number of connection/recording retry attempts before giving up
max_retries = 10
@@ -58,7 +55,6 @@ format = auto
# Override general settings for this source (optional):
# output_directory = recordings/streams
# split_minutes = 30
# filename_pattern = mystream_%Y%m%d_%H%M%S
# =============================================================================
@@ -93,7 +89,6 @@ format = auto
# # Override general settings for this source (optional):
# # output_directory = recordings/soundcard
# # split_minutes = 60
# # filename_pattern = soundcard_%Y%m%d_%H%M%S
# =============================================================================
@@ -105,13 +100,11 @@ format = auto
# type = stream
# url = http://radio1.example.com:8000/live
# format = auto
# filename_pattern = radio1_%Y%m%d_%H%M%S
#
# [radio_station_2]
# type = stream
# url = http://radio2.example.com:8000/live
# format = auto
# filename_pattern = radio2_%Y%m%d_%H%M%S
#
# [system_audio]
# type = soundcard
@@ -119,7 +112,6 @@ format = auto
# sample_rate = 48000
# channels = 2
# format = flac
# filename_pattern = system_%Y%m%d_%H%M%S
# =============================================================================