From e2785c39859cb318c7ef8d1513f9f99aae6bc01f Mon Sep 17 00:00:00 2001 From: Ozzie Isaacs Date: Sat, 15 Apr 2023 15:25:46 +0200 Subject: [PATCH] Added djv file format to djvu reader --- cps/constants.py | 2 +- cps/helper.py | 2 +- cps/templates/readdjvu.html | 2 +- cps/web.py | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/cps/constants.py b/cps/constants.py index 7d6d0416..069630b6 100644 --- a/cps/constants.py +++ b/cps/constants.py @@ -147,7 +147,7 @@ EXTENSIONS_CONVERT_FROM = ['pdf', 'epub', 'mobi', 'azw3', 'docx', 'rtf', 'fb2', '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', +EXTENSIONS_UPLOAD = {'txt', 'pdf', 'epub', 'kepub', 'mobi', 'azw', 'azw3', 'cbr', 'cbz', 'cbt', 'djvu', 'djv', 'prc', 'doc', 'docx', 'fb2', 'html', 'rtf', 'lit', 'odt', 'mp3', 'mp4', 'ogg', 'opus', 'wav', 'flac', 'm4a', 'm4b'} diff --git a/cps/helper.py b/cps/helper.py index 9871af0c..be0323a2 100644 --- a/cps/helper.py +++ b/cps/helper.py @@ -191,7 +191,7 @@ def check_send_to_ereader(entry): # Check if a reader is existing for any of the book formats, if not, return empty list, otherwise return # list with supported formats def check_read_formats(entry): - extensions_reader = {'TXT', 'PDF', 'EPUB', 'CBZ', 'CBT', 'CBR', 'DJVU'} + extensions_reader = {'TXT', 'PDF', 'EPUB', 'CBZ', 'CBT', 'CBR', 'DJVU', 'DJV'} book_formats = list() if len(entry.data): for ele in iter(entry.data): diff --git a/cps/templates/readdjvu.html b/cps/templates/readdjvu.html index 2fcfe052..bdc3ef95 100644 --- a/cps/templates/readdjvu.html +++ b/cps/templates/readdjvu.html @@ -18,6 +18,6 @@ -
+
diff --git a/cps/web.py b/cps/web.py index 4660406e..ad825f02 100755 --- a/cps/web.py +++ b/cps/web.py @@ -1540,9 +1540,9 @@ def read_book(book_id, book_format): elif book_format.lower() == "txt": log.debug("Start txt reader for %d", book_id) return render_title_template('readtxt.html', txtfile=book_id, title=book.title) - elif book_format.lower() == "djvu": + elif book_format.lower() in ["djvu", "djv"]: log.debug("Start djvu reader for %d", book_id) - return render_title_template('readdjvu.html', djvufile=book_id, title=book.title) + return render_title_template('readdjvu.html', djvufile=book_id, title=book.title, extension=book_format.lower()) else: for fileExt in constants.EXTENSIONS_AUDIO: if book_format.lower() == fileExt: