zhangyong 11 months ago
parent
commit
95babb995c
3 changed files with 33 additions and 20 deletions
  1. 8 2
      common/feishu_form.py
  2. 14 14
      video_job.py
  3. 11 4
      video_rewriting/video_prep.py

+ 8 - 2
common/feishu_form.py

@@ -46,7 +46,9 @@ class Material():
             number = row[4]
             video_share = row[5]
             video_ending = row[6]
-            title = row[7]
+            crop_tool = row[7]
+            gg_duration = row[8]
+            title = row[9]
 
             def count_items(item, separator):
                 if item and item not in {'None', ''}:
@@ -57,6 +59,8 @@ class Material():
             video_id_total = count_items(str(video_id), ',')
             new_id_total = count_items(str(new_id), ',')
             title_total = count_items(str(title), '/')
+            crop_total = count_items(str(crop_tool))
+            gg_duration_total = count_items(str(gg_duration))
 
             values = [old_id_total, video_id_total, new_id_total, video_share, video_ending, title_total]
             task_mark = "_".join(map(str, values))
@@ -70,7 +74,9 @@ class Material():
                     "number": number,
                     "title": title,
                     "video_share": video_share,
-                    "video_ending": video_ending
+                    "video_ending": video_ending,
+                    "crop_total": crop_total,
+                    "gg_duration_total": gg_duration_total,
                 }
                 processed_list.append(number_dict)
             else:

+ 14 - 14
video_job.py

@@ -71,19 +71,19 @@ def usernames_today():
     print("today 已清空")
 
 
-# video_start()
-
-
-# 定时任务设置
-schedule.every().day.at("01:00").do(usernames_today)
-
-
-schedule.every(12).hours.do(video_start)
-
-
-
-while True:
-    schedule.run_pending()
-    time.sleep(1)
+video_start()
+
+
+# # 定时任务设置
+# schedule.every().day.at("01:00").do(usernames_today)
+#
+#
+# schedule.every(12).hours.do(video_start)
+#
+#
+#
+# while True:
+#     schedule.run_pending()
+#     time.sleep(1)
 
 

+ 11 - 4
video_rewriting/video_prep.py

@@ -74,16 +74,17 @@ class getVideo:
             return mark
 
         for task in task_data:
-            task_mark = task["task_mark"]  # 任务标示
+            task_marks = task["task_mark"]  # 任务标示
             old_id = str(task["old_id"])
             video_id = str(task["video_id"])
             new_id = str(task["new_id"])
-
             number = task["number"]  # 指定条数
             title = task["title"]
             video_share = task["video_share"]
             video_ending = task["video_ending"]
-            video_path_url = cls.create_folders(mark, str(task_mark))  # 创建目录
+            crop_total = task["crop_total"]
+            gg_duration_total = task["gg_duration_total"]
+
             try:
                 if ',' in new_id:
                     n_id = new_id.split(',')
@@ -93,6 +94,9 @@ class getVideo:
                     task_id = old_id.split(',')
                 else:
                     task_id = video_id.split(',')
+                values = [task_id[0], task_marks]
+                task_mark = "_".join(map(str, values))  # 最终任务标示
+                video_path_url = cls.create_folders(mark, str(task_mark))  # 创建目录
                 count = 0  # 初始化计数器
                 for id in task_id:
                     pw_list, zm_list = Material.get_pwsrt_data(feishu_id, pw_sheet)  # 获取srt
@@ -122,7 +126,10 @@ class getVideo:
                             Common.logger("log").info(f"{task_mark}下的视频ID{id},{new_video_path}视频下载失败")
                             cls.remove_files(video_path_url)
                             continue
-
+                        # if crop_total and crop_total != 'None':  # 判断是否需要裁剪
+                        #     pass
+                        # if gg_duration_total and gg_duration_total != 'None':  # 判断是否需要指定视频时长
+                        #     pass
                         if video_ending and video_ending != 'None':
                             pw_id = pws["pw_id"]
                             pw_srt = pws["pw_srt"]