@@ -199,11 +199,7 @@ public struct LocalFileInformationGenerator {
199199 static public var audioThumbnail : ( _ fileURL: URL , _ dimension: CGSize ? ) -> ImageClass ? = { fileURL, dimension in
200200 let playerItem = AVPlayerItem ( url: fileURL)
201201 let metadataList = playerItem. asset. commonMetadata
202- #if swift(>=4.0)
203202 let commonKeyArtwork = AVMetadataKey . commonKeyArtwork
204- #else
205- let commonKeyArtwork = AVMetadataCommonKeyArtwork
206- #endif
207203 for item in metadataList {
208204 if item. commonKey == commonKeyArtwork {
209205 if let data = item. dataValue {
@@ -356,11 +352,7 @@ public struct LocalFileInformationGenerator {
356352 let playerItem = AVPlayerItem ( url: fileURL)
357353 let metadataList = playerItem. asset. commonMetadata
358354 for item in metadataList {
359- #if swift(>=4.0)
360- let commonKey = item. commonKey? . rawValue
361- #else
362- let commonKey = item. commonKey
363- #endif
355+ let commonKey = item. commonKey? . rawValue
364356 if let key = makeKeyDescription ( commonKey) {
365357 if commonKey == " location " , let value = item. stringValue, let loc = parseLocationData ( value) {
366358 keys. append ( key)
@@ -401,16 +393,12 @@ public struct LocalFileInformationGenerator {
401393 dic = audioprops. prop
402394 keys = audioprops. keys
403395 dic. removeValue ( forKey: " Duration " )
404- if let index = keys. index ( of: " Duration " ) {
396+ if let index = keys. firstIndex ( of: " Duration " ) {
405397 keys. remove ( at: index)
406398 }
407399 }
408400 let asset = AVURLAsset ( url: fileURL, options: nil )
409- #if swift(>=4.0)
410401 let videoTracks = asset. tracks ( withMediaType: AVMediaType . video)
411- #else
412- let videoTracks = asset. tracks ( withMediaType: AVMediaTypeVideo)
413- #endif
414402 if let videoTrack = videoTracks. first {
415403 var bitrate : Float = 0
416404 let width = Int ( videoTrack. naturalSize. width)
@@ -424,11 +412,7 @@ public struct LocalFileInformationGenerator {
424412 add ( key: " Duration " , value: TimeInterval ( duration) . formatshort)
425413 add ( key: " Video Bitrate " , value: " \( Int ( ceil ( bitrate / 1000 ) ) ) kbps " )
426414 }
427- #if swift(>=4.0)
428415 let audioTracks = asset. tracks ( withMediaType: AVMediaType . audio)
429- #else
430- let audioTracks = asset. tracks ( withMediaType: AVMediaTypeAudio)
431- #endif
432416 // dic["Audio channels"] = audioTracks.count
433417 var bitrate : Float = 0
434418 for track in audioTracks {
0 commit comments