forked from rDrama/rDrama
dynamic duration
parent
67d284fd7e
commit
b43c63c33b
|
@ -1968,7 +1968,6 @@ def schedule_orgy(v):
|
|||
link = request.values.get("link", "").strip()
|
||||
title = request.values.get("title", "").strip()
|
||||
start_utc = request.values.get("start_utc", "").strip()
|
||||
duration = request.values.get("duration", "").strip()
|
||||
|
||||
if not link:
|
||||
abort(400, "A link is required!")
|
||||
|
@ -1985,6 +1984,8 @@ def schedule_orgy(v):
|
|||
start_utc = int(time.time())
|
||||
redir = '/chat'
|
||||
|
||||
end_utc = None
|
||||
|
||||
if bare_youtube_regex.match(normalized_link):
|
||||
orgy_type = 'youtube'
|
||||
data, _ = get_youtube_id_and_t(normalized_link)
|
||||
|
@ -1997,17 +1998,14 @@ def schedule_orgy(v):
|
|||
elif any((normalized_link.lower().endswith(f'.{x}') for x in VIDEO_FORMATS)):
|
||||
orgy_type = 'file'
|
||||
data = normalized_link
|
||||
print(ffmpeg.probe(data, headers=f'referer:https://{SITE}/chat'), flush=True)
|
||||
else:
|
||||
abort(400)
|
||||
|
||||
if duration:
|
||||
duration = int(duration)
|
||||
video_info = ffmpeg.probe(data, headers=f'referer:https://{SITE}/chat')
|
||||
duration = float(video_info['streams'][0]['duration'])
|
||||
if duration == 2.0: raise
|
||||
if duration > 3000:
|
||||
duration += 300 #account for break
|
||||
end_utc = int(start_utc + duration)
|
||||
else:
|
||||
end_utc = None
|
||||
abort(400)
|
||||
|
||||
orgy = Orgy(
|
||||
title=title,
|
||||
|
|
|
@ -37,14 +37,6 @@
|
|||
<input id="start_utc" autocomplete="off" type="number" step="any" name="start_utc" max="2147483647" class="form-control" placeholder="Optional. Leave blank to start orgy now.">
|
||||
</div>
|
||||
</div>
|
||||
<div class="d-lg-flex border-bottom mt-3">
|
||||
<div class="title w-lg-25">
|
||||
<label for="duration">Duration (in seconds)</label>
|
||||
</div>
|
||||
<div class="body w-lg-100">
|
||||
<input id="duration" autocomplete="off" type="number" step="any" name="duration" max="2147483647" class="form-control" placeholder="Optional">
|
||||
</div>
|
||||
</div>
|
||||
<input hidden name="formkey" value="{{v|formkey}}">
|
||||
<div class="d-flex mt-3">
|
||||
<input id="start-orgy" autocomplete="off" class="btn btn-primary ml-auto" type="submit" value="Schedule Orgy">
|
||||
|
|
Loading…
Reference in New Issue