本文整理汇总了Python中Configuration.Configuration.new_configuration方法的典型用法代码示例。如果您正苦于以下问题:Python Configuration.new_configuration方法的具体用法?Python Configuration.new_configuration怎么用?Python Configuration.new_configuration使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Configuration.Configuration
的用法示例。
在下文中一共展示了Configuration.new_configuration方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: new_configuration
# 需要导入模块: from Configuration import Configuration [as 别名]
# 或者: from Configuration.Configuration import new_configuration [as 别名]
def new_configuration(cls):
"""
Creates a new configuration file and builds
a test video.
"""
try:
print("No configuration file provided.")
print("Creating new configuration file.")
config = Configuration()
config.new_configuration()
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.")
print(
"Please wait. Telemetry being processed and ",
"rendered. If this is the first time this data has ",
"been used, it make take longer.")
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
示例2: edit_configuration
# 需要导入模块: from Configuration import Configuration [as 别名]
# 或者: from Configuration.Configuration import new_configuration [as 别名]
def edit_configuration(cls, previous_file):
"""
Edits and exiting configuration file and builds a
test video.
"""
try:
print("Editing configuration file {}".format(
previous_file))
config = Configuration(previous_file)
config.new_configuration()
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