@@ -77,14 +77,17 @@ fn main() -> Result<()> {
77
77
api. calibrate ( win_id) ?;
78
78
79
79
let force_natural = args. is_present ( "natural-mode" ) ;
80
- let with_video = args. is_present ( "video" ) ;
80
+ let should_generate_gif = !args. is_present ( "video-only" ) ;
81
+ let should_generate_video = args. is_present ( "video" ) || args. is_present ( "video-only" ) ;
81
82
let ( start_delay, end_delay) = (
82
83
parse_delay ( args. value_of ( "start-pause" ) , "start-pause" ) ?,
83
84
parse_delay ( args. value_of ( "end-pause" ) , "end-pause" ) ?,
84
85
) ;
85
86
86
- check_for_gif ( ) ?;
87
- if with_video {
87
+ if should_generate_gif {
88
+ check_for_gif ( ) ?;
89
+ }
90
+ if should_generate_video {
88
91
check_for_mp4 ( ) ?;
89
92
}
90
93
@@ -155,24 +158,26 @@ fn main() -> Result<()> {
155
158
}
156
159
157
160
let target = target_file ( ) ;
158
- let gif_target = format ! ( "{}.{}" , target, "gif" ) ;
159
- let mut time = prof ! {
160
- generate_gif(
161
- & time_codes. lock( ) . unwrap( ) ,
162
- tempdir. lock( ) . unwrap( ) . borrow( ) ,
163
- & gif_target,
164
- start_delay,
165
- end_delay
166
- ) ?;
167
- } ;
161
+ let mut time = Duration :: default ( ) ;
162
+
163
+ if should_generate_gif {
164
+ time += prof ! {
165
+ generate_gif(
166
+ & time_codes. lock( ) . unwrap( ) ,
167
+ tempdir. lock( ) . unwrap( ) . borrow( ) ,
168
+ & format!( "{}.{}" , target, "gif" ) ,
169
+ start_delay,
170
+ end_delay
171
+ ) ?;
172
+ } ;
173
+ }
168
174
169
- if with_video {
170
- let mp4_target = format ! ( "{}.{}" , target, "mp4" ) ;
175
+ if should_generate_video {
171
176
time += prof ! {
172
177
generate_mp4(
173
178
& time_codes. lock( ) . unwrap( ) ,
174
179
tempdir. lock( ) . unwrap( ) . borrow( ) ,
175
- & mp4_target ,
180
+ & format! ( "{}.{}" , target , "mp4" ) ,
176
181
) ?;
177
182
}
178
183
}
0 commit comments