diff --git a/source/net/filebot/ui/analyze/AnalyzePanel.java b/source/net/filebot/ui/analyze/AnalyzePanel.java index aa8e7aaf..d1192424 100644 --- a/source/net/filebot/ui/analyze/AnalyzePanel.java +++ b/source/net/filebot/ui/analyze/AnalyzePanel.java @@ -18,13 +18,12 @@ public class AnalyzePanel extends JComponent { toolsPanel.setBorder(BorderFactory.createTitledBorder("Tools")); setLayout(new MigLayout("insets dialog, gapx 50, fill")); - add(fileTreePanel, "grow, sizegroupx column"); add(toolsPanel, "grow, sizegroupx column"); addTool(new ExtractTool()); - addTool(new SplitTool()); addTool(new TypeTool()); + addTool(new SplitTool()); addTool(new AttributeTool()); putClientProperty("transferablePolicy", fileTreePanel.getTransferablePolicy()); diff --git a/source/net/filebot/ui/analyze/SplitTool.java b/source/net/filebot/ui/analyze/SplitTool.java index 04b2ea64..5d022978 100644 --- a/source/net/filebot/ui/analyze/SplitTool.java +++ b/source/net/filebot/ui/analyze/SplitTool.java @@ -30,7 +30,7 @@ class SplitTool extends Tool { private SpinnerNumberModel spinnerModel = new SpinnerNumberModel(4480, 0, Integer.MAX_VALUE, 100); public SplitTool() { - super("Disks"); + super("Parts"); JScrollPane treeScrollPane = new JScrollPane(tree); treeScrollPane.setBorder(new SeparatorBorder(2, new Color(0, 0, 0, 90), GradientStyle.TOP_TO_BOTTOM, SeparatorBorder.Position.BOTTOM)); diff --git a/source/net/filebot/ui/analyze/TypeTool.java b/source/net/filebot/ui/analyze/TypeTool.java index 081a17fd..ed470545 100644 --- a/source/net/filebot/ui/analyze/TypeTool.java +++ b/source/net/filebot/ui/analyze/TypeTool.java @@ -1,6 +1,8 @@ package net.filebot.ui.analyze; +import static java.util.Arrays.*; import static java.util.Collections.*; +import static net.filebot.MediaTypes.*; import static net.filebot.util.FileUtilities.*; import java.io.File; @@ -37,7 +39,6 @@ class TypeTool extends Tool { super("Types"); setLayout(new MigLayout("insets 0, fill")); - JScrollPane treeScrollPane = new JScrollPane(tree); treeScrollPane.setBorder(BorderFactory.createEmptyBorder()); @@ -49,7 +50,7 @@ class TypeTool extends Tool { @Override protected TreeModel createModelInBackground(File root) throws InterruptedException { - List filesAndFolders = (root != null) ? listFiles(singleton(root), FILE_WALK_MAX_DEPTH, false, true, true) : new ArrayList(); + List filesAndFolders = (root != null) ? listFiles(singleton(root), FILE_WALK_MAX_DEPTH, true, true, true) : new ArrayList(); List groups = new ArrayList(); for (Entry it : getMetaTypes().entrySet()) { @@ -74,20 +75,46 @@ class TypeTool extends Tool { public Map getMetaTypes() { Map types = new LinkedHashMap(); - types.put("Video", MediaTypes.VIDEO_FILES); - types.put("Disk Folder", MediaDetection.getDiskFolderFilter()); - types.put("Subtitle", MediaTypes.SUBTITLE_FILES); - types.put("Audio", MediaTypes.AUDIO_FILES); - types.put("Archive", MediaTypes.ARCHIVE_FILES); - types.put("Verification", MediaTypes.VERIFICATION_FILES); try { + types.put("Episode", new EpisodeFilter()); + types.put("Movie", new MovieFilter()); + types.put("Video", MediaTypes.VIDEO_FILES); + types.put("Subtitle", MediaTypes.SUBTITLE_FILES); + types.put("Audio", MediaTypes.AUDIO_FILES); + types.put("Archive", MediaTypes.ARCHIVE_FILES); + types.put("Verification", MediaTypes.VERIFICATION_FILES); types.put("Clutter", MediaDetection.getClutterFileFilter()); + types.put("Disk Folder", MediaDetection.getDiskFolderFilter()); } catch (IOException e) { Logger.getLogger(TypeTool.class.getName()).log(Level.WARNING, e.getMessage()); } return types; } + private static class EpisodeFilter implements FileFilter { + + private final static long MAX_SIZE = 50 * MEGA; + + @Override + public boolean accept(File file) { + return file.length() > MAX_SIZE && VIDEO_FILES.accept(file) && MediaDetection.isEpisode(file.getPath(), true); + } + } + + private static class MovieFilter implements FileFilter { + + private final static long MAX_SIZE = 500 * MEGA; + + @Override + public boolean accept(File file) { + try { + return file.length() > MAX_SIZE && VIDEO_FILES.accept(file) && !MediaDetection.isEpisode(file.getPath(), true) && MediaDetection.matchMovieName(asList(file.getName(), file.getParent()), true, 0).size() > 0; + } catch (Exception e) { + return false; + } + } + } + @Override protected void setModel(TreeModel model) { tree.setModel(model); diff --git a/source/net/filebot/util/FileUtilities.java b/source/net/filebot/util/FileUtilities.java index b9d66308..79af8c73 100644 --- a/source/net/filebot/util/FileUtilities.java +++ b/source/net/filebot/util/FileUtilities.java @@ -647,7 +647,9 @@ public final class FileUtilities { public static final long GIGA = 1024 * MEGA; public static String formatSize(long size) { - if (size >= MEGA) + if (size >= GIGA) + return String.format("%,d GB", size / GIGA); + else if (size >= MEGA) return String.format("%,d MB", size / MEGA); else if (size >= KILO) return String.format("%,d KB", size / KILO);