本文整理汇总了Python中settings.Settings.isShowArtistInBookList方法的典型用法代码示例。如果您正苦于以下问题:Python Settings.isShowArtistInBookList方法的具体用法?Python Settings.isShowArtistInBookList怎么用?Python Settings.isShowArtistInBookList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类settings.Settings
的用法示例。
在下文中一共展示了Settings.isShowArtistInBookList方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _loadDetailsFromFfmpeg
# 需要导入模块: from settings import Settings [as 别名]
# 或者: from settings.Settings import isShowArtistInBookList [as 别名]
def _loadDetailsFromFfmpeg(self, includeCover=True):
# check if the cover is required
coverTargetName = None
if includeCover:
coverTargetName = self._getMainCoverLocation()
info = self._runFFmpegCommand(self.filePath, coverTargetName)
# If we needed the cover, then save the details
if includeCover:
if xbmcvfs.exists(coverTargetName):
self.coverImage = coverTargetName
if info not in [None, ""]:
self.title = info['title']
# Check if the title should start with the artist name
if Settings.isShowArtistInBookList() and (self.title not in [None, ""]):
artist = info['artist']
if artist not in [None, ""]:
# Make sure the artist name is not already in the title
if (not self.title.startswith(artist)) and (not self.title.endswith(artist)):
try:
self.title = "%s - %s" % (artist, self.title)
except:
log("M4BHandler: Failed to add artist to title")
self.chapters = info['chapters']
self.totalDuration = info['duration']
示例2: _loadBookDetails
# 需要导入模块: from settings import Settings [as 别名]
# 或者: from settings.Settings import isShowArtistInBookList [as 别名]
def _loadBookDetails(self):
# List all the files in the directory, as that will be the chapters
dirs, files = xbmcvfs.listdir(self.filePath)
files.sort()
runningStartTime = 0
for audioFile in files:
if not Settings.isPlainAudioFile(audioFile):
continue
# Store this audio file in the chapter file list
fullpath = os_path_join(self.filePath, audioFile)
self.chapterFiles.append(fullpath)
# Make the call to metadata to get the details of the chapter
title, album, artist, duration = self._readMetaData(fullpath)
chapterTitle = None
endTime = 0
if self.title in [None, ""]:
if album not in [None, ""]:
self.title = album
# Check if the title should start with the artist name
if Settings.isShowArtistInBookList():
if artist not in [None, ""]:
# Make sure the artist name is not already in the title
if (not album.startswith(artist)) and (not album.endswith(artist)):
try:
self.title = "%s - %s" % (artist, album)
except:
log("FolderHandler: Failed to add artist to title")
if title not in [None, ""]:
chapterTitle = title
if duration not in [None, 0]:
endTime = runningStartTime + duration
if chapterTitle in [None, ""]:
# Now generate the name of the chapter from the audio file
sections = audioFile.split('.')
sections.pop()
# Replace the dots with spaces
chapterTitle = ' '.join(sections)
detail = {'title': chapterTitle, 'startTime': runningStartTime, 'endTime': endTime, 'duration': duration}
self.chapters.append(detail)
# Set the next start time to be after this chapter
runningStartTime = endTime
if runningStartTime > 0:
self.totalDuration = runningStartTime