This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
package ru.soune.nocopy.handler;
|
||||
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -15,7 +14,6 @@ import ru.soune.nocopy.exception.NotValidFieldException;
|
||||
import ru.soune.nocopy.repository.FileEntityRepository;
|
||||
import ru.soune.nocopy.service.file.CheckCounterService;
|
||||
import ru.soune.nocopy.service.search.SearchImageService;
|
||||
import ru.soune.nocopy.service.search.GoogleVisionSearchService;
|
||||
import ru.soune.nocopy.service.tariff.TariffConstants;
|
||||
import ru.soune.nocopy.service.tariff.TariffInfoService;
|
||||
|
||||
@@ -32,8 +30,6 @@ public class ImageFoundRequestHandler implements RequestHandler {
|
||||
|
||||
private final SearchImageService searchImageService;
|
||||
|
||||
private final GoogleVisionSearchService googleVisionSearchService;
|
||||
|
||||
private final CheckCounterService checkCounterService;
|
||||
|
||||
private final FileEntityRepository fileEntityRepository;
|
||||
@@ -54,7 +50,7 @@ public class ImageFoundRequestHandler implements RequestHandler {
|
||||
Map.of("fileId",fileId)));
|
||||
});
|
||||
|
||||
String searchResponseYandex;
|
||||
// String searchResponseYandex;
|
||||
String searchResponseGoogle;
|
||||
List<YandexSearchResponse.ImageResult> allYandexImages = new ArrayList<>();
|
||||
List<YandexSearchResponse.ImageResult> allGoogleImages = new ArrayList<>();
|
||||
@@ -74,18 +70,18 @@ public class ImageFoundRequestHandler implements RequestHandler {
|
||||
log.error("Google search failed for file {}", fileId, e);
|
||||
}
|
||||
|
||||
try {
|
||||
searchResponseYandex = searchImageService.searchReverseByPublicUrl(fileEntity, "yandex_reverse_image",
|
||||
"visual_matches");
|
||||
log.info("searchResponseYandex OK");
|
||||
allYandexImages = searchImageService.getAllImagesWithoutPagination(
|
||||
searchResponseYandex, "visual_matches");
|
||||
} catch (TimeoutException e) {
|
||||
log.warn("Yandex search timeout for file {}", fileId);
|
||||
hasTimeout = true;
|
||||
} catch (IOException e) {
|
||||
log.error("Yandex search failed for file {}", fileId, e);
|
||||
}
|
||||
// try {
|
||||
// searchResponseYandex = searchImageService.searchReverseByPublicUrl(fileEntity, "yandex_reverse_image",
|
||||
// "visual_matches");
|
||||
// log.info("searchResponseYandex OK");
|
||||
// allYandexImages = searchImageService.getAllImagesWithoutPagination(
|
||||
// searchResponseYandex, "visual_matches");
|
||||
// } catch (TimeoutException e) {
|
||||
// log.warn("Yandex search timeout for file {}", fileId);
|
||||
// hasTimeout = true;
|
||||
// } catch (IOException e) {
|
||||
// log.error("Yandex search failed for file {}", fileId, e);
|
||||
// }
|
||||
|
||||
allUniqueImages = searchImageService.removeDuplicateUrls(allYandexImages, allGoogleImages);
|
||||
log.info("allUniqueImages OK: {} images", allUniqueImages.size());
|
||||
|
||||
Reference in New Issue
Block a user