* exclude trailer/sample files from processing as is done for movies already in episode mode as well
This commit is contained in:
parent
7a11589bc4
commit
6b5b757cfa
|
@ -1,7 +1,5 @@
|
||||||
|
|
||||||
package net.sourceforge.filebot.ui.rename;
|
package net.sourceforge.filebot.ui.rename;
|
||||||
|
|
||||||
|
|
||||||
import static java.util.Collections.*;
|
import static java.util.Collections.*;
|
||||||
import static net.sourceforge.filebot.MediaTypes.*;
|
import static net.sourceforge.filebot.MediaTypes.*;
|
||||||
import static net.sourceforge.filebot.Settings.*;
|
import static net.sourceforge.filebot.Settings.*;
|
||||||
|
@ -52,7 +50,6 @@ import net.sourceforge.filebot.web.EpisodeListProvider;
|
||||||
import net.sourceforge.filebot.web.SearchResult;
|
import net.sourceforge.filebot.web.SearchResult;
|
||||||
import net.sourceforge.filebot.web.SortOrder;
|
import net.sourceforge.filebot.web.SortOrder;
|
||||||
|
|
||||||
|
|
||||||
class EpisodeListMatcher implements AutoCompleteMatcher {
|
class EpisodeListMatcher implements AutoCompleteMatcher {
|
||||||
|
|
||||||
private final EpisodeListProvider provider;
|
private final EpisodeListProvider provider;
|
||||||
|
@ -60,12 +57,10 @@ class EpisodeListMatcher implements AutoCompleteMatcher {
|
||||||
// only allow one fetch session at a time so later requests can make use of cached results
|
// only allow one fetch session at a time so later requests can make use of cached results
|
||||||
private final Object providerLock = new Object();
|
private final Object providerLock = new Object();
|
||||||
|
|
||||||
|
|
||||||
public EpisodeListMatcher(EpisodeListProvider provider) {
|
public EpisodeListMatcher(EpisodeListProvider provider) {
|
||||||
this.provider = provider;
|
this.provider = provider;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
protected SearchResult selectSearchResult(final String query, final List<SearchResult> searchResults, Map<String, SearchResult> selectionMemory, final Component parent) throws Exception {
|
protected SearchResult selectSearchResult(final String query, final List<SearchResult> searchResults, Map<String, SearchResult> selectionMemory, final Component parent) throws Exception {
|
||||||
if (searchResults.size() == 1) {
|
if (searchResults.size() == 1) {
|
||||||
return searchResults.get(0);
|
return searchResults.get(0);
|
||||||
|
@ -137,7 +132,6 @@ class EpisodeListMatcher implements AutoCompleteMatcher {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
protected Set<Episode> fetchEpisodeSet(Collection<String> seriesNames, final SortOrder sortOrder, final Locale locale, final Map<String, SearchResult> selectionMemory, final Component parent) throws Exception {
|
protected Set<Episode> fetchEpisodeSet(Collection<String> seriesNames, final SortOrder sortOrder, final Locale locale, final Map<String, SearchResult> selectionMemory, final Component parent) throws Exception {
|
||||||
List<Callable<List<Episode>>> tasks = new ArrayList<Callable<List<Episode>>>();
|
List<Callable<List<Episode>>> tasks = new ArrayList<Callable<List<Episode>>>();
|
||||||
|
|
||||||
|
@ -185,11 +179,13 @@ class EpisodeListMatcher implements AutoCompleteMatcher {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Match<File, ?>> match(final List<File> files, final SortOrder sortOrder, final Locale locale, final boolean autodetection, final Component parent) throws Exception {
|
public List<Match<File, ?>> match(List<File> files, final SortOrder sortOrder, final Locale locale, final boolean autodetection, final Component parent) throws Exception {
|
||||||
|
// ignore sample files
|
||||||
|
final List<File> fileset = filter(files, not(getClutterFileFilter()));
|
||||||
|
|
||||||
// focus on movie and subtitle files
|
// focus on movie and subtitle files
|
||||||
final List<File> mediaFiles = filter(files, VIDEO_FILES, SUBTITLE_FILES);
|
final List<File> mediaFiles = filter(fileset, VIDEO_FILES, SUBTITLE_FILES);
|
||||||
|
|
||||||
// assume that many shows will be matched, do it folder by folder
|
// assume that many shows will be matched, do it folder by folder
|
||||||
List<Callable<List<Match<File, ?>>>> taskPerFolder = new ArrayList<Callable<List<Match<File, ?>>>>();
|
List<Callable<List<Match<File, ?>>>> taskPerFolder = new ArrayList<Callable<List<Match<File, ?>>>>();
|
||||||
|
@ -237,7 +233,7 @@ class EpisodeListMatcher implements AutoCompleteMatcher {
|
||||||
|
|
||||||
// handle derived files
|
// handle derived files
|
||||||
List<Match<File, ?>> derivateMatches = new ArrayList<Match<File, ?>>();
|
List<Match<File, ?>> derivateMatches = new ArrayList<Match<File, ?>>();
|
||||||
SortedSet<File> derivateFiles = new TreeSet<File>(files);
|
SortedSet<File> derivateFiles = new TreeSet<File>(fileset);
|
||||||
derivateFiles.removeAll(mediaFiles);
|
derivateFiles.removeAll(mediaFiles);
|
||||||
|
|
||||||
for (File file : derivateFiles) {
|
for (File file : derivateFiles) {
|
||||||
|
@ -257,7 +253,7 @@ class EpisodeListMatcher implements AutoCompleteMatcher {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int compare(Match<File, ?> o1, Match<File, ?> o2) {
|
public int compare(Match<File, ?> o1, Match<File, ?> o2) {
|
||||||
return files.indexOf(o1.getValue()) - files.indexOf(o2.getValue());
|
return fileset.indexOf(o1.getValue()) - fileset.indexOf(o2.getValue());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -269,7 +265,6 @@ class EpisodeListMatcher implements AutoCompleteMatcher {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public List<Match<File, ?>> matchEpisodeSet(final List<File> files, Collection<String> queries, SortOrder sortOrder, Locale locale, boolean autodetection, Map<String, SearchResult> selectionMemory, Map<String, List<String>> inputMemory, Component parent) throws Exception {
|
public List<Match<File, ?>> matchEpisodeSet(final List<File> files, Collection<String> queries, SortOrder sortOrder, Locale locale, boolean autodetection, Map<String, SearchResult> selectionMemory, Map<String, List<String>> inputMemory, Component parent) throws Exception {
|
||||||
Set<Episode> episodes = emptySet();
|
Set<Episode> episodes = emptySet();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue