1
0
mirror of https://github.com/mitb-archive/filebot synced 2025-03-09 22:09:47 -04:00

Fix JDK8 patch

This commit is contained in:
Reinhard Pointner 2019-05-18 03:04:33 +07:00
parent d28df06818
commit bd9b0415ff

View File

@ -283,7 +283,7 @@ index 4aec2ab8..eb200e57 100644
}
diff --git a/source/net/filebot/ThumbnailServices.java b/source/net/filebot/ThumbnailServices.java
index f7241bd2..fae11e64 100644
index f7241bd2..9e2b3bd9 100644
--- a/source/net/filebot/ThumbnailServices.java
+++ b/source/net/filebot/ThumbnailServices.java
@@ -10,10 +10,6 @@ import java.awt.image.BufferedImage;
@ -297,7 +297,7 @@ index f7241bd2..fae11e64 100644
import java.nio.ByteBuffer;
import java.util.HashMap;
import java.util.List;
@@ -62,9 +58,6 @@ public enum ThumbnailServices implements ThumbnailProvider {
@@ -62,43 +58,15 @@ public enum ThumbnailServices implements ThumbnailProvider {
private final Resource<Set<Integer>> index = Resource.lazy(this::getIndex);
@ -307,18 +307,18 @@ index f7241bd2..fae11e64 100644
public byte[][] getThumbnails(int[] ids, ResolutionVariant variant) throws Exception {
Cache cache = getCache(variant);
byte[][] response = new byte[ids.length][];
@@ -72,34 +65,7 @@ public enum ThumbnailServices implements ThumbnailProvider {
synchronized (index) {
// check cache
for (int i = 0; i < response.length; i++) {
- for (int i = 0; i < response.length; i++) {
- response[i] = (byte[]) cache.get(ids[i]);
- }
-
- // create if necessary
- CompletableFuture<HttpResponse<byte[]>>[] request = new CompletableFuture[ids.length];
-
- for (int i = 0; i < response.length; i++) {
- if (response[i] == null && index.get().contains(ids[i])) {
for (int i = 0; i < response.length; i++) {
if (response[i] == null && index.get().contains(ids[i])) {
- String resource = getThumbnailResource(ids[i], variant);
- request[i] = http.get().sendAsync(HttpRequest.newBuilder(URI.create(resource)).build(), BodyHandlers.ofByteArray());
-
@ -338,11 +338,10 @@ index f7241bd2..fae11e64 100644
- } catch (Exception e) {
- debug.warning(e::toString);
- }
- }
+ response[i] = cache.bytes(ids[i], id -> new URL(getThumbnailResource(id, ResolutionVariant.NORMAL))).expire(Cache.ONE_MONTH).get();
}
}
return response;
diff --git a/source/net/filebot/UserFiles.java b/source/net/filebot/UserFiles.java
index bb0f65de..25b687ab 100644
--- a/source/net/filebot/UserFiles.java