|
@@ -933,78 +933,85 @@ s.resp.generate_video = function(_msg_body,_fd)
|
|
|
item_custom = item_info.custom
|
|
|
end
|
|
|
|
|
|
-
|
|
|
- if is_corner_mark then
|
|
|
- hot_tag_type = 1
|
|
|
- end
|
|
|
-
|
|
|
- local fictitious_tag_type = 0
|
|
|
- if is_video_bottom_text then
|
|
|
- fictitious_tag_type = 1
|
|
|
+ local generate_status = 1; --生成状态 0:不生成 1:生成
|
|
|
+ if item_custom~=nil then
|
|
|
+ if item_custom.generate_status~=nil then
|
|
|
+ generate_status = tonumber(item_custom.generate_status)
|
|
|
+ end
|
|
|
end
|
|
|
- local gen_info = {user_id=0,id=0,project_name=tab.project_name,
|
|
|
- book_name=tab.book_name,
|
|
|
- ratio=tab.ratio,
|
|
|
- video_stype=tab.video_stype,
|
|
|
- crop_time=tab.video_crop_time,
|
|
|
- marketing_title_info={marketing_title_top_h = 0,stroke_h=0,marketing_title=item_info.title_html},
|
|
|
- video_list = content_video,
|
|
|
- subtitles = {stype=0,subtitle_font="",subtitles_path=template_info.subtitles_path},
|
|
|
- subtitles_audio={path = template_info.subtitles_audio_path,duration=template_info.subtitles_audio_duration },
|
|
|
- video_last_frame =end_video[1] or {},
|
|
|
- video_first_frame = head_video[1] or {},
|
|
|
- bgm_list = bgm_audio[1],
|
|
|
- corner_mark_image = corner[1] or {},
|
|
|
- bottom_text_image = bottom[1] or {},
|
|
|
- background_image = background_image[1] or {},
|
|
|
- hot_tag = {type=hot_tag_type,path=""}, --上边
|
|
|
- fictitious_tag = {type=fictitious_tag_type,path=""}, --下边
|
|
|
- custom = custom,
|
|
|
- video_custom = item_custom,
|
|
|
- }
|
|
|
-
|
|
|
- local video_name = gen_info.book_name.."__视频"..i
|
|
|
- local book_name = gen_info.book_name
|
|
|
- local ratio = gen_info.ratio
|
|
|
- local video_stype = gen_info.video_stype
|
|
|
- local video_url = ""
|
|
|
- local generate_video_info = {}
|
|
|
- generate_video_info =item_info
|
|
|
- generate_video_info.book_name = tab.book_name
|
|
|
- generate_video_info.project_name = tab.project_name
|
|
|
- generate_video_info.ratio = tab.ratio
|
|
|
- generate_video_info.video_stype = tab.video_stype
|
|
|
- generate_video_info = cjson.encode(generate_video_info)
|
|
|
- local video_state = 0
|
|
|
- sql = string.format("INSERT INTO generate_video_list_tab (user_id,template_id, folder_id,video_name,book_name,ratio,video_stype,video_url,video_state,generate_video_info) VALUES (%d,%d,%d,'%s','%s',%d,%d,'%s',%d,'%s')",user_id,
|
|
|
- template_id,
|
|
|
- folder_id,
|
|
|
- video_name,
|
|
|
- book_name,
|
|
|
- ratio,
|
|
|
- video_stype,
|
|
|
- video_url,video_state,cjson.encode({data=tools.base64encode(generate_video_info)}))
|
|
|
- -- skynet.error("123sss")
|
|
|
- -- tools.dump(gen_info)
|
|
|
- db:query(sql)
|
|
|
- -- skynet.error(sql)
|
|
|
- sql = string.format("SELECT * FROM generate_video_list_tab WHERE user_id = %d and folder_id = %d and is_use = 0 LIMIT 1",user_id,folder_id)
|
|
|
- res = db:query(sql)
|
|
|
- if res and #res > 0 then
|
|
|
- local tab = {}
|
|
|
- if #res > 0 then
|
|
|
- tab = tools.getDbResData(res)
|
|
|
- gen_info.id = tab.id
|
|
|
- gen_info.user_id = user_id
|
|
|
- sql = string.format("UPDATE generate_video_list_tab SET is_use = %d WHERE id =%d",1,gen_info.id)
|
|
|
- db:query(sql)
|
|
|
- skynet.send("tools_work","lua","generate_video",gen_info)
|
|
|
+ if generate_status == 1 then
|
|
|
+ if is_corner_mark then
|
|
|
+ hot_tag_type = 1
|
|
|
+ end
|
|
|
+
|
|
|
+ local fictitious_tag_type = 0
|
|
|
+ if is_video_bottom_text then
|
|
|
+ fictitious_tag_type = 1
|
|
|
+ end
|
|
|
+ local gen_info = {user_id=0,id=0,project_name=tab.project_name,
|
|
|
+ book_name=tab.book_name,
|
|
|
+ ratio=tab.ratio,
|
|
|
+ video_stype=tab.video_stype,
|
|
|
+ crop_time=tab.video_crop_time,
|
|
|
+ marketing_title_info={marketing_title_top_h = 0,stroke_h=0,marketing_title=item_info.title_html},
|
|
|
+ video_list = content_video,
|
|
|
+ subtitles = {stype=0,subtitle_font="",subtitles_path=template_info.subtitles_path},
|
|
|
+ subtitles_audio={path = template_info.subtitles_audio_path,duration=template_info.subtitles_audio_duration },
|
|
|
+ video_last_frame =end_video[1] or {},
|
|
|
+ video_first_frame = head_video[1] or {},
|
|
|
+ bgm_list = bgm_audio[1],
|
|
|
+ corner_mark_image = corner[1] or {},
|
|
|
+ bottom_text_image = bottom[1] or {},
|
|
|
+ background_image = background_image[1] or {},
|
|
|
+ hot_tag = {type=hot_tag_type,path=""}, --上边
|
|
|
+ fictitious_tag = {type=fictitious_tag_type,path=""}, --下边
|
|
|
+ custom = custom,
|
|
|
+ video_custom = item_custom,
|
|
|
+ }
|
|
|
+
|
|
|
+ local video_name = gen_info.book_name.."__视频"..i
|
|
|
+ local book_name = gen_info.book_name
|
|
|
+ local ratio = gen_info.ratio
|
|
|
+ local video_stype = gen_info.video_stype
|
|
|
+ local video_url = ""
|
|
|
+ local generate_video_info = {}
|
|
|
+ generate_video_info =item_info
|
|
|
+ generate_video_info.book_name = tab.book_name
|
|
|
+ generate_video_info.project_name = tab.project_name
|
|
|
+ generate_video_info.ratio = tab.ratio
|
|
|
+ generate_video_info.video_stype = tab.video_stype
|
|
|
+ generate_video_info = cjson.encode(generate_video_info)
|
|
|
+ local video_state = 0
|
|
|
+ sql = string.format("INSERT INTO generate_video_list_tab (user_id,template_id, folder_id,video_name,book_name,ratio,video_stype,video_url,video_state,generate_video_info) VALUES (%d,%d,%d,'%s','%s',%d,%d,'%s',%d,'%s')",user_id,
|
|
|
+ template_id,
|
|
|
+ folder_id,
|
|
|
+ video_name,
|
|
|
+ book_name,
|
|
|
+ ratio,
|
|
|
+ video_stype,
|
|
|
+ video_url,video_state,cjson.encode({data=tools.base64encode(generate_video_info)}))
|
|
|
+ -- skynet.error("123sss")
|
|
|
+ -- tools.dump(gen_info)
|
|
|
+ db:query(sql)
|
|
|
+ -- skynet.error(sql)
|
|
|
+ sql = string.format("SELECT * FROM generate_video_list_tab WHERE user_id = %d and folder_id = %d and is_use = 0 LIMIT 1",user_id,folder_id)
|
|
|
+ res = db:query(sql)
|
|
|
+ if res and #res > 0 then
|
|
|
+ local tab = {}
|
|
|
+ if #res > 0 then
|
|
|
+ tab = tools.getDbResData(res)
|
|
|
+ gen_info.id = tab.id
|
|
|
+ gen_info.user_id = user_id
|
|
|
+ sql = string.format("UPDATE generate_video_list_tab SET is_use = %d WHERE id =%d",1,gen_info.id)
|
|
|
+ db:query(sql)
|
|
|
+ skynet.send("tools_work","lua","generate_video",gen_info)
|
|
|
+ end
|
|
|
+ -- return true,tab
|
|
|
+ else
|
|
|
+ skynet.error("No data found.")
|
|
|
end
|
|
|
- -- return true,tab
|
|
|
- else
|
|
|
- skynet.error("No data found.")
|
|
|
end
|
|
|
-
|
|
|
+
|
|
|
end
|
|
|
|
|
|
--获取5个未使用的生成视频文件
|