make a piece of code a little prettier

pull/176/head
Aevann 2023-08-04 01:22:37 +03:00
parent 4918e284d5
commit a0d40c94b5
1 changed files with 5 additions and 6 deletions

View File

@ -133,12 +133,11 @@ def process_video(file, v):
old = f'/videos/{time.time()}'.replace('.','') old = f'/videos/{time.time()}'.replace('.','')
file.save(old) file.save(old)
size = os.stat(old).st_size if SITE_NAME != 'WPD':
if (SITE_NAME != 'WPD' and size = os.stat(old).st_size
(size > MAX_VIDEO_SIZE_MB_PATRON * 1024 * 1024 if size > MAX_VIDEO_SIZE_MB_PATRON * 1024 * 1024 or (not v.patron and size > MAX_VIDEO_SIZE_MB * 1024 * 1024):
or not v.patron and size > MAX_VIDEO_SIZE_MB * 1024 * 1024)): os.remove(old)
os.remove(old) abort(413, f"Max video size is {MAX_VIDEO_SIZE_MB} MB ({MAX_VIDEO_SIZE_MB_PATRON} MB for {patron}s)")
abort(413, f"Max video size is {MAX_VIDEO_SIZE_MB} MB ({MAX_VIDEO_SIZE_MB_PATRON} MB for {patron}s)")
name_original = secure_filename(file.filename) name_original = secure_filename(file.filename)
extension = name_original.split('.')[-1].lower() extension = name_original.split('.')[-1].lower()