Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -72,6 +72,7 @@ def prepare_media(source_path_or_url: os.PathLike,
|
|
| 72 |
audio_file = './downloaded/yt_audio'
|
| 73 |
command = ['yt-dlp', '-x', source_path_or_url, '-f', 'bestaudio',
|
| 74 |
'-o', audio_file, '--audio-format', 'mp3', '--restrict-filenames',
|
|
|
|
| 75 |
'--force-overwrites', '--username', 'oauth2', '--password', '', '-v']
|
| 76 |
if simulate:
|
| 77 |
command = command + ['-s']
|
|
@@ -114,8 +115,8 @@ def process_audio(audio_filepath):
|
|
| 114 |
return create_html_from_midi(midifile) # html midiplayer
|
| 115 |
|
| 116 |
def process_video(youtube_url):
|
| 117 |
-
if 'youtu' not in youtube_url:
|
| 118 |
-
|
| 119 |
audio_info = prepare_media(youtube_url, source_type='youtube_url')
|
| 120 |
midifile = transcribe(model, audio_info)
|
| 121 |
midifile = to_data_url(midifile)
|
|
|
|
| 72 |
audio_file = './downloaded/yt_audio'
|
| 73 |
command = ['yt-dlp', '-x', source_path_or_url, '-f', 'bestaudio',
|
| 74 |
'-o', audio_file, '--audio-format', 'mp3', '--restrict-filenames',
|
| 75 |
+
'--extractor-retries', '10',
|
| 76 |
'--force-overwrites', '--username', 'oauth2', '--password', '', '-v']
|
| 77 |
if simulate:
|
| 78 |
command = command + ['-s']
|
|
|
|
| 115 |
return create_html_from_midi(midifile) # html midiplayer
|
| 116 |
|
| 117 |
def process_video(youtube_url):
|
| 118 |
+
# if 'youtu' not in youtube_url:
|
| 119 |
+
# return None
|
| 120 |
audio_info = prepare_media(youtube_url, source_type='youtube_url')
|
| 121 |
midifile = transcribe(model, audio_info)
|
| 122 |
midifile = to_data_url(midifile)
|