Update app.py
Browse files
app.py
CHANGED
@@ -1758,6 +1758,11 @@ video_files = glob.glob("*.mp4")
|
|
1758 |
video_files = [file for file in video_files if len(os.path.splitext(file)[0]) >= 10] # exclude files with short names
|
1759 |
video_files.sort(key=lambda x: (os.path.splitext(x)[1], x), reverse=True) # sort by file type and file name in descending order
|
1760 |
|
|
|
|
|
|
|
|
|
|
|
1761 |
|
1762 |
|
1763 |
|
@@ -1774,11 +1779,16 @@ if st.sidebar.button("π Delete All Images"):
|
|
1774 |
os.remove(file)
|
1775 |
st.rerun()
|
1776 |
|
1777 |
-
if st.sidebar.button("π Delete All Videos"):
|
1778 |
for file in video_files:
|
1779 |
os.remove(file)
|
1780 |
st.rerun()
|
1781 |
|
|
|
|
|
|
|
|
|
|
|
1782 |
# Display and handle audio files
|
1783 |
for file in audio_files:
|
1784 |
col1, col2 = st.sidebar.columns([6, 1]) # adjust the ratio as needed
|
@@ -1806,7 +1816,7 @@ for file in image_files:
|
|
1806 |
os.remove(file)
|
1807 |
st.rerun()
|
1808 |
|
1809 |
-
# Display and handle video files
|
1810 |
for file in video_files:
|
1811 |
col1, col2 = st.sidebar.columns([6, 1]) # adjust the ratio as needed
|
1812 |
with col1:
|
@@ -1820,6 +1830,20 @@ for file in video_files:
|
|
1820 |
os.remove(file)
|
1821 |
st.rerun()
|
1822 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1823 |
|
1824 |
|
1825 |
|
|
|
1758 |
video_files = [file for file in video_files if len(os.path.splitext(file)[0]) >= 10] # exclude files with short names
|
1759 |
video_files.sort(key=lambda x: (os.path.splitext(x)[1], x), reverse=True) # sort by file type and file name in descending order
|
1760 |
|
1761 |
+
# π₯ MP3 Video files
|
1762 |
+
video_files_mp3 = glob.glob("*.mp3")
|
1763 |
+
video_files_mp3 = [file for file in video_files_mp3 if len(os.path.splitext(file)[0]) >= 10] # exclude files with short names
|
1764 |
+
video_files_mp3.sort(key=lambda x: (os.path.splitext(x)[1], x), reverse=True) # sort by file type and file name in descending order
|
1765 |
+
|
1766 |
|
1767 |
|
1768 |
|
|
|
1779 |
os.remove(file)
|
1780 |
st.rerun()
|
1781 |
|
1782 |
+
if st.sidebar.button("π Delete All MP4 Videos"):
|
1783 |
for file in video_files:
|
1784 |
os.remove(file)
|
1785 |
st.rerun()
|
1786 |
|
1787 |
+
if st.sidebar.button("π Delete All MP3 Videos"):
|
1788 |
+
for file in video_files_mp3:
|
1789 |
+
os.remove(file)
|
1790 |
+
st.rerun()
|
1791 |
+
|
1792 |
# Display and handle audio files
|
1793 |
for file in audio_files:
|
1794 |
col1, col2 = st.sidebar.columns([6, 1]) # adjust the ratio as needed
|
|
|
1816 |
os.remove(file)
|
1817 |
st.rerun()
|
1818 |
|
1819 |
+
# Display and handle MP4 video files
|
1820 |
for file in video_files:
|
1821 |
col1, col2 = st.sidebar.columns([6, 1]) # adjust the ratio as needed
|
1822 |
with col1:
|
|
|
1830 |
os.remove(file)
|
1831 |
st.rerun()
|
1832 |
|
1833 |
+
# Display and handle MP3 video files
|
1834 |
+
for file in video_files_mp3:
|
1835 |
+
col1, col2 = st.sidebar.columns([6, 1]) # adjust the ratio as needed
|
1836 |
+
with col1:
|
1837 |
+
st.markdown(file)
|
1838 |
+
if st.button("π₯", key="play_" + file): # play emoji button
|
1839 |
+
video_file = open(file, 'rb')
|
1840 |
+
video_bytes = video_file_mp3.read()
|
1841 |
+
st.video(video_bytes)
|
1842 |
+
with col2:
|
1843 |
+
if st.button("π", key="delete_" + file):
|
1844 |
+
os.remove(file)
|
1845 |
+
st.rerun()
|
1846 |
+
|
1847 |
|
1848 |
|
1849 |
|