Spaces:
Runtime error
Runtime error
Commit
·
6c30d8b
1
Parent(s):
11bd532
probing setting change
Browse files
ui.py
CHANGED
@@ -1,7 +1,8 @@
|
|
1 |
from lang_ui import get_ui_lang
|
2 |
import gradio as gr
|
3 |
import file_name
|
4 |
-
import
|
|
|
5 |
import urllib.request
|
6 |
|
7 |
# Display available langauges and set default UI language
|
@@ -87,13 +88,17 @@ def get_duration(input_file):
|
|
87 |
end_time.update(None, interactive=False)
|
88 |
]
|
89 |
print("Getting duration")
|
90 |
-
|
|
|
|
|
|
|
|
|
91 |
print("Probing finished")
|
92 |
-
duration_seconds = float(info_json['format']['duration'])
|
93 |
-
duration_formatted = time_str(duration_seconds)
|
94 |
return [
|
95 |
start_time.update("00:00:00", interactive=True),
|
96 |
-
end_time.update(
|
97 |
]
|
98 |
|
99 |
|
|
|
1 |
from lang_ui import get_ui_lang
|
2 |
import gradio as gr
|
3 |
import file_name
|
4 |
+
import subprocess
|
5 |
+
import re
|
6 |
import urllib.request
|
7 |
|
8 |
# Display available langauges and set default UI language
|
|
|
88 |
end_time.update(None, interactive=False)
|
89 |
]
|
90 |
print("Getting duration")
|
91 |
+
result = subprocess.run(['ffprobe', '-v', 'error', '-show_entries', 'format=duration', '-of',
|
92 |
+
'default=noprint_wrappers=1:nokey=1', input_file], stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True)
|
93 |
+
duration = float(result.stdout.strip())
|
94 |
+
print(f"Result: {duration}")
|
95 |
+
# info_json = ffmpeg.probe(input_file)
|
96 |
print("Probing finished")
|
97 |
+
# duration_seconds = float(info_json['format']['duration'])
|
98 |
+
# duration_formatted = time_str(duration_seconds)
|
99 |
return [
|
100 |
start_time.update("00:00:00", interactive=True),
|
101 |
+
end_time.update(duration, interactive=True)
|
102 |
]
|
103 |
|
104 |
|