Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/FujiwaraChoki/MoneyPrinter/llms.txt

Use this file to discover all available pages before exploring further.

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 accepts multipart/form-data with one or more MP3 files.
songs
file[]
required
One or more MP3 audio files to upload.Requirements:
  • File format: MP3 only (.mp3 extension)
  • Multiple files can be uploaded in a single request
  • All previously uploaded songs are deleted when new songs are uploaded

Response

status
string
"success" if at least one MP3 file was uploaded successfully, "error" otherwise.
message
string
Human-readable message describing the result.Examples:
  • "Uploaded 3 song(s)."
  • "No files uploaded."
  • "No MP3 files found."

Example Request

curl -X POST http://localhost:8080/api/upload-songs \
  -F "songs=@background1.mp3" \
  -F "songs=@background2.mp3" \
  -F "songs=@background3.mp3"

Example Response (Success)

{
  "status": "success",
  "message": "Uploaded 3 song(s)."
}

Error Responses

No Files Provided

{
  "status": "error",
  "message": "No files uploaded."
}
HTTP Status: 400 Bad Request

No MP3 Files Found

When files are uploaded but none have the .mp3 extension:
{
  "status": "error",
  "message": "No MP3 files found."
}
HTTP Status: 400 Bad Request

Server Error

{
  "status": "error",
  "message": "Error description"
}
HTTP Status: 500 Internal Server Error

Usage Flow

  1. Upload background music files:
    curl -X POST http://localhost:8080/api/upload-songs \
      -F "songs=@music1.mp3" \
      -F "songs=@music2.mp3"
    
  2. Generate a video with music:
    curl -X POST http://localhost:8080/api/generate \
      -H "Content-Type: application/json" \
      -d '{
        "videoSubject": "Nature documentary",
        "useMusic": true
      }'
    
The video generator will randomly select one of the uploaded MP3 files as background music when useMusic: true is set.

Important Notes

Destructive OperationUploading new songs deletes all previously uploaded songs. The Songs/ directory is cleared before saving new files.

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 the Songs/ directory in the MoneyPrinter root:
MoneyPrinter/
├── Backend/
├── Frontend/
├── Songs/           # Uploaded MP3 files stored here
│   ├── background1.mp3
│   ├── background2.mp3
│   └── background3.mp3
└── ...

Troubleshooting

”No MP3 files found” Error

This error occurs when uploaded files don’t have the .mp3 extension. Ensure all files:
  • Have the .mp3 extension (case-insensitive)
  • Are actual MP3 audio files (not renamed from other formats)

Permission Errors

If uploads fail with permission errors:
# Ensure the Songs directory is writable
chmod 755 Songs/

Large File Uploads

For very large MP3 files, you may need to increase Flask’s upload size limit. The default limit should be sufficient for typical background music files.