From 1d83a6a898861e12115540dee5c2a5120571d2de Mon Sep 17 00:00:00 2001 From: cbartondock Date: Fri, 16 Oct 2020 11:51:59 -0400 Subject: [PATCH] distinguish convert from and convert to extensions --- cps/constants.py | 3 ++- cps/editbooks.py | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/cps/constants.py b/cps/constants.py index 89810e90..c1bcbe59 100644 --- a/cps/constants.py +++ b/cps/constants.py @@ -113,7 +113,8 @@ del env_CALIBRE_PORT EXTENSIONS_AUDIO = {'mp3', 'mp4', 'ogg', 'opus', 'wav', 'flac', 'm4a', 'm4b'} -EXTENSIONS_CONVERT = ['pdf', 'epub', 'mobi', 'azw3', 'docx', 'rtf', 'fb2', 'lit', 'lrf', 'txt', 'htmlz', 'rtf', 'odt'] +EXTENSIONS_CONVERT_FROM = ['pdf', 'epub', 'mobi', 'azw3', 'docx', 'rtf', 'fb2', 'lit', 'lrf', 'txt', 'htmlz', 'rtf', 'odt','cbz','cbr'] +EXTENSIONS_CONVERT_TO = ['pdf', 'epub', 'mobi', 'azw3', 'docx', 'rtf', 'fb2', 'lit', 'lrf', 'txt', 'htmlz', 'rtf', 'odt'] EXTENSIONS_UPLOAD = {'txt', 'pdf', 'epub', 'kepub', 'mobi', 'azw', 'azw3', 'cbr', 'cbz', 'cbt', 'djvu', 'prc', 'doc', 'docx', 'fb2', 'html', 'rtf', 'lit', 'odt', 'mp3', 'mp4', 'ogg', 'opus', 'wav', 'flac', 'm4a', 'm4b'} diff --git a/cps/editbooks.py b/cps/editbooks.py index 7f7764e5..be9adc55 100644 --- a/cps/editbooks.py +++ b/cps/editbooks.py @@ -308,7 +308,7 @@ def render_edit_book(book_id): kepub_possible=None if config.config_converterpath: for file in book.data: - if file.format.lower() in constants.EXTENSIONS_CONVERT: + if file.format.lower() in constants.EXTENSIONS_CONVERT_FROM: valid_source_formats.append(file.format.lower()) if config.config_kepubifypath and 'epub' in [file.format.lower() for file in book.data]: kepub_possible = True @@ -317,7 +317,7 @@ def render_edit_book(book_id): # Determine what formats don't already exist if config.config_converterpath: - allowed_conversion_formats = constants.EXTENSIONS_CONVERT[:] + allowed_conversion_formats = constants.EXTENSIONS_CONVERT_TO[:] for file in book.data: if file.format.lower() in allowed_conversion_formats: allowed_conversion_formats.remove(file.format.lower())