ADD thumbnail to database (#12)

* ADD thumbnail to database

* ADD thumbnail generation and retrieval functionality

* ADD thumbnail availability check in VideoCard component

* ADD ClipDTO to reduce exposed internals

* REFactor move APIResponse and VideoMetadata to dto package

* REMOVE unused props from VideoCard

* ADD isThumbnailAvailable function
This commit is contained in:
Dylan De Faoite
2025-07-17 23:21:01 +02:00
committed by GitHub
parent 4c49a1daf8
commit 87ad7e3537
26 changed files with 190 additions and 44 deletions

View File

@@ -61,6 +61,32 @@ public class DirectoryService {
return new File(dir);
}
public File getUserClipsDir(Long userId) {
if (userId == null) {
throw new IllegalArgumentException("User ID cannot be null");
}
String dir = outputDir + File.separator + userId + File.separator + "clips";
return new File(dir);
}
public File getUserThumbnailsDir(Long userId) {
if (userId == null) {
throw new IllegalArgumentException("User ID cannot be null");
}
String dir = outputDir + File.separator + userId + File.separator + "thumbnails";
File thumbnailDir = new File(dir);
try {
createDirectory(thumbnailDir.getAbsolutePath());
} catch (IOException e) {
logger.error("Error creating thumbnails directory: {}", e.getMessage());
}
return thumbnailDir;
}
public void saveAtDir(File file, MultipartFile multipartFile) {
try {
createDirectory(file.getAbsolutePath());
@@ -118,7 +144,6 @@ public class DirectoryService {
Files.delete(f.toPath());
}
}
}
@PostConstruct