Implement advanced multi-part movie detection (via group by mediainfo)

This commit is contained in:
Reinhard Pointner 2016-08-08 07:18:00 +08:00
parent 6eeb63c9fb
commit 8457561dd5
3 changed files with 9 additions and 20 deletions

View File

@ -755,16 +755,6 @@ public class MediaBindingBean {
return new Double(getMediaInfo(StreamKind.General, 0, "OverallBitRate")).longValue();
}
@Define("vbr")
public Long getVideoBitRate() {
return new Double(getMediaInfo(StreamKind.Video, 0, "BitRate")).longValue();
}
@Define("abr")
public Long getAudioBitRate() {
return new Double(getMediaInfo(StreamKind.Audio, 0, "BitRate")).longValue();
}
@Define("duration")
public Long getDuration() {
return new Double(getMediaInfo(StreamKind.General, 0, "Duration")).longValue();
@ -780,6 +770,11 @@ public class MediaBindingBean {
return (int) (getDuration() / 60000);
}
@Define("encodedDate")
public String getEncodedDate() {
return getMediaInfo(StreamKind.General, 0, "Encoded_Date"); // e.g. UTC 2014-07-18 13:57:37
}
@Define("media")
public AssociativeScriptObject getGeneralMediaInfo() {
return createMediaInfoBindings(StreamKind.General).get(0);

View File

@ -1083,7 +1083,7 @@ public class MediaDetection {
}
try {
filesByMediaFolder.stream().collect(groupingBy(new VideoQuality()::getVideoBitrate)).forEach((vbr, videos) -> {
filesByMediaFolder.stream().collect(groupingBy(new VideoQuality()::getEncodedDate)).forEach((group, videos) -> {
groups.add(videos);
});
} catch (Exception e) {

View File

@ -64,16 +64,10 @@ public class VideoQuality implements Comparator<File> {
}).orElseGet(f::length);
}
public long getVideoBitrate(File f) {
public String getEncodedDate(File f) {
return media(f).map(it -> {
return it.getVideoBitRate();
}).orElse(0L);
}
public long getAudioBitrate(File f) {
return media(f).map(it -> {
return it.getAudioBitRate();
}).orElse(0L);
return it.getEncodedDate();
}).orElse(null);
}
}