'Add Genres to the basic NCX file.
Generate the Genre NCX content, add to self.ncx_soup.
Inputs:
genres (list)
Updated:
play_order (int)
Outputs:
ncx_soup (file): updated'

def generate_ncx_by_genre(self, tocTitle):

    self.update_progress_full_step(_('NCX    for    genres'))
    if (not len(self.genres)):
        self.opts.log.warn('    No    genres    found\n    No    Genre    section    added    to    Catalog')
        return
    ncx_soup = self.ncx_soup
    if self.generate_for_kindle_mobi:
        body = ncx_soup.find('navPoint')
    else:
        body = ncx_soup.find('navMap')
    btc = len(body.contents)
    navPointTag = Tag(ncx_soup, 'navPoint')
    if self.generate_for_kindle_mobi:
        navPointTag['class'] = 'section'
    file_ID = ('%s' % tocTitle.lower())
    file_ID = file_ID.replace('    ', '')
    navPointTag['id'] = ('%s-ID' % file_ID)
    navPointTag['playOrder'] = self.play_order
    self.play_order += 1
    navLabelTag = Tag(ncx_soup, 'navLabel')
    textTag = Tag(ncx_soup, 'text')
    section_header = ('%s    [%d]' % (tocTitle, len(self.genres)))
    if self.generate_for_kindle_mobi:
        section_header = tocTitle
    textTag.insert(0, NavigableString(section_header))
    navLabelTag.insert(0, textTag)
    nptc = 0
    navPointTag.insert(nptc, navLabelTag)
    nptc += 1
    contentTag = Tag(ncx_soup, 'content')
    contentTag['src'] = ('content/Genre_%s.html#section_start' % self.genres[0]['tag'])
    navPointTag.insert(nptc, contentTag)
    nptc += 1
    for genre in self.genres:
        navPointVolumeTag = Tag(ncx_soup, 'navPoint')
        if self.generate_for_kindle_mobi:
            navPointVolumeTag['class'] = 'article'
        navPointVolumeTag['id'] = ('genre-%s-ID' % genre['tag'])
        navPointVolumeTag['playOrder'] = self.play_order
        self.play_order += 1
        navLabelTag = Tag(ncx_soup, 'navLabel')
        textTag = Tag(ncx_soup, 'text')
        normalized_tag = None
        for friendly_tag in self.genre_tags_dict:
            if (self.genre_tags_dict[friendly_tag] == genre['tag']):
                normalized_tag = self.genre_tags_dict[friendly_tag]
                break
        textTag.insert(0, self.format_ncx_text(NavigableString(friendly_tag), dest='description'))
        navLabelTag.insert(0, textTag)
        navPointVolumeTag.insert(0, navLabelTag)
        contentTag = Tag(ncx_soup, 'content')
        contentTag['src'] = ('content/Genre_%s.html#Genre_%s' % (normalized_tag, normalized_tag))
        navPointVolumeTag.insert(1, contentTag)
        if self.generate_for_kindle_mobi:
            cmTag = Tag(ncx_soup, ('%s' % 'calibre:meta'))
            cmTag['name'] = 'author'
            if (len(genre['titles_spanned']) > 1):
                author_range = ('%s    -    %s' % (genre['titles_spanned'][0][0], genre['titles_spanned'][1][0]))
            else:
                author_range = ('%s' % genre['titles_spanned'][0][0])
            cmTag.insert(0, NavigableString(author_range))
            navPointVolumeTag.insert(2, cmTag)
            cmTag = Tag(ncx_soup, ('%s' % 'calibre:meta'))
            cmTag['name'] = 'description'
            if False:
                if (len(genre['titles_spanned']) > 1):
                    title_range = ('%s    -\n%s' % (genre['titles_spanned'][0][1], genre['titles_spanned'][1][1]))
                else:
                    title_range = ('%s' % genre['titles_spanned'][0][1])
                cmTag.insert(0, NavigableString(self.format_ncx_text(title_range, dest='description')))
            else:
                titles = []
                for title in genre['books']:
                    titles.append(title['title'])
                titles = sorted(titles, key=(lambda x: (self.generate_sort_title(x), self.generate_sort_title(x))))
                titles_list = self.generate_short_description(u'    &bull;    '.join(titles), dest='description')
                cmTag.insert(0, NavigableString(self.format_ncx_text(titles_list, dest='description')))
            navPointVolumeTag.insert(3, cmTag)
        navPointTag.insert(nptc, navPointVolumeTag)
        nptc += 1
    body.insert(btc, navPointTag)
    btc += 1
    self.ncx_soup = ncx_soup
