Skip to content
  • Per Cederqvist's avatar
    Display a progress bar while converting a wav file to mp3. · 547a9f97
    Per Cederqvist authored
    Automatically insert a download link for the converted file once the
    conversions completes.
    
    This uses jquery on the client side.  Two new API methods are
    provided:
    
        <...>.mp3/convert_start
        <...>.mp3/convert_cont/<progress>/<total>
    
    The first starts the conversion and returns an AJAX dict with the
    following items:
    
        "status": "enqueued"
        "progress": 0
        "workload": X
    
    X is the number of megabytes to convert (including both the current
    wav file and any previously queued wav files that will be converted
    before the current one).
    
    If somebody else converted the file before the request was made, it
    may also return:
    
        "status": "done"
        "size": human-readable size of the mp3 file
        "link": download link
    
    The convert_cont API waits until the progress information is
    significantly different than what the client says it last saw, but
    always waits at least 0.2 seconds.  Then it returns a JSON-encoded
    dictionary:
    
        "status": "progress".
        "progress": Y
        "workload"": X
    
    X is as in the "enqueued" mapping above, and Y is the progress so far.
    Once Y == X, the conversion is complete.  If that has happened,
    convert_cont will instead return a mapping with status "done" (see
    above).
    
    Redesigned how wav2mp3d reports and keeps track of progress.  The
    wav2mp3c demo client is not updated, so it probably no longer works.
    
    547a9f97