diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..c26b360 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,8 @@ +FROM eclipse-temurin:21-jdk + +WORKDIR /app + +COPY yt-dlp /app +COPY target/video_downloader-0.0.1-SNAPSHOT.jar /app + +CMD ["java", "-jar", "/app/video_downloader-0.0.1-SNAPSHOT.jar"] diff --git a/src/main/java/com/example/video_downloader/services/ProcessService.java b/src/main/java/com/example/video_downloader/services/ProcessService.java new file mode 100644 index 0000000..f39c95c --- /dev/null +++ b/src/main/java/com/example/video_downloader/services/ProcessService.java @@ -0,0 +1,29 @@ +package com.example.video_downloader.services; + +import jakarta.annotation.PostConstruct; +import org.springframework.stereotype.Service; + +import java.io.IOException; +import java.nio.charset.StandardCharsets; + +@Service +public class ProcessService { + + @PostConstruct + public void init() throws InterruptedException, IOException { + System.out.println("Init..."); + + ProcessBuilder builder = new ProcessBuilder("/app/yt-dlp"); + Process process = builder.start(); + process.waitFor(); + String text = new String(process.getInputStream().readAllBytes(), StandardCharsets.UTF_8); + String text2 = new String(process.getErrorStream().readAllBytes(), StandardCharsets.UTF_8); + + System.out.println(text); + System.out.println(text2); + + System.out.println("Marker..."); + } + + +} diff --git a/yt-dlp b/yt-dlp new file mode 100644 index 0000000..83c2474 Binary files /dev/null and b/yt-dlp differ