[vlc-commits] [Git][videolan/vlc][master] macosx: Make VLCMediaLibraryGenre iterateMediaItems more concise

Jean-Baptiste Kempf (@jbk) gitlab at videolan.org
Sun Jul 24 14:46:35 UTC 2022



Jean-Baptiste Kempf pushed to branch master at VideoLAN / VLC


Commits:
f25ac47e by Claudio Cambra at 2022-07-24T14:32:11+00:00
macosx: Make VLCMediaLibraryGenre iterateMediaItems more concise

Signed-off-by: Claudio Cambra <claudio.cambra at gmail.com>

- - - - -


1 changed file:

- modules/gui/macosx/library/VLCLibraryDataTypes.m


Changes:

=====================================
modules/gui/macosx/library/VLCLibraryDataTypes.m
=====================================
@@ -442,29 +442,22 @@ NSString *VLCMediaLibraryMediaItemLibraryID = @"VLCMediaLibraryMediaItemLibraryI
 
 - (void)iterateMediaItemsWithBlock:(void (^)(VLCMediaLibraryMediaItem*))mediaItemBlock orderedBy:(int)mediaItemParentType
 {
+    NSArray<id<VLCMediaLibraryItemProtocol>> *childItems;
     switch(mediaItemParentType) {
         case VLC_ML_PARENT_ARTIST:
-        {
-            for(VLCMediaLibraryArtist *artist in self.artists) {
-                [artist iterateMediaItemsWithBlock:mediaItemBlock];
-            }
+            childItems = self.artists;
             break;
-        }
         case VLC_ML_PARENT_ALBUM:
-        {
-            for(VLCMediaLibraryAlbum *album in self.albums) {
-                [album iterateMediaItemsWithBlock:mediaItemBlock];
-            }
+            childItems = self.albums;
             break;
-        }
         case VLC_ML_PARENT_UNKNOWN:
         default:
-        {
-            for(VLCMediaLibraryMediaItem *mediaItem in self.tracksAsMediaItems) {
-                mediaItemBlock(mediaItem);
-            }
+            childItems = self.tracksAsMediaItems;
             break;
-        }
+    }
+
+    for(id<VLCMediaLibraryItemProtocol> childItem in childItems) {
+        [childItem iterateMediaItemsWithBlock:mediaItemBlock];
     }
 }
 



View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/f25ac47e0f468897438287b06869adf2555ad506

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/f25ac47e0f468897438287b06869adf2555ad506
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the vlc-commits mailing list