pcdoido2 commited on
Commit
949b5e2
verified
1 Parent(s): 8461346

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -14
app.py CHANGED
@@ -65,8 +65,9 @@ if video_path and not st.session_state.processando:
65
 
66
  st.checkbox("鉁傦笍 Ativar cortes e embaralhamento aleat贸rio", value=True, key="embaralhar_cortes")
67
 
68
- corte_min = st.number_input("Tamanho m铆nimo do corte (segundos)", min_value=1, value=2, key="corte_min")
69
- corte_max = st.number_input("Tamanho m谩ximo do corte (segundos)", min_value=3, value=5, key="corte_max")
 
70
 
71
  tutorial = st.file_uploader("Adicionar tutorial (opcional)", type=["mp4"])
72
  if tutorial:
@@ -145,22 +146,24 @@ if st.session_state.processando:
145
 
146
  excluir_inicio = st.session_state.excluir_inicio
147
  excluir_fim = st.session_state.excluir_fim
148
- corte_min = st.session_state.corte_min
149
- corte_max = st.session_state.corte_max
150
  velocidade_cortes = st.session_state.velocidade_cortes
151
 
152
- partes = []
153
- if excluir_inicio > 0:
154
- partes.append((0, excluir_inicio))
155
- if excluir_fim < dur:
156
- partes.append((excluir_fim, dur))
157
-
158
  cortes = []
159
  usados = set()
 
160
  barra.progress(15)
161
  status.markdown("鉁傦笍 Realizando cortes...")
162
 
163
  if st.session_state.embaralhar_cortes:
 
 
 
 
 
 
 
 
 
164
  for inicio, fim in partes:
165
  pos = inicio
166
  while pos < fim:
@@ -177,10 +180,11 @@ if st.session_state.processando:
177
 
178
  random.shuffle(cortes)
179
  else:
180
- # Apenas um corte simples direto
181
- start = excluir_inicio
182
- end = excluir_fim if excluir_fim > excluir_inicio else dur
183
- cortes = [(start, end)]
 
184
  barra.progress(25)
185
 
186
  # --- PROCESSAR OS CORTES ---
 
65
 
66
  st.checkbox("鉁傦笍 Ativar cortes e embaralhamento aleat贸rio", value=True, key="embaralhar_cortes")
67
 
68
+ if st.session_state.embaralhar_cortes:
69
+ corte_min = st.number_input("Tamanho m铆nimo do corte (segundos)", min_value=1, value=2, key="corte_min")
70
+ corte_max = st.number_input("Tamanho m谩ximo do corte (segundos)", min_value=3, value=5, key="corte_max")
71
 
72
  tutorial = st.file_uploader("Adicionar tutorial (opcional)", type=["mp4"])
73
  if tutorial:
 
146
 
147
  excluir_inicio = st.session_state.excluir_inicio
148
  excluir_fim = st.session_state.excluir_fim
 
 
149
  velocidade_cortes = st.session_state.velocidade_cortes
150
 
 
 
 
 
 
 
151
  cortes = []
152
  usados = set()
153
+
154
  barra.progress(15)
155
  status.markdown("鉁傦笍 Realizando cortes...")
156
 
157
  if st.session_state.embaralhar_cortes:
158
+ corte_min = st.session_state.corte_min
159
+ corte_max = st.session_state.corte_max
160
+
161
+ partes = []
162
+ if excluir_inicio > 0:
163
+ partes.append((0, excluir_inicio))
164
+ if excluir_fim < dur:
165
+ partes.append((excluir_fim, dur))
166
+
167
  for inicio, fim in partes:
168
  pos = inicio
169
  while pos < fim:
 
180
 
181
  random.shuffle(cortes)
182
  else:
183
+ # Apenas remover o trecho entre excluir_inicio e excluir_fim
184
+ if excluir_inicio > 0:
185
+ cortes.append((0, excluir_inicio))
186
+ if excluir_fim < dur:
187
+ cortes.append((excluir_fim, dur))
188
  barra.progress(25)
189
 
190
  # --- PROCESSAR OS CORTES ---