same as last commit

master
Aevann1 2022-09-18 22:39:40 +02:00
parent aea885247c
commit 0739358e3f
1 changed files with 9 additions and 13 deletions

View File

@ -63,19 +63,15 @@ def process_video(file):
extension = 'mp4' extension = 'mp4'
new = old + '.' + extension new = old + '.' + extension
if file.filename.split('.')[-1].lower() == 'webm': subprocess.run(["ffmpeg", "-y", "-loglevel", "warning", "-i", old, "-map_metadata", "-1", "-c:v", "copy", "-c:a", "copy", new], check=True)
os.rename(old, new) os.remove(old)
return f'{SITE_FULL}{new}' if os.stat(new).st_size > 8 * 1024 * 1024:
else: with open(new, 'rb') as f:
subprocess.run(["ffmpeg", "-y", "-loglevel", "warning", "-i", old, "-map_metadata", "-1", "-c:v", "copy", "-c:a", "copy", new], check=True) os.remove(new)
os.remove(old) req = requests.request("POST", "https://pomf2.lain.la/upload.php",
if os.stat(new).st_size > 8 * 1024 * 1024: files={'files[]': f}, timeout=20).json()
with open(new, 'rb') as f: return req['files'][0]['url']
os.remove(new) return f'{SITE_FULL}{new}'
req = requests.request("POST", "https://pomf2.lain.la/upload.php",
files={'files[]': f}, timeout=20).json()
return req['files'][0]['url']
return f'{SITE_FULL}{new}'