mirror of
git://github.com/kovidgoyal/calibre.git
synced 2026-01-26 14:05:11 +01:00
Better error message for text less DJVU files
This commit is contained in:
parent
bb733041cc
commit
f040283261
1 changed files with 5 additions and 1 deletions
|
|
@ -28,8 +28,12 @@ def convert(self, stream, options, file_ext, log, accelerators):
|
|||
from calibre.ebooks.djvu.djvu import DJVUFile
|
||||
x = DJVUFile(stream)
|
||||
x.get_text(stdout)
|
||||
raw_text = stdout.getvalue()
|
||||
if not raw_text:
|
||||
raise ValueError('The DJVU file contains no text, only images, probably page scans.'
|
||||
' calibre only supports conversion of DJVU files with actual text in them.')
|
||||
|
||||
html = convert_basic(stdout.getvalue().replace(b"\n", b' ').replace(
|
||||
html = convert_basic(raw_text.replace(b"\n", b' ').replace(
|
||||
b'\037', b'\n\n'))
|
||||
# Run the HTMLized text through the html processing plugin.
|
||||
from calibre.customize.ui import plugin_for_input_format
|
||||
|
|
|
|||
Loading…
Reference in a new issue