fix video syncing issues
parent
322e0fe50f
commit
cfe0adc5fd
|
@ -29,12 +29,6 @@ def purge_files_in_cloudflare_cache(files):
|
|||
if isinstance(files, str):
|
||||
files = [files]
|
||||
|
||||
if SITE == 'watchpeopledie.tv':
|
||||
for file in files:
|
||||
if file.startswith('https://videos.watchpeopledie.tv/'):
|
||||
filename = file.split('https://videos.watchpeopledie.tv/')[1]
|
||||
gevent.spawn(rclone_delete, f'no:/videos/{filename}')
|
||||
|
||||
post_data = {"files": files}
|
||||
res = None
|
||||
try:
|
||||
|
@ -42,9 +36,3 @@ def purge_files_in_cloudflare_cache(files):
|
|||
except:
|
||||
return False
|
||||
return res == "<Response [200]>"
|
||||
|
||||
if SITE == 'watchpeopledie.tv':
|
||||
from rclone_python import rclone
|
||||
def rclone_delete(filename):
|
||||
try: rclone.delete(filename)
|
||||
except Exception as e: print(e, flush=True)
|
||||
|
|
|
@ -144,6 +144,7 @@ def reencode_video(old, new, check_sizes=False):
|
|||
os.remove(old)
|
||||
|
||||
if SITE == 'watchpeopledie.tv':
|
||||
rclone_copy(new)
|
||||
url = f'https://videos.{SITE}' + new.split('/videos')[1]
|
||||
else:
|
||||
url = f"{SITE_FULL}{new}"
|
||||
|
@ -171,12 +172,15 @@ def process_video(file, v):
|
|||
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.")
|
||||
|
||||
is_reencoding = False
|
||||
if codec != 'h264':
|
||||
copyfile(old, new)
|
||||
gevent.spawn(reencode_video, old, new)
|
||||
is_reencoding = True
|
||||
elif bitrate >= 3000000:
|
||||
copyfile(old, new)
|
||||
gevent.spawn(reencode_video, old, new, True)
|
||||
is_reencoding = True
|
||||
else:
|
||||
try:
|
||||
ffmpeg.input(old).output(new, loglevel="quiet", map_metadata=-1, acodec="copy", vcodec="copy").run()
|
||||
|
@ -198,9 +202,11 @@ def process_video(file, v):
|
|||
|
||||
if SITE == 'watchpeopledie.tv' and v and v.username.lower().startswith("icosaka"):
|
||||
gevent.spawn(delete_file, new, f'https://videos.{SITE}' + new.split('/videos')[1])
|
||||
return f'https://videos.{SITE}' + new.split('/videos')[1]
|
||||
|
||||
if SITE == 'watchpeopledie.tv':
|
||||
gevent.spawn(rclone_copy, new)
|
||||
if not is_reencoding:
|
||||
gevent.spawn(rclone_copy, new)
|
||||
return f'https://videos.{SITE}' + new.split('/videos')[1]
|
||||
else:
|
||||
return f"{SITE_FULL}{new}"
|
||||
|
|
|
@ -1886,6 +1886,11 @@ def delete_media_post(v):
|
|||
g.db.add(ma)
|
||||
|
||||
purge_files_in_cloudflare_cache(url)
|
||||
|
||||
if url.startswith('https://videos.watchpeopledie.tv/'):
|
||||
filename = url.split('https://videos.watchpeopledie.tv/')[1]
|
||||
gevent.spawn(rclone.delete, f'no:/videos/{filename}')
|
||||
|
||||
return {"message": "Media deleted successfully!"}
|
||||
|
||||
@app.post("/admin/reset_password/<int:user_id>")
|
||||
|
|
Loading…
Reference in New Issue