Refactor
This commit is contained in:
parent
b1a30e4bc3
commit
d829ef97c8
|
@ -16,7 +16,6 @@ import javax.swing.ListSelectionModel;
|
||||||
import javax.swing.table.AbstractTableModel;
|
import javax.swing.table.AbstractTableModel;
|
||||||
import javax.swing.table.TableModel;
|
import javax.swing.table.TableModel;
|
||||||
|
|
||||||
import net.filebot.util.FileUtilities;
|
|
||||||
import net.filebot.util.ui.LoadingOverlayPane;
|
import net.filebot.util.ui.LoadingOverlayPane;
|
||||||
import net.filebot.web.Episode;
|
import net.filebot.web.Episode;
|
||||||
import net.filebot.web.Movie;
|
import net.filebot.web.Movie;
|
||||||
|
@ -49,14 +48,16 @@ class AttributeTool extends Tool<TableModel> {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected TableModel createModelInBackground(File root) throws InterruptedException {
|
protected TableModel createModelInBackground(File root) {
|
||||||
FileAttributesTableModel model = new FileAttributesTableModel();
|
FileAttributesTableModel model = new FileAttributesTableModel();
|
||||||
|
|
||||||
if (root == null) {
|
if (root == null) {
|
||||||
return model;
|
return model;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (File file : filter(FileUtilities.listFiles(root), VIDEO_FILES, SUBTITLE_FILES)) {
|
List<File> files = filter(listFiles(root), VIDEO_FILES, SUBTITLE_FILES);
|
||||||
|
|
||||||
|
for (File file : files) {
|
||||||
Object metaObject = xattr.getMetaInfo(file);
|
Object metaObject = xattr.getMetaInfo(file);
|
||||||
String originalName = xattr.getOriginalName(file);
|
String originalName = xattr.getOriginalName(file);
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package net.filebot.ui.filter;
|
package net.filebot.ui.filter;
|
||||||
|
|
||||||
|
import static java.util.Collections.*;
|
||||||
import static net.filebot.Logging.*;
|
import static net.filebot.Logging.*;
|
||||||
import static net.filebot.UserFiles.*;
|
import static net.filebot.UserFiles.*;
|
||||||
import static net.filebot.util.ExceptionUtilities.*;
|
import static net.filebot.util.ExceptionUtilities.*;
|
||||||
|
@ -77,7 +78,7 @@ class ExtractTool extends Tool<TableModel> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected TableModel createModelInBackground(File root) throws InterruptedException {
|
protected TableModel createModelInBackground(File root) throws InterruptedException {
|
||||||
List<File> files = (root != null) ? FileUtilities.listFiles(root) : new ArrayList<File>();
|
List<File> files = root != null ? listFiles(root) : emptyList();
|
||||||
|
|
||||||
List<ArchiveEntry> entries = new ArrayList<ArchiveEntry>();
|
List<ArchiveEntry> entries = new ArrayList<ArchiveEntry>();
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -24,7 +24,6 @@ import javax.swing.table.TableModel;
|
||||||
|
|
||||||
import net.filebot.mediainfo.MediaInfo;
|
import net.filebot.mediainfo.MediaInfo;
|
||||||
import net.filebot.mediainfo.MediaInfo.StreamKind;
|
import net.filebot.mediainfo.MediaInfo.StreamKind;
|
||||||
import net.filebot.util.FileUtilities;
|
|
||||||
import net.filebot.util.ui.LoadingOverlayPane;
|
import net.filebot.util.ui.LoadingOverlayPane;
|
||||||
import net.miginfocom.swing.MigLayout;
|
import net.miginfocom.swing.MigLayout;
|
||||||
|
|
||||||
|
@ -54,13 +53,13 @@ class MediaInfoTool extends Tool<TableModel> {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected TableModel createModelInBackground(File root) throws InterruptedException {
|
protected TableModel createModelInBackground(File root) {
|
||||||
if (root == null) {
|
if (root == null) {
|
||||||
return new MediaInfoTableModel();
|
return new MediaInfoTableModel();
|
||||||
}
|
}
|
||||||
|
|
||||||
List<File> files = filter(FileUtilities.listFiles(root), VIDEO_FILES, AUDIO_FILES);
|
List<File> files = filter(listFiles(root), VIDEO_FILES, AUDIO_FILES);
|
||||||
Map<MediaInfoKey, String[]> data = new TreeMap<>();
|
Map<MediaInfoKey, String[]> data = new TreeMap<MediaInfoKey, String[]>();
|
||||||
|
|
||||||
try (MediaInfo mi = new MediaInfo()) {
|
try (MediaInfo mi = new MediaInfo()) {
|
||||||
IntStream.range(0, files.size()).forEach(f -> {
|
IntStream.range(0, files.size()).forEach(f -> {
|
||||||
|
|
Loading…
Reference in New Issue