def extract_metadata(filepath, filect): mdextractor = MetadataExtractor() try: return mdextractor.from_file(filepath, filect) except Exception as ex: LOG.warn("Couldn't extract metadata from file: %s : %s", filepath, repr(ex)) raise
def test_csv_extract(self): mdextractor = MetadataExtractor() md = mdextractor.from_file( resource_filename(__name__, 'occur_utf8.csv'), 'text/csv') expect = { 'bounds': {'bottom': -21.783, 'left': 114.166, 'right': 145.85, 'top': -5.166}, 'headers': [ u'species', u'lon', u'lat', u'uncertainty', u'date', u'year', u'month'], 'rows': 2, 'species': [u'Pt\xe9ria penguin', u'Pteria penguin'] } self.assertEqual(md, expect)