mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
MOBI Metadata: Add 113 record for ebooks when editing metadata if it does not exist.
This commit is contained in:
parent
80ec48e50b
commit
bd6cb6e694
@ -271,11 +271,11 @@ class MetadataUpdater(object):
|
|||||||
FILTER=''.join([(len(repr(chr(x)))==3) and chr(x) or '.' for x in range(256)])
|
FILTER=''.join([(len(repr(chr(x)))==3) and chr(x) or '.' for x in range(256)])
|
||||||
N=0; result=''
|
N=0; result=''
|
||||||
while src:
|
while src:
|
||||||
s,src = src[:length],src[length:]
|
s,src = src[:length],src[length:]
|
||||||
hexa = ' '.join(["%02X"%ord(x) for x in s])
|
hexa = ' '.join(["%02X"%ord(x) for x in s])
|
||||||
s = s.translate(FILTER)
|
s = s.translate(FILTER)
|
||||||
result += "%04X %-*s %s\n" % (N, length*3, hexa, s)
|
result += "%04X %-*s %s\n" % (N, length*3, hexa, s)
|
||||||
N+=length
|
N+=length
|
||||||
print result
|
print result
|
||||||
|
|
||||||
def get_pdbrecords(self):
|
def get_pdbrecords(self):
|
||||||
@ -370,6 +370,9 @@ class MetadataUpdater(object):
|
|||||||
update_exth_record((203, pack('>I', 0)))
|
update_exth_record((203, pack('>I', 0)))
|
||||||
if self.thumbnail_record is not None:
|
if self.thumbnail_record is not None:
|
||||||
update_exth_record((202, pack('>I', self.thumbnail_rindex)))
|
update_exth_record((202, pack('>I', self.thumbnail_rindex)))
|
||||||
|
if 113 not in self.original_exth_records and 501 in self.original_exth_records and self.original_exth_records[501] == 'EBOK' and not recs.has_key(501):
|
||||||
|
from uuid import uuid4
|
||||||
|
update_exth_record((113, str(uuid4())))
|
||||||
if 503 in self.original_exth_records:
|
if 503 in self.original_exth_records:
|
||||||
update_exth_record((503, mi.title.encode(self.codec, 'replace')))
|
update_exth_record((503, mi.title.encode(self.codec, 'replace')))
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user