Release: v2.6.2

This commit is contained in:
Patrick Asmus
2026-09-06 20:53:20 +02:00
parent 1d33baf949
commit eee5cf2b88
+17 -34
View File
@@ -8,9 +8,9 @@
# Web: https://www.cleveradmin.de # Web: https://www.cleveradmin.de
# Repository: https://git.techniverse.net/scriptos/stream-recorder.git # Repository: https://git.techniverse.net/scriptos/stream-recorder.git
# License: MIT # License: MIT
# Version: v2.6.1 # Version: v2.6.2
# Date: 06.09.2026 # Date: 06.09.2026
# Modifications: Doppelte Benachrichtigung entfernt # Modifications: Mehrtägige Aufnahmen nun möglich
############################################### ###############################################
set -uo pipefail set -uo pipefail
@@ -211,6 +211,7 @@ parse_duration() {
[[ "$input" =~ ^[0-9]+$ ]] && { echo "$input"; return; } [[ "$input" =~ ^[0-9]+$ ]] && { echo "$input"; return; }
local total=0 local total=0
[[ "$input" =~ ([0-9]+)d ]] && total=$((total + ${BASH_REMATCH[1]} * 86400))
[[ "$input" =~ ([0-9]+)h ]] && total=$((total + ${BASH_REMATCH[1]} * 3600)) [[ "$input" =~ ([0-9]+)h ]] && total=$((total + ${BASH_REMATCH[1]} * 3600))
[[ "$input" =~ ([0-9]+)m ]] && total=$((total + ${BASH_REMATCH[1]} * 60)) [[ "$input" =~ ([0-9]+)m ]] && total=$((total + ${BASH_REMATCH[1]} * 60))
[[ "$input" =~ ([0-9]+)s ]] && total=$((total + ${BASH_REMATCH[1]})) [[ "$input" =~ ([0-9]+)s ]] && total=$((total + ${BASH_REMATCH[1]}))
@@ -714,7 +715,11 @@ run_scheduler() {
fi fi
else else
if is_recording "$job_id" && [[ -f "${PID_DIR}/${job_id}.scheduled" ]]; then if is_recording "$job_id" && [[ -f "${PID_DIR}/${job_id}.scheduled" ]]; then
if [[ -n "${SCHEDULE_STOP:-}" ]] || ! $is_today; then if [[ -n "${SCHEDULE_STOP:-}" ]]; then
log "INFO" "Scheduler: Stoppe '${STREAM_NAME}' [${job_id}]"
stop_recording "$job_id"
rm -f "${PID_DIR}/${job_id}.scheduled"
elif ! $is_today && [[ "${SCHEDULE_ONCE:-false}" != "true" ]]; then
log "INFO" "Scheduler: Stoppe '${STREAM_NAME}' [${job_id}]" log "INFO" "Scheduler: Stoppe '${STREAM_NAME}' [${job_id}]"
stop_recording "$job_id" stop_recording "$job_id"
rm -f "${PID_DIR}/${job_id}.scheduled" rm -f "${PID_DIR}/${job_id}.scheduled"
@@ -858,49 +863,25 @@ create_job() {
echo "Kein Datum angegeben - Zeitplan deaktiviert." echo "Kein Datum angegeben - Zeitplan deaktiviert."
sched_enabled="false" sched_enabled="false"
else else
echo "" read -rp "Laufzeit (z.B. 2h, 30m, 2d, 1d12h oder leer=unbegrenzt): " duration_input
echo "Wie soll die Aufnahme begrenzt werden?"
echo " 1) Endzeit angeben (z.B. 18:30)"
echo " 2) Laufzeit angeben (z.B. 1h, 30m)"
echo " 3) Unbegrenzt (läuft bis manuell gestoppt)"
read -rp "Auswahl [1/2/3]: " limit_choice
case "$limit_choice" in
1)
read -rp "Endzeit (HH:MM): " sched_stop
if [[ -n "$sched_stop" ]]; then
local start_min stop_min diff_min
start_min=$(_time_to_minutes "$sched_start")
stop_min=$(_time_to_minutes "$sched_stop")
diff_min=$(( stop_min - start_min ))
[[ $diff_min -le 0 ]] && diff_min=$(( diff_min + 1440 ))
duration=$(( diff_min * 60 ))
echo " -> Laufzeit automatisch berechnet: ${diff_min} Minuten"
fi
;;
2)
read -rp "Laufzeit (z.B. 1h, 30m, 1h30m, 3600): " duration_input
if [[ -n "$duration_input" ]]; then if [[ -n "$duration_input" ]]; then
duration=$(parse_duration "$duration_input") duration=$(parse_duration "$duration_input")
if [[ -n "$duration" ]]; then if [[ -n "$duration" && $duration -lt 86400 ]]; then
local start_min end_min end_h end_m local start_min end_min end_h end_m
start_min=$(_time_to_minutes "$sched_start") start_min=$(_time_to_minutes "$sched_start")
end_min=$(( start_min + duration / 60 )) end_min=$(( start_min + duration / 60 ))
[[ $end_min -ge 1440 ]] && end_min=$(( end_min - 1440 )) if [[ $end_min -lt 1440 ]]; then
end_h=$(( end_min / 60 )) end_h=$(( end_min / 60 ))
end_m=$(( end_min % 60 )) end_m=$(( end_min % 60 ))
sched_stop=$(printf "%02d:%02d" "$end_h" "$end_m") sched_stop=$(printf "%02d:%02d" "$end_h" "$end_m")
echo " -> Endzeit automatisch berechnet: ${sched_stop}"
fi fi
fi fi
;; fi
*)
;;
esac
fi fi
fi fi
if [[ "$sched_enabled" != "true" ]]; then if [[ "$sched_enabled" != "true" ]]; then
read -rp "Laufzeit (z.B. 1h, 30m, 3600 oder leer=unbegrenzt): " duration_input read -rp "Laufzeit (z.B. 2h, 30m, 2d, 1d12h oder leer=unbegrenzt): " duration_input
if [[ -n "$duration_input" ]]; then if [[ -n "$duration_input" ]]; then
duration=$(parse_duration "$duration_input") duration=$(parse_duration "$duration_input")
fi fi
@@ -943,8 +924,10 @@ create_job() {
echo " Format: ${ext:-auto}" echo " Format: ${ext:-auto}"
local duration_display="unbegrenzt" local duration_display="unbegrenzt"
if [[ -n "$duration" ]]; then if [[ -n "$duration" ]]; then
local d_h=$((duration / 3600)) d_m=$(( (duration % 3600) / 60 )) local d_d=$((duration / 86400)) d_h=$(( (duration % 86400) / 3600 )) d_m=$(( (duration % 3600) / 60 ))
duration_display="${d_h}h ${d_m}m (${duration}s)" duration_display=""
[[ $d_d -gt 0 ]] && duration_display+="${d_d}d "
duration_display+="${d_h}h ${d_m}m"
fi fi
echo " Dauer: ${duration_display}" echo " Dauer: ${duration_display}"
if [[ "$sched_enabled" == "true" ]]; then if [[ "$sched_enabled" == "true" ]]; then