From a8d91485ae8af33bc7a074ff08cbc963aa82b359 Mon Sep 17 00:00:00 2001 From: Reinhard Pointner Date: Wed, 13 Apr 2016 11:21:57 +0000 Subject: [PATCH] Support dummy files for debugging --- source/net/filebot/web/OpenSubtitlesClient.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/source/net/filebot/web/OpenSubtitlesClient.java b/source/net/filebot/web/OpenSubtitlesClient.java index 1a0ec2a8..54072f31 100644 --- a/source/net/filebot/web/OpenSubtitlesClient.java +++ b/source/net/filebot/web/OpenSubtitlesClient.java @@ -5,6 +5,7 @@ import static java.util.Collections.*; import static java.util.stream.Collectors.*; import static net.filebot.Logging.*; import static net.filebot.util.FileUtilities.*; +import static net.filebot.util.JsonUtilities.*; import static net.filebot.web.OpenSubtitlesHasher.*; import java.io.File; @@ -221,6 +222,14 @@ public class OpenSubtitlesClient implements SubtitleProvider, VideoHashSubtitleS } catch (Exception e) { debug.log(Level.SEVERE, "Failed to compute hash", e); } + } else { + // debug dummy files, e.g. {hash: 1ed67c43e4a3b09f, size: 992272721} + try { + Map json = asMap(readJson(readTextFile(f))); + return Query.forHash(json.get("hash").toString(), Long.parseLong(json.get("size").toString()), getLanguageFilter(language)); + } catch (Exception e) { + debug.finest(e::toString); + } } return null; });