forked from rDrama/rDrama
add duration field cuz the probing shit is an unfixable mess
parent
10461fa27e
commit
059204bb24
|
@ -1950,6 +1950,7 @@ def schedule_orgy(v):
|
||||||
link = request.values.get("link", "").strip()
|
link = request.values.get("link", "").strip()
|
||||||
title = request.values.get("title", "").strip()
|
title = request.values.get("title", "").strip()
|
||||||
start_utc = request.values.get("start_utc", "").strip()
|
start_utc = request.values.get("start_utc", "").strip()
|
||||||
|
duration = request.values.get("duration", "").strip()
|
||||||
|
|
||||||
if not link:
|
if not link:
|
||||||
abort(400, "A link is required!")
|
abort(400, "A link is required!")
|
||||||
|
@ -1967,8 +1968,6 @@ def schedule_orgy(v):
|
||||||
else:
|
else:
|
||||||
start_utc = int(time.time())
|
start_utc = int(time.time())
|
||||||
|
|
||||||
end_utc = None
|
|
||||||
|
|
||||||
if bare_youtube_regex.match(normalized_link):
|
if bare_youtube_regex.match(normalized_link):
|
||||||
orgy_type = 'youtube'
|
orgy_type = 'youtube'
|
||||||
data, _ = get_youtube_id_and_t(normalized_link)
|
data, _ = get_youtube_id_and_t(normalized_link)
|
||||||
|
@ -1981,18 +1980,15 @@ def schedule_orgy(v):
|
||||||
elif any((normalized_link.lower().endswith(f'.{x}') for x in VIDEO_FORMATS)):
|
elif any((normalized_link.lower().endswith(f'.{x}') for x in VIDEO_FORMATS)):
|
||||||
orgy_type = 'file'
|
orgy_type = 'file'
|
||||||
data = normalized_link
|
data = normalized_link
|
||||||
#not deduped, cuz cron checks local file, it can't check the url cuz of referrer restriction
|
|
||||||
try:
|
|
||||||
video_info = ffmpeg.probe(data)
|
|
||||||
except:
|
|
||||||
pass
|
|
||||||
else:
|
|
||||||
seconds = float(video_info['streams'][0]['duration'])
|
|
||||||
if seconds == 2.0: raise
|
|
||||||
end_utc = int(start_utc + seconds)
|
|
||||||
else:
|
else:
|
||||||
abort(400)
|
abort(400)
|
||||||
|
|
||||||
|
if duration:
|
||||||
|
duration = int(duration)
|
||||||
|
end_utc = int(start_utc + duration)
|
||||||
|
else:
|
||||||
|
end_utc = None
|
||||||
|
|
||||||
orgy = Orgy(
|
orgy = Orgy(
|
||||||
title=title,
|
title=title,
|
||||||
type=orgy_type,
|
type=orgy_type,
|
||||||
|
|
|
@ -38,6 +38,14 @@
|
||||||
<input autocomplete="off" type="number" step="any" name="start_utc" max="2147483647" class="form-control" placeholder="Leave blank to start orgy now">
|
<input autocomplete="off" type="number" step="any" name="start_utc" max="2147483647" class="form-control" placeholder="Leave blank to start orgy now">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="d-lg-flex border-bottom mt-3">
|
||||||
|
<div class="title w-lg-25">
|
||||||
|
<label for="link">Duration (in seconds)</label>
|
||||||
|
</div>
|
||||||
|
<div class="body w-lg-100">
|
||||||
|
<input autocomplete="off" type="number" step="any" name="duration" max="2147483647" class="form-control" placeholder="Optional">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<input hidden name="formkey" value="{{v|formkey}}">
|
<input hidden name="formkey" value="{{v|formkey}}">
|
||||||
<div class="d-flex mt-3">
|
<div class="d-flex mt-3">
|
||||||
<input id="start-orgy" autocomplete="off" class="btn btn-primary ml-auto" type="submit" value="Schedule Orgy">
|
<input id="start-orgy" autocomplete="off" class="btn btn-primary ml-auto" type="submit" value="Schedule Orgy">
|
||||||
|
|
Loading…
Reference in New Issue