def process(tmp_file_path, original_file_name, original_file_extension): try: if ".PDF" == original_file_extension.upper(): return pdf_meta(tmp_file_path, original_file_name, original_file_extension) if ".EPUB" == original_file_extension.upper() and use_epub_meta == True: return epub.get_epub_info(tmp_file_path, original_file_name, original_file_extension) if ".FB2" == original_file_extension.upper() and use_fb2_meta == True: return fb2.get_fb2_info(tmp_file_path, original_file_name, original_file_extension) except Exception, e: logger.warning('cannot parse metadata, using default: %s', e)
def process(tmp_file_path, original_file_name, original_file_extension): try: if ".PDF" == original_file_extension.upper(): return pdf_meta(tmp_file_path, original_file_name, original_file_extension) if ".EPUB" == original_file_extension.upper( ) and use_epub_meta == True: return epub.get_epub_info(tmp_file_path, original_file_name, original_file_extension) if ".FB2" == original_file_extension.upper() and use_fb2_meta == True: return fb2.get_fb2_info(tmp_file_path, original_file_name, original_file_extension) except Exception, e: logger.warning('cannot parse metadata, using default: %s', e)
def process(tmp_file_path, original_file_name, original_file_extension): meta = None try: if ".PDF" == original_file_extension.upper(): meta = pdf_meta(tmp_file_path, original_file_name, original_file_extension) if ".EPUB" == original_file_extension.upper() and use_epub_meta is True: meta = epub.get_epub_info(tmp_file_path, original_file_name, original_file_extension) if ".FB2" == original_file_extension.upper() and use_fb2_meta is True: meta = fb2.get_fb2_info(tmp_file_path, original_file_extension) except Exception as e: logger.warning('cannot parse metadata, using default: %s', e) if meta and meta.title.strip() and meta.author.strip(): return meta else: return default_meta(tmp_file_path, original_file_name, original_file_extension)
def process(tmp_file_path, original_file_name, original_file_extension): meta = None try: if ".PDF" == original_file_extension.upper(): meta = pdf_meta(tmp_file_path, original_file_name, original_file_extension) if ".EPUB" == original_file_extension.upper() and use_epub_meta is True: meta = epub.get_epub_info(tmp_file_path, original_file_name, original_file_extension) if ".FB2" == original_file_extension.upper() and use_fb2_meta is True: meta = fb2.get_fb2_info(tmp_file_path, original_file_extension) if original_file_extension.upper() in ['.CBZ', '.CBT']: meta = comic.get_comic_info(tmp_file_path, original_file_name, original_file_extension) except Exception as ex: logger.warning('cannot parse metadata, using default: %s', ex) if meta and meta.title.strip() and meta.author.strip(): return meta else: return default_meta(tmp_file_path, original_file_name, original_file_extension)