Spaces:
Runtime error
Runtime error
Campfireman
commited on
Commit
•
065d9bd
1
Parent(s):
67a5fbe
Update app.py
Browse files
app.py
CHANGED
@@ -11,11 +11,11 @@ from pytube import YouTube
|
|
11 |
global notify
|
12 |
notify = ""
|
13 |
global temp_addr
|
14 |
-
temp_addr = "
|
15 |
|
16 |
def clean_up():
|
17 |
-
os.rmdir("
|
18 |
-
os.mkdir("
|
19 |
|
20 |
def convert_video_to_audio_ffmpeg(video_file, output_ext="mp3"):
|
21 |
"""Converts video to audio directly using `ffmpeg` command
|
@@ -48,7 +48,7 @@ def get_video(url):
|
|
48 |
return True
|
49 |
|
50 |
def extract_audio():
|
51 |
-
for file in os.listdir(
|
52 |
if file.endswith(".mp4"):
|
53 |
f_addr = temp_addr + "/" + convert_video_to_audio_ffmpeg(file)
|
54 |
print("Current audio address:" + f_addr)
|
|
|
11 |
global notify
|
12 |
notify = ""
|
13 |
global temp_addr
|
14 |
+
temp_addr = "./yt_download/" + str(datetime.datetime.now())
|
15 |
|
16 |
def clean_up():
|
17 |
+
os.rmdir("./yt_download/")
|
18 |
+
os.mkdir("./yt_download/")
|
19 |
|
20 |
def convert_video_to_audio_ffmpeg(video_file, output_ext="mp3"):
|
21 |
"""Converts video to audio directly using `ffmpeg` command
|
|
|
48 |
return True
|
49 |
|
50 |
def extract_audio():
|
51 |
+
for file in os.listdir(temp_addr):
|
52 |
if file.endswith(".mp4"):
|
53 |
f_addr = temp_addr + "/" + convert_video_to_audio_ffmpeg(file)
|
54 |
print("Current audio address:" + f_addr)
|