Spaces:
Sleeping
Sleeping
Commit ·
7e948ae
1
Parent(s): 165e808
Update app.py
Browse files
app.py
CHANGED
|
@@ -53,19 +53,17 @@ with st.sidebar:
|
|
| 53 |
funciones = [youtube]
|
| 54 |
|
| 55 |
def download_all_button(cut_files):
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
zip_file.write(cut_file, os.path.basename(cut_file))
|
| 62 |
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
st.markdown(href, unsafe_allow_html=True)
|
| 69 |
|
| 70 |
if seleccionado:
|
| 71 |
indice = opciones.index(seleccionado)
|
|
@@ -92,8 +90,8 @@ if seleccionado:
|
|
| 92 |
info_list = [f"{titulo_video}_cut_{i+1}", cut_file, thumbnail_file, cuts[i][0], cuts[i][1]]
|
| 93 |
session(info_list)
|
| 94 |
|
| 95 |
-
download_all_button(cut_files)
|
| 96 |
-
else:
|
| 97 |
if st.button(f"Descargar {seleccionado}"):
|
| 98 |
video_file, titulo_video, video_info, thumbnail_file = funcion(video_link)
|
| 99 |
file_size = os.path.getsize(video_file)
|
|
|
|
| 53 |
funciones = [youtube]
|
| 54 |
|
| 55 |
def download_all_button(cut_files):
|
| 56 |
+
st.markdown("### Descargar Todos")
|
| 57 |
+
zip_buffer = BytesIO()
|
| 58 |
+
with zipfile.ZipFile(zip_buffer, 'w') as zip_file:
|
| 59 |
+
for cut_file in cut_files:
|
| 60 |
+
zip_file.write(cut_file, os.path.basename(cut_file))
|
|
|
|
| 61 |
|
| 62 |
+
zip_filename = 'cortes_videos.zip'
|
| 63 |
+
zip_data = zip_buffer.getvalue()
|
| 64 |
+
b64 = base64.b64encode(zip_data).decode()
|
| 65 |
+
href = f'<a href="data:application/zip;base64,{b64}" download="{zip_filename}">Descargar Todos</a>'
|
| 66 |
+
st.markdown(href, unsafe_allow_html=True)
|
|
|
|
| 67 |
|
| 68 |
if seleccionado:
|
| 69 |
indice = opciones.index(seleccionado)
|
|
|
|
| 90 |
info_list = [f"{titulo_video}_cut_{i+1}", cut_file, thumbnail_file, cuts[i][0], cuts[i][1]]
|
| 91 |
session(info_list)
|
| 92 |
|
| 93 |
+
download_all_button(cut_files)
|
| 94 |
+
else:
|
| 95 |
if st.button(f"Descargar {seleccionado}"):
|
| 96 |
video_file, titulo_video, video_info, thumbnail_file = funcion(video_link)
|
| 97 |
file_size = os.path.getsize(video_file)
|