Browse Source

server browsing cell: correctly fallback on backdrop image if we don't have a poster

Felix Paul Kühne 9 years ago
parent
commit
278de66d92
1 changed files with 11 additions and 5 deletions
  1. 11 5
      VLC for Apple TV/VLCServerBrowsingTVCell.m

+ 11 - 5
VLC for Apple TV/VLCServerBrowsingTVCell.m

@@ -119,15 +119,18 @@ NSString *const VLCServerBrowsingTVCellIdentifier = @"VLCServerBrowsingTVCell";
     }
 
     NSString *imagePath = details.posterPath;
-    if (!imagePath)
+    NSString *imageSize = sessionManager.posterSizes.firstObject;
+    if (!imagePath) {
         imagePath = details.backdropPath;
+        imageSize = sessionManager.backdropSizes.firstObject;
+    }
     if (!imagePath)
         return;
 
     NSString *thumbnailURLString = [NSString stringWithFormat:@"%@%@%@",
                                     sessionManager.imageBaseURL,
                                     sessionManager.posterSizes.firstObject,
-                                    details.posterPath];
+                                    imagePath];
     self.thumbnailURL = [NSURL URLWithString:thumbnailURLString];
 }
 
@@ -146,15 +149,18 @@ NSString *const VLCServerBrowsingTVCellIdentifier = @"VLCServerBrowsingTVCell";
         return;
 
     NSString *imagePath = details.posterPath;
-    if (!imagePath)
+    NSString *imageSize = sessionManager.posterSizes.firstObject;
+    if (!imagePath) {
         imagePath = details.backdropPath;
+        imageSize = sessionManager.backdropSizes.firstObject;
+    }
     if (!imagePath)
         return;
 
     NSString *thumbnailURLString = [NSString stringWithFormat:@"%@%@%@",
                                     sessionManager.imageBaseURL,
-                                    sessionManager.posterSizes.firstObject,
-                                    details.posterPath];
+                                    imageSize,
+                                    imagePath];
     self.thumbnailURL = [NSURL URLWithString:thumbnailURLString];
 }