mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-08 02:34:06 -04:00
Remove ununsed vars from mobi.py
This commit is contained in:
parent
9ba8790663
commit
0a73a7cf51
@ -17,7 +17,7 @@ from calibre.ebooks.mobi import MobiError
|
||||
from calibre.ebooks.mobi.writer import rescale_image, MAX_THUMB_DIMEN
|
||||
from calibre.ebooks.mobi.langcodes import iana2mobi
|
||||
|
||||
import struct, traceback
|
||||
import struct
|
||||
|
||||
class StreamSlicer(object):
|
||||
|
||||
@ -90,7 +90,7 @@ class MetadataUpdater(object):
|
||||
def __init__(self, stream):
|
||||
self.stream = stream
|
||||
data = self.data = StreamSlicer(stream)
|
||||
type = self.type = data[60:68]
|
||||
self.type = data[60:68]
|
||||
self.nrecs, = unpack('>H', data[76:78])
|
||||
record0 = self.record0 = self.record(0)
|
||||
self.encryption_type, = unpack('>H', record0[12:14])
|
||||
@ -148,7 +148,6 @@ class MetadataUpdater(object):
|
||||
# record1 offset will be offset of record0 + len(new_record0)
|
||||
updated_pdbrecords = [self.pdbrecords[0][0]]
|
||||
record0_offset = self.pdbrecords[0][0]
|
||||
current_offset = self.pdbrecords[1][0]
|
||||
updated_offset = record0_offset + len(new_record0)
|
||||
|
||||
for i in range(1,self.nrecs-1):
|
||||
@ -175,10 +174,6 @@ class MetadataUpdater(object):
|
||||
self.data.stop = updated_pdbrecords[-1] + record_sizes[-1]
|
||||
|
||||
def patchSection(self, section, new):
|
||||
if (section + 1 == self.nrecs):
|
||||
endoff = len(self.stream)
|
||||
else:
|
||||
endoff = self.pdbrecords[section + 1][0]
|
||||
off = self.pdbrecords[section][0]
|
||||
self.patch(off, new)
|
||||
|
||||
@ -325,7 +320,6 @@ class MetadataUpdater(object):
|
||||
exth = ['EXTH', pack('>II', len(exth) + 12, len(recs)), exth, pad]
|
||||
exth = ''.join(exth)
|
||||
|
||||
title = (mi.title or _('Unknown')).encode(self.codec, 'replace')
|
||||
if getattr(self, 'exth', None) is None:
|
||||
raise MobiError('No existing EXTH record. Cannot update metadata.')
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user