File tree Expand file tree Collapse file tree 2 files changed +27
-14
lines changed Expand file tree Collapse file tree 2 files changed +27
-14
lines changed Original file line number Diff line number Diff line change @@ -168,6 +168,17 @@ fn main() {
168
168
. to_str ( )
169
169
. unwrap_or ( "" ) ,
170
170
) ;
171
+
172
+ if Path :: new ( & final_file_name) . exists ( ) && !cmd_args. overwrite {
173
+ logger. log_error (
174
+ format ! ( "File {final_file_name} already exists and --overwrite is set to false. Continuing with next task if there is more to do..." ) ,
175
+ thread,
176
+ verbose
177
+ ) ;
178
+ failed_paths. lock ( ) . unwrap ( ) . push ( final_file_name) ;
179
+ break ;
180
+ }
181
+
171
182
let final_path_parent = Path :: new ( & final_file_name) . parent ( ) . unwrap ( ) ;
172
183
173
184
if !final_path_parent. exists ( ) {
@@ -187,20 +198,18 @@ fn main() {
187
198
}
188
199
}
189
200
190
- let overwrite = match cmd_args. overwrite {
191
- true => "-y" ,
192
- false => "-n" ,
193
- } ;
201
+ let mut command = Command :: new ( "ffmpeg" ) ;
202
+ command. arg ( "-i" ) . arg ( path. to_str ( ) . unwrap ( ) ) ;
203
+ command. args ( split_options) ;
204
+ command. arg ( & final_file_name) ;
205
+ command. stdout ( Stdio :: null ( ) ) ;
206
+ command. stderr ( Stdio :: piped ( ) ) ;
207
+
208
+ if cmd_args. overwrite {
209
+ command. arg ( "-y" ) ;
210
+ }
194
211
195
- if let Ok ( output) = Command :: new ( "ffmpeg" )
196
- . args ( [ "-i" , path. to_str ( ) . unwrap ( ) ] )
197
- . args ( split_options)
198
- . arg ( & final_file_name)
199
- . arg ( overwrite)
200
- . stdout ( Stdio :: null ( ) )
201
- . stderr ( Stdio :: piped ( ) )
202
- . output ( )
203
- {
212
+ if let Ok ( output) = command. output ( ) {
204
213
if output. status . success ( ) {
205
214
logger. log_info (
206
215
format ! ( "Success, saving to {final_file_name}" ) ,
Original file line number Diff line number Diff line change @@ -10,7 +10,11 @@ impl Progress {
10
10
pub ( crate ) fn new ( length : usize , eta : bool ) -> Self {
11
11
let multi = MultiProgress :: new ( ) ;
12
12
let progress = multi. add ( ProgressBar :: new ( length as u64 ) ) ;
13
- let progress_bar_template = if eta { "{spinner:.green} [{elapsed_precise} - ETA: {eta_precise}] [{bar:40.cyan/blue}] {pos}/{len} ({percent}%)" } else { "{spinner:.green} [{elapsed_precise}] [{bar:40.cyan/blue}] {pos}/{len} ({percent}%)" } ;
13
+ let progress_bar_template = if eta {
14
+ "{spinner:.green} [{elapsed_precise} - ETA: {eta_precise}] [{bar:40.cyan/blue}] {pos}/{len} ({percent}%)"
15
+ } else {
16
+ "{spinner:.green} [{elapsed_precise}] [{bar:40.cyan/blue}] {pos}/{len} ({percent}%)"
17
+ } ;
14
18
progress. set_style (
15
19
ProgressStyle :: default_bar ( )
16
20
. template ( progress_bar_template)
You can’t perform that action at this time.
0 commit comments