wangkun 2 éve
szülő
commit
3ed4e271bf
2 módosított fájl, 32 hozzáadás és 4 törlés
  1. 27 1
      main/demo.py
  2. 5 3
      main/person_list.py

+ 27 - 1
main/demo.py

@@ -357,7 +357,33 @@ class Demo:
         print(f"原标题:{befor_video_title}")
         print(f"加表情后的标题:{video_title}")
 
+    @classmethod
+    def demo1(cls):
+        char_sheet = Feishu.get_values_batch("hour", "xiaoniangao", "BhlbST")
+        # print(char_sheet)
+        expression_list = []
+        char_list = []
+        for q in range(len(char_sheet)):
+            if char_sheet[q][0] is not None:
+                expression_list.append(char_sheet[q][0])
+            if char_sheet[q][1] is not None:
+                char_list.append(char_sheet[q][1])
+        befor_video_title = "今天星期二"
+        expression = random.choice(expression_list)
+        print(f"随机表情:{expression}")
+        expression_title_list = [expression + befor_video_title, befor_video_title + expression]
+        print(f"随机表情+标题列表:{expression_title_list}")
+        # 标题,表情随机加在片头
+        title_list1 = random.choice(expression_title_list)
+        print(f"随机表情+标题:{title_list1}")
+        # 标题,表情随机加在片尾
+        title_list2 = befor_video_title + random.choice(char_list)
+        print(f"随机表情+符号:{title_list2}")
+        title_list4 = [title_list1, title_list2]
+        video_title = random.choice(title_list4)
+        print(f"最终标题:{video_title}")
+
 
 if __name__ == "__main__":
     demo = Demo()
-    demo.update_title()
+    demo.demo1()

+ 5 - 3
main/person_list.py

@@ -356,11 +356,13 @@ class Person:
                 char_sheet = Feishu.get_values_batch("hour", "xiaoniangao", "BhlbST")
                 expression_list = []
                 char_list = []
-                for q in range(1, len(char_sheet)):
+                for q in range(len(char_sheet)):
                     if char_sheet[q][0] is not None:
-                        expression_list.append(char_sheet[i][0])
+                        expression_list.append(char_sheet[q][0])
                     if char_sheet[q][1] is not None:
-                        char_list.append(char_sheet[i][1])
+                        char_list.append(char_sheet[q][1])
+                # print(expression_list)
+                # print(char_list)
                 befor_video_title = feeds[i]["title"].strip().replace("\n", "") \
                     .replace("/", "").replace("\r", "").replace("#", "") \
                     .replace(".", "。").replace("\\", "").replace("&NBSP", "") \