Add option to get original page image
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
14673733e3
commit
04569cb8e0
|
@ -219,7 +219,7 @@ class CalibreDB:
|
||||||
with ZipFile(path, 'r') as volume:
|
with ZipFile(path, 'r') as volume:
|
||||||
return len(volume.filelist)
|
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:
|
if page_number < 1:
|
||||||
raise exceptions.NotFound()
|
raise exceptions.NotFound()
|
||||||
path = self.get_volume_filepath(volume_id)
|
path = self.get_volume_filepath(volume_id)
|
||||||
|
@ -233,7 +233,7 @@ class CalibreDB:
|
||||||
page_filename = zip_info.filename
|
page_filename = zip_info.filename
|
||||||
mimetype = mimetypes[os.path.splitext(page_filename)[1]]
|
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'
|
mimetype = 'image/webp'
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
|
|
@ -80,6 +80,11 @@ def get_volume_page(volume_id, page_number):
|
||||||
page = db.get_volume_page(volume_id, page_number)
|
page = db.get_volume_page(volume_id, page_number)
|
||||||
return send_image(page)
|
return send_image(page)
|
||||||
|
|
||||||
|
@app.route('/api/volume/<int:volume_id>/page/<int:page_number>/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__':
|
if __name__ == '__main__':
|
||||||
app.run(host='0.0.0.0')
|
app.run(host='0.0.0.0')
|
||||||
|
|
Reference in a new issue