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


Python Configuration.modify_racestart方法代码示例

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


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

示例1: edit_racestart

# 需要导入模块: from Configuration import Configuration [as 别名]
# 或者: from Configuration.Configuration import modify_racestart [as 别名]
    def edit_racestart(cls, previous_file):
        """
        Updates the race start parameters in the configuration
        file and builds a test video.
        """
        try:
            print(
                "Editing configuration file {}".format(
                    previous_file))

            config = Configuration(previous_file)
            config.modify_racestart()

            print(
                "Creating low-quality video as {}".format(
                    config.output_video))
            print(
                "If video trimming needs to be adjusted, run the ",
                "Project CARS Replay Enhancer with the `-t` option.")
            print("\n")
            print(
                "To synchronize telemetry with video, run the ",
                "Project CARS Replay Enhancer with the `-r` option.")
            print(
                "Set the synchronization offset to the value shown ",
                "on the Timer when the viewed car crosses the start ",
                "finish line to begin lap 2.")

            try:
                replay = cls(config.config_file)
            except ValueError as error:
                print("Invalid JSON in configuration file: {}".format(
                    error))
            else:
                start_video = replay.build_default_video(False)
                end_video = replay.build_default_video(False)

                start_video = start_video.set_duration(
                    start_video.duration).subclip(0, 185)
                if replay.show_champion:
                    end_video = end_video.set_duration(
                        end_video.duration).subclip(
                            end_video.duration-120)
                else:
                    end_video = end_video.set_duration(
                        end_video.duration).subclip(
                            end_video.duration-100)
                output = mpy.concatenate_videoclips(
                    [start_video, end_video])
                output.write_videofile(
                    replay.output_video,
                    fps=10,
                    preset='superfast')

        except KeyboardInterrupt:
            raise
开发者ID:SenorPez,项目名称:project-cars-replay-enhancer,代码行数:58,代码来源:ReplayEnhancer.py


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