def parse_metadata_line(self):
        if isinstance(self.metadata_line, dict):
            return self.metadata_line

        source = self.source
        if source is None:
            return None

        with open(source, 'r') as f:
            first_line = f.readline().strip()

        try:
            parsed_json = loads(first_line)
            if isinstance(parsed_json, dict):
                self.metadata_line = parsed_json
        except __HOLE__:
            if(constants.debug is True):
                print 'Could not parse JSON from first line: %s' % first_line
            pass
dataset/ETHPy150Open jmathai/elodie/elodie/media/text.py/Text.parse_metadata_line