From b4310b0024747beadca278aea0b0c65ed4f82852 Mon Sep 17 00:00:00 2001 From: Mike Lang Date: Sun, 27 Oct 2019 04:50:59 -0700 Subject: [PATCH] restreamer: Allow blank start/end for cut So it acts the same as generating a playlist. --- restreamer/restreamer/main.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/restreamer/restreamer/main.py b/restreamer/restreamer/main.py index c6859ed..78fdce9 100644 --- a/restreamer/restreamer/main.py +++ b/restreamer/restreamer/main.py @@ -239,8 +239,16 @@ def cut(channel, quality): A fast cut is much faster but minor artifacting may be present near the start and end. A fast cut is encoded as MPEG-TS, a full as mp4. """ - start = dateutil.parse_utc_only(request.args['start']) - end = dateutil.parse_utc_only(request.args['end']) + start = dateutil.parse_utc_only(request.args['start']) if 'start' in request.args else None + end = dateutil.parse_utc_only(request.args['end']) if 'end' in request.args else None + if start is None or end is None: + # If start or end are not given, use the earliest/latest time available + first, last = time_range_for_quality(channel, quality) + if start is None: + start = first + if end is None: + end = last + if end <= start: return "End must be after start", 400