# playlists/playlist_page.py import streamlit as st from playlists import playlist_db from playlists.playlist_model import Playlist from playlists.playlist_controller import playlist_manual_editor, playlist_dynamic_editor from playlists.playlist_controller import RuleSet def main(): st.title("đŸŽ” Gestion des Playlists") playlists = playlist_db.load_all_playlists() selected = st.selectbox("Playlists existantes", ["(Nouvelle)"] + [p.name for p in playlists]) # playlists/playlist_page.py (partie crĂ©ation) if selected == "(Nouvelle)": st.subheader("➕ Nouvelle playlist") name = st.text_input("Nom") desc = st.text_area("Description") type_choice = st.radio("Type", ["manual", "dynamic"]) if st.button("CrĂ©er"): if not name.strip(): st.error("Le nom ne peut pas ĂȘtre vide.") else: pl = Playlist(name=name.strip(), description=desc or "", type=type_choice, rules=RuleSet()) pl.save() st.success("Playlist créée ✅") # Recharge immĂ©diate : rerun force tout Ă  re-exĂ©cuter st.rerun() else: current = next(p for p in playlists if p.name == selected) if current.type == "manual": playlist_manual_editor(current) else: playlist_dynamic_editor(current)