Ejemplo n.º 1
0
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
Ejemplo n.º 2
0
 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)