当前位置: 首页>>代码示例>>Python>>正文


Python Settings.onlyShowWholeBookIfChapters方法代码示例

本文整理汇总了Python中settings.Settings.onlyShowWholeBookIfChapters方法的典型用法代码示例。如果您正苦于以下问题:Python Settings.onlyShowWholeBookIfChapters方法的具体用法?Python Settings.onlyShowWholeBookIfChapters怎么用?Python Settings.onlyShowWholeBookIfChapters使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在settings.Settings的用法示例。


在下文中一共展示了Settings.onlyShowWholeBookIfChapters方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: getChapterDetails

# 需要导入模块: from settings import Settings [as 别名]
# 或者: from settings.Settings import onlyShowWholeBookIfChapters [as 别名]
    def getChapterDetails(self):
        if self.book is None:
            return []

        # Keeping at the moment in comments as may be useful later
        # for chapter in book.chapters:
        #    log("*** ROB ***: Chanter Identifier %s" % str(chapter.identifier))
        #    log("*** ROB ***: Content %s" % str(chapter.read()))

        # Don't really need these 2
        # log("TOC title = %s" % str(bookFile.toc.title))
        # log("TOC author = %s" % str(bookFile.toc.authors))

        chapterDetails = []
        try:
            # Get all the chapters
            for navPoint in self.bookFile.toc.nav_map.nav_point:
                # Get each of the chapter labels
                for aLabelGroup in navPoint.labels:
                    if aLabelGroup not in [None, ""]:
                        for aLabel in aLabelGroup:
                            if aLabel not in [None, ""]:
                                log("EPubEBook: Adding chapter %s with src %s" % (aLabel, navPoint.src))
                                detail = {'title': aLabel.encode("utf-8"), 'link': navPoint.src}
                                chapterDetails.append(detail)
                                # Only need the first string for this label group
                                break
        except:
            log("EPubEBook: Failed to read chapter list %s with error: %s" % (self.filePath, traceback.format_exc()), xbmc.LOGERROR)

        # There may be the case that the user wants to display the entire book in one link
        # epub stores each chapter in an independent file, so we will need to join those
        # chapters into one record, so we use a special key for that
        if len(chapterDetails) > 0:
            if not Settings.onlyShowWholeBookIfChapters():
                detail = {'title': ADDON.getLocalizedString(32016), 'link': 'ENTIRE_BOOK'}
                chapterDetails.insert(0, detail)

        return chapterDetails
开发者ID:robwebset,项目名称:script.ebooks,代码行数:41,代码来源:ebook.py


注:本文中的settings.Settings.onlyShowWholeBookIfChapters方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。