瀏覽代碼

Show collections in main library view

This bbasically means that detected albums and shows won't be displayed as individual items anymore but collapsed on only. On touch, they'll reveal the hidden items.

Display order is [Albums] [Shows] [items which don't be belong to a collection]
Felix Paul Kühne 11 年之前
父節點
當前提交
7e5cbd3227
共有 1 個文件被更改,包括 26 次插入11 次删除
  1. 26 11
      AspenProject/VLCPlaylistViewController.m

+ 26 - 11
AspenProject/VLCPlaylistViewController.m

@@ -246,23 +246,38 @@
 
 - (void)updateViewContents
 {
-    if (_libraryMode == VLCLibraryModeAllAlbums) {
+    _foundMedia = [[NSMutableArray alloc] init];
+
+    /* add all albums */
+    if (_libraryMode != VLCLibraryModeAllSeries) {
         NSArray *rawAlbums = [MLAlbum allAlbums];
-        _foundMedia = [[NSMutableArray alloc] init];
         for (MLAlbum *album in rawAlbums) {
             if (album.name.length > 0 && album.tracks.count > 0)
                 [_foundMedia addObject:album];
         }
+    }
+    if (_libraryMode == VLCLibraryModeAllAlbums) {
+        [self reloadViews];
+        return;
+    }
 
-    } else if (_libraryMode == VLCLibraryModeAllSeries) {
-        NSArray *rawShows = [MLShow allShows];
-        _foundMedia = [[NSMutableArray alloc] init];
-        for (MLShow *show in rawShows) {
-            if (show.name.length > 0 && show.episodes.count > 0)
-                [_foundMedia addObject:show];
-        }
-    } else
-        _foundMedia = [NSMutableArray arrayWithArray:[MLFile allFiles]];
+    /* add all shows */
+    NSArray *rawShows = [MLShow allShows];
+    for (MLShow *show in rawShows) {
+        if (show.name.length > 0 && show.episodes.count > 0)
+            [_foundMedia addObject:show];
+    }
+    if (_libraryMode == VLCLibraryModeAllSeries) {
+        [self reloadViews];
+        return;
+    }
+
+    /* add all remaining files */
+    NSArray *allFiles = [MLFile allFiles];
+    for (MLFile *file in allFiles) {
+        if (!file.isShowEpisode && !file.isAlbumTrack)
+            [_foundMedia addObject:file];
+    }
 
     [self reloadViews];
 }