forked from rDrama/rDrama
videos bullshit
commit
a771596d25
|
@ -16,7 +16,8 @@ def process_audio(file):
|
|||
if os.stat(name).st_size > 8 * 1024 * 1024:
|
||||
with open(name, 'rb') as f:
|
||||
os.remove(name)
|
||||
req = requests.request("POST", "https://pomf2.lain.la/upload.php", files={'files[]': f}, timeout=20).json()
|
||||
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}{name}'
|
||||
|
@ -30,14 +31,15 @@ def process_video(file):
|
|||
file.save(new)
|
||||
else:
|
||||
file.save(old)
|
||||
subprocess.run(["ffmpeg", "-y", "-loglevel", "warning", "-i", old, "-map_metadata", "-1", "-c:v", "copy", "-c:a", "copy", new])
|
||||
subprocess.run(["ffmpeg", "-y", "-loglevel", "warning", "-i", old, "-map_metadata", "-1", "-c:v", "copy", "-c:a", "copy", new], check=True)
|
||||
os.remove(old)
|
||||
|
||||
size = os.stat(new).st_size
|
||||
if os.stat(new).st_size > 8 * 1024 * 1024:
|
||||
with open(new, 'rb') as f:
|
||||
os.remove(new)
|
||||
req = requests.request("POST", "https://pomf2.lain.la/upload.php", files={'files[]': f}, timeout=20).json()
|
||||
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}'
|
||||
|
@ -65,7 +67,8 @@ def process_image(patron, filename=None, resize=0):
|
|||
i.info["exif"] = exif.tobytes()
|
||||
|
||||
if i.format.lower() == "gif":
|
||||
gifwebp(input_image=filename, output_image=filename, option="-mixed -metadata none -f 100 -mt -m 6")
|
||||
gifwebp(input_image=filename, output_image=filename,
|
||||
option="-mixed -metadata none -f 100 -mt -m 6")
|
||||
else:
|
||||
i = ImageOps.exif_transpose(i)
|
||||
i.save(filename, format="WEBP", method=6)
|
||||
|
|
Loading…
Reference in New Issue