Release: v2.8.0

This commit is contained in:
Patrick Asmus
2026-09-07 13:44:25 +02:00
parent f3a8e20d7f
commit e2e36e4d2d
4 changed files with 115 additions and 39 deletions
+92 -22
View File
@@ -8,15 +8,15 @@
# Web: https://www.cleveradmin.de
# Repository: https://git.techniverse.net/scriptos/stream-recorder.git
# License: MIT
# Version: v2.7.0
# Version: v2.8.0
# Date: 07.09.2026
# Modifications: Segment-Splitting, erweiterter Status, verbessertes Stoppen
# Modifications: Segment-Splitting, erweiterter Status, interaktive Job-Auswahl, Konfig updatesicher
###############################################
set -uo pipefail
readonly SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
readonly VERSION="2.7.0"
readonly VERSION="2.8.0"
# --- Standardwerte (überschreibbar via Konfiguration) ---
CONFIG_FILE="${SCRIPT_DIR}/config/stream-recorder.conf"
@@ -1053,17 +1053,30 @@ create_job() {
echo "Kein Datum angegeben - Zeitplan deaktiviert."
sched_enabled="false"
else
read -rp "Laufzeit (z.B. 2h, 30m, 2d, 1d12h oder leer=unbegrenzt): " duration_input
if [[ -n "$duration_input" ]]; then
duration=$(parse_duration "$duration_input")
if [[ -n "$duration" && $duration -lt 86400 ]]; then
local start_min end_min end_h end_m
read -rp "Endzeit oder Laufzeit (z.B. 22:00 oder 2h, 30m, 1d12h, leer=unbegrenzt): " end_input
if [[ -n "$end_input" ]]; then
if [[ "$end_input" =~ ^[0-9]{1,2}:[0-9]{2}$ ]]; then
sched_stop="$end_input"
local start_min stop_min diff_min
start_min=$(_time_to_minutes "$sched_start")
end_min=$(( start_min + duration / 60 ))
if [[ $end_min -lt 1440 ]]; then
end_h=$(( end_min / 60 ))
end_m=$(( end_min % 60 ))
sched_stop=$(printf "%02d:%02d" "$end_h" "$end_m")
stop_min=$(_time_to_minutes "$sched_stop")
if [[ $stop_min -gt $start_min ]]; then
diff_min=$((stop_min - start_min))
else
diff_min=$((1440 - start_min + stop_min))
fi
duration=$((diff_min * 60))
else
duration=$(parse_duration "$end_input")
if [[ -n "$duration" && $duration -lt 86400 ]]; then
local start_min end_min end_h end_m
start_min=$(_time_to_minutes "$sched_start")
end_min=$(( start_min + duration / 60 ))
if [[ $end_min -lt 1440 ]]; then
end_h=$(( end_min / 60 ))
end_m=$(( end_min % 60 ))
sched_stop=$(printf "%02d:%02d" "$end_h" "$end_m")
fi
fi
fi
fi
@@ -1411,6 +1424,60 @@ stop_all() {
fi
}
select_job() {
local -a job_files=()
local -a job_names=()
local -a job_urls=()
local -a job_stati=()
for job_file in "${JOBS_DIR}"/*.job; do
[[ -f "$job_file" ]] || continue
load_job "$job_file" 2>/dev/null || continue
local job_id
job_id=$(basename "$job_file" .job)
local status="bereit"
if is_recording "$job_id"; then
status="läuft"
fi
job_files+=("$job_file")
job_names+=("$STREAM_NAME")
job_urls+=("$STREAM_URL")
job_stati+=("$status")
done
if [[ ${#job_files[@]} -eq 0 ]]; then
echo "Keine .job-Dateien gefunden in: ${JOBS_DIR}"
echo "Erstelle einen Job: $(basename "$0") create"
return 1
fi
echo ""
echo "Verfügbare Jobs:"
echo "$(printf '=%.0s' {1..50})"
echo ""
local i
for (( i=0; i < ${#job_files[@]}; i++ )); do
local num=$((i + 1))
local marker=" "
[[ "${job_stati[$i]}" == "läuft" ]] && marker="* "
printf " %s%d) %-25s [%s]\n" "$marker" "$num" "${job_names[$i]}" "${job_stati[$i]}"
done
echo ""
read -rp "Job auswählen (1-${#job_files[@]}): " choice
if [[ ! "$choice" =~ ^[0-9]+$ ]] || [[ "$choice" -lt 1 || "$choice" -gt ${#job_files[@]} ]]; then
echo "Ungültige Auswahl."
return 1
fi
local idx=$((choice - 1))
echo "${job_files[$idx]}"
}
watch_logs() {
local log_file="${LOG_DIR}/stream-recorder.log"
@@ -1437,12 +1504,12 @@ stream-recorder v${VERSION} - Generischer Stream-Recorder
Verwendung: $(basename "$0") [Optionen] <Befehl> [Argumente]
Befehle:
record <job> Einzelnen Stream aufzeichnen
record [job] Einzelnen Stream aufzeichnen (ohne Angabe: Auswahl)
record-all Alle Jobs aufzeichnen
create Neuen Job interaktiv erstellen
quick Interaktive Schnellaufnahme (URL eingeben)
upload <datei> Vorhandene Datei nach Plik hochladen
stop <name> Aufnahme stoppen (Teilaufnahme wird hochgeladen)
stop [name] Aufnahme stoppen (ohne Angabe: Auswahl)
stop-all Alle Aufnahmen stoppen
list Jobs und deren Zeitpläne anzeigen
status Laufende Aufnahmen mit Details anzeigen
@@ -1499,12 +1566,12 @@ main() {
case "$command" in
record)
if [[ -z "${1:-}" ]]; then
log "ERROR" "Job-Datei oder Job-Name erforderlich"
echo ""; usage; exit 1
fi
local job_file
job_file=$(resolve_job_path "$1")
if [[ -z "${1:-}" ]]; then
job_file=$(select_job) || exit 1
else
job_file=$(resolve_job_path "$1")
fi
if [[ "$FOREGROUND" == "true" || "$VERBOSE" == "true" ]]; then
record_stream "$job_file"
else
@@ -1532,9 +1599,12 @@ main() {
scheduler) run_scheduler ;;
stop)
if [[ -z "${1:-}" ]]; then
log "ERROR" "Job-Name erforderlich"; exit 1
local job_file
job_file=$(select_job) || exit 1
stop_recording "$(basename "$job_file" .job)"
else
stop_recording "$1"
fi
stop_recording "$1"
;;
stop-all) stop_all ;;
list) list_jobs ;;