|
@@ -67,6 +67,7 @@ class getVideo:
|
|
feishu_id = data["feishu_id"]
|
|
feishu_id = data["feishu_id"]
|
|
feishu_sheet = data["feishu_sheet"]
|
|
feishu_sheet = data["feishu_sheet"]
|
|
pw_sheet = data["pw_sheet"]
|
|
pw_sheet = data["pw_sheet"]
|
|
|
|
+ pz_sheet = data["pz_sheet"]
|
|
|
|
|
|
task_data = Material.get_task_data(feishu_id, feishu_sheet)
|
|
task_data = Material.get_task_data(feishu_id, feishu_sheet)
|
|
if len(task_data) == 0:
|
|
if len(task_data) == 0:
|
|
@@ -84,6 +85,21 @@ class getVideo:
|
|
video_ending = task["video_ending"]
|
|
video_ending = task["video_ending"]
|
|
crop_total = task["crop_total"]
|
|
crop_total = task["crop_total"]
|
|
gg_duration_total = task["gg_duration_total"]
|
|
gg_duration_total = task["gg_duration_total"]
|
|
|
|
+ if video_share and video_share != 'None':
|
|
|
|
+ video_share_list = video_share.split('/')
|
|
|
|
+ video_share_mark = video_share_list[0]
|
|
|
|
+ video_share_name = video_share_list[1]
|
|
|
|
+ zm = Material.get_pzsrt_data(feishu_id, pz_sheet, video_share_name) # 获取srt
|
|
|
|
+ if zm == '':
|
|
|
|
+ Feishu.bot(mark, '机器自动改造消息通知', f'{task_marks}任务下片中标示填写错误,请关注!!!!', name)
|
|
|
|
+ if video_ending and video_ending != 'None':
|
|
|
|
+ pw_list = Material.get_pwsrt_data(feishu_id, pw_sheet, video_ending) # 获取srt
|
|
|
|
+ if pw_list:
|
|
|
|
+ pw_id = pw_list["pw_id"]
|
|
|
|
+ pw_srt = pw_list["pw_srt"]
|
|
|
|
+ pw_url = PQ.get_pw_url(pw_id)
|
|
|
|
+ else:
|
|
|
|
+ Feishu.bot(mark, '机器自动改造消息通知', f'{task_marks}任务下片尾标示错误,请关注!!!!', name)
|
|
if ',' in new_id:
|
|
if ',' in new_id:
|
|
n_id = new_id.split(',')
|
|
n_id = new_id.split(',')
|
|
else:
|
|
else:
|
|
@@ -98,9 +114,6 @@ class getVideo:
|
|
try:
|
|
try:
|
|
count = 0 # 初始化计数器
|
|
count = 0 # 初始化计数器
|
|
for id in task_id:
|
|
for id in task_id:
|
|
- pw_list, zm_list = Material.get_pwsrt_data(feishu_id, pw_sheet) # 获取srt
|
|
|
|
- zm = random.choice(zm_list) # 随机选择 视频中字幕
|
|
|
|
- pws = random.choice(pw_list) # 随机选择 片尾srt+音频
|
|
|
|
Common.logger("log").info(f"{task_mark}下的ID{id} 开始获取视频")
|
|
Common.logger("log").info(f"{task_mark}下的ID{id} 开始获取视频")
|
|
time.sleep(1)
|
|
time.sleep(1)
|
|
if old_id and old_id != 'None':
|
|
if old_id and old_id != 'None':
|
|
@@ -131,14 +144,8 @@ class getVideo:
|
|
if gg_duration_total and gg_duration_total != 'None': # 判断是否需要指定视频时长
|
|
if gg_duration_total and gg_duration_total != 'None': # 判断是否需要指定视频时长
|
|
new_video_path = FFmpeg.video_ggduration(new_video_path, video_path_url, pw_random_id, gg_duration_total)
|
|
new_video_path = FFmpeg.video_ggduration(new_video_path, video_path_url, pw_random_id, gg_duration_total)
|
|
if video_ending and video_ending != 'None':
|
|
if video_ending and video_ending != 'None':
|
|
- pw_id = pws["pw_id"]
|
|
|
|
- pw_srt = pws["pw_srt"]
|
|
|
|
- pw_url = PQ.get_pw_url(pw_id)
|
|
|
|
-
|
|
|
|
- jpg_path = None
|
|
|
|
- pw_path = None
|
|
|
|
for attempt in range(3):
|
|
for attempt in range(3):
|
|
- jpg_path, height = FFmpeg.video_png(new_video_path, video_path_url, pw_random_id) # 生成视频最后一帧jpg
|
|
|
|
|
|
+ jpg_path = FFmpeg.video_png(new_video_path, video_path_url, pw_random_id) # 生成视频最后一帧jpg
|
|
if os.path.isfile(jpg_path):
|
|
if os.path.isfile(jpg_path):
|
|
Common.logger("log").info(f"{task_mark}下的视频ID{id},生成视频最后一帧成功")
|
|
Common.logger("log").info(f"{task_mark}下的视频ID{id},生成视频最后一帧成功")
|
|
break
|
|
break
|
|
@@ -149,7 +156,7 @@ class getVideo:
|
|
continue
|
|
continue
|
|
for attempt in range(3):
|
|
for attempt in range(3):
|
|
pw_mp3_path = FFmpeg.get_video_mp3(pw_url, video_path_url, pw_random_id)
|
|
pw_mp3_path = FFmpeg.get_video_mp3(pw_url, video_path_url, pw_random_id)
|
|
- pw_path = FFmpeg.pw_video(jpg_path, video_path_url, pw_url, pw_srt, pw_random_id, pw_mp3_path, height) # 生成片尾视频
|
|
|
|
|
|
+ pw_path = FFmpeg.pw_video(jpg_path, video_path_url, pw_url, pw_srt, pw_random_id, pw_mp3_path) # 生成片尾视频
|
|
if os.path.isfile(pw_path):
|
|
if os.path.isfile(pw_path):
|
|
Common.logger("log").info(f"{task_mark}下的视频ID{id},生成片尾视频成功")
|
|
Common.logger("log").info(f"{task_mark}下的视频ID{id},生成片尾视频成功")
|
|
break
|
|
break
|
|
@@ -163,12 +170,12 @@ class getVideo:
|
|
video_path = FFmpeg.concatenate_videos(pw_video_list, video_path_url) # 视频与片尾拼接到一起
|
|
video_path = FFmpeg.concatenate_videos(pw_video_list, video_path_url) # 视频与片尾拼接到一起
|
|
time.sleep(1)
|
|
time.sleep(1)
|
|
if video_share and video_share != 'None':
|
|
if video_share and video_share != 'None':
|
|
- new_video_path = FFmpeg.single_video(video_path, video_share, video_path_url, zm)
|
|
|
|
|
|
+ new_video_path = FFmpeg.single_video(video_path, video_share_mark, video_path_url, zm)
|
|
else:
|
|
else:
|
|
new_video_path = video_path
|
|
new_video_path = video_path
|
|
else:
|
|
else:
|
|
if video_share and video_share != 'None':
|
|
if video_share and video_share != 'None':
|
|
- new_video_path = FFmpeg.single_video(new_video_path, video_share, video_path_url, zm)
|
|
|
|
|
|
+ new_video_path = FFmpeg.single_video(new_video_path, video_share_mark, video_path_url, zm)
|
|
time.sleep(1)
|
|
time.sleep(1)
|
|
oss_id = cls.random_id()
|
|
oss_id = cls.random_id()
|
|
oss_object_key = Oss.stitching_sync_upload_oss(new_video_path, oss_id) # 视频发送OSS
|
|
oss_object_key = Oss.stitching_sync_upload_oss(new_video_path, oss_id) # 视频发送OSS
|