Support dummy files for debugging

This commit is contained in:
Reinhard Pointner 2016-04-13 11:21:57 +00:00
parent 627abb1ced
commit a8d91485ae
1 changed files with 9 additions and 0 deletions

View File

@ -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;
});