GilbertClaus commited on
Commit
313984d
·
1 Parent(s): 8f7e782

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -2
app.py CHANGED
@@ -2,6 +2,17 @@ import streamlit as st
2
  from streamlit_option_menu import option_menu
3
  import streamlit as st
4
  from youtube import cut_video
 
 
 
 
 
 
 
 
 
 
 
5
 
6
  # Navigasi Sidebar
7
  with st.sidebar:
@@ -13,10 +24,11 @@ if selected == 'Youtube':
13
  st.write("Potong dan download sebagian video YouTube.")
14
  video_link = st.text_input("Link Video", value='https://www.youtube.com/watch?v=ZGltvcmVSAk')
15
  resolution = st.text_input("Resolusi", value='720')
16
- start_time = st.text_input("Start Time", value='00:07:12.500')
17
  end_time = st.text_input("End Time", value='00:09:31.000')
18
 
19
  if st.button("Download and Cut Video"):
 
20
  video_info, video_result, video_file = cut_video(video_link, resolution, start_time, end_time)
21
  num_lines = video_info.count('\n') + 1
22
  text_area_height = 25 * num_lines
@@ -27,6 +39,7 @@ if selected == 'Youtube':
27
  st.download_button(
28
  label="Download Hasil Potongan Video",
29
  data=file_contents,
30
- file_name=video_file.replace('/home/user/app/', '').title().replace('Mp4', 'mp4'),
31
  mime='application/octet-stream'
32
  )
 
 
2
  from streamlit_option_menu import option_menu
3
  import streamlit as st
4
  from youtube import cut_video
5
+ from datetime import datetime
6
+ import time
7
+
8
+ finish = False
9
+ def digital_clock(finish):
10
+ placeholder = st.empty()
11
+ stop_button = st.button("Hentikan Jam Digital")
12
+ while not finish:
13
+ current_time = datetime.now().strftime("%H:%M:%S.%f")[:-3]
14
+ placeholder.markdown(f"## {current_time}")
15
+ time.sleep(0.1)
16
 
17
  # Navigasi Sidebar
18
  with st.sidebar:
 
24
  st.write("Potong dan download sebagian video YouTube.")
25
  video_link = st.text_input("Link Video", value='https://www.youtube.com/watch?v=ZGltvcmVSAk')
26
  resolution = st.text_input("Resolusi", value='720')
27
+ start_time = st.text_input("Start Time", value='00:07:12.750')
28
  end_time = st.text_input("End Time", value='00:09:31.000')
29
 
30
  if st.button("Download and Cut Video"):
31
+ digital_clock(finish)
32
  video_info, video_result, video_file = cut_video(video_link, resolution, start_time, end_time)
33
  num_lines = video_info.count('\n') + 1
34
  text_area_height = 25 * num_lines
 
39
  st.download_button(
40
  label="Download Hasil Potongan Video",
41
  data=file_contents,
42
+ file_name=video_file.replace('/home/user/app/Hasil Potong', '').title().replace('Mp4', 'mp4'),
43
  mime='application/octet-stream'
44
  )
45
+ finish = True