forked from rDrama/rDrama
Merge branch 'frost' of github.com:Aevann1/rDrama into frost
commit
c21eacc651
|
@ -933,4 +933,4 @@ class User(Base):
|
||||||
from_casino = g.db.query(func.sum(Casino_Game.winnings)).filter(Casino_Game.user_id == self.id).one()[0]
|
from_casino = g.db.query(func.sum(Casino_Game.winnings)).filter(Casino_Game.user_id == self.id).one()[0]
|
||||||
from_casino_value = from_casino or 0
|
from_casino_value = from_casino or 0
|
||||||
|
|
||||||
return from_casino_value + self.total_lottery_winnings
|
return from_casino_value + self.total_lottery_winnings
|
||||||
|
|
|
@ -54,11 +54,6 @@ def process_audio(file):
|
||||||
return f'{SITE_FULL}{name}'
|
return f'{SITE_FULL}{name}'
|
||||||
|
|
||||||
|
|
||||||
def webm_to_mp4(old, new):
|
|
||||||
subprocess.run(["ffmpeg", "-y", "-loglevel", "warning", "-i", old, "-map_metadata", "-1", new], check=True, stderr=subprocess.STDOUT)
|
|
||||||
os.remove(old)
|
|
||||||
requests.post(f'https://api.cloudflare.com/client/v4/zones/{CF_ZONE}/purge_cache', headers=CF_HEADERS, data={'files': [f"{SITE_FULL}{new}"]}, timeout=5)
|
|
||||||
|
|
||||||
def process_video(file):
|
def process_video(file):
|
||||||
old = f'/videos/{time.time()}'.replace('.','')
|
old = f'/videos/{time.time()}'.replace('.','')
|
||||||
file.save(old)
|
file.save(old)
|
||||||
|
@ -70,11 +65,7 @@ def process_video(file):
|
||||||
|
|
||||||
if file.filename.split('.')[-1].lower() == 'webm':
|
if file.filename.split('.')[-1].lower() == 'webm':
|
||||||
file.save(new)
|
file.save(new)
|
||||||
if os.stat(new).st_size > 16 * 1024 * 1024:
|
return f'{SITE_FULL}{new}'
|
||||||
abort(418)
|
|
||||||
else:
|
|
||||||
gevent.spawn(webm_to_mp4, old, new)
|
|
||||||
return f'{SITE_FULL}{new}'
|
|
||||||
else:
|
else:
|
||||||
subprocess.run(["ffmpeg", "-y", "-loglevel", "warning", "-i", old, "-map_metadata", "-1", "-c:v", "copy", "-c:a", "copy", new], check=True)
|
subprocess.run(["ffmpeg", "-y", "-loglevel", "warning", "-i", old, "-map_metadata", "-1", "-c:v", "copy", "-c:a", "copy", new], check=True)
|
||||||
os.remove(old)
|
os.remove(old)
|
||||||
|
|
|
@ -585,18 +585,19 @@ def leaderboard(v):
|
||||||
pos13 = (pos13+1, users13[pos13][1])
|
pos13 = (pos13+1, users13[pos13][1])
|
||||||
except: pos13 = (len(users13)+1, 0)
|
except: pos13 = (len(users13)+1, 0)
|
||||||
|
|
||||||
users14 = users.order_by(User.winnings.desc()).limit(25).all()
|
winnings_sq = g.db.query(Casino_Game.user_id, func.sum(Casino_Game.winnings)).group_by(Casino_Game.user_id).subquery()
|
||||||
|
users14 = g.db.query(User).join(winnings_sq, winnings_sq.c.user_id == User.id).order_by(winnings_sq.c.sum.desc()).limit(25).all()
|
||||||
if v in users14:
|
if v in users14:
|
||||||
pos14 = None
|
pos14 = None
|
||||||
else:
|
else:
|
||||||
sq = g.db.query(User.id, func.rank().over(order_by=User.winnings.desc()).label("rank")).subquery()
|
sq = g.db.query(User.id, func.rank().over(order_by=winnings_sq.c.sum.desc()).label("rank")).join(winnings_sq, winnings_sq.c.user_id == User.id).subquery()
|
||||||
pos14 = g.db.query(sq.c.id, sq.c.rank).filter(sq.c.id == v.id).limit(1).one()[1]
|
pos14 = g.db.query(sq.c.id, sq.c.rank).filter(sq.c.id == v.id).limit(1).one()[1]
|
||||||
|
|
||||||
users15 = users.order_by(User.winnings).limit(25).all()
|
users15 = g.db.query(User).join(winnings_sq, winnings_sq.c.user_id == User.id).order_by(winnings_sq.c.sum.asc()).limit(25).all()
|
||||||
if v in users15:
|
if v in users15:
|
||||||
pos15 = None
|
pos15 = None
|
||||||
else:
|
else:
|
||||||
sq = g.db.query(User.id, func.rank().over(order_by=User.winnings).label("rank")).subquery()
|
sq = g.db.query(User.id, func.rank().over(order_by=winnings_sq.c.sum.asc()).label("rank")).join(winnings_sq, winnings_sq.c.user_id == User.id).subquery()
|
||||||
pos15 = g.db.query(sq.c.id, sq.c.rank).filter(sq.c.id == v.id).limit(1).one()[1]
|
pos15 = g.db.query(sq.c.id, sq.c.rank).filter(sq.c.id == v.id).limit(1).one()[1]
|
||||||
|
|
||||||
sq = g.db.query(UserBlock.target_id, func.count(UserBlock.target_id).label("count")).group_by(UserBlock.target_id).subquery()
|
sq = g.db.query(UserBlock.target_id, func.count(UserBlock.target_id).label("count")).group_by(UserBlock.target_id).subquery()
|
||||||
|
|
Loading…
Reference in New Issue