本文整理汇总了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