NCBACK-25 add protection for audio and use hash method from library
Test Workflow / test (push) Successful in 2s
Test Workflow / test (push) Successful in 2s
This commit is contained in:
@@ -22,19 +22,19 @@ public class ImageHashService {
|
||||
|
||||
private final ImageHashRepository repository;
|
||||
|
||||
public Map<String, Integer> calculateHash(Path imagePath) throws IOException {
|
||||
public Map<String, Long> calculateHash(Path imagePath) throws IOException {
|
||||
File file = imagePath.toFile();
|
||||
PHash pHash = PerceptualHashHelper.INSTANCE.generateDCTPerceptualHash(file);
|
||||
Long firstPart = pHash.getFirstPart();
|
||||
Long secondPart = pHash.getSecondPart();
|
||||
Map<String, Integer> hash = Map.of(
|
||||
"hi", Math.toIntExact(firstPart),
|
||||
"low", Math.toIntExact(secondPart));
|
||||
Map<String, Long> hash = Map.of(
|
||||
"hi", firstPart,
|
||||
"low", secondPart);
|
||||
|
||||
return hash;
|
||||
}
|
||||
|
||||
public void create(FileEntity file, Map<String, Integer> stringIntegerMap) {
|
||||
public void create(FileEntity file, Map<String, Long> stringIntegerMap) {
|
||||
ImageHashEntity entity = ImageHashEntity.builder()
|
||||
.file(file)
|
||||
.hash64Hi(stringIntegerMap.get("hi"))
|
||||
|
||||
Reference in New Issue
Block a user