v0.8.8: Fix stems extraction — upload MP3 file instead of audio_url
The MusicGPT Extraction API's audio_url field only accepts YouTube URLs, not direct MP3 links. Sending our /api/audio-source/ endpoint URL resulted in 'Error fetching audio length from YouTube' because MusicGPT tried to parse it as a YouTube video. Switch to the audio_file upload option: open the local MP3 and upload it directly as multipart/form-data to the Extraction API. Bumped timeout from 30s to 60s for file upload.
This commit is contained in:
parent
8df735d88c
commit
9575464be2
4 changed files with 15 additions and 10 deletions
6
app.py
6
app.py
|
|
@ -1267,10 +1267,10 @@ def admin_request(rid):
|
|||
if not song_path or not Path(song_path).exists():
|
||||
flash(f'Version {selected.upper()} MP3 is not available. Generate or upload it first.', 'error')
|
||||
return redirect(url_for('admin_request', rid=rid))
|
||||
# Build a public URL the MusicGPT Extraction API can fetch.
|
||||
audio_url = f"{current_app.config['PUBLIC_BASE_URL'].rstrip('/')}/api/audio-source/{req['player_token']}/{selected}.mp3"
|
||||
# Upload the MP3 file directly to the Extraction API.
|
||||
# The API's audio_url field only supports YouTube URLs, not direct MP3 links.
|
||||
stems = request.form.getlist('stems') or ['vocals', 'instrumental']
|
||||
task_id, conv_id, estimate, error = musicgpt_queue_stems(rid, audio_url, stems=stems)
|
||||
task_id, conv_id, estimate, error = musicgpt_queue_stems(rid, song_path, stems=stems)
|
||||
if error:
|
||||
update_request(rid, stems_status='ERROR', stems_error=error)
|
||||
flash(f'Failed to queue stems extraction: {error}', 'error')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue