diff --git a/source/net/filebot/media/ReleaseInfo.java b/source/net/filebot/media/ReleaseInfo.java index a822e559..5b4c9633 100644 --- a/source/net/filebot/media/ReleaseInfo.java +++ b/source/net/filebot/media/ReleaseInfo.java @@ -392,7 +392,7 @@ public class ReleaseInfo { return roots; } - protected final Resource> seriesMappings = lines("url.series-mappings", Cache.ONE_WEEK).transform(lines -> { + protected final Resource> seriesMappings = resource("url.series-mappings", Cache.ONE_WEEK, Function.identity(), String[]::new).transform(lines -> { Map map = new LinkedHashMap(lines.length); stream(lines).map(s -> s.split("\t", 2)).filter(v -> v.length == 2).forEach(v -> { Pattern pattern = compile("(? lines(String name, Duration expirationTime) { - return resource(name, expirationTime, s -> { - return s.length() > 0 ? s : null; - }, String[]::new).memoize(); + return resource(name, expirationTime, Function.identity(), String[]::new).memoize(); } protected Resource tsv(String name, Duration expirationTime, Function parse, IntFunction generator) { - return resource(name, expirationTime, s -> { - String[] v = s.split("\t"); - return v.length > 0 ? parse.apply(v) : null; - }, generator).memoize(); + return resource(name, expirationTime, s -> parse.apply(s.split("\t")), generator).memoize(); } protected Resource resource(String name, Duration expirationTime, Function parse, IntFunction generator) { @@ -464,7 +459,7 @@ public class ReleaseInfo { // all data file are xz compressed try (BufferedReader text = new BufferedReader(new InputStreamReader(new XZInputStream(new ByteArrayInputStream(bytes)), UTF_8))) { - return text.lines().map(parse).filter(Objects::nonNull).toArray(generator); + return text.lines().filter(s -> s.length() > 0).map(parse).filter(Objects::nonNull).toArray(generator); } }; }