forked from rDrama/rDrama
fsd
parent
3354363261
commit
ef0046f091
|
@ -1,6 +1,6 @@
|
||||||
image.*
|
image.*
|
||||||
video.mp4
|
video.mp4
|
||||||
video.webm
|
unsanitized.mp4
|
||||||
cache/
|
cache/
|
||||||
__pycache__/
|
__pycache__/
|
||||||
.idea/
|
.idea/
|
||||||
|
|
|
@ -311,7 +311,8 @@ 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/'):
|
||||||
file.save("video.mp4")
|
file.save("unsanitized.mp4")
|
||||||
|
os.system(f'ffmpeg -y -loglevel warning -i unsanitized.mp4 -map_metadata -1 -c:v copy -c:a copy video.mp4')
|
||||||
with open("video.mp4", 'rb') as f:
|
with open("video.mp4", 'rb') as f:
|
||||||
try: req = requests.request("POST", "https://pomf2.lain.la/upload.php", files={'files[]': f}, timeout=5).json()
|
try: req = requests.request("POST", "https://pomf2.lain.la/upload.php", files={'files[]': f}, timeout=5).json()
|
||||||
except requests.Timeout: return {"error": "Video upload timed out, please try again!"}
|
except requests.Timeout: return {"error": "Video upload timed out, please try again!"}
|
||||||
|
@ -767,7 +768,8 @@ def edit_comment(cid, v):
|
||||||
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/'):
|
||||||
file.save("video.mp4")
|
file.save("unsanitized.mp4")
|
||||||
|
os.system(f'ffmpeg -y -loglevel warning -i unsanitized.mp4 -map_metadata -1 -c:v copy -c:a copy video.mp4')
|
||||||
with open("video.mp4", 'rb') as f:
|
with open("video.mp4", 'rb') as f:
|
||||||
try: req = requests.request("POST", "https://pomf2.lain.la/upload.php", files={'files[]': f}, timeout=5).json()
|
try: req = requests.request("POST", "https://pomf2.lain.la/upload.php", files={'files[]': f}, timeout=5).json()
|
||||||
except requests.Timeout: return {"error": "Video upload timed out, please try again!"}
|
except requests.Timeout: return {"error": "Video upload timed out, please try again!"}
|
||||||
|
|
|
@ -18,7 +18,7 @@ from os import path
|
||||||
import requests
|
import requests
|
||||||
from shutil import copyfile
|
from shutil import copyfile
|
||||||
from sys import stdout
|
from sys import stdout
|
||||||
|
import os
|
||||||
|
|
||||||
if SITE_NAME == 'PCM': snappyquotes = []
|
if SITE_NAME == 'PCM': snappyquotes = []
|
||||||
else: snappyquotes = [f':#{x}:' for x in marseys_const2]
|
else: snappyquotes = [f':#{x}:' for x in marseys_const2]
|
||||||
|
@ -464,7 +464,8 @@ def edit_post(pid, v):
|
||||||
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/'):
|
||||||
file.save("video.mp4")
|
file.save("unsanitized.mp4")
|
||||||
|
os.system(f'ffmpeg -y -loglevel warning -i unsanitized.mp4 -map_metadata -1 -c:v copy -c:a copy video.mp4')
|
||||||
with open("video.mp4", 'rb') as f:
|
with open("video.mp4", 'rb') as f:
|
||||||
try: req = requests.request("POST", "https://pomf2.lain.la/upload.php", files={'files[]': f}, timeout=5).json()
|
try: req = requests.request("POST", "https://pomf2.lain.la/upload.php", files={'files[]': f}, timeout=5).json()
|
||||||
except requests.Timeout: return {"error": "Video upload timed out, please try again!"}
|
except requests.Timeout: return {"error": "Video upload timed out, please try again!"}
|
||||||
|
@ -1077,7 +1078,8 @@ def submit_post(v, sub=None):
|
||||||
file.save(name)
|
file.save(name)
|
||||||
body += f"\n\n![]({process_image(v.patron, name)})"
|
body += f"\n\n![]({process_image(v.patron, name)})"
|
||||||
elif file.content_type.startswith('video/'):
|
elif file.content_type.startswith('video/'):
|
||||||
file.save("video.mp4")
|
file.save("unsanitized.mp4")
|
||||||
|
os.system(f'ffmpeg -y -loglevel warning -i unsanitized.mp4 -map_metadata -1 -c:v copy -c:a copy video.mp4')
|
||||||
with open("video.mp4", 'rb') as f:
|
with open("video.mp4", 'rb') as f:
|
||||||
try: req = requests.request("POST", "https://pomf2.lain.la/upload.php", files={'files[]': f}, timeout=5).json()
|
try: req = requests.request("POST", "https://pomf2.lain.la/upload.php", files={'files[]': f}, timeout=5).json()
|
||||||
except requests.Timeout: return {"error": "Video upload timed out, please try again!"}
|
except requests.Timeout: return {"error": "Video upload timed out, please try again!"}
|
||||||
|
@ -1182,7 +1184,8 @@ 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/'):
|
||||||
file.save("video.mp4")
|
file.save("unsanitized.mp4")
|
||||||
|
os.system(f'ffmpeg -y -loglevel warning -i unsanitized.mp4 -map_metadata -1 -c:v copy -c:a copy video.mp4')
|
||||||
with open("video.mp4", 'rb') as f:
|
with open("video.mp4", 'rb') as f:
|
||||||
try: req = requests.request("POST", "https://pomf2.lain.la/upload.php", files={'files[]': f}, timeout=5).json()
|
try: req = requests.request("POST", "https://pomf2.lain.la/upload.php", files={'files[]': f}, timeout=5).json()
|
||||||
except requests.Timeout: return {"error": "Video upload timed out, please try again!"}
|
except requests.Timeout: return {"error": "Video upload timed out, please try again!"}
|
||||||
|
|
|
@ -217,7 +217,8 @@ def settings_profile_post(v):
|
||||||
url = process_image(v.patron, name)
|
url = process_image(v.patron, name)
|
||||||
bio += f"\n\n![]({url})"
|
bio += f"\n\n![]({url})"
|
||||||
elif file.content_type.startswith('video/'):
|
elif file.content_type.startswith('video/'):
|
||||||
file.save("video.mp4")
|
file.save("unsanitized.mp4")
|
||||||
|
os.system(f'ffmpeg -y -loglevel warning -i unsanitized.mp4 -map_metadata -1 -c:v copy -c:a copy video.mp4')
|
||||||
with open("video.mp4", 'rb') as f:
|
with open("video.mp4", 'rb') as f:
|
||||||
try: req = requests.request("POST", "https://pomf2.lain.la/upload.php", files={'files[]': f}, timeout=5).json()
|
try: req = requests.request("POST", "https://pomf2.lain.la/upload.php", files={'files[]': f}, timeout=5).json()
|
||||||
except requests.Timeout: return {"error": "Video upload timed out, please try again!"}
|
except requests.Timeout: return {"error": "Video upload timed out, please try again!"}
|
||||||
|
|
|
@ -4,7 +4,7 @@ from files.helpers.alerts import *
|
||||||
from files.helpers.const import *
|
from files.helpers.const import *
|
||||||
from files.classes.award import AWARDS
|
from files.classes.award import AWARDS
|
||||||
from sqlalchemy import func
|
from sqlalchemy import func
|
||||||
from os import path
|
import os
|
||||||
import calendar
|
import calendar
|
||||||
import matplotlib.pyplot as plt
|
import matplotlib.pyplot as plt
|
||||||
from files.classes.mod_logs import ACTIONTYPES, ACTIONTYPES2
|
from files.classes.mod_logs import ACTIONTYPES, ACTIONTYPES2
|
||||||
|
@ -404,7 +404,8 @@ 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/'):
|
||||||
file.save("video.mp4")
|
file.save("unsanitized.mp4")
|
||||||
|
os.system(f'ffmpeg -y -loglevel warning -i unsanitized.mp4 -map_metadata -1 -c:v copy -c:a copy video.mp4')
|
||||||
with open("video.mp4", 'rb') as f:
|
with open("video.mp4", 'rb') as f:
|
||||||
try: req = requests.request("POST", "https://pomf2.lain.la/upload.php", files={'files[]': f}, timeout=5).json()
|
try: req = requests.request("POST", "https://pomf2.lain.la/upload.php", files={'files[]': f}, timeout=5).json()
|
||||||
except requests.Timeout: return {"error": "Video upload timed out, please try again!"}
|
except requests.Timeout: return {"error": "Video upload timed out, please try again!"}
|
||||||
|
|
|
@ -13,6 +13,7 @@ from pusher_push_notifications import PushNotifications
|
||||||
from collections import Counter
|
from collections import Counter
|
||||||
import gevent
|
import gevent
|
||||||
from sys import stdout
|
from sys import stdout
|
||||||
|
import os
|
||||||
|
|
||||||
if PUSHER_ID != 'blahblahblah':
|
if PUSHER_ID != 'blahblahblah':
|
||||||
beams_client = PushNotifications(instance_id=PUSHER_ID, secret_key=PUSHER_KEY)
|
beams_client = PushNotifications(instance_id=PUSHER_ID, secret_key=PUSHER_KEY)
|
||||||
|
@ -700,7 +701,8 @@ 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/'):
|
||||||
file.save("video.mp4")
|
file.save("unsanitized.mp4")
|
||||||
|
os.system(f'ffmpeg -y -loglevel warning -i unsanitized.mp4 -map_metadata -1 -c:v copy -c:a copy video.mp4')
|
||||||
with open("video.mp4", 'rb') as f:
|
with open("video.mp4", 'rb') as f:
|
||||||
try: req = requests.request("POST", "https://pomf2.lain.la/upload.php", files={'files[]': f}, timeout=5).json()
|
try: req = requests.request("POST", "https://pomf2.lain.la/upload.php", files={'files[]': f}, timeout=5).json()
|
||||||
except requests.exceptions.ConnectionError: return {"error": "Video upload timed out, please try again!"}
|
except requests.exceptions.ConnectionError: return {"error": "Video upload timed out, please try again!"}
|
||||||
|
|
Loading…
Reference in New Issue