|
@@ -13,7 +13,9 @@ from whisper_asr import get_whisper_asr
|
|
from gpt_tag import request_gpt
|
|
from gpt_tag import request_gpt
|
|
from config import set_config
|
|
from config import set_config
|
|
from log import Log
|
|
from log import Log
|
|
|
|
+from ReadXlsxFile import getVideoInfoInXlxs
|
|
import mysql_connect
|
|
import mysql_connect
|
|
|
|
+
|
|
config_ = set_config()
|
|
config_ = set_config()
|
|
log_ = Log()
|
|
log_ = Log()
|
|
features = ['videoid', 'title', 'video_path']
|
|
features = ['videoid', 'title', 'video_path']
|
|
@@ -267,4 +269,41 @@ def timer_check():
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
if __name__ == '__main__':
|
|
- timer_check()
|
|
|
|
|
|
+ # timer_check()
|
|
|
|
+ feature_df = getVideoInfoInXlxs('past_videos.xlsx')
|
|
|
|
+ video_id_list = feature_df['videoid'].to_list()
|
|
|
|
+ video_info = {}
|
|
|
|
+ for video_id in video_id_list:
|
|
|
|
+ titleObj = feature_df[feature_df['videoid']
|
|
|
|
+ == video_id]['title'].values[0]
|
|
|
|
+ video_path = feature_df[feature_df['videoid']
|
|
|
|
+ == video_id]['video_path'].values[0]
|
|
|
|
+ title = str(titleObj)
|
|
|
|
+ if title is None:
|
|
|
|
+ continue
|
|
|
|
+ title = title.strip()
|
|
|
|
+ if len(title) > 0:
|
|
|
|
+ video_info[video_id] = {'title': title, 'video_path': video_path}
|
|
|
|
+ # print(video_id, title)
|
|
|
|
+ print(len(video_info))
|
|
|
|
+ # 获取已asr识别的视频
|
|
|
|
+ asr_folder = 'asr_res'
|
|
|
|
+ retry = 0
|
|
|
|
+ while retry < 30:
|
|
|
|
+ asr_file_list = os.listdir(asr_folder)
|
|
|
|
+ if len(asr_file_list) < 1:
|
|
|
|
+ retry += 1
|
|
|
|
+ time.sleep(60)
|
|
|
|
+ continue
|
|
|
|
+ retry = 0
|
|
|
|
+ for asr_filename in asr_file_list:
|
|
|
|
+ video_id = asr_filename[:-4]
|
|
|
|
+ if video_id not in video_id_list:
|
|
|
|
+ continue
|
|
|
|
+ asr_file = os.path.join(asr_folder, asr_filename)
|
|
|
|
+ if video_info.get(video_id, None) is None:
|
|
|
|
+ os.remove(asr_file)
|
|
|
|
+ else:
|
|
|
|
+ get_video_ai_tags(
|
|
|
|
+ video_id=video_id, asr_file=asr_file, video_info=video_info.get(video_id))
|
|
|
|
+ os.remove(asr_file)
|