|
@@ -98,7 +98,7 @@ class VideoStitching():
|
|
|
|
|
|
@classmethod
|
|
@classmethod
|
|
def get_audio_list(cls):
|
|
def get_audio_list(cls):
|
|
- audio_list = f"""select oss_object_key from video_koubo_url;"""
|
|
+ audio_list = f"""select oss_object_key from video_koubo_url ;"""
|
|
audio_list = MysqlHelper.get_values(audio_list, "prod")
|
|
audio_list = MysqlHelper.get_values(audio_list, "prod")
|
|
return audio_list
|
|
return audio_list
|
|
|
|
|
|
@@ -188,7 +188,7 @@ class VideoStitching():
|
|
duration_limit = mp3.duration
|
|
duration_limit = mp3.duration
|
|
if type_audio == "口播--美文类":
|
|
if type_audio == "口播--美文类":
|
|
|
|
|
|
- clip = f"https://art-crawler.oss-cn-hangzhou.aliyuncs.com/{videos[0]}"
|
|
+ clip = f"./video_stitching/video_material/koubo.mp4"
|
|
clip = VideoFileClip(clip)
|
|
clip = VideoFileClip(clip)
|
|
video_duration = clip.duration
|
|
video_duration = clip.duration
|
|
|
|
|
|
@@ -202,7 +202,8 @@ class VideoStitching():
|
|
else:
|
|
else:
|
|
|
|
|
|
for i, video in enumerate(videos):
|
|
for i, video in enumerate(videos):
|
|
- clip = VideoFileClip(f"https://art-crawler.oss-cn-hangzhou.aliyuncs.com/{video[2]}")
|
|
+ filename = video[2].split("/")[-1]
|
|
|
|
+ clip = VideoFileClip(f'./video_stitching/video_material/{filename}.mp4')
|
|
clips.append(clip)
|
|
clips.append(clip)
|
|
total_duration += clip.duration
|
|
total_duration += clip.duration
|
|
if total_duration >= duration_limit:
|
|
if total_duration >= duration_limit:
|
|
@@ -356,7 +357,7 @@ class VideoStitching():
|
|
|
|
|
|
url_list = cls.get_url_list(audio_id, account)
|
|
url_list = cls.get_url_list(audio_id, account)
|
|
videos = [list(item) for item in url_list]
|
|
videos = [list(item) for item in url_list]
|
|
-
|
|
+ videos = Oss.get_oss_url(video_type, videos)
|
|
|
|
|
|
try:
|
|
try:
|
|
audio_url, video_with_subtitles, clips = cls.concatenate_videos(videos, str(audio), srt, video_type)
|
|
audio_url, video_with_subtitles, clips = cls.concatenate_videos(videos, str(audio), srt, video_type)
|
|
@@ -384,6 +385,12 @@ class VideoStitching():
|
|
Common.logger().info(f"文件删除成功{output_path}")
|
|
Common.logger().info(f"文件删除成功{output_path}")
|
|
else:
|
|
else:
|
|
Common.logger().info(f"文件不存在{output_path}")
|
|
Common.logger().info(f"文件不存在{output_path}")
|
|
|
|
+ if video_type == "口播--美文类":
|
|
|
|
+ os.remove("./video_stitching/video_material/koubo.mp4")
|
|
|
|
+ else:
|
|
|
|
+ for video in videos:
|
|
|
|
+ filename = video[2].split("/")[-1]
|
|
|
|
+ os.remove(f'./video_stitching/video_material/{filename}.mp4')
|
|
piaoquantv = cls.insert_piaoquantv(oss_object_key, title_list, video_type, channel_type)
|
|
piaoquantv = cls.insert_piaoquantv(oss_object_key, title_list, video_type, channel_type)
|
|
if piaoquantv:
|
|
if piaoquantv:
|
|
Common.logger().info(f"视频添加到对应用户成功")
|
|
Common.logger().info(f"视频添加到对应用户成功")
|
|
@@ -401,7 +408,9 @@ class VideoStitching():
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
if __name__ == '__main__':
|
|
- video_type = "口播--美文类"
|
|
+ koubo_count = 1
|
|
- VideoStitching.video_stitching(video_type)
|
|
+ video_type = "口播"
|
|
|
|
+ channel_type = "douyin"
|
|
|
|
+ VideoStitching.video_stitching(video_type, koubo_count, channel_type)
|
|
|
|
|
|
|
|
|