add end_utc to file orgies
parent
094cbf1c41
commit
edd07137f7
|
@ -38,3 +38,7 @@ orgy_file.addEventListener("timeupdate", function(){
|
||||||
}, 300000);
|
}, 300000);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
orgy_file.addEventListener("ended", function(){
|
||||||
|
location.reload()
|
||||||
|
});
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import time
|
import time
|
||||||
from flask import g, abort
|
from flask import g, abort
|
||||||
|
|
||||||
from sqlalchemy import Column
|
from sqlalchemy import Column, or_
|
||||||
from sqlalchemy.sql.sqltypes import *
|
from sqlalchemy.sql.sqltypes import *
|
||||||
|
|
||||||
from files.classes import Base
|
from files.classes import Base
|
||||||
|
@ -15,6 +15,7 @@ class Orgy(Base):
|
||||||
data = Column(String)
|
data = Column(String)
|
||||||
title = Column(String)
|
title = Column(String)
|
||||||
created_utc = Column(Integer)
|
created_utc = Column(Integer)
|
||||||
|
end_utc = Column(Integer)
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
if "created_utc" not in kwargs: kwargs["created_utc"] = int(time.time())
|
if "created_utc" not in kwargs: kwargs["created_utc"] = int(time.time())
|
||||||
|
@ -33,4 +34,10 @@ class Orgy(Base):
|
||||||
|
|
||||||
def get_orgy(v):
|
def get_orgy(v):
|
||||||
if not (v and v.allowed_in_chat): return None
|
if not (v and v.allowed_in_chat): return None
|
||||||
return g.db.query(Orgy).one_or_none()
|
t = int(time.time())
|
||||||
|
return g.db.query(Orgy).filter(
|
||||||
|
or_(
|
||||||
|
Orgy.end_utc == None,
|
||||||
|
Orgy.end_utc > t,
|
||||||
|
)
|
||||||
|
).one_or_none()
|
||||||
|
|
|
@ -185,10 +185,15 @@ def _create_post(title, body, pin_hours):
|
||||||
cache.delete_memoized(frontlist)
|
cache.delete_memoized(frontlist)
|
||||||
|
|
||||||
def _create_and_delete_orgy():
|
def _create_and_delete_orgy():
|
||||||
|
video_info = ffmpeg.probe(f'/orgies/{get_file()}')
|
||||||
|
seconds = int(video_info['streams'][0]['duration'])
|
||||||
|
end_utc = int(time.time() + seconds)
|
||||||
|
|
||||||
orgy = Orgy(
|
orgy = Orgy(
|
||||||
title=get_name(),
|
title=get_name(),
|
||||||
type='file',
|
type='file',
|
||||||
data=f'https://videos.watchpeopledie.tv/orgies/{get_file()}'
|
data=f'https://videos.watchpeopledie.tv/orgies/{get_file()}',
|
||||||
|
end_utc = end_utc,
|
||||||
)
|
)
|
||||||
g.db.add(orgy)
|
g.db.add(orgy)
|
||||||
g.db.commit()
|
g.db.commit()
|
||||||
|
@ -198,15 +203,6 @@ def _create_and_delete_orgy():
|
||||||
|
|
||||||
requests.post('http://localhost:5001/refresh_chat', headers={"Host": SITE})
|
requests.post('http://localhost:5001/refresh_chat', headers={"Host": SITE})
|
||||||
|
|
||||||
video_info = ffmpeg.probe(f'/orgies/{get_file()}')
|
|
||||||
seconds = int(video_info['streams'][0]['duration'])
|
|
||||||
time.sleep(seconds)
|
|
||||||
|
|
||||||
orgy = g.db.query(Orgy).one_or_none()
|
|
||||||
if orgy:
|
|
||||||
g.db.delete(orgy)
|
|
||||||
g.db.commit()
|
|
||||||
requests.post('http://localhost:5001/refresh_chat', headers={"Host": SITE})
|
|
||||||
|
|
||||||
def _delete_all_posts():
|
def _delete_all_posts():
|
||||||
posts = g.db.query(Post).filter_by(author_id=AUTOJANNY_ID, deleted_utc=0).all()
|
posts = g.db.query(Post).filter_by(author_id=AUTOJANNY_ID, deleted_utc=0).all()
|
||||||
|
|
|
@ -1941,7 +1941,8 @@ def admin_reset_password(user_id, v):
|
||||||
@app.get("/admin/orgy")
|
@app.get("/admin/orgy")
|
||||||
@admin_level_required(PERMS['ORGIES'])
|
@admin_level_required(PERMS['ORGIES'])
|
||||||
def orgy_control(v):
|
def orgy_control(v):
|
||||||
return render_template("admin/orgy_control.html", v=v, orgy=get_orgy(v))
|
orgy = g.db.query(Orgy).one_or_none()
|
||||||
|
return render_template("admin/orgy_control.html", v=v, orgy=orgy)
|
||||||
|
|
||||||
@app.post("/admin/start_orgy")
|
@app.post("/admin/start_orgy")
|
||||||
@admin_level_required(PERMS['ORGIES'])
|
@admin_level_required(PERMS['ORGIES'])
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
alter table orgies add column end_utc int;
|
Loading…
Reference in New Issue