From 04569cb8e04732e2ec0b1cb053469d4c1879ecda Mon Sep 17 00:00:00 2001 From: Simon Bruder Date: Sun, 22 Dec 2019 16:29:00 +0000 Subject: [PATCH] Add option to get original page image --- backend.py | 4 ++-- mangareader.py | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/backend.py b/backend.py index 3466393..8321e76 100644 --- a/backend.py +++ b/backend.py @@ -219,7 +219,7 @@ class CalibreDB: with ZipFile(path, 'r') as volume: return len(volume.filelist) - def get_volume_page(self, volume_id, page_number): + def get_volume_page(self, volume_id, page_number, original=False): if page_number < 1: raise exceptions.NotFound() path = self.get_volume_filepath(volume_id) @@ -233,7 +233,7 @@ class CalibreDB: page_filename = zip_info.filename mimetype = mimetypes[os.path.splitext(page_filename)[1]] - if self.webp is True and mimetype != 'image/webp': + if self.webp is True and mimetype != 'image/webp' and original is False: mimetype = 'image/webp' try: diff --git a/mangareader.py b/mangareader.py index 49e6235..aa412d5 100755 --- a/mangareader.py +++ b/mangareader.py @@ -80,6 +80,11 @@ def get_volume_page(volume_id, page_number): page = db.get_volume_page(volume_id, page_number) return send_image(page) +@app.route('/api/volume//page//original') +def get_volume_page_original(volume_id, page_number): + page = db.get_volume_page(volume_id, page_number, original=True) + return send_image(page) + if __name__ == '__main__': app.run(host='0.0.0.0')