Give alias and random suffix for whatsapp videos without created timestamp

This commit is contained in:
Gabriel Radureau
2025-10-16 17:28:26 +02:00
parent 78313ffbef
commit fbe3c01de7
10 changed files with 131 additions and 25 deletions

View File

@@ -39,7 +39,7 @@ def video_filter_sidebar(unlabeled=False):
show_unlabeled_only=show_unlabeled_only
)
def video_list_view(filters: dict, editable_labels=True, editable_difficulty=True, playlist=None):
def video_list_view(filters: dict, editable_labels=True, editable_difficulty=True, editable_alias=True, playlist=None):
"""Affiche les vidéos selon les filtres fournis."""
st.markdown(f"""
<style>
@@ -93,7 +93,7 @@ def video_list_view(filters: dict, editable_labels=True, editable_difficulty=Tru
css_class = "unlabeled" if not preselected else ""
with st.container():
st.markdown(f"<div class='{css_class}'>", unsafe_allow_html=True)
show_video_row(video, preselected, editable_labels, editable_difficulty, playlist)
show_video_row(video, preselected, editable_labels, editable_difficulty, editable_alias, playlist)
st.markdown("</div>", unsafe_allow_html=True)
# lazy loading bouton

View File

@@ -11,6 +11,7 @@ def show_video_row(
preselected_labels,
editable_labels=True,
editable_difficulty=True,
editable_alias=True,
playlist=None,
playlist_video_ids=None,
video_playlists=None,
@@ -19,7 +20,7 @@ def show_video_row(
Affiche une ligne Streamlit pour une vidéo :
- miniature + lecture conditionnelle
- métadonnées et labels
- édition des labels et difficulté
- édition des labels, difficulté et alias
- (optionnel) ajout/retrait d'une playlist
"""
@@ -100,6 +101,11 @@ def show_video_row(
if new_level != video.difficulty_display:
db.update_video_difficulty(video.file_name, new_level)
st.success(f"Niveau mis à jour pour {video.file_name}")
if editable_alias:
alias = st.text_input("Alias (optionnel)", value=video.alias, key=f'new_alias_{video.id}')
if alias != video.alias:
db.update_video_alias(video.file_name, alias.strip())
st.success(f"Alias mis à jour pour {video.file_name}")
# --- Colonne 4 : action playlist ---
if col4 and playlist: