|
@@ -44,6 +44,8 @@ import gSlide
|
|
|
import aiofiles
|
|
|
import json
|
|
|
import util.user
|
|
|
+#https://www.choozmo.com:8887/verify_email?code=16370312713065429 =>
|
|
|
+#https://video.choozmo.com/verify_email.html?code=16370312713065429
|
|
|
pymysql.install_as_MySQLdb()
|
|
|
|
|
|
app = FastAPI()
|
|
@@ -55,7 +57,7 @@ app.add_middleware(
|
|
|
allow_origins=["*"],
|
|
|
allow_credentials=True,
|
|
|
allow_methods=["*"],
|
|
|
- allow_headers=["*"],
|
|
|
+ allow_headers=['Accept','Content-Type','X-Requested-With','x-api-key'],
|
|
|
)
|
|
|
SECRET_KEY = "df2f77bd544240801a048bd4293afd8eeb7fff3cb7050e42c791db4b83ebadcd"
|
|
|
ALGORITHM = "HS256"
|
|
@@ -287,6 +289,7 @@ async def register(request: util.models.register_req):
|
|
|
reg_model.left_time = 60
|
|
|
|
|
|
id = user_register(reg_model)
|
|
|
+
|
|
|
result = util.user.add_to_basic_role(id)
|
|
|
print(result)
|
|
|
if type(id) is int:
|
|
@@ -1075,7 +1078,7 @@ def gen_video_queue(name_hash,name,text_content, image_urls,avatar,multiLang,vid
|
|
|
db['video_queue'].insert({'name_hash':name_hash,'name':name,'text_content':txt_content_seperate_by_dot
|
|
|
,'image_urls':img_urls_seperate_by_dot,'multiLang':multiLang,'video_type':'short','avatar':avatar,'timestamp':time_stamp,'freeTrial':freeTrial})
|
|
|
while True:
|
|
|
-
|
|
|
+ db = dataset.connect('mysql://choozmo:pAssw0rd@db.ptt.cx:3306/AI_anchor?charset=utf8mb4')
|
|
|
if first(db.query('SELECT * FROM video_queue_status'))['status'] == 1:#only one row in this table, which is the id 1 one
|
|
|
print('another process running, leave loop')#1 means already running
|
|
|
break
|
|
@@ -1123,8 +1126,10 @@ def gen_video_queue(name_hash,name,text_content, image_urls,avatar,multiLang,vid
|
|
|
logging.error(traceback.format_exc())
|
|
|
print('video generation error')
|
|
|
notify_group('影片錯誤')
|
|
|
+
|
|
|
db['video_queue'].delete(id=top1['id'])
|
|
|
db.query('UPDATE video_queue_status SET status = 0')
|
|
|
+ db.close()
|
|
|
db.close()
|
|
|
|
|
|
def gen_video_queue_eng(name_hash,name,text_content, image_urls,sub_titles,avatar,video_id,freeTrial):
|
|
@@ -1151,6 +1156,7 @@ def gen_video_queue_eng(name_hash,name,text_content, image_urls,sub_titles,avata
|
|
|
db['video_queue'].insert({'name_hash':name_hash,'name':name,'text_content':txt_content_seperate_by_dot,
|
|
|
'image_urls':img_urls_seperate_by_dot,'subtitles':subtitles_seperate_by_dot,'video_type':'eng','avatar':avatar,'timestamp':time_stamp,'freeTrial':freeTrial})
|
|
|
while True:
|
|
|
+ db = dataset.connect('mysql://choozmo:pAssw0rd@db.ptt.cx:3306/AI_anchor?charset=utf8mb4')
|
|
|
if first(db.query('SELECT * FROM video_queue_status'))['status'] == 1:#only one row in this table, which is the id 1 one
|
|
|
print('another process running, leave loop')
|
|
|
break
|
|
@@ -1172,12 +1178,14 @@ def gen_video_queue_eng(name_hash,name,text_content, image_urls,sub_titles,avata
|
|
|
notify_group('影片錯誤')
|
|
|
db['video_queue'].delete(id=top1['id'])
|
|
|
db.query('UPDATE video_queue_status SET status = 0')
|
|
|
+ db.close()
|
|
|
db.close()
|
|
|
|
|
|
def gen_avatar(name_hash, imgurl):
|
|
|
db_check()
|
|
|
db['avatar_queue'].insert({'name_hash':name_hash,'imgurl':imgurl})
|
|
|
while True:
|
|
|
+
|
|
|
statement = 'SELECT * FROM avatar_service_status'#only one row in this table, which is the id 1 one
|
|
|
status = -1
|
|
|
for row in db.query(statement):
|