2024-07-01 09:57:30 +00:00
|
|
|
# night_flight -- Setup the night flight black box recorder for build pipelines.
|
2024-06-30 11:52:33 +00:00
|
|
|
#
|
2024-06-30 14:13:44 +00:00
|
|
|
# Adds the following commands to openMSX;
|
2024-06-30 11:52:33 +00:00
|
|
|
#
|
2024-07-01 09:57:30 +00:00
|
|
|
# 'night_flight_save_screenshot [prefix-id]'
|
2024-06-30 11:52:33 +00:00
|
|
|
# Takes an screenshot with optional prefix parameter.
|
|
|
|
#
|
2024-07-01 09:57:30 +00:00
|
|
|
# 'night_flight_save_video [prefix-id]'
|
2024-06-30 11:52:33 +00:00
|
|
|
# Starts video recording with optional prefix parameter.
|
|
|
|
#
|
|
|
|
# Supported environment variables by this script;
|
|
|
|
#
|
|
|
|
# NF_PREFIX=msxbuild
|
|
|
|
# Gives screenshots and videos an prefix; msxbuild0001.avi
|
|
|
|
#
|
|
|
|
# NF_SEPERATOR=-
|
|
|
|
# Gives screenshots and videos an seperator; openmsx-0001.png
|
|
|
|
#
|
|
|
|
# NF_RECORD_FLAG=-doublesize
|
|
|
|
# Flag given to the video record command.
|
|
|
|
#
|
|
|
|
|
|
|
|
set night_flight_prefix flight
|
|
|
|
set night_flight_seperator -
|
|
|
|
set night_flight_record_flag ""
|
|
|
|
|
|
|
|
proc night_flight_save_screenshot {{prefix_id 0}} {
|
|
|
|
global night_flight_prefix
|
|
|
|
global night_flight_seperator
|
|
|
|
if {$prefix_id != 0} {
|
|
|
|
set file_prefix "$prefix_id$night_flight_seperator"
|
|
|
|
} else {
|
|
|
|
set file_prefix "$night_flight_prefix$night_flight_seperator"
|
|
|
|
}
|
2024-07-14 12:38:32 +00:00
|
|
|
global throttle
|
|
|
|
global speed
|
|
|
|
set old_throttle [set throttle]
|
|
|
|
set old_speed [set speed]
|
|
|
|
set throttle on
|
|
|
|
set speed 100
|
|
|
|
after time 1 "screenshot -prefix $file_prefix"
|
|
|
|
after time 2 "set throttle $old_throttle"
|
|
|
|
after time 2 "set speed $old_speed"
|
2024-07-02 13:34:26 +00:00
|
|
|
return "mb::save flight screenshot"
|
2024-06-30 11:52:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
proc night_flight_save_video {{prefix_id 0}} {
|
|
|
|
global night_flight_prefix
|
|
|
|
global night_flight_seperator
|
|
|
|
global night_flight_record_flag
|
|
|
|
if {$prefix_id != 0} {
|
|
|
|
set file_prefix "$prefix_id$night_flight_seperator"
|
|
|
|
} else {
|
|
|
|
set file_prefix "$night_flight_prefix$night_flight_seperator"
|
|
|
|
}
|
|
|
|
after quit "record stop"
|
|
|
|
after time 1 "record start $night_flight_record_flag -prefix $file_prefix"
|
2024-07-02 13:34:26 +00:00
|
|
|
return "mb::save flight video"
|
2024-06-30 11:52:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if {[info exists ::env(NF_PREFIX)] && ([string trim $::env(NF_PREFIX)] != "")} {
|
|
|
|
set night_flight_prefix [string trim $::env(NF_PREFIX)]
|
|
|
|
}
|
|
|
|
|
|
|
|
if {[info exists ::env(NF_SEPERATOR)] && ([string trim $::env(NF_SEPERATOR)] != "")} {
|
|
|
|
set night_flight_seperator [string trim $::env(NF_SEPERATOR)]
|
|
|
|
}
|
|
|
|
|
|
|
|
if {[info exists ::env(NF_RECORD_FLAG)] && ([string trim $::env(NF_RECORD_FLAG)] != "")} {
|
|
|
|
set night_flight_record_flag [string trim $::env(NF_RECORD_FLAG)]
|
|
|
|
}
|