'Generate the basic NCX file.
Generate the initial NCX, which is added to depending on included Sections.
Inputs:
None
Updated:
play_order (int)
Outputs:
ncx_soup (file): NCX foundation'

def generate_ncx_header(self):

    self.update_progress_full_step(_('NCX    header'))
    header = '\n                                                <?xml    version="1.0"    encoding="utf-8"?>\n                                                <ncx    xmlns="http://www.daisy.org/z3986/2005/ncx/"    xmlns:calibre="http://calibre.kovidgoyal.net/2009/metadata"    version="2005-1"    xml:lang="en">\n                                                </ncx>\n                                '
    soup = BeautifulStoneSoup(header, selfClosingTags=['content', 'calibre:meta-img'])
    ncx = soup.find('ncx')
    navMapTag = Tag(soup, 'navMap')
    if self.generate_for_kindle_mobi:
        navPointTag = Tag(soup, 'navPoint')
        navPointTag['class'] = 'periodical'
        navPointTag['id'] = 'title'
        navPointTag['playOrder'] = self.play_order
        self.play_order += 1
        navLabelTag = Tag(soup, 'navLabel')
        textTag = Tag(soup, 'text')
        textTag.insert(0, NavigableString(self.opts.catalog_title))
        navLabelTag.insert(0, textTag)
        navPointTag.insert(0, navLabelTag)
        if self.opts.generate_authors:
            contentTag = Tag(soup, 'content')
            contentTag['src'] = 'content/ByAlphaAuthor.html'
            navPointTag.insert(1, contentTag)
        elif self.opts.generate_titles:
            contentTag = Tag(soup, 'content')
            contentTag['src'] = 'content/ByAlphaTitle.html'
            navPointTag.insert(1, contentTag)
        elif self.opts.generate_series:
            contentTag = Tag(soup, 'content')
            contentTag['src'] = 'content/BySeries.html'
            navPointTag.insert(1, contentTag)
        elif self.opts.generate_genres:
            contentTag = Tag(soup, 'content')
            contentTag['src'] = ('%s' % self.genres[0]['file'])
            navPointTag.insert(1, contentTag)
        elif self.opts.generate_recently_added:
            contentTag = Tag(soup, 'content')
            contentTag['src'] = 'content/ByDateAdded.html'
            navPointTag.insert(1, contentTag)
        elif self.opts.generate_descriptions:
            contentTag = Tag(soup, 'content')
            contentTag['src'] = ('content/book_%d.html' % int(self.books_by_description[0]['id']))
            navPointTag.insert(1, contentTag)
        if self.generate_for_kindle_mobi:
            cmiTag = Tag(soup, ('%s' % 'calibre:meta-img'))
            cmiTag['id'] = 'mastheadImage'
            cmiTag['src'] = 'images/mastheadImage.gif'
            navPointTag.insert(2, cmiTag)
        navMapTag.insert(0, navPointTag)
    ncx.insert(0, navMapTag)
    self.ncx_soup = soup
