# Path: resources/lib/kindleunpack/compatibility_utils.py
# PY2 = sys.version_info[0] == 2
# 
# def bchr(s):
#     return bytes([s])
# 
# def bstr(s):
#     if isinstance(s, str):
#         return bytes(s, 'latin-1')
#     else:
#         return bytes(s)
# 
# def bord(s):
#     return s
# 
# Path: resources/lib/kindleunpack/mobi_utils.py
# def toHex(byteList):
#     return binascii.hexlify(byteList)


from .compatibility_utils import PY2, bchr, bstr, bord
from .mobi_utils import toHex
import struct
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# vim:ts=4:sw=4:softtabstop=4:smarttab:expandtab

from __future__ import unicode_literals, division, absolute_import, print_function

if PY2:
    range = xrange

# note:  struct pack, unpack, unpack_from all require bytestring format
# data all the way up to at least python 2.7.5, python 3 okay with bytestring


class MobiIndex:

    def __init__(self, sect, DEBUG=False):
        self.sect = sect
        self.DEBUG = DEBUG

    def getIndexData(self, idx, label="Unknown"):
        sect = self.sect
        outtbl = []
        ctoc_text = {}
        if idx != 0xffffffff:

# Path: resources/lib/kindleunpack/compatibility_utils.py
# PY2 = sys.version_info[0] == 2
# 
# def bchr(s):
#     return bytes([s])
# 
# def bstr(s):
#     if isinstance(s, str):
#         return bytes(s, 'latin-1')
#     else:
#         return bytes(s)
# 
# def bord(s):
#     return s
# 
# Path: resources/lib/kindleunpack/mobi_utils.py
# def toHex(byteList):
#     return binascii.hexlify(byteList)


# Path: resources/lib/kindleunpack/mobi_index.py
from .compatibility_utils import PY2, bchr, bstr, bord
from .mobi_utils import toHex
import struct

#!/usr/bin/env python
# -*- coding: utf-8 -*-
# vim:ts=4:sw=4:softtabstop=4:smarttab:expandtab

from __future__ import unicode_literals, division, absolute_import, print_function

if PY2:
    range = xrange

# note:  struct pack, unpack, unpack_from all require bytestring format
# data all the way up to at least python 2.7.5, python 3 okay with bytestring


class MobiIndex:

    def __init__(self, sect, DEBUG=False):
        self.sect = sect
        self.DEBUG = DEBUG

    def getIndexData(self, idx, label="Unknown"):
        sect = self.sect
        outtbl = []
        ctoc_text = {}
        if idx != 0xffffffff:

            sect.setsectiondescription(idx,"{0} Main INDX section".format(label))