remove legacy code in video upload (thx @everyone)

master
Aevann1 2022-06-18 18:23:10 +02:00
parent 22557b62fb
commit b34dd88560
5 changed files with 5 additions and 15 deletions

View File

@ -20,9 +20,7 @@ def process_files():
url = process_image(v.patron, name) url = process_image(v.patron, name)
body += f"\n\n![]({url})" body += f"\n\n![]({url})"
elif file.content_type.startswith('video/'): elif file.content_type.startswith('video/'):
value = process_video(file) body += f"\n\n{process_video(file)}"
if type(value) is str: body += f"\n\n{value}"
else: return value
elif file.content_type.startswith('audio/'): elif file.content_type.startswith('audio/'):
body += f"\n\n{process_audio(file)}" body += f"\n\n{process_audio(file)}"
else: else:

View File

@ -293,9 +293,7 @@ def api_comment(v):
return {"error": str(e)}, 400 return {"error": str(e)}, 400
body += f"\n\n![]({image})" body += f"\n\n![]({image})"
elif file.content_type.startswith('video/'): elif file.content_type.startswith('video/'):
value = process_video(file) body += f"\n\n{process_video(file)}"
if type(value) is str: body += f"\n\n{value}"
else: return value
elif file.content_type.startswith('audio/'): elif file.content_type.startswith('audio/'):
body += f"\n\n{process_audio(file)}" body += f"\n\n{process_audio(file)}"
else: else:

View File

@ -1060,9 +1060,7 @@ def submit_post(v, sub=None):
copyfile(name, name2) copyfile(name, name2)
post.thumburl = process_image(v.patron, name2, resize=100) post.thumburl = process_image(v.patron, name2, resize=100)
elif file.content_type.startswith('video/'): elif file.content_type.startswith('video/'):
value = process_video(file) post.url = process_video(file)
if type(value) is str: post.url = value
else: return error(value['error'])
elif file.content_type.startswith('audio/'): elif file.content_type.startswith('audio/'):
post.url = process_audio(file) post.url = process_audio(file)
else: else:

View File

@ -207,9 +207,7 @@ def submit_contact(v):
url = process_image(v.patron, name) url = process_image(v.patron, name)
body_html += f'<img data-bs-target="#expandImageModal" data-bs-toggle="modal" onclick="expandDesktopImage(this.src)" class="img" src="{url}" loading="lazy">' body_html += f'<img data-bs-target="#expandImageModal" data-bs-toggle="modal" onclick="expandDesktopImage(this.src)" class="img" src="{url}" loading="lazy">'
elif file.content_type.startswith('video/'): elif file.content_type.startswith('video/'):
value = process_video(file) body_html += f"<p>{process_video(file)}</p>"
if type(value) is str: body_html += f"<p>{value}</p>"
else: return value
elif file.content_type.startswith('audio/'): elif file.content_type.startswith('audio/'):
body_html += f"<p>{process_audio(file)}</p>" body_html += f"<p>{process_audio(file)}</p>"
else: else:

View File

@ -734,9 +734,7 @@ def messagereply(v):
url = process_image(v.patron, name) url = process_image(v.patron, name)
body_html += f'<img data-bs-target="#expandImageModal" data-bs-toggle="modal" onclick="expandDesktopImage(this.src)" class="img" src="{url}" loading="lazy">' body_html += f'<img data-bs-target="#expandImageModal" data-bs-toggle="modal" onclick="expandDesktopImage(this.src)" class="img" src="{url}" loading="lazy">'
elif file.content_type.startswith('video/'): elif file.content_type.startswith('video/'):
value = process_video(file) body_html += f"<p>{process_video(file)}</p>"
if type(value) is str: body_html += f"<p>{value}</p>"
else: return value
elif file.content_type.startswith('audio/'): elif file.content_type.startswith('audio/'):
body_html += f"<p>{process_audio(file)}</p>" body_html += f"<p>{process_audio(file)}</p>"
else: else: