         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"]

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

    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))
                }
                println("cccc")
            }
            }, failureBlock:{
                (myerror: NSError!) -> Void in
                println("error occurred: \(myerror.localizedDescription)")

@objc(HWPMediaLister) public class MediaLister: CDVPlugin{
    
    let library = ALAssetsLibrary()
    let priority = DISPATCH_QUEUE_PRIORITY_DEFAULT
    
    var command: CDVInvokedUrlCommand!
    var option: [String: AnyObject] = [:]
    
    var result:[[String: AnyObject]] = []
    var success: Bool!
    
    public func readLibrary(command: CDVInvokedUrlCommand){
        dispatch_async(dispatch_get_global_queue(priority, 0)){
            self.command = command
            var temp = command.arguments[0] as! [String: AnyObject]
            self.option = self.initailizeOption(temp)
            self.loadMedia(self.option)
        }
    }
    
    public func startLoad(thumbnail: Bool = true, limit: Int = 20, mediaTypes: [String] = ["image"], offset:Int = 0) -> [[String: AnyObject]]{
