mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-06-23 15:30:45 -04:00
MOBI metadata: Dont try to set metadata in textread files
This commit is contained in:
commit
d3ac5835a8
@ -91,6 +91,10 @@ class MetadataUpdater(object):
|
|||||||
self.stream = stream
|
self.stream = stream
|
||||||
data = self.data = StreamSlicer(stream)
|
data = self.data = StreamSlicer(stream)
|
||||||
self.type = data[60:68]
|
self.type = data[60:68]
|
||||||
|
|
||||||
|
if self.type != "BOOKMOBI":
|
||||||
|
return
|
||||||
|
|
||||||
self.nrecs, = unpack('>H', data[76:78])
|
self.nrecs, = unpack('>H', data[76:78])
|
||||||
record0 = self.record0 = self.record(0)
|
record0 = self.record0 = self.record(0)
|
||||||
self.encryption_type, = unpack('>H', record0[12:14])
|
self.encryption_type, = unpack('>H', record0[12:14])
|
||||||
@ -271,6 +275,11 @@ class MetadataUpdater(object):
|
|||||||
return StreamSlicer(self.stream, start, stop)
|
return StreamSlicer(self.stream, start, stop)
|
||||||
|
|
||||||
def update(self, mi):
|
def update(self, mi):
|
||||||
|
#print "self.type: %s" % self.type
|
||||||
|
if self.type != "BOOKMOBI":
|
||||||
|
raise MobiError("Setting metadata only supported for MOBI files of type 'BOOK'.\n"
|
||||||
|
"\tThis is a '%s' file of type '%s'" % (self.type[0:4], self.type[4:8]))
|
||||||
|
|
||||||
recs = []
|
recs = []
|
||||||
try:
|
try:
|
||||||
from calibre.ebooks.conversion.config import load_defaults
|
from calibre.ebooks.conversion.config import load_defaults
|
||||||
|
Loading…
x
Reference in New Issue
Block a user