playlist edition

This commit is contained in:
Gabriel Radureau
2025-10-13 16:53:15 +02:00
parent 0fa5a30809
commit 65d63ec828
15 changed files with 550 additions and 137 deletions

32
app/views/video_views.py Normal file
View File

@@ -0,0 +1,32 @@
import streamlit as st
from controllers.label_controller import label_widget
import db
def show_video_row(video, preselected_labels, editable_labels=True, editable_difficulty=True):
col1, col2, col3 = st.columns([1, 3, 2])
with col1:
if video.thumbnail_file:
st.image(video.thumbnail_file)
st.caption(video.mp4_file_name)
with col2:
st.markdown(f"**📅 {video.record_datetime or ''}** — {video.day_of_week or ''}")
st.text(f"🏷️ Labels: {', '.join(preselected_labels) or 'Aucun'}")
playlists = db.get_video_playlists(video.file_name)
if playlists:
st.text(f"🎵 Playlists: {', '.join(playlists)}")
with col3:
if editable_labels:
label_widget(video, preselected=preselected_labels)
if editable_difficulty:
levels = ["Tout niveau", "Débutant", "Intermédiaire", "Avancé", "Star"]
new_level = st.selectbox(
"🎚 Niveau",
levels,
index=levels.index(video.difficulty_display),
key=f"diff_{video.file_name}"
)
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}")