Browse Source

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 years ago
parent
commit
7e5cbd3227
1 changed files with 26 additions and 11 deletions
  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];
 }