def read_info(self): ext2format = { 'doc': 'word', 'docx': 'word', 'pptx': 'ppt', } ext = get_ext(self.docpath) fmt = ext2format.get(ext, ext) info = { 'format': fmt, 'size': get_file_size(self.docpath), 'paths': [self.docpath], } return info
def get_reader(docpath): global EXT2READER return EXT2READER.get(get_ext(docpath).lower())