 require('zappa') port, ->
   @get '/res/:id': ->
     db.hget @params.id, 'path', (err, path) =>
-      @response.sendfile path
+      # Transcode to mp3 using ffmpeg
+      @response.contentType 'mp3'
+      prov = new ffmpeg(path)
+        .withAudioCodec('libmp3lame')
+        .toFormat('mp3')
+        .writeToStream @response, (ret, err) ->
+          console.log err if err?

"use strict"

async = require 'async'
fs = require 'fs'
mime = require 'mime'
mmd = require 'musicmetadata'

          media.genre = data.genre if data.genre?
          media.track = data.track if data.track?
          media.date = data.year if data.year?
          media.contenttype = 'audio/mpeg'
          fs.stat file, (err, stats) ->
            media.filesize = stats?.size or 0
            cb null, media
