本文整理汇总了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