mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
...
This commit is contained in:
parent
a9f0a04128
commit
c4ed54aaf1
@ -652,9 +652,26 @@ class Tag(object): # {{{
|
|||||||
|
|
||||||
INTERPRET_MAP = {
|
INTERPRET_MAP = {
|
||||||
'subchapter': {
|
'subchapter': {
|
||||||
21 : ('Parent chapter index', 'parent_index')
|
21 : ('Parent chapter index', 'parent_index'),
|
||||||
|
5 : ('Unknown (koffs)', 'koffs'),
|
||||||
},
|
},
|
||||||
|
|
||||||
|
'section' : {
|
||||||
|
6 : ('File Index', 'pos_fid'),
|
||||||
|
},
|
||||||
|
|
||||||
|
'section_with_subsections' : {
|
||||||
|
6 : ('File Index', 'pos_fid'),
|
||||||
|
22 : ('First subsection index', 'first_child_index'),
|
||||||
|
23 : ('Last subsection index', 'last_child_index'),
|
||||||
|
|
||||||
|
},
|
||||||
|
'subsection' : {
|
||||||
|
6 : ('File Index', 'pos_fid'),
|
||||||
|
21 : ('Parent section index', 'parent_index'),
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
'article' : {
|
'article' : {
|
||||||
5 : ('Class offset in cncx', 'class_offset'),
|
5 : ('Class offset in cncx', 'class_offset'),
|
||||||
21 : ('Parent section index', 'parent_index'),
|
21 : ('Parent section index', 'parent_index'),
|
||||||
@ -707,13 +724,17 @@ class Tag(object): # {{{
|
|||||||
try:
|
try:
|
||||||
self.desc, self.attr = td[tag_type]
|
self.desc, self.attr = td[tag_type]
|
||||||
except:
|
except:
|
||||||
print ('Unknown tag value: %d'%tag_type)
|
print ('Unknown tag value: %d in entry type: %s'%(tag_type,
|
||||||
|
entry_type))
|
||||||
self.desc = '??Unknown (tag value: %d type: %s)'%(
|
self.desc = '??Unknown (tag value: %d type: %s)'%(
|
||||||
tag_type, entry_type)
|
tag_type, entry_type)
|
||||||
self.attr = 'unknown'
|
self.attr = 'unknown'
|
||||||
if '_offset' in self.attr:
|
if '_offset' in self.attr:
|
||||||
self.cncx_value = cncx[self.value]
|
self.cncx_value = cncx[self.value]
|
||||||
|
|
||||||
|
if self.attr == 'pos_fid':
|
||||||
|
print (1111111, vals)
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
if self.cncx_value is not None:
|
if self.cncx_value is not None:
|
||||||
return '%s : %r [%r]'%(self.desc, self.value, self.cncx_value)
|
return '%s : %r [%r]'%(self.desc, self.value, self.cncx_value)
|
||||||
@ -738,6 +759,9 @@ class IndexEntry(object): # {{{
|
|||||||
0x0f : 'chapter',
|
0x0f : 'chapter',
|
||||||
0x6f : 'chapter_with_subchapters',
|
0x6f : 'chapter_with_subchapters',
|
||||||
0x1f : 'subchapter',
|
0x1f : 'subchapter',
|
||||||
|
0x8f : 'section',
|
||||||
|
0xef : 'section_with_subsections',
|
||||||
|
0x9f : 'subsection',
|
||||||
# Present in periodicals
|
# Present in periodicals
|
||||||
0xdf : 'periodical',
|
0xdf : 'periodical',
|
||||||
0xff : 'section',
|
0xff : 'section',
|
||||||
|
@ -105,9 +105,11 @@ def get_tag_map(control_byte_count, tags, data, start, end):
|
|||||||
if value != 0:
|
if value != 0:
|
||||||
if value == mask:
|
if value == mask:
|
||||||
if count_set_bits(mask) > 1:
|
if count_set_bits(mask) > 1:
|
||||||
# If all bits of masked value are set and the mask has more than one bit, a variable width value
|
# If all bits of masked value are set and the mask has more
|
||||||
# will follow after the control bytes which defines the length of bytes (NOT the value count!)
|
# than one bit, a variable width value will follow after
|
||||||
# which will contain the corresponding variable width values.
|
# the control bytes which defines the length of bytes (NOT
|
||||||
|
# the value count!) which will contain the corresponding
|
||||||
|
# variable width values.
|
||||||
value, consumed = decint(data[data_start:])
|
value, consumed = decint(data[data_start:])
|
||||||
data_start += consumed
|
data_start += consumed
|
||||||
ptags.append((tag, None, value, values_per_entry))
|
ptags.append((tag, None, value, values_per_entry))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user