From d829ef97c826d2b61f4b9cbc4ac90d041ac06b43 Mon Sep 17 00:00:00 2001 From: Reinhard Pointner Date: Wed, 28 Sep 2016 13:34:04 +0800 Subject: [PATCH] Refactor --- source/net/filebot/ui/filter/AttributeTool.java | 7 ++++--- source/net/filebot/ui/filter/ExtractTool.java | 3 ++- source/net/filebot/ui/filter/MediaInfoTool.java | 7 +++---- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/source/net/filebot/ui/filter/AttributeTool.java b/source/net/filebot/ui/filter/AttributeTool.java index 800f6d3b..9eed09c4 100644 --- a/source/net/filebot/ui/filter/AttributeTool.java +++ b/source/net/filebot/ui/filter/AttributeTool.java @@ -16,7 +16,6 @@ import javax.swing.ListSelectionModel; import javax.swing.table.AbstractTableModel; import javax.swing.table.TableModel; -import net.filebot.util.FileUtilities; import net.filebot.util.ui.LoadingOverlayPane; import net.filebot.web.Episode; import net.filebot.web.Movie; @@ -49,14 +48,16 @@ class AttributeTool extends Tool { } @Override - protected TableModel createModelInBackground(File root) throws InterruptedException { + protected TableModel createModelInBackground(File root) { FileAttributesTableModel model = new FileAttributesTableModel(); if (root == null) { return model; } - for (File file : filter(FileUtilities.listFiles(root), VIDEO_FILES, SUBTITLE_FILES)) { + List files = filter(listFiles(root), VIDEO_FILES, SUBTITLE_FILES); + + for (File file : files) { Object metaObject = xattr.getMetaInfo(file); String originalName = xattr.getOriginalName(file); diff --git a/source/net/filebot/ui/filter/ExtractTool.java b/source/net/filebot/ui/filter/ExtractTool.java index 3b7c8c78..39d8932a 100644 --- a/source/net/filebot/ui/filter/ExtractTool.java +++ b/source/net/filebot/ui/filter/ExtractTool.java @@ -1,5 +1,6 @@ package net.filebot.ui.filter; +import static java.util.Collections.*; import static net.filebot.Logging.*; import static net.filebot.UserFiles.*; import static net.filebot.util.ExceptionUtilities.*; @@ -77,7 +78,7 @@ class ExtractTool extends Tool { @Override protected TableModel createModelInBackground(File root) throws InterruptedException { - List files = (root != null) ? FileUtilities.listFiles(root) : new ArrayList(); + List files = root != null ? listFiles(root) : emptyList(); List entries = new ArrayList(); try { diff --git a/source/net/filebot/ui/filter/MediaInfoTool.java b/source/net/filebot/ui/filter/MediaInfoTool.java index 0a60c865..f5d2c67a 100644 --- a/source/net/filebot/ui/filter/MediaInfoTool.java +++ b/source/net/filebot/ui/filter/MediaInfoTool.java @@ -24,7 +24,6 @@ import javax.swing.table.TableModel; import net.filebot.mediainfo.MediaInfo; import net.filebot.mediainfo.MediaInfo.StreamKind; -import net.filebot.util.FileUtilities; import net.filebot.util.ui.LoadingOverlayPane; import net.miginfocom.swing.MigLayout; @@ -54,13 +53,13 @@ class MediaInfoTool extends Tool { } @Override - protected TableModel createModelInBackground(File root) throws InterruptedException { + protected TableModel createModelInBackground(File root) { if (root == null) { return new MediaInfoTableModel(); } - List files = filter(FileUtilities.listFiles(root), VIDEO_FILES, AUDIO_FILES); - Map data = new TreeMap<>(); + List files = filter(listFiles(root), VIDEO_FILES, AUDIO_FILES); + Map data = new TreeMap(); try (MediaInfo mi = new MediaInfo()) { IntStream.range(0, files.size()).forEach(f -> {