forked from rDrama/rDrama
attempt fix for video sync
parent
d9c665a872
commit
883b953478
|
@ -132,8 +132,6 @@ def reencode_video(old, new, check_sizes=False):
|
||||||
os.remove(old)
|
os.remove(old)
|
||||||
if os.path.isfile(tmp):
|
if os.path.isfile(tmp):
|
||||||
os.remove(tmp)
|
os.remove(tmp)
|
||||||
if SITE == 'watchpeopledie.tv':
|
|
||||||
rclone_copy(new)
|
|
||||||
return
|
return
|
||||||
|
|
||||||
if check_sizes:
|
if check_sizes:
|
||||||
|
@ -142,8 +140,6 @@ def reencode_video(old, new, check_sizes=False):
|
||||||
if new_size > old_size:
|
if new_size > old_size:
|
||||||
os.remove(old)
|
os.remove(old)
|
||||||
os.remove(tmp)
|
os.remove(tmp)
|
||||||
if SITE == 'watchpeopledie.tv':
|
|
||||||
rclone_copy(new)
|
|
||||||
return
|
return
|
||||||
|
|
||||||
os.replace(tmp, new)
|
os.replace(tmp, new)
|
||||||
|
@ -184,15 +180,12 @@ def process_video(file, v):
|
||||||
os.remove(old)
|
os.remove(old)
|
||||||
abort(400, "Something went wrong processing your video on our end. Please try uploading it to https://pomf2.lain.la and post the link instead.")
|
abort(400, "Something went wrong processing your video on our end. Please try uploading it to https://pomf2.lain.la and post the link instead.")
|
||||||
|
|
||||||
is_reencoding = False
|
|
||||||
if codec != 'h264':
|
if codec != 'h264':
|
||||||
copyfile(old, new)
|
copyfile(old, new)
|
||||||
gevent.spawn(reencode_video, old, new)
|
gevent.spawn(reencode_video, old, new)
|
||||||
is_reencoding = True
|
|
||||||
elif bitrate >= 3000000:
|
elif bitrate >= 3000000:
|
||||||
copyfile(old, new)
|
copyfile(old, new)
|
||||||
gevent.spawn(reencode_video, old, new, True)
|
gevent.spawn(reencode_video, old, new, True)
|
||||||
is_reencoding = True
|
|
||||||
else:
|
else:
|
||||||
try:
|
try:
|
||||||
ffmpeg.input(old).output(new, loglevel="quiet", map_metadata=-1, acodec="copy", vcodec="copy").run()
|
ffmpeg.input(old).output(new, loglevel="quiet", map_metadata=-1, acodec="copy", vcodec="copy").run()
|
||||||
|
@ -219,7 +212,7 @@ def process_video(file, v):
|
||||||
posterurl = SITE_FULL_IMAGES + name
|
posterurl = SITE_FULL_IMAGES + name
|
||||||
media.posterurl = posterurl
|
media.posterurl = posterurl
|
||||||
|
|
||||||
if SITE == 'watchpeopledie.tv' and not is_reencoding:
|
if SITE == 'watchpeopledie.tv':
|
||||||
gevent.spawn(rclone_copy, new)
|
gevent.spawn(rclone_copy, new)
|
||||||
|
|
||||||
return url, posterurl, name
|
return url, posterurl, name
|
||||||
|
@ -318,8 +311,9 @@ def process_badge_entry(oldname, v, comment_body):
|
||||||
if SITE == 'watchpeopledie.tv':
|
if SITE == 'watchpeopledie.tv':
|
||||||
from rclone_python import rclone
|
from rclone_python import rclone
|
||||||
def rclone_copy(filename):
|
def rclone_copy(filename):
|
||||||
|
print(f'attempting to sync {filename}', flush=True)
|
||||||
x = rclone.copy(filename, 'no:/videos', ignore_existing=True, show_progress=False)
|
x = rclone.copy(filename, 'no:/videos', ignore_existing=True, show_progress=False)
|
||||||
print(filename, x, flush=True)
|
print(f'finished syncing {filename}', flush=True)
|
||||||
def rclone_delete(path):
|
def rclone_delete(path):
|
||||||
params = ("rclone", "deletefile", path)
|
params = ("rclone", "deletefile", path)
|
||||||
subprocess.run(params, check=True, timeout=30)
|
subprocess.run(params, check=True, timeout=30)
|
||||||
|
|
Loading…
Reference in New Issue