playlist_service #2
@@ -7,7 +7,6 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
public class VideoDownloaderApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(VideoDownloaderApplication.class, args);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -5,13 +5,10 @@ import com.example.video_downloader.entity.Video;
|
||||
import com.example.video_downloader.services.VideoService;
|
||||
import lombok.Data;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.server.ResponseStatusException;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
@RestController
|
||||
@RequestMapping(path="/video")
|
||||
@@ -22,7 +19,7 @@ public class VideoController {
|
||||
private VideoService videoService;
|
||||
|
||||
@Data
|
||||
private class Response {
|
||||
private static class Response {
|
||||
|
|
||||
private Long id;
|
||||
}
|
||||
|
||||
|
||||
@@ -5,4 +5,5 @@ import lombok.Data;
|
||||
@Data
|
||||
public class SaveNewVideoRequest {
|
||||
private String url;
|
||||
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package com.example.video_downloader.services;
|
||||
|
||||
import com.example.video_downloader.repositories.VideoRepository;
|
||||
import jakarta.annotation.PostConstruct;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.io.IOException;
|
||||
@@ -9,9 +11,12 @@ import java.nio.charset.StandardCharsets;
|
||||
@Service
|
||||
public class ProcessService {
|
||||
|
||||
@PostConstruct
|
||||
@Autowired
|
||||
private VideoRepository videoRepository;
|
||||
|
||||
//@PostConstruct
|
||||
public void init() throws InterruptedException, IOException {
|
||||
execute("yt-dlp", "");
|
||||
execute("yt-dlp", "youtube:player_client=android", "");
|
||||
}
|
||||
|
||||
public void execute(String... command) throws InterruptedException, IOException {
|
||||
|
||||
Reference in New Issue
Block a user
Move this to a new File
dto package-be SaveNewVideoResponse.java