Last active
December 14, 2015 09:08
-
-
Save amundo/5062195 to your computer and use it in GitHub Desktop.
i'm trying to load a json file with some metadata in it
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Metadata = function(){ | |
this.files = []; | |
this.load = function(){ | |
//console.log('this.load…'); | |
$.getJSON( | |
"metadata.json", | |
this.store | |
) | |
}; | |
this.store = function(json){ | |
//console.log('Metadata' + show(Metadata)); | |
//console.log('this…' + show(this)); | |
//console.log('this…' + show(json)); | |
console.log('this.store…' + json); | |
console.log('this.files…' + this.files); | |
this.files = json; | |
}; | |
this.lookup = function(file_id){ | |
return _.where(this.files, {file_id: file_id})[0]; | |
}; | |
this.load(); | |
return { | |
files : this.files | |
} | |
} | |
// what i'm hoping to do with this thing (elsewhere in the app): | |
} | |
window.app = (function(){ | |
var myapp = {}; | |
myapp.metadata = new Metadata(); | |
// then i'd be able to: | |
var hil001 = myapp.lookup('hil001'); | |
// now i have the info about hil001… | |
})() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{ | |
"comment": "really quiet", | |
"index": "001", | |
"analysis_status": "Handwritten phonetic transcription", | |
"language": "Hiligaynon (hil)", | |
"title": "Vocabulary 1", | |
"mediatype": "audio", | |
"format": "wav", | |
"equipment": "Edirol", | |
"sample_rate": 44100.0, | |
"access": "Open", | |
"filename": "hil001_2012-09-27_JDL_Class_NumbersOneToTen.wav", | |
"eaf_filename": "hil001_2012-09-27_JDL_Class_NumbersOneToTen.eaf", | |
"genre": "Elicited words", | |
"topic": "Numbers 1 to 10", | |
"setting": "FM Class", | |
"speaker": "Joshua de Leon", | |
"file_id": "hil001", | |
"date": "2012-09-27", | |
"place": "UCSB classroom", | |
"collector": "FM class" | |
}, | |
{ | |
"comment": "normal", | |
"index": "002", | |
"analysis_status": "", | |
"language": "Hiligaynon (hil)", | |
"title": "Diseases", | |
"mediatype": "audio", | |
"format": "wav", | |
"equipment": "Edirol", | |
"sample_rate": 44100.0, | |
"access": "", | |
"filename": "hil002_2012-10-01_JDL_DW_Diseases.wav", | |
"eaf_filename": "hil002_2012-10-01_JDL_DW_Diseases.eaf", | |
"genre": "", | |
"topic": "Diseases", | |
"setting": "Individual meeting", | |
"speaker": "Joshua de Leon", | |
"file_id": "hil002", | |
"date": "2012-10-01", | |
"place": "Field Methods room", | |
"collector": "Di" | |
}, | |
{ | |
"comment": "really quiet", | |
"index": "003", | |
"analysis_status": "", | |
"language": "Hiligaynon (hil)", | |
"title": "Animals", | |
"mediatype": "audio", | |
"format": "wav", | |
"equipment": "Edirol", | |
"sample_rate": 44100.0, | |
"access": "", | |
"filename": "hil003_2012-10-01_JDL_Class_Animals.wav", | |
"eaf_filename": "hil003_2012-10-01_JDL_Class_Animals.eaf", | |
"genre": "", | |
"topic": "Animals", | |
"setting": "FM Class", | |
"speaker": "Joshua de Leon", | |
"file_id": "hil003", | |
"date": "2012-10-01", | |
"place": "Field Methods room", | |
"collector": "FM Class" | |
} | |
] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment