 
   logger.info 'user "' + req.user + '" queued URL "' + req.body.nzburl + '"'
 
-  sabnzbd.queueNZBUrl req.body.nzburl, req.user, (nzbName, queueRes) ->
+  nzbname = sabnzbd.getNZBName req.body.nzburl
+
+  sabnzbd.queueNZBUrl req.body.nzburl, nzbname, req.user, (queueRes) ->
     if queueRes
-      sabnzbd.addUserNZB req.user, nzbName, req.body.flac2mp3
+      sabnzbd.addUserNZB req.user, nzbname, req.body.flac2mp3
       res.json nzb: true
     else
       res.send 500


# index route
app.get '/', (req, res) ->
  res.render 'index'

# authentication route
app.post '/login', auth.authUser, (req, res) ->

  setInterval () ->
    functions.writePasses _.filter(functions.getPasses(), (p) -> p.time > new Date().getTime() - 604800000)
    functions.writeTarContents _.filter(functions.getTarContents(), (c) -> fs.existsSync(settings.downloadDir + c.filename))
    if settings.downloadExpireDays > 0
      functions.writeUserNZBs _.filter(functions.getUserNZBs(), (n) -> n.time > new Date().getTime() - 604800000)
  , 86400
else
  settings.setup()
