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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user