浏览代码

library: add media list creation for albums for the pad style form factor

Felix Paul Kühne 11 年之前
父节点
当前提交
457e09e17c
共有 1 个文件被更改,包括 15 次插入1 次删除
  1. 15 1
      Sources/VLCPlaylistViewController.m

+ 15 - 1
Sources/VLCPlaylistViewController.m

@@ -530,7 +530,21 @@ static NSString *kDisplayedFirstSteps = @"Did we display the first steps tutoria
     }
 
     NSManagedObject *selectedObject = _foundMedia[indexPath.row];
-    [self openMediaObject:selectedObject];
+
+    if ([selectedObject isKindOfClass:[MLAlbumTrack class]]) {
+        VLCMediaList *list;
+        NSArray *tracks = [[(MLAlbumTrack*)selectedObject album] sortedTracks];
+        NSUInteger count = tracks.count;
+        list = [[VLCMediaList alloc] init];
+
+        MLFile *file;
+        for (NSUInteger x = 0; x < count; x++) {
+            file = [(MLAlbumTrack*)tracks[x] files].anyObject;
+            [list addMedia:[VLCMedia mediaWithURL: [NSURL URLWithString:file.url]]];
+        }
+        [(VLCAppDelegate*)[UIApplication sharedApplication].delegate openMediaList:list atIndex:[tracks indexOfObject:selectedObject]];
+    } else
+        [self openMediaObject:selectedObject];
 }
 
 - (void)collectionView:(UICollectionView *)collectionView didDeselectItemAtIndexPath:(NSIndexPath *)indexPath