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


Python util.gather_subtitle_files函数代码示例

本文整理汇总了Python中miro.util.gather_subtitle_files函数的典型用法代码示例。如果您正苦于以下问题:Python gather_subtitle_files函数的具体用法?Python gather_subtitle_files怎么用?Python gather_subtitle_files使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: get_subtitles

    def get_subtitles(self):
        """Returns a dict of index -> (language, filename) for available
        tracks.
        """
        if not self.playbin or not self.supports_subtitles:
            return {}

        tracks = {}

        if self.playbin.get_property("suburi") is None:
            # Don't list subtitle tracks that we're getting from an SRT file
            for track_index in range(self.playbin.get_property("n-text")):
                track_name = self._get_subtitle_track_name(track_index)
                if track_name is None:
                    track_name = _("Track %(tracknumber)d",
                                   {"tracknumber": track_index})
                tracks[track_index] = (track_name, None)

        files = gather_subtitle_files(self.iteminfo.video_path)

        external_track_id = 100
        for i, mem in enumerate(files):
            track_name = self._get_subtitle_file_name(mem)
            if track_name is None:
                track_name = _("Subtitle file %(tracknumber)d",
                               {"tracknumber": i})
            tracks[external_track_id + i] = (track_name, mem)

        return tracks
开发者ID:codito,项目名称:miro,代码行数:29,代码来源:gstreamerrenderer.py

示例2: test_lots_of_files

    def test_lots_of_files(self):
        movie_file, sub_files = self.create_files(
            "foo.mov", ["foo.en.srt", "blah.ogv", "foo.ogv"])

        # weed out the non-srt files so we can test correctly
        sub_files = [mem for mem in sub_files if mem.endswith(".srt")]
        self.assertEquals(
            sub_files, util.gather_subtitle_files(FilenameType(movie_file)))
开发者ID:codito,项目名称:miro,代码行数:8,代码来源:utiltest.py

示例3: test_filename_possibilities

    def test_filename_possibilities(self):
        movie_file, sub_files = self.create_files(
            "foo.mov", ["foo.en.srt", "foo.en.sub", "foo.srt", "foo.sub"])

        self.assertEquals(
            sub_files, util.gather_subtitle_files(FilenameType(movie_file)))
开发者ID:codito,项目名称:miro,代码行数:6,代码来源:utiltest.py

示例4: test_subtitles_dir

 def test_subtitles_dir(self):
     movie_file, sub_files = self.create_files(
         "foo.mov", [os.path.join("subtitles", "foo.en.srt"),
                     os.path.join("subtitles", "foo.fr.srt")])
     self.assertEquals(
         sub_files, util.gather_subtitle_files(FilenameType(movie_file)))
开发者ID:codito,项目名称:miro,代码行数:6,代码来源:utiltest.py

示例5: test_multiple_files

 def test_multiple_files(self):
     movie_file, sub_files = self.create_files(
         "foo.mov", ["foo.en.srt", "foo.fr.srt", "foo.es.srt"])
     self.assertEquals(
         sub_files, util.gather_subtitle_files(FilenameType(movie_file)))
开发者ID:codito,项目名称:miro,代码行数:5,代码来源:utiltest.py

示例6: test_no_subtitle_files

 def test_no_subtitle_files(self):
     movie_file, sub_files = self.create_files("foo.mov")
     self.assertEquals(
         sub_files, util.gather_subtitle_files(FilenameType(movie_file)))
开发者ID:codito,项目名称:miro,代码行数:4,代码来源:utiltest.py

示例7: test_no_directory

 def test_no_directory(self):
     # tests the case where the foofeed directory doesn't exist
     movie_file = os.path.join(self.tempdir, "foofeed", "foo.mov")
     self.assertEquals(
         [], util.gather_subtitle_files(FilenameType(movie_file)))
开发者ID:codito,项目名称:miro,代码行数:5,代码来源:utiltest.py


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