Determine video codecs
This commit is contained in:
@@ -82,7 +82,18 @@ final class PostListPageGenerator {
|
||||
images.forEach(source.results.require)
|
||||
media = .images(images)
|
||||
} else if localized.hasVideos {
|
||||
media = .video(localized.images)
|
||||
let videos: [PostVideo.Video] = localized.images.compactMap { file -> PostVideo.Video? in
|
||||
guard file.type.isVideo else {
|
||||
self.source.results.warning("File \(file.identifier) ignored due to videos present in the post")
|
||||
return nil
|
||||
}
|
||||
guard let type = file.videoType() else {
|
||||
self.source.results.warning("Video \(file.identifier) ignored due to unknown video type")
|
||||
return nil
|
||||
}
|
||||
return .init(path: file.absoluteUrl, type: type)
|
||||
}
|
||||
media = .video(videos)
|
||||
localized.images.forEach(source.results.require)
|
||||
} else {
|
||||
media = nil
|
||||
|
||||
Reference in New Issue
Block a user