* renamed AutoEpisodeListMatcher to AutoFetchEpisodeListMatcher

* fixed memory leak by not using FunctionList (would need to be disposed)
This commit is contained in:
Reinhard Pointner 2009-02-06 13:11:54 +00:00
parent 7b61757fd7
commit 90f58b06ff
2 changed files with 11 additions and 14 deletions

View File

@ -33,7 +33,7 @@ import net.sourceforge.filebot.web.SearchResult;
import net.sourceforge.tuned.FileUtilities;
class AutoEpisodeListMatcher extends SwingWorker<List<Match<File, Episode>>, Void> {
class AutoFetchEpisodeListMatcher extends SwingWorker<List<Match<File, Episode>>, Void> {
private final List<File> files;
@ -42,7 +42,7 @@ class AutoEpisodeListMatcher extends SwingWorker<List<Match<File, Episode>>, Voi
private final Collection<SimilarityMetric> metrics;
public AutoEpisodeListMatcher(EpisodeListClient client, List<File> files, Collection<SimilarityMetric> metrics) {
public AutoFetchEpisodeListMatcher(EpisodeListClient client, List<File> files, Collection<SimilarityMetric> metrics) {
this.client = client;
this.files = new LinkedList<File>(files);
this.metrics = new ArrayList<SimilarityMetric>(metrics);
@ -56,7 +56,7 @@ class AutoEpisodeListMatcher extends SwingWorker<List<Match<File, Episode>>, Voi
protected Collection<String> detectSeriesNames(Collection<File> files) {
// detect series name(s) from files
return new SeriesNameMatcher().matchAll(files.toArray(new File[files.size()]));
return new SeriesNameMatcher().matchAll(files.toArray(new File[0]));
}
@ -109,7 +109,7 @@ class AutoEpisodeListMatcher extends SwingWorker<List<Match<File, Episode>>, Voi
List<Match<File, Episode>> matches = new ArrayList<Match<File, Episode>>();
// group by subtitles first and then by files in general
for (List<File> filesPerType : mapByFileType(files, MOVIE_FILES, SUBTITLE_FILES).values()) {
for (List<File> filesPerType : mapByFileType(mediaFiles, MOVIE_FILES, SUBTITLE_FILES).values()) {
Matcher<File, Episode> matcher = new Matcher<File, Episode>(filesPerType, episodes, metrics);
matches.addAll(matcher.match());
}

View File

@ -34,8 +34,6 @@ import net.sourceforge.filebot.web.TheTVDBClient;
import net.sourceforge.tuned.ExceptionUtil;
import net.sourceforge.tuned.ui.ActionPopup;
import net.sourceforge.tuned.ui.LoadingOverlayPane;
import ca.odell.glazedlists.FunctionList;
import ca.odell.glazedlists.FunctionList.Function;
import ca.odell.glazedlists.event.ListEvent;
import ca.odell.glazedlists.event.ListEventListener;
@ -166,15 +164,14 @@ public class RenamePanel extends FileBotPanel {
// clear names list
model.names().clear();
List<File> files = new FunctionList<FileEntry, File>(model.files(), new Function<FileEntry, File>() {
@Override
public File evaluate(FileEntry entry) {
return entry.getFile();
}
});
// gather File objects from model
List<File> files = new ArrayList<File>();
AutoEpisodeListMatcher worker = new AutoEpisodeListMatcher(client, files, matchAction.getMetrics()) {
for (FileEntry entry : model.files()) {
files.add(entry.getFile());
}
AutoFetchEpisodeListMatcher worker = new AutoFetchEpisodeListMatcher(client, files, matchAction.getMetrics()) {
@Override
protected void done() {