1
0
mirror of https://github.com/mitb-archive/filebot synced 2024-08-13 17:03:45 -04:00

Presume that OpenSubtitles hash matches are being polluted by BSPlayer and never just trust hash matches

@see https://www.filebot.net/forums/viewtopic.php?f=6&t=3452#p19190
This commit is contained in:
Reinhard Pointner 2016-02-26 13:14:17 +00:00
parent 9613049cb1
commit 55491a137d
3 changed files with 8 additions and 11 deletions

View File

@ -875,11 +875,6 @@ public class CmdlineOperations implements CmdlineInterface {
// guess best hash match (default order is open bad due to invalid hash links)
SubtitleDescriptor bestMatch = getBestMatch(it.getKey(), it.getValue(), strict);
// if we can't guess the best one, just pick the first one, since all hash matches should good (ideally)
if (bestMatch == null && !strict && it.getValue().size() > 0) {
bestMatch = it.getValue().get(0);
}
if (bestMatch != null) {
CLILogger.finest(format("Matched [%s] to [%s] via hash", it.getKey().getName(), bestMatch.getName()));
subtitleByVideo.put(it.getKey(), bestMatch);

View File

@ -159,8 +159,9 @@ public final class SubtitleUtilities {
}
// allow early abort
if (Thread.interrupted())
if (Thread.interrupted()) {
throw new InterruptedException();
}
// files by possible subtitles matches
for (File file : files) {

View File

@ -214,12 +214,13 @@ public class OpenSubtitlesClient implements SubtitleProvider, VideoHashSubtitleS
List<Query> hashQueryList = new ArrayList<Query>(files.length);
for (File file : files) {
// add hash query
if (file.length() > HASH_CHUNK_SIZE) {
String movieHash = computeHash(file);
Query query = Query.forHash(movieHash, file.length(), languageFilter);
Query query = file.length() > HASH_CHUNK_SIZE ? Query.forHash(computeHash(file), file.length(), languageFilter) : null;
// check hash
// DEBUG
// query = Query.forHash("b4a91d8384a92269", 1178926184, languageFilter);
// add hash query
if (query != null) {
List<SubtitleDescriptor> cachedResults = getCache().getSubtitleDescriptorList(query);
if (cachedResults == null) {
hashQueryList.add(query);