From 96d6018ecc591370d32b872cf6b8c82a29d1ba54 Mon Sep 17 00:00:00 2001 From: Ozzieisaacs Date: Sat, 23 May 2020 16:20:19 +0200 Subject: [PATCH] Added ability to view comicapi version Changed required comicapi version Unified "cannot" and "Cannot" texts Removed annoying "was already removed" string from log --- cps/comic.py | 8 ++++++-- cps/editbooks.py | 4 +--- cps/uploader.py | 12 ++++++------ optional-requirements.txt | 2 +- 4 files changed, 14 insertions(+), 12 deletions(-) diff --git a/cps/comic.py b/cps/comic.py index a96b732d..f6bf84b2 100644 --- a/cps/comic.py +++ b/cps/comic.py @@ -36,15 +36,19 @@ log = logger.create() try: from comicapi.comicarchive import ComicArchive, MetaDataStyle use_comic_meta = True + try: + from comicapi import __version__ as comic_version + except (ImportError): + comic_version = '' except ImportError as e: - log.debug('cannot import comicapi, extracting comic metadata will not work: %s', e) + log.debug('Cannot import comicapi, extracting comic metadata will not work: %s', e) import zipfile import tarfile try: import rarfile use_rarfile = True except ImportError as e: - log.debug('cannot import rarfile, extracting cover files from rar files will not work: %s', e) + log.debug('Cannot import rarfile, extracting cover files from rar files will not work: %s', e) use_rarfile = False use_comic_meta = False diff --git a/cps/editbooks.py b/cps/editbooks.py index cb9424a2..97f79771 100644 --- a/cps/editbooks.py +++ b/cps/editbooks.py @@ -280,10 +280,8 @@ def render_edit_book(book_id): if config.config_converterpath: allowed_conversion_formats = constants.EXTENSIONS_CONVERT.copy() for file in book.data: - try: + if file.format.lower() in allowed_conversion_formats: allowed_conversion_formats.remove(file.format.lower()) - except Exception: - log.warning('%s already removed from list.', file.format.lower()) if kepub_possible: allowed_conversion_formats.append('kepub') return render_title_template('book_edit.html', book=book, authors=author_names, cc=cc, diff --git a/cps/uploader.py b/cps/uploader.py index fe3b9b0a..1323e3d0 100644 --- a/cps/uploader.py +++ b/cps/uploader.py @@ -40,7 +40,7 @@ try: from wand.exceptions import PolicyError use_generic_pdf_cover = False except (ImportError, RuntimeError) as e: - log.debug('cannot import Image, generating pdf covers for pdf uploads will not work: %s', e) + log.debug('Cannot import Image, generating pdf covers for pdf uploads will not work: %s', e) use_generic_pdf_cover = True try: @@ -48,21 +48,21 @@ try: from PyPDF2 import __version__ as PyPdfVersion use_pdf_meta = True except ImportError as e: - log.debug('cannot import PyPDF2, extracting pdf metadata will not work: %s', e) + log.debug('Cannot import PyPDF2, extracting pdf metadata will not work: %s', e) use_pdf_meta = False try: from . import epub use_epub_meta = True except ImportError as e: - log.debug('cannot import epub, extracting epub metadata will not work: %s', e) + log.debug('Cannot import epub, extracting epub metadata will not work: %s', e) use_epub_meta = False try: from . import fb2 use_fb2_meta = True except ImportError as e: - log.debug('cannot import fb2, extracting fb2 metadata will not work: %s', e) + log.debug('Cannot import fb2, extracting fb2 metadata will not work: %s', e) use_fb2_meta = False try: @@ -70,7 +70,7 @@ try: from PIL import __version__ as PILversion use_PIL = True except ImportError as e: - log.debug('cannot import Pillow, using png and webp images as cover will not work: %s', e) + log.debug('Cannot import Pillow, using png and webp images as cover will not work: %s', e) use_PIL = False @@ -179,7 +179,7 @@ def get_versions(): else: PILVersion = u'not installed' if comic.use_comic_meta: - ComicVersion = u'installed' + ComicVersion = comic.comic_version or u'installed' else: ComicVersion = u'not installed' return {'Image Magick': IVersion, diff --git a/optional-requirements.txt b/optional-requirements.txt index d830e700..5cef4a05 100644 --- a/optional-requirements.txt +++ b/optional-requirements.txt @@ -31,7 +31,7 @@ rarfile>=2.7 # other natsort>=2.2.0,<7.1.0 -git+https://github.com/OzzieIsaacs/comicapi.git@15dff9ce4e1ffed29ba4a2feadfcdb6bed00bcad#egg=comicapi +git+https://github.com/OzzieIsaacs/comicapi.git@3e15b950b72724b1b8ca619c36580b5fbaba9784#egg=comicapi #Kobo integration jsonschema>=3.2.0,<3.3.0