mirror of
git://github.com/kovidgoyal/calibre.git
synced 2026-05-09 11:14:02 +02:00
Nicer error message when user tries to convert/view a Topaz book with a .prc extension
This commit is contained in:
parent
90446f0632
commit
78339374d8
1 changed files with 3 additions and 1 deletions
|
|
@ -254,6 +254,8 @@ def __init__(self, filename_or_stream, log, user_encoding=None, debug=None,
|
|||
stream = open(filename_or_stream, 'rb')
|
||||
|
||||
raw = stream.read()
|
||||
if raw.startswith('TPZ'):
|
||||
raise ValueError(_('This is an Amazon Topaz book. It cannot be processed.'))
|
||||
|
||||
self.header = raw[0:72]
|
||||
self.name = self.header[:32].replace('\x00', '')
|
||||
|
|
@ -261,7 +263,7 @@ def __init__(self, filename_or_stream, log, user_encoding=None, debug=None,
|
|||
|
||||
self.ident = self.header[0x3C:0x3C + 8].upper()
|
||||
if self.ident not in ['BOOKMOBI', 'TEXTREAD']:
|
||||
raise MobiError('Unknown book type: %s' % self.ident)
|
||||
raise MobiError('Unknown book type: %s' % repr(self.ident))
|
||||
|
||||
self.sections = []
|
||||
self.section_headers = []
|
||||
|
|
|
|||
Loading…
Reference in a new issue