1
0
mirror of https://github.com/aNNiMON/ffmpegbot synced 2024-09-19 22:54:20 +03:00

Force overwrites for yt-dlp

This commit is contained in:
aNNiMON 2023-10-21 17:18:43 +03:00
parent e049062493
commit 3222624b1f
2 changed files with 5 additions and 2 deletions

View File

@ -55,6 +55,6 @@ public class YtDlpCommandBuilder {
private static List<String> buildOutput(@NotNull YtDlpSession session) { private static List<String> buildOutput(@NotNull YtDlpSession session) {
final var targetFilename = FilePath.outputDir() + "/" + session.getOutputFilename(); final var targetFilename = FilePath.outputDir() + "/" + session.getOutputFilename();
return List.of("-o", targetFilename); return List.of("--force-overwrites", "-o", targetFilename);
} }
} }

View File

@ -34,7 +34,10 @@ public class YtDlpTask {
pb.redirectErrorStream(true); pb.redirectErrorStream(true);
pb.inheritIO(); pb.inheritIO();
final Process process = pb.start(); final Process process = pb.start();
process.waitFor(); int status = process.waitFor();
if (status != 0) {
throw new RuntimeException("yt-dlp process was finished with non-zero value " + status);
}
} catch (InterruptedException | IOException e) { } catch (InterruptedException | IOException e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} }