mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
E-book viewer: When reading a MOBI file that is actually a KF8 book, show the format as being KF8
This commit is contained in:
parent
3a986cfd43
commit
9bb9ad53f1
@ -32,6 +32,7 @@ class MOBIInput(InputFormatPlugin):
|
||||
|
||||
def convert(self, stream, options, file_ext, log,
|
||||
accelerators):
|
||||
self.is_kf8 = False
|
||||
|
||||
if os.environ.get('USE_MOBIUNPACK', None) is not None:
|
||||
pos = stream.tell()
|
||||
@ -62,6 +63,7 @@ class MOBIInput(InputFormatPlugin):
|
||||
mr = Mobi8Reader(mr, log)
|
||||
opf = os.path.abspath(mr())
|
||||
self.encrypted_fonts = mr.encrypted_fonts
|
||||
self.is_kf8 = True
|
||||
return opf
|
||||
|
||||
raw = parse_cache.pop('calibre_raw_mobi_markup', False)
|
||||
|
@ -217,6 +217,10 @@ class EbookIterator(object):
|
||||
if hasattr(self.pathtoopf, 'manifest'):
|
||||
self.pathtoopf = write_oebbook(self.pathtoopf, self.base)
|
||||
|
||||
self.book_format = os.path.splitext(self.pathtoebook)[1][1:].upper()
|
||||
if getattr(plumber.input_plugin, 'is_kf8', False):
|
||||
self.book_format = 'KF8'
|
||||
|
||||
self.opf = getattr(plumber.input_plugin, 'optimize_opf_parsing', None)
|
||||
if self.opf is None:
|
||||
self.opf = OPF(self.pathtoopf, os.path.dirname(self.pathtoopf))
|
||||
|
@ -822,7 +822,8 @@ class EbookViewer(MainWindow, Ui_EbookViewer):
|
||||
as_unicode(r), det_msg=worker.traceback, show=True)
|
||||
self.close_progress_indicator()
|
||||
else:
|
||||
self.metadata.show_opf(self.iterator.opf, os.path.splitext(pathtoebook)[1][1:])
|
||||
self.metadata.show_opf(self.iterator.opf,
|
||||
self.iterator.book_format)
|
||||
self.view.current_language = self.iterator.language
|
||||
title = self.iterator.opf.title
|
||||
if not title:
|
||||
@ -849,7 +850,7 @@ class EbookViewer(MainWindow, Ui_EbookViewer):
|
||||
self.current_book_has_toc = bool(self.iterator.toc)
|
||||
self.current_title = title
|
||||
self.setWindowTitle(self.base_window_title+' - '+title +
|
||||
' [%s]'%os.path.splitext(pathtoebook)[1][1:].upper())
|
||||
' [%s]'%self.iterator.book_format)
|
||||
self.pos.setMaximum(sum(self.iterator.pages))
|
||||
self.pos.setSuffix(' / %d'%sum(self.iterator.pages))
|
||||
self.vertical_scrollbar.setMinimum(100)
|
||||
|
Loading…
x
Reference in New Issue
Block a user