POST /api/upload-songs
Uploads MP3 files to use as background music in video generation. Uploaded songs replace any previously uploaded music.Request
This endpoint acceptsmultipart/form-data with one or more MP3 files.
One or more MP3 audio files to upload.Requirements:
- File format: MP3 only (
.mp3extension) - Multiple files can be uploaded in a single request
- All previously uploaded songs are deleted when new songs are uploaded
Response
"success" if at least one MP3 file was uploaded successfully, "error" otherwise.Human-readable message describing the result.Examples:
"Uploaded 3 song(s).""No files uploaded.""No MP3 files found."
Example Request
Example Response (Success)
Error Responses
No Files Provided
400 Bad Request
No MP3 Files Found
When files are uploaded but none have the.mp3 extension:
400 Bad Request
Server Error
500 Internal Server Error
Usage Flow
-
Upload background music files:
-
Generate a video with music:
The video generator will randomly select one of the uploaded MP3 files as background music when
useMusic: true is set.Important Notes
File Requirements
- Format: Only MP3 files are accepted (checked by file extension)
- Size: No explicit size limit, but very large files may cause upload timeouts
- Naming: Filenames are sanitized using
os.path.basename()for security
Storage Location
Uploaded files are stored in theSongs/ directory in the MoneyPrinter root:
Troubleshooting
”No MP3 files found” Error
This error occurs when uploaded files don’t have the.mp3 extension. Ensure all files:
- Have the
.mp3extension (case-insensitive) - Are actual MP3 audio files (not renamed from other formats)