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


Python Settings.isPlainAudioFile方法代码示例

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


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

示例1: _loadBookDetails

# 需要导入模块: from settings import Settings [as 别名]
# 或者: from settings.Settings import isPlainAudioFile [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

示例2: _isAudioBookDir

# 需要导入模块: from settings import Settings [as 别名]
# 或者: from settings.Settings import isPlainAudioFile [as 别名]
    def _isAudioBookDir(self, fullDir):
        # Check to see if this directory contains audio files (non m4b), if it does then we construct the
        # book using each audio file file as a chapter
        dirs, files = xbmcvfs.listdir(fullDir)

        containsMP3 = False
        for aFile in files:
            if Settings.isPlainAudioFile(aFile):
                log("AudioBooksPlugin: Directory contains MP3 files: %s" % fullDir)
                containsMP3 = True
                break

        return containsMP3
开发者ID:pospon,项目名称:script.audiobooks,代码行数:15,代码来源:plugin.py

示例3: _loadDetailsFromFfmpeg

# 需要导入模块: from settings import Settings [as 别名]
# 或者: from settings.Settings import isPlainAudioFile [as 别名]
    def _loadDetailsFromFfmpeg(self, includeCover=True):
        # List all the files in the directory, as that will be the chapters
        dirs, files = xbmcvfs.listdir(self.filePath)
        files.sort()

        # Check if the cover image is required
        coverTargetName = None
        if includeCover and (self.coverImage in [None, ""]):
            coverTargetName = self._getMainCoverLocation()

        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 ffmpeg to get the details of the chapter
            info = self._runFFmpegCommand(fullpath, coverTargetName)

            # If we needed the cover, then save the details
            if coverTargetName not in [None, ""]:
                if xbmcvfs.exists(coverTargetName):
                    self.coverImage = coverTargetName
                    # Clear the cover image flag so we do not get it again
                    coverTargetName = None

            duration = 0
            chapterTitle = None
            endTime = 0
            if info not in [None, ""]:
                if self.title in [None, ""]:
                    self.title = info['album']

                    # Check if the title should start with the artist name
                    if Settings.isShowArtistInBookList():
                        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("FolderHandler: Failed to add artist to title")

                duration = info['duration']
                chapterTitle = info['title']
                if duration not in [None, 0]:
                    endTime = runningStartTime + info['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,代码行数:68,代码来源:audiobook.py


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