mirror of
https://github.com/mitb-archive/filebot
synced 2025-03-09 22:09:47 -04:00
* optimize open subtitles hash matches to make sure invalid uploads (that don't match at all) get 1st place
This commit is contained in:
parent
64c3d77100
commit
9ba3e36d23
@ -810,8 +810,11 @@ public class CmdlineOperations implements CmdlineInterface {
|
||||
|
||||
for (Entry<File, List<SubtitleDescriptor>> it : service.getSubtitleList(videoFiles.toArray(new File[0]), language.getName()).entrySet()) {
|
||||
if (it.getValue() != null && it.getValue().size() > 0) {
|
||||
CLILogger.finest(format("Matched [%s] to [%s] via filehash", it.getKey().getName(), it.getValue().get(0).getName()));
|
||||
subtitleByVideo.put(it.getKey(), it.getValue().get(0));
|
||||
// guess best hash match (default order is open bad due to invalid hash links)
|
||||
Entry<File, SubtitleDescriptor> bestMatch = matchSubtitles(singleton(it.getKey()), it.getValue(), false).entrySet().iterator().next();
|
||||
|
||||
CLILogger.finest(format("Matched [%s] to [%s] via filehash", bestMatch.getKey().getName(), bestMatch.getValue().getName()));
|
||||
subtitleByVideo.put(bestMatch.getKey(), bestMatch.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
package net.sourceforge.filebot.ui.subtitle;
|
||||
|
||||
import static java.util.Collections.*;
|
||||
import static javax.swing.BorderFactory.*;
|
||||
import static javax.swing.JOptionPane.*;
|
||||
import static net.sourceforge.filebot.media.MediaDetection.*;
|
||||
@ -23,10 +24,12 @@ import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Set;
|
||||
import java.util.TreeSet;
|
||||
import java.util.concurrent.CancellationException;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
@ -716,13 +719,20 @@ class SubtitleAutoMatchDialog extends JDialog {
|
||||
try {
|
||||
Map<File, List<SubtitleDescriptorBean>> subtitleSet = new HashMap<File, List<SubtitleDescriptorBean>>();
|
||||
for (final Entry<File, List<SubtitleDescriptor>> result : service.lookupSubtitles(remainingVideos, languageName, parent).entrySet()) {
|
||||
List<SubtitleDescriptorBean> subtitles = new ArrayList<SubtitleDescriptorBean>();
|
||||
Set<SubtitleDescriptor> subtitlesByRelevance = new LinkedHashSet<SubtitleDescriptor>();
|
||||
|
||||
// guess best hash match (default order is open bad due to invalid hash links)
|
||||
if (result.getValue().size() > 0) {
|
||||
Entry<File, SubtitleDescriptor> bestMatch = matchSubtitles(singleton(result.getKey()), result.getValue(), false).entrySet().iterator().next();
|
||||
subtitlesByRelevance.add(bestMatch.getValue());
|
||||
}
|
||||
subtitlesByRelevance.addAll(result.getValue());
|
||||
|
||||
// associate subtitles with services
|
||||
for (SubtitleDescriptor subtitleDescriptor : result.getValue()) {
|
||||
subtitles.add(new SubtitleDescriptorBean(result.getKey(), subtitleDescriptor, service));
|
||||
List<SubtitleDescriptorBean> subtitles = new ArrayList<SubtitleDescriptorBean>();
|
||||
for (SubtitleDescriptor it : subtitlesByRelevance) {
|
||||
subtitles.add(new SubtitleDescriptorBean(result.getKey(), it, service));
|
||||
}
|
||||
|
||||
subtitleSet.put(result.getKey(), subtitles);
|
||||
}
|
||||
|
||||
|
@ -38,9 +38,11 @@
|
||||
^extract$
|
||||
^extracted$
|
||||
^Family$
|
||||
^file[s]?$
|
||||
^Film[s]?
|
||||
^Filme$
|
||||
^Finished
|
||||
^folder$
|
||||
^good$
|
||||
^HD[0-9]$
|
||||
^hdd[0-9]$
|
||||
@ -48,6 +50,7 @@
|
||||
^Horror$
|
||||
^HVDVD_TS$
|
||||
^I$
|
||||
^ignore.folder$
|
||||
^II$
|
||||
^III$
|
||||
^In.Progress$
|
||||
|
Loading…
x
Reference in New Issue
Block a user