refactor(directories): switch from File to Path objs

This commit is contained in:
2026-06-23 20:53:24 +01:00
parent 8b49a10a8c
commit 5651aa4ce9
12 changed files with 143 additions and 210 deletions

View File

@@ -5,8 +5,8 @@ import org.slf4j.LoggerFactory;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import java.io.File;
import java.io.IOException;
import java.nio.file.Path;
import java.util.List;
@Service
@@ -14,15 +14,15 @@ public class ThumbnailService {
private static final Logger logger = LoggerFactory.getLogger(ThumbnailService.class);
@Async("ffmpegTaskExecutor")
public void createThumbnail(File inputFile, File outputFile, Float timeInVideo) throws IOException, InterruptedException {
public void createThumbnail(Path inputFile, Path outputFile, Float timeInVideo) throws IOException, InterruptedException {
logger.info("Creating thumbnail at {} seconds", timeInVideo);
List<String> command = List.of(
"ffmpeg",
"-ss", timeInVideo.toString(),
"-i", inputFile.getAbsolutePath(),
"-i", inputFile.toAbsolutePath().toString(),
"-frames:v", "1",
outputFile.getAbsolutePath()
outputFile.toAbsolutePath().toString()
);
CommandRunner.run(command);