|
@@ -284,6 +284,8 @@ class AgcVidoe():
|
|
|
#文件没有则创建目录
|
|
|
@classmethod
|
|
|
def create_folders(cls, mark):
|
|
|
+ oss_id = cls.random_id()
|
|
|
+
|
|
|
video_path_url = config['PATHS']['VIDEO_PATH'] + mark + "/"
|
|
|
# srt 目录
|
|
|
s_path_url = config['PATHS']['VIDEO_PATH'] + mark + "/srt/"
|
|
@@ -297,18 +299,10 @@ class AgcVidoe():
|
|
|
if not os.path.exists(v_path_url):
|
|
|
os.makedirs(v_path_url)
|
|
|
# srt 文件地址
|
|
|
- s_path = s_path_url + mark + ".srt"
|
|
|
+ s_path = s_path_url + mark + f"{str(oss_id)}.srt"
|
|
|
# 最终生成视频地址
|
|
|
- v_path = v_path_url + mark + ".mp4"
|
|
|
- v_oss_path = v_path_url + mark + "oss.mp4"
|
|
|
- if os.path.isfile(v_oss_path):
|
|
|
- os.remove(v_oss_path)
|
|
|
- if os.path.isfile(v_path):
|
|
|
- os.remove(v_path)
|
|
|
- if os.path.isfile(s_path):
|
|
|
- os.remove(s_path)
|
|
|
- # 清空所有mp4数据
|
|
|
- cls.clear_mp4_files(video_path_url)
|
|
|
+ v_path = v_path_url + mark + f"{str(oss_id)}.mp4"
|
|
|
+ v_oss_path = v_path_url + mark + f"{str(oss_id)}oss.mp4"
|
|
|
return s_path, v_path, video_path_url, v_oss_path
|
|
|
|
|
|
|
|
@@ -386,7 +380,6 @@ class AgcVidoe():
|
|
|
# 常规任务
|
|
|
@classmethod
|
|
|
def video_stitching(cls, ex_list):
|
|
|
-
|
|
|
pq_ids = ex_list["pq_id"]
|
|
|
pq_ids_list = pq_ids.split(',')
|
|
|
mark_name = ex_list['mark_name']
|
|
@@ -483,6 +476,14 @@ class AgcVidoe():
|
|
|
piaoquantv = cls.insert_piaoquantv(oss_object_key, audio_title, pq_ids_list)
|
|
|
if piaoquantv:
|
|
|
Common.logger("video").info(f"{mark}的{platform}渠道视频添加到对应用户成功")
|
|
|
+ if os.path.isfile(v_oss_path):
|
|
|
+ os.remove(v_oss_path)
|
|
|
+ if os.path.isfile(v_path):
|
|
|
+ os.remove(v_path)
|
|
|
+ if os.path.isfile(s_path):
|
|
|
+ os.remove(s_path)
|
|
|
+ # 清空所有mp4数据
|
|
|
+ cls.clear_mp4_files(video_path_url)
|
|
|
return ''
|
|
|
except Exception as e:
|
|
|
Common.logger("video").warning(f"{mark}的视频拼接失败:{e}\n")
|
|
@@ -590,6 +591,14 @@ class AgcVidoe():
|
|
|
piaoquantv = cls.insert_piaoquantv(oss_object_key, audio_title, pq_ids_list)
|
|
|
if piaoquantv:
|
|
|
Common.logger("gs_video").info(f"{mark}的{platform}渠道视频添加到对应用户成功")
|
|
|
+ if os.path.isfile(v_oss_path):
|
|
|
+ os.remove(v_oss_path)
|
|
|
+ if os.path.isfile(v_path):
|
|
|
+ os.remove(v_path)
|
|
|
+ if os.path.isfile(s_path):
|
|
|
+ os.remove(s_path)
|
|
|
+ # 清空所有mp4数据
|
|
|
+ cls.clear_mp4_files(video_path_url)
|
|
|
return ''
|
|
|
except Exception as e:
|
|
|
Common.logger("gs_video").warning(f"{mark}的视频拼接失败:{e}\n")
|