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


Python Settings.isShowArtistInBookList方法代码示例

本文整理汇总了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']
开发者ID:robwebset,项目名称:script.audiobooks,代码行数:31,代码来源:audiobook.py

示例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
开发者ID:robwebset,项目名称:script.audiobooks,代码行数:54,代码来源:audiobook.py


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