         data["mediaType"] = setType(asset)
         var date: NSDate = asset.valueForProperty(ALAssetPropertyDate) as! NSDate
         data["dateAdded"] = date.timeIntervalSince1970
-        data["path"] = asset.valueForProperty(ALAssetPropertyAssetURL)
+//        data["path"] = asset.valueForProperty(ALAssetPropertyAssetURL)
         var rep = asset.defaultRepresentation()
         data["size"] = Int(rep.size())
         data["orientation"] = rep.metadata()["Orientation"]

@objc(HWPMediaLister) public class MediaLister: CDVPlugin{
    
    let library = ALAssetsLibrary()
    var success: Bool!
    var result:[[String: AnyObject]] = []
    var option: [String: AnyObject] = [:]
    
    public func readLibrary(command: CDVInvokedUrlCommand){
        var temp = command.arguments[0] as! [String: AnyObject]
        option = initailizeOption(temp)
        loadMedia(option)
        var pluginResult: CDVPluginResult! = nil
        if success == true {
            pluginResult = CDVPluginResult(status: CDVCommandStatus_OK, messageAsArray: result)
        } else {
            pluginResult = CDVPluginResult(status: CDVCommandStatus_ERROR)
        }
        self.commandDelegate.sendPluginResult(pluginResult, callbackId: command.callbackId)
    }
    
    public func startLoad(thumbnail: Bool = true, limit: Int = 20, mediaTypes: [String] = ["image"], offset:Int = 0) -> [[String: AnyObject]]{

    
    private func initailizeOption(option:[String: AnyObject]) -> [String: AnyObject]{
        var tempOption = option
        if tempOption["offset"] == nil{
            tempOption["offset"] = 0
        }
        if tempOption["limit"]  == nil{
            tempOption["limit"] = 20
        }
        if tempOption["thumbnail"] == nil{
            tempOption["thumbnail"] = true
        }
        if tempOption["mediaTypes"] == nil{
            tempOption["mdeiaTypes"] = ["image"]
        }
        return tempOption
    }

    private func sendResult(){
        dispatch_async(dispatch_get_main_queue()){
            var pluginResult: CDVPluginResult! = nil
            if self.success == true {
                pluginResult = CDVPluginResult(status: CDVCommandStatus_OK, messageAsArray: self.result)
            } else {
                pluginResult = CDVPluginResult(status: CDVCommandStatus_ERROR)
            }
            self.commandDelegate.sendPluginResult(pluginResult, callbackId: self.command.callbackId)
        }
    }

    private func loadMedia(option: [String: AnyObject]){
        success = false
        library.enumerateGroupsWithTypes(ALAssetsGroupSavedPhotos,usingBlock: {
                (group: ALAssetsGroup!, stop: UnsafeMutablePointer) in
                if group == nil{
                    return
                }

                self.success = true

                if let filter = self.getFilter(option["mediaTypes"] as! [String]){
                    group.setAssetsFilter(filter)
                } else {
                    return
                }
                
                let num = group.numberOfAssets()
                let indexSet = self.getIndexSet(num, limit: option["limit"] as! Int, offset: option["offset"] as! Int)
                if indexSet == nil{
                    return
                }
                
                group.enumerateAssetsAtIndexes(indexSet!, options: NSEnumerationOptions.Reverse){
                    (asset:ALAsset!, id:Int , stop: UnsafeMutablePointer) in
                    if asset != nil{
                        self.result.append(self.setDictionary(asset, id: id, option:option))
                    }
                }
                self.sendResult()
            }, failureBlock:{
                (myerror: NSError!) -> Void in
                println("error occurred: \(myerror.localizedDescription)")
