forked from rDrama/rDrama
add end_utc to manual file orgies too
parent
926fb50b6c
commit
e266fc85e9
|
@ -1,6 +1,7 @@
|
||||||
import time
|
import time
|
||||||
from math import floor
|
from math import floor
|
||||||
import os
|
import os
|
||||||
|
import ffmpeg
|
||||||
|
|
||||||
from sqlalchemy.orm import load_only
|
from sqlalchemy.orm import load_only
|
||||||
|
|
||||||
|
@ -1960,6 +1961,7 @@ def start_orgy(v):
|
||||||
abort(400, "An orgy is already in progress")
|
abort(400, "An orgy is already in progress")
|
||||||
|
|
||||||
normalized_link = normalize_url(link)
|
normalized_link = normalize_url(link)
|
||||||
|
end_utc = None
|
||||||
|
|
||||||
if bare_youtube_regex.match(normalized_link):
|
if bare_youtube_regex.match(normalized_link):
|
||||||
orgy_type = 'youtube'
|
orgy_type = 'youtube'
|
||||||
|
@ -1973,13 +1975,18 @@ def start_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
|
||||||
|
video_info = ffmpeg.probe(data)
|
||||||
|
seconds = float(video_info['streams'][0]['duration'])
|
||||||
|
end_utc = int(time.time() + seconds)
|
||||||
else:
|
else:
|
||||||
abort(400)
|
abort(400)
|
||||||
|
|
||||||
orgy = Orgy(
|
orgy = Orgy(
|
||||||
title=title,
|
title=title,
|
||||||
type=orgy_type,
|
type=orgy_type,
|
||||||
data=data
|
data=data,
|
||||||
|
end_utc=end_utc,
|
||||||
)
|
)
|
||||||
g.db.add(orgy)
|
g.db.add(orgy)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue