sum size of all files
This commit is contained in:
parent
7663977c9a
commit
20c85970e2
|
@ -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();
|
||||
}
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ public class VideoQuality implements Comparator<File> {
|
|||
return DESCENDING_ORDER.compare(f1, f2) < 0;
|
||||
}
|
||||
|
||||
private final Comparator<File> chain = comparing(f -> new MediaBindingBean(f, f), comparingInt(this::getRepack).thenComparingInt(this::getResolution).thenComparingLong(this::getSize));
|
||||
private final Comparator<File> 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<File> {
|
|||
return 0;
|
||||
}
|
||||
|
||||
private long getSize(MediaBindingBean m) {
|
||||
return m.getInferredMediaFile().length();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue