Prechádzať zdrojové kódy

Medialibrary: Bump medialibary and adapt to 0.3.0

Carola Nitz 6 rokov pred
rodič
commit
3d611509b0

+ 1 - 1
Podfile

@@ -23,7 +23,7 @@ target 'VLC-iOS' do
   pod 'PAPasscode', '~>1.0'
   pod 'GoogleAPIClientForREST/Drive'
   pod 'MobileVLCKit', '3.3.2'
-  pod 'VLCMediaLibraryKit', '0.2.2'
+  pod 'VLCMediaLibraryKit', '0.3.0'
   pod 'MediaLibraryKit-prod'
   pod 'GTMAppAuth'
   pod 'OneDriveSDK'

+ 5 - 5
Podfile.lock

@@ -75,7 +75,7 @@ PODS:
   - TVVLCKit (3.3.2)
   - upnpx (1.4.1)
   - VLC-WhiteRaccoon (1.0.0)
-  - VLCMediaLibraryKit (0.2.2):
+  - VLCMediaLibraryKit (0.3.0):
     - MobileVLCKit
   - XKKeychain (1.0.1)
   - xmlrpc (2.3.4):
@@ -103,7 +103,7 @@ DEPENDENCIES:
   - TVVLCKit (= 3.3.2)
   - upnpx (~> 1.4.0)
   - VLC-WhiteRaccoon
-  - VLCMediaLibraryKit (= 0.2.2)
+  - VLCMediaLibraryKit (= 0.3.0)
   - XKKeychain (~> 1.0)
 
 SPEC REPOS:
@@ -193,10 +193,10 @@ SPEC CHECKSUMS:
   TVVLCKit: dec91b12a8ae8a0031205279598a75993156cc65
   upnpx: f2a1b44c095b90e0a017ec0394e367053e78c31f
   VLC-WhiteRaccoon: 1e7e59b0568959135a89d09c416d1e11a5d9a986
-  VLCMediaLibraryKit: 5c2c3610c6a6e23fd03fecde44c61758467326a8
+  VLCMediaLibraryKit: 4247a534cfe3bc4188c19e5669b46679a7c5051c
   XKKeychain: 852ef663c56a7194c73d3c68e8d9d4f07b121d4f
   xmlrpc: 109bb21d15ed6d108b2c1ac5973a6a223a50f5f4
 
-PODFILE CHECKSUM: 760bb6224deb4354eae6b1efb5ee5375ad8fc319
+PODFILE CHECKSUM: dd57301afee824bce3a5afdd39fcb46c92086047
 
-COCOAPODS: 1.7.0
+COCOAPODS: 1.7.4

+ 2 - 2
SharedSources/MediaLibraryModel/AlbumModel.swift

@@ -118,10 +118,10 @@ extension VLCMLAlbum {
     }
 
     @objc func thumbnail() -> UIImage? {
-        var image = UIImage(contentsOfFile: artworkMrl.path)
+        var image = UIImage(contentsOfFile: artworkMRL()?.path ?? "")
         if image == nil {
             for track in files() ?? [] where track.isThumbnailGenerated() {
-                image = UIImage(contentsOfFile: track.thumbnail.path)
+                image = UIImage(contentsOfFile: track.thumbnail()?.path ?? "")
                 break
             }
         }

+ 2 - 2
SharedSources/MediaLibraryModel/ArtistModel.swift

@@ -102,10 +102,10 @@ extension VLCMLArtist {
     }
 
     @objc func thumbnail() -> UIImage? {
-        var image = UIImage(contentsOfFile: artworkMrl.path)
+        var image = UIImage(contentsOfFile: artworkMRL()?.path ?? "")
         if image == nil {
             for track in files() ?? [] where track.isThumbnailGenerated() {
-                image = UIImage(contentsOfFile: track.thumbnail.path)
+                image = UIImage(contentsOfFile: track.thumbnail()?.path ?? "")
                 break
             }
         }

+ 1 - 1
SharedSources/MediaLibraryModel/GenreModel.swift

@@ -92,7 +92,7 @@ extension VLCMLGenre {
     func thumbnail() -> UIImage? {
         var image: UIImage? = nil
         for track in tracks() ?? [] where track.isThumbnailGenerated() {
-            image = UIImage(contentsOfFile: track.thumbnail.path)
+            image = UIImage(contentsOfFile: track.thumbnail()?.path ?? "")
             break
         }
         if image == nil {

+ 3 - 2
SharedSources/MediaLibraryModel/MediaModel.swift

@@ -74,7 +74,7 @@ extension VLCMLMedia {
     }
 
     @objc func thumbnailImage() -> UIImage? {
-        var image = UIImage(contentsOfFile: thumbnail.path)
+        var image = UIImage(contentsOfFile: thumbnail()?.path ?? "")
         if image == nil {
             let isDarktheme = PresentationTheme.current == PresentationTheme.darkTheme
             if subtype() == .albumTrack {
@@ -108,7 +108,8 @@ extension VLCMLMedia {
         attributeSet.local = 1
         attributeSet.playCount = NSNumber(value: playCount())
         if isThumbnailGenerated() {
-            attributeSet.thumbnailData = UIImage(contentsOfFile: thumbnail.path)?.jpegData(compressionQuality: 0.9)
+            let image = UIImage(contentsOfFile: thumbnail()?.path ?? "")
+            attributeSet.thumbnailData = image?.jpegData(compressionQuality: 0.9)
         }
         attributeSet.codecs = codecs()
         attributeSet.languages = languages()

+ 1 - 1
SharedSources/MediaLibraryModel/PlaylistModel.swift

@@ -113,7 +113,7 @@ extension VLCMLPlaylist {
         var image = UIImage(contentsOfFile: artworkMrl())
         if image == nil {
             for track in files() ?? [] where track.isThumbnailGenerated() {
-                image = UIImage(contentsOfFile: track.thumbnail.path)
+                image = UIImage(contentsOfFile: track.thumbnail()?.path ?? "")
                 break
             }
         }

+ 1 - 2
SharedSources/MediaLibraryService.swift

@@ -362,8 +362,7 @@ extension MediaLibraryService {
     func requestThumbnail(for media: [VLCMLMedia]) {
         media.forEach() {
             guard !$0.isThumbnailGenerated() else { return }
-
-            if !medialib.requestThumbnail(for: $0) {
+            if !$0.requestThumbnail(of: .thumbnail, desiredWidth: 320, desiredHeight: 200, atPosition: 0.3) {
                 assertionFailure("MediaLibraryService: Failed to generate thumbnail for: \($0.identifier())")
             }
         }

+ 1 - 1
Sources/MediaCategoryCells/MediaCollectionViewCell.swift

@@ -96,7 +96,7 @@ class MediaCollectionViewCell: BaseCollectionViewCell {
         accessibilityLabel = movie.accessibilityText(editing: false)
         descriptionLabel.text = movie.mediaDuration()
         if movie.isThumbnailGenerated() {
-            thumbnailView.image = UIImage(contentsOfFile: movie.thumbnail.path)
+            thumbnailView.image = UIImage(contentsOfFile: movie.thumbnail()?.path ?? "")
         }
         newLabel.isHidden = !movie.isNew
     }

+ 1 - 1
Sources/VLCHTTPConnection.m

@@ -248,7 +248,7 @@
         } else if ([mediaObject isKindOfClass:[VLCMLAlbum class]]) {
             VLCMLAlbum *album = (VLCMLAlbum *)mediaObject;
             NSArray *albumTracks = [album tracks];
-            [mediaInHtml addObject:[self createHTMLFolderObjectWithImagePath:album.artworkMrl.path
+            [mediaInHtml addObject:[self createHTMLFolderObjectWithImagePath:[album artworkMRL].path
                                                                         name:album.title
                                                                        count:albumTracks.count]];
             for (VLCMLMedia *track in albumTracks) {