 crypto = require "crypto"
 fs = require "fs"
-lazy = require 'lazy'
+lazy = require "lazy"
 _s = require "underscore.string"
 
 exports.AudaciousPlaylistParser = class AudaciousPlaylistParser
+        postfix: ".audpl"
+
         parse: (file, callback) =>
                 filereader = new lazy fs.createReadStream(file)
                 result = []

                                        uri: value
                                if _s.startsWith value, "file://"
                                        currentItem.filename = value.substring "file://".length
                        else if value
                                currentItem[option] = value



exports.Parser = class Parser
        constructor: (@log) ->
                @parsers = [
                        new FilenamePerLineParser(),
                        new AudaciousPlaylistParser(),
                        ]

        parse: (filename, callback) =>
                @log.info "Reading song database file: '#{filename}'."
                parsed = false
                for parser in @parsers
                        if _s.endsWith filename, parser.postfix
                                parsed = true
                                parser.parse filename, callback
                                break
                if not parsed
                        callback "Failed to recognize format for file '#{filename}'"
