This commit is contained in:
2025-07-22 13:39:46 +08:00
parent dc94cc41c2
commit 0214a6069b
18 changed files with 69 additions and 1059 deletions

View File

@ -4,12 +4,14 @@ import streamlit as st
import os
from pathlib import Path
from utils.helpers import analyze_ass_for_keywords, search_pixabay_videos, search_pexels_videos
from utils.helpers import display_operation_status
@st.fragment
def render_tab(project,callbacks):
"""一個用於從多個來源搜尋並下載影片的獨立UI片段。"""
display_operation_status
paths = project.paths
st.header("步驟 5: 從線上圖庫搜尋影片素材")
st.header("從線上圖庫搜尋影片素材")
pixabay_api_key = st.secrets.get("PIXABAY_API_KEY")
pexels_api_key = st.secrets.get("PEXELS_API_KEY")
@ -17,7 +19,7 @@ def render_tab(project,callbacks):
st.warning("請至少在 Streamlit secrets 中設定 `PIXABAY_API_KEY` 或 `PEXELS_API_KEY` 以使用此功能。")
return
st.subheader("5.1 搜尋影片")
st.subheader("搜尋影片")
# 【新增】影片來源選擇
available_sources = []
@ -113,8 +115,8 @@ def render_tab(project,callbacks):
st.divider()
if st.session_state.search_results:
st.subheader("5.2 選擇影片並下載")
st.button("📥 下載選取的影片到專案素材庫", on_click=callbacks.callback_download_videos, args=(paths,), help="將下方勾選的影片下載至目前專案的 `output/test` 資料夾,並自動循序命名。")
st.subheader("選擇影片並下載")
st.button("📥 下載選取的影片到專案素材庫", on_click=callbacks.callback_download_videos, args=(paths,), help="將下方勾選的影片下載至目前專案的 `output/temp_video` 資料夾,並自動循序命名。")
num_cols = 5
cols = st.columns(num_cols)