diff --git a/source/net/filebot/format/MediaBindingBean.java b/source/net/filebot/format/MediaBindingBean.java index 871aa596..9db82581 100644 --- a/source/net/filebot/format/MediaBindingBean.java +++ b/source/net/filebot/format/MediaBindingBean.java @@ -967,7 +967,13 @@ public class MediaBindingBean { } @Define("bytes") - public Long getFileSize() { + public long getFileSize() { + // sum size of all files + if (getMediaFile().isDirectory()) { + return listFiles(getMediaFile(), FILES).stream().mapToLong(File::length).sum(); + } + + // size of inferred media file (e.g. video file size for subtitle file) return getInferredMediaFile().length(); } diff --git a/source/net/filebot/media/VideoQuality.java b/source/net/filebot/media/VideoQuality.java index f0587ea7..547733dd 100644 --- a/source/net/filebot/media/VideoQuality.java +++ b/source/net/filebot/media/VideoQuality.java @@ -20,7 +20,7 @@ public class VideoQuality implements Comparator { return DESCENDING_ORDER.compare(f1, f2) < 0; } - private final Comparator chain = comparing(f -> new MediaBindingBean(f, f), comparingInt(this::getRepack).thenComparingInt(this::getResolution).thenComparingLong(this::getSize)); + private final Comparator chain = comparing(f -> new MediaBindingBean(f, f), comparingInt(this::getRepack).thenComparingInt(this::getResolution).thenComparingLong(MediaBindingBean::getFileSize)); @Override public int compare(File f1, File f2) { @@ -48,8 +48,4 @@ public class VideoQuality implements Comparator { return 0; } - private long getSize(MediaBindingBean m) { - return m.getInferredMediaFile().length(); - } - }