[vlc-commits] [Git][videolan/vlc][master] 26 commits: macosx: Add methods to get playlists by type in VLCLibraryModel

Steve Lhomme (@robUx4) gitlab at videolan.org
Fri Sep 6 10:57:22 UTC 2024



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
fa8f9803 by Claudio Cambra at 2024-09-06T10:33:54+00:00
macosx: Add methods to get playlists by type in VLCLibraryModel

Signed-off-by: Claudio Cambra <developer at claudiocambra.com>

- - - - -
cc746ed6 by Claudio Cambra at 2024-09-06T10:33:54+00:00
macosx: Add playlistType property to playlist data source

Signed-off-by: Claudio Cambra <developer at claudiocambra.com>

- - - - -
d2a4c8b6 by Claudio Cambra at 2024-09-06T10:33:54+00:00
macosx: Retrieve playlist for current playlistType in playlist data source

Signed-off-by: Claudio Cambra <developer at claudiocambra.com>

- - - - -
b4509638 by Claudio Cambra at 2024-09-06T10:33:54+00:00
macosx: Use specific playlist type when querying number of playlists in playlist view controller

Signed-off-by: Claudio Cambra <developer at claudiocambra.com>

- - - - -
9cce9974 by Claudio Cambra at 2024-09-06T10:33:54+00:00
macosx: Fix playlist notification emitted with update event

Signed-off-by: Claudio Cambra <developer at claudiocambra.com>

- - - - -
99f63441 by Claudio Cambra at 2024-09-06T10:33:54+00:00
macosx: Remove now-unused numberOfPlaylists and listOfPlaylists properties from VLCLibraryModel

Signed-off-by: Claudio Cambra <developer at claudiocambra.com>

- - - - -
2c9853e5 by Claudio Cambra at 2024-09-06T10:33:54+00:00
macosx: Only emit notifications when handling playlist-related events in library model

Signed-off-by: Claudio Cambra <developer at claudiocambra.com>

- - - - -
d5a5161f by Claudio Cambra at 2024-09-06T10:33:54+00:00
macosx: Modify playlist deletion handler in playlist data source to fit new deletion notification object from library model

Signed-off-by: Claudio Cambra <developer at claudiocambra.com>

- - - - -
d8a6cd3f by Claudio Cambra at 2024-09-06T10:33:54+00:00
macosx: Fix handling of playlist added events in VLCLibraryModel

Signed-off-by: Claudio Cambra <developer at claudiocambra.com>

- - - - -
f3e17f76 by Claudio Cambra at 2024-09-06T10:33:54+00:00
macosx: Add method to present playlist library view for specific playlist type in playlist view controller

Signed-off-by: Claudio Cambra <developer at claudiocambra.com>

- - - - -
f80f184f by Claudio Cambra at 2024-09-06T10:33:54+00:00
macosx: Constify init from vlc_ml_playlist_t for VLCMediaLibraryPlaylist

Signed-off-by: Claudio Cambra <developer at claudiocambra.com>

- - - - -
c3ae5a2a by Claudio Cambra at 2024-09-06T10:33:54+00:00
macosx: Add playlist subsegment types

Signed-off-by: Claudio Cambra <developer at claudiocambra.com>

- - - - -
8cf7a774 by Claudio Cambra at 2024-09-06T10:33:54+00:00
macosx: Handle playlist subsegments in library window toolbar delegate

Signed-off-by: Claudio Cambra <developer at claudiocambra.com>

- - - - -
63c5362d by Claudio Cambra at 2024-09-06T10:33:54+00:00
macosx: Add specific view mode preferences for playlist subsegments

Signed-off-by: Claudio Cambra <developer at claudiocambra.com>

- - - - -
4456995a by Claudio Cambra at 2024-09-06T10:33:54+00:00
macosx: Handle playlist subsegment view modes in library window

Signed-off-by: Claudio Cambra <developer at claudiocambra.com>

- - - - -
fb2a2e56 by Claudio Cambra at 2024-09-06T10:33:54+00:00
macosx: Handle playlist subsegments in library window showPlaylistLibrary

Signed-off-by: Claudio Cambra <developer at claudiocambra.com>

- - - - -
62fd381a by Claudio Cambra at 2024-09-06T10:33:54+00:00
macosx: Match constness of declaration with implementation in playlist data type

Signed-off-by: Claudio Cambra <developer at claudiocambra.com>

- - - - -
aa92b7e4 by Claudio Cambra at 2024-09-06T10:33:54+00:00
macosx: Provide playlist subsegments in playlist segment

Signed-off-by: Claudio Cambra <developer at claudiocambra.com>

- - - - -
1ed91477 by Claudio Cambra at 2024-09-06T10:33:54+00:00
macosx: Improve display text for playlist subsegments

Signed-off-by: Claudio Cambra <developer at claudiocambra.com>

- - - - -
34e25123 by Claudio Cambra at 2024-09-06T10:33:54+00:00
macosx: Make icon for general playlist segment different from music playlists segment

Signed-off-by: Claudio Cambra <developer at claudiocambra.com>

- - - - -
4d6b5171 by Claudio Cambra at 2024-09-06T10:33:54+00:00
macosx: Fix getter preference key for playlist subsegment view modes

Signed-off-by: Claudio Cambra <developer at claudiocambra.com>

- - - - -
56a5a020 by Claudio Cambra at 2024-09-06T10:33:54+00:00
macosx: Tailor playlist view placeholder string to specific playlist types being presented

Signed-off-by: Claudio Cambra <developer at claudiocambra.com>

- - - - -
b1666979 by Claudio Cambra at 2024-09-06T10:33:54+00:00
macosx: Add method to expand all parents of a target node in nav sidebar view controller

Signed-off-by: Claudio Cambra <developer at claudiocambra.com>

- - - - -
2932b7df by Claudio Cambra at 2024-09-06T10:33:54+00:00
macosx: Fix handling of expanding music segment node when clicked in nav sidebar view controller

Signed-off-by: Claudio Cambra <developer at claudiocambra.com>

- - - - -
8c9fc69f by Claudio Cambra at 2024-09-06T10:33:54+00:00
macosx: Make sure to expand parents of nodes when dealing with segment updates or selection changes

Signed-off-by: Claudio Cambra <developer at claudiocambra.com>

- - - - -
30ad95ef by Claudio Cambra at 2024-09-06T10:33:54+00:00
macosx: Simplify node selection handling and expansion in nav sidebar view controller

Automatically trying to expand all parents obviates need for specific per-segment handling of selection, except for music segment

Signed-off-by: Claudio Cambra <developer at claudiocambra.com>

- - - - -


15 changed files:

- modules/gui/macosx/library/VLCLibraryDataTypes.h
- modules/gui/macosx/library/VLCLibraryDataTypes.m
- modules/gui/macosx/library/VLCLibraryModel.h
- modules/gui/macosx/library/VLCLibraryModel.m
- modules/gui/macosx/library/VLCLibrarySegment.h
- modules/gui/macosx/library/VLCLibrarySegment.m
- modules/gui/macosx/library/VLCLibraryWindow.m
- modules/gui/macosx/library/VLCLibraryWindowNavigationSidebarViewController.m
- modules/gui/macosx/library/VLCLibraryWindowPersistentPreferences.h
- modules/gui/macosx/library/VLCLibraryWindowPersistentPreferences.m
- modules/gui/macosx/library/VLCLibraryWindowToolbarDelegate.m
- modules/gui/macosx/library/playlist-library/VLCLibraryPlaylistDataSource.h
- modules/gui/macosx/library/playlist-library/VLCLibraryPlaylistDataSource.m
- modules/gui/macosx/library/playlist-library/VLCLibraryPlaylistViewController.h
- modules/gui/macosx/library/playlist-library/VLCLibraryPlaylistViewController.m


Changes:

=====================================
modules/gui/macosx/library/VLCLibraryDataTypes.h
=====================================
@@ -277,7 +277,7 @@ typedef NS_ENUM(NSUInteger, VLCMediaLibraryParentGroupType) {
 @property (readonly) BOOL readOnly;
 
 + (instancetype)playlistForLibraryID:(int64_t)libraryID;
-- (instancetype)initWithPlaylist:(struct vlc_ml_playlist_t *)p_playlist;
+- (instancetype)initWithPlaylist:(const struct vlc_ml_playlist_t * const)p_playlist;
 
 @end
 


=====================================
modules/gui/macosx/library/VLCLibraryDataTypes.m
=====================================
@@ -868,7 +868,7 @@ static NSString *genreArrayDisplayString(NSArray<VLCMediaLibraryGenre *> * const
     return [[VLCMediaLibraryPlaylist alloc] initWithPlaylist:p_playlist];
 }
 
-- (instancetype)initWithPlaylist:(struct vlc_ml_playlist_t *)p_playlist
+- (instancetype)initWithPlaylist:(const struct vlc_ml_playlist_t * const)p_playlist
 {
     self = [super init];
     if (self && p_playlist != NULL) {


=====================================
modules/gui/macosx/library/VLCLibraryModel.h
=====================================
@@ -30,7 +30,7 @@ NS_ASSUME_NONNULL_BEGIN
 extern NSString * const VLCLibraryModelArtistListReset;
 extern NSString * const VLCLibraryModelAlbumListReset;
 extern NSString * const VLCLibraryModelGenreListReset;
-extern NSString * const VLCLibraryModelPlaylistListReset;
+extern NSString * const VLCLibraryModelPlaylistAdded;
 extern NSString * const VLCLibraryModelListOfMonitoredFoldersUpdated;
 extern NSString * const VLCLibraryModelMediaItemThumbnailGenerated;
 
@@ -84,9 +84,6 @@ extern NSString * const VLCLibraryModelPlaylistUpdated;
 @property (readonly) size_t numberOfVideoMedia;
 @property (readonly) NSArray <VLCMediaLibraryMediaItem *> *listOfVideoMedia;
 
- at property (readonly) size_t numberOfPlaylists;
- at property (readonly) NSArray <VLCMediaLibraryPlaylist *> *listOfPlaylists;
-
 @property (readwrite) uint32_t recentMediaLimit;
 @property (readonly) size_t numberOfRecentMedia;
 @property (readonly) NSArray <VLCMediaLibraryMediaItem *> *listOfRecentMedia;
@@ -109,6 +106,8 @@ extern NSString * const VLCLibraryModelPlaylistUpdated;
 
 @property (readwrite, nonatomic) NSString *filterString;
 
+- (size_t)numberOfPlaylistsOfType:(const enum vlc_ml_playlist_type_t)playlistType;
+- (nullable NSArray<VLCMediaLibraryPlaylist *> *)listOfPlaylistsOfType:(const enum vlc_ml_playlist_type_t)playlistType;
 - (nullable NSArray<VLCMediaLibraryAlbum *> *)listAlbumsOfParentType:(const enum vlc_ml_parent_type)parentType forID:(int64_t)ID;
 - (NSArray<id<VLCMediaLibraryItemProtocol>> *)listOfLibraryItemsOfParentType:(const VLCMediaLibraryParentGroupType)parentType;
 - (NSArray<VLCMediaLibraryMediaItem *> *)listOfMediaItemsForParentType:(const VLCMediaLibraryParentGroupType)parentType;


=====================================
modules/gui/macosx/library/VLCLibraryModel.m
=====================================
@@ -30,7 +30,6 @@
 NSString * const VLCLibraryModelArtistListReset = @"VLCLibraryModelArtistListReset";
 NSString * const VLCLibraryModelAlbumListReset = @"VLCLibraryModelAlbumListReset";
 NSString * const VLCLibraryModelGenreListReset = @"VLCLibraryModelGenreListReset";
-NSString * const VLCLibraryModelPlaylistListReset = @"VLCLibraryModelPlaylistListReset";
 NSString * const VLCLibraryModelListOfMonitoredFoldersUpdated = @"VLCLibraryModelListOfMonitoredFoldersUpdated";
 NSString * const VLCLibraryModelMediaItemThumbnailGenerated = @"VLCLibraryModelMediaItemThumbnailGenerated";
 
@@ -41,6 +40,8 @@ NSString * const VLCLibraryModelRecentAudioMediaListReset = @"VLCLibraryModelRec
 NSString * const VLCLibraryModelListOfShowsReset = @"VLCLibraryModelListOfShowsReset";
 NSString * const VLCLibraryModelListOfGroupsReset = @"VLCLibraryModelListOfGroupsReset";
 
+NSString * const VLCLibraryModelPlaylistAdded = @"VLCLibraryModelPlaylistAdded";
+
 NSString * const VLCLibraryModelAudioMediaItemDeleted = @"VLCLibraryModelAudioMediaItemDeleted";
 NSString * const VLCLibraryModelVideoMediaItemDeleted = @"VLCLibraryModelVideoMediaItemDeleted";
 NSString * const VLCLibraryModelRecentsMediaItemDeleted = @"VLCLibraryModelRecentsMediaItemDeleted";
@@ -78,7 +79,6 @@ NSString * const VLCLibraryModelPlaylistUpdated = @"VLCLibraryModelPlaylistUpdat
     size_t _initialGenreCount;
     size_t _initialShowCount;
     size_t _initialGroupCount;
-    size_t _initialPlaylistCount;
     size_t _initialRecentsCount;
     size_t _initialRecentAudioCount;
 
@@ -87,7 +87,6 @@ NSString * const VLCLibraryModelPlaylistUpdated = @"VLCLibraryModelPlaylistUpdat
     dispatch_queue_t _artistCacheModificationQueue;
     dispatch_queue_t _genreCacheModificationQueue;
     dispatch_queue_t _groupCacheModificationQueue;
-    dispatch_queue_t _playlistCacheModificationQueue;
 }
 
 @property (readwrite, atomic) NSArray *cachedAudioMedia;
@@ -99,7 +98,6 @@ NSString * const VLCLibraryModelPlaylistUpdated = @"VLCLibraryModelPlaylistUpdat
 @property (readwrite, atomic) NSArray *cachedListOfGroups;
 @property (readwrite, atomic) NSArray *cachedRecentMedia;
 @property (readwrite, atomic) NSArray *cachedRecentAudioMedia;
- at property (readwrite, atomic) NSArray *cachedPlaylists;
 @property (readwrite, atomic) NSArray *cachedListOfMonitoredFolders;
 
 - (void)resetCachedListOfRecentMedia;
@@ -110,9 +108,9 @@ NSString * const VLCLibraryModelPlaylistUpdated = @"VLCLibraryModelPlaylistUpdat
 - (void)resetCachedListOfShows;
 - (void)resetCachedListOfGroups;
 - (void)resetCachedListOfMonitoredFolders;
-- (void)resetCachedListOfPlaylists;
 - (void)mediaItemThumbnailGenerated:(VLCMediaLibraryMediaItem *)mediaItem;
 - (void)handleMediaItemAddedEvent:(const vlc_ml_event_t * const)p_event;
+- (void)handlePlaylistAddedEvent:(const vlc_ml_event_t * const)p_event;
 - (void)handleMediaItemDeletionEvent:(const vlc_ml_event_t * const)p_event;
 - (void)handleAlbumDeletionEvent:(const vlc_ml_event_t * const)p_event;
 - (void)handleArtistDeletionEvent:(const vlc_ml_event_t * const)p_event;
@@ -194,7 +192,7 @@ static void libraryCallback(void *p_data, const vlc_ml_event_t *p_event)
             [libraryModel handleGroupDeletionEvent:p_event];
             break;
         case VLC_ML_EVENT_PLAYLIST_ADDED:
-            [libraryModel resetCachedListOfPlaylists];
+            [libraryModel handlePlaylistAddedEvent:p_event];
             break;
         case VLC_ML_EVENT_PLAYLIST_UPDATED:
             [libraryModel handlePlaylistUpdateEvent:p_event];
@@ -249,7 +247,6 @@ static void libraryCallback(void *p_data, const vlc_ml_event_t *p_event)
         _artistCacheModificationQueue = dispatch_queue_create("artistCacheModificationQueue", 0);
         _genreCacheModificationQueue = dispatch_queue_create("genreCacheModificationQueue", 0);
         _groupCacheModificationQueue = dispatch_queue_create("groupCacheModificationQueue", 0);
-        _playlistCacheModificationQueue = dispatch_queue_create("playlistCacheModificationQueue", 0);
 
         _defaultNotificationCenter = NSNotificationCenter.defaultCenter;
         [_defaultNotificationCenter addObserver:self
@@ -268,8 +265,6 @@ static void libraryCallback(void *p_data, const vlc_ml_event_t *p_event)
             self->_initialGenreCount = vlc_ml_count_genres(self->_p_mediaLibrary, &queryParameters);
             self->_initialShowCount = vlc_ml_count_shows(self->_p_mediaLibrary, &queryParameters);
             self->_initialGroupCount = vlc_ml_count_groups(self->_p_mediaLibrary, &queryParameters);
-            self->_initialPlaylistCount =
-                vlc_ml_count_playlists(self->_p_mediaLibrary, &queryParameters, VLC_ML_PLAYLIST_TYPE_ALL);
 
             queryParameters.i_nbResults = self->_recentMediaLimit;
             self->_initialRecentsCount = vlc_ml_count_video_history(self->_p_mediaLibrary, &queryParameters);
@@ -697,51 +692,33 @@ static void libraryCallback(void *p_data, const vlc_ml_event_t *p_event)
     }
 }
 
-
-- (size_t)numberOfPlaylists
+- (size_t)numberOfPlaylistsOfType:(const enum vlc_ml_playlist_type_t)playlistType
 {
-    if (!_cachedPlaylists) {
-        [self resetCachedListOfPlaylists];
-        // Return initial count here, otherwise it will return 0 on the first time
-        return _initialPlaylistCount;
-    }
-
-    return _cachedPlaylists.count;
+    const vlc_ml_query_params_t queryParams = self.queryParams;
+    return vlc_ml_count_playlists(_p_mediaLibrary, &queryParams, playlistType);
 }
 
-- (NSArray<VLCMediaLibraryPlaylist *> *)listOfPlaylists
+- (nullable NSArray<VLCMediaLibraryPlaylist *> *)listOfPlaylistsOfType:(const enum vlc_ml_playlist_type_t)playlistType
 {
-    if (!_cachedPlaylists) {
-        [self resetCachedListOfPlaylists];
+    const vlc_ml_query_params_t queryParams = self.queryParams;
+    vlc_ml_playlist_list_t * const p_playlistList =
+        vlc_ml_list_playlists(_p_mediaLibrary, &queryParams, playlistType);
+    if (p_playlistList == NULL) {
+        return nil;
     }
 
-    return _cachedPlaylists;
-}
-
-- (void)resetCachedListOfPlaylists
-{
-    dispatch_async(dispatch_get_global_queue(QOS_CLASS_USER_INTERACTIVE, 0), ^{
-        const vlc_ml_query_params_t queryParameters = [self queryParams];
-        vlc_ml_playlist_list_t * const p_playlist_list = vlc_ml_list_playlists(self->_p_mediaLibrary, &queryParameters, VLC_ML_PLAYLIST_TYPE_ALL);
-        if (p_playlist_list == NULL) {
-            return;
-        }
-
-        NSMutableArray * const mutableArray = [[NSMutableArray alloc] initWithCapacity:p_playlist_list->i_nb_items];
-        for (size_t x = 0; x < p_playlist_list->i_nb_items; x++) {
-            VLCMediaLibraryPlaylist * const playlist = [[VLCMediaLibraryPlaylist alloc] initWithPlaylist:&p_playlist_list->p_items[x]];
-            if (playlist != nil) {
-                [mutableArray addObject:playlist];
-            }
+    NSMutableArray * const mutableArray =
+        [[NSMutableArray alloc] initWithCapacity:p_playlistList->i_nb_items];
+    for (size_t x = 0; x < p_playlistList->i_nb_items; x++) {
+        VLCMediaLibraryPlaylist * const playlist =
+            [[VLCMediaLibraryPlaylist alloc] initWithPlaylist:&p_playlistList->p_items[x]];
+        if (playlist) {
+            [mutableArray addObject:playlist];
         }
+    }
 
-        vlc_ml_playlist_list_release(p_playlist_list);
-        
-        dispatch_async(dispatch_get_main_queue(), ^{
-            self.cachedPlaylists = mutableArray.copy;
-            [self->_defaultNotificationCenter postNotificationName:VLCLibraryModelPlaylistListReset object:self];
-        });
-    });
+    vlc_ml_playlist_list_release(p_playlistList);
+    return mutableArray.copy;
 }
 
 - (void)resetCachedListOfMonitoredFolders
@@ -1257,6 +1234,24 @@ static void libraryCallback(void *p_data, const vlc_ml_event_t *p_event)
     });
 }
 
+- (void)handlePlaylistAddedEvent:(const vlc_ml_event_t * const)p_event
+{
+    NSParameterAssert(p_event != NULL);
+
+    const vlc_ml_playlist_t * const p_playlist = p_event->creation.p_playlist;
+    VLCMediaLibraryPlaylist * const playlist =
+        [[VLCMediaLibraryPlaylist alloc] initWithPlaylist:p_playlist];
+    if (playlist == nil) {
+        NSLog(@"Could not find a library playlist with this ID. Can't handle update.");
+        return;
+    }
+
+    dispatch_sync(dispatch_get_main_queue(), ^{
+        [self->_defaultNotificationCenter postNotificationName:VLCLibraryModelPlaylistAdded
+                                                        object:playlist];
+    });
+}
+
 - (void)handlePlaylistUpdateEvent:(const vlc_ml_event_t * const)p_event
 {
     NSParameterAssert(p_event != NULL);
@@ -1268,23 +1263,9 @@ static void libraryCallback(void *p_data, const vlc_ml_event_t *p_event)
         return;
     }
 
-    dispatch_async(_playlistCacheModificationQueue, ^{
-        NSMutableArray * const mutablePlaylists = self.cachedPlaylists.mutableCopy;
-        const NSUInteger playlistIdx = [mutablePlaylists indexOfObjectPassingTest:^BOOL(VLCMediaLibraryPlaylist * const playlist, const NSUInteger idx, BOOL * const stop) {
-            NSAssert(playlist != nil, @"Cache list should not contain nil playlists");
-            return playlist.libraryID == itemId;
-        }];
-
-        if (playlistIdx == NSNotFound) {
-            NSLog(@"Could not handle deletion of playlist with id %lld in model", itemId);
-            return;
-        }
-
-        dispatch_sync(dispatch_get_main_queue(), ^{
-            [mutablePlaylists replaceObjectAtIndex:playlistIdx withObject:playlist];
-            self.cachedPlaylists = mutablePlaylists.copy;
-            [self->_defaultNotificationCenter postNotificationName:VLCLibraryModelPlaylistDeleted object:playlist];
-        });
+    dispatch_sync(dispatch_get_main_queue(), ^{
+        [self->_defaultNotificationCenter postNotificationName:VLCLibraryModelPlaylistUpdated
+                                                        object:playlist];
     });
 }
 
@@ -1293,25 +1274,9 @@ static void libraryCallback(void *p_data, const vlc_ml_event_t *p_event)
     NSParameterAssert(p_event != NULL);
 
     const int64_t itemId = p_event->modification.i_entity_id;
-
-    dispatch_async(_playlistCacheModificationQueue, ^{
-        NSMutableArray * const mutablePlaylists = self.cachedPlaylists.mutableCopy;
-        const NSUInteger playlistIdx = [mutablePlaylists indexOfObjectPassingTest:^BOOL(VLCMediaLibraryPlaylist * const playlist, const NSUInteger idx, BOOL * const stop) {
-            NSAssert(playlist != nil, @"Cache list should not contain nil playlists");
-            return playlist.libraryID == itemId;
-        }];
-
-        if (playlistIdx == NSNotFound) {
-            NSLog(@"Could not handle deletion of playlist with id %lld in model", itemId);
-            return;
-        }
-
-        dispatch_sync(dispatch_get_main_queue(), ^{
-            VLCMediaLibraryPlaylist * const playlist = mutablePlaylists[playlistIdx];
-            [mutablePlaylists removeObjectAtIndex:playlistIdx];
-            self.cachedPlaylists = mutablePlaylists.copy;
-            [self->_defaultNotificationCenter postNotificationName:VLCLibraryModelPlaylistDeleted object:playlist];
-        });
+    dispatch_sync(dispatch_get_main_queue(), ^{
+        [self->_defaultNotificationCenter postNotificationName:VLCLibraryModelPlaylistDeleted 
+                                                        object:@(itemId)];
     });
 }
 


=====================================
modules/gui/macosx/library/VLCLibrarySegment.h
=====================================
@@ -38,6 +38,8 @@ typedef NS_ENUM(NSInteger, VLCLibrarySegmentType) {
     VLCLibrarySongsMusicSubSegment,
     VLCLibraryGenresMusicSubSegment,
     VLCLibraryPlaylistsSegment,
+    VLCLibraryPlaylistsMusicOnlyPlaylistsSubSegment,
+    VLCLibraryPlaylistsVideoOnlyPlaylistsSubSegment,
     VLCLibraryBrowseSegment,
     VLCLibraryBrowseBookmarkedLocationSubSegment,
     VLCLibraryStreamsSegment,


=====================================
modules/gui/macosx/library/VLCLibrarySegment.m
=====================================
@@ -100,6 +100,11 @@ NSString * const VLCLibraryBookmarkedLocationsChanged = @"VLCLibraryBookmarkedLo
             [VLCLibrarySegment segmentWithSegmentType:VLCLibrarySongsMusicSubSegment],
             [VLCLibrarySegment segmentWithSegmentType:VLCLibraryGenresMusicSubSegment],
         ];
+    } else if (self.segmentType == VLCLibraryPlaylistsSegment) {
+        return @[
+            [VLCLibrarySegment segmentWithSegmentType:VLCLibraryPlaylistsMusicOnlyPlaylistsSubSegment],
+            [VLCLibrarySegment segmentWithSegmentType:VLCLibraryPlaylistsVideoOnlyPlaylistsSubSegment]
+        ];
     } else if (self.segmentType == VLCLibraryBrowseSegment) {
         NSUserDefaults * const defaults = NSUserDefaults.standardUserDefaults;
         NSArray<NSString *> *bookmarkedLocations =
@@ -192,6 +197,10 @@ NSString * const VLCLibraryBookmarkedLocationsChanged = @"VLCLibraryBookmarkedLo
             return _NS("Shows");
         case VLCLibraryPlaylistsSegment:
             return _NS("Playlists");
+        case VLCLibraryPlaylistsMusicOnlyPlaylistsSubSegment:
+            return _NS("Music playlists");
+        case VLCLibraryPlaylistsVideoOnlyPlaylistsSubSegment:
+            return _NS("Video playlists");
         case VLCLibraryBrowseSegment:
             return _NS("Browse");
         case VLCLibraryBrowseBookmarkedLocationSubSegment:
@@ -225,7 +234,11 @@ NSString * const VLCLibraryBookmarkedLocationsChanged = @"VLCLibraryBookmarkedLo
         case VLCLibraryShowsVideoSubSegment:
             return [NSImage imageNamed:@"sidebar-movie"];
         case VLCLibraryPlaylistsSegment:
+            return [NSImage imageNamed:@"NSListViewTemplate"];
+        case VLCLibraryPlaylistsMusicOnlyPlaylistsSubSegment:
             return [NSImage imageNamed:@"sidebar-music"];
+        case VLCLibraryPlaylistsVideoOnlyPlaylistsSubSegment:
+            return [NSImage imageNamed:@"sidebar-movie"];
         case VLCLibraryBrowseSegment:
         case VLCLibraryBrowseBookmarkedLocationSubSegment:
             return [NSImage imageNamed:@"NSFolder"];
@@ -269,8 +282,14 @@ NSString * const VLCLibraryBookmarkedLocationsChanged = @"VLCLibraryBookmarkedLo
             return [NSImage imageWithSystemSymbolName:@"tv"
                              accessibilityDescription:@"Shows icon"];
         case VLCLibraryPlaylistsSegment:
-            return [NSImage imageWithSystemSymbolName:@"music.note.list"
+            return [NSImage imageWithSystemSymbolName:@"list.triangle"
                              accessibilityDescription:@"Playlists icon"];
+        case VLCLibraryPlaylistsMusicOnlyPlaylistsSubSegment:
+            return [NSImage imageWithSystemSymbolName:@"music.note.list"
+                             accessibilityDescription:@"Music playlists icon"];
+        case VLCLibraryPlaylistsVideoOnlyPlaylistsSubSegment:
+            return [NSImage imageWithSystemSymbolName:@"list.and.film"
+                             accessibilityDescription:@"Video playlists icon"];
         case VLCLibraryBrowseSegment:
             return [NSImage imageWithSystemSymbolName:@"folder"
                              accessibilityDescription:@"Browse icon"];


=====================================
modules/gui/macosx/library/VLCLibraryWindow.m
=====================================
@@ -84,6 +84,7 @@
 
 #import <vlc_common.h>
 #import <vlc_configuration.h>
+#import <vlc_media_library.h>
 #import <vlc_url.h>
 
 const CGFloat VLCLibraryWindowMinimalWidth = 604.;
@@ -240,6 +241,12 @@ static void addShadow(NSImageView *__unsafe_unretained imageView)
     case VLCLibraryPlaylistsSegment:
         _currentSelectedViewModeSegment = preferences.playlistLibraryViewMode;
         break;
+    case VLCLibraryPlaylistsMusicOnlyPlaylistsSubSegment:
+        _currentSelectedViewModeSegment = preferences.musicOnlyPlaylistLibraryViewMode;
+        break;
+    case VLCLibraryPlaylistsVideoOnlyPlaylistsSubSegment:
+        _currentSelectedViewModeSegment = preferences.videoOnlyPlaylistLibraryViewMode;
+        break;
     case VLCLibraryBrowseSegment:
         _currentSelectedViewModeSegment = preferences.browseLibraryViewMode;
         break;
@@ -277,7 +284,13 @@ static void addShadow(NSImageView *__unsafe_unretained imageView)
         [self showAudioLibrary];
         break;
     case VLCLibraryPlaylistsSegment:
-        [self showPlaylistLibrary];
+        [self showPlaylistLibrary:VLC_ML_PLAYLIST_TYPE_ALL];
+        break;
+    case VLCLibraryPlaylistsMusicOnlyPlaylistsSubSegment:
+        [self showPlaylistLibrary:VLC_ML_PLAYLIST_TYPE_AUDIO_ONLY];
+        break;
+    case VLCLibraryPlaylistsVideoOnlyPlaylistsSubSegment:
+        [self showPlaylistLibrary:VLC_ML_PLAYLIST_TYPE_VIDEO_ONLY];
         break;
     case VLCLibraryBrowseSegment:
     case VLCLibraryBrowseBookmarkedLocationSubSegment:
@@ -341,6 +354,12 @@ static void addShadow(NSImageView *__unsafe_unretained imageView)
     case VLCLibraryPlaylistsSegment:
         preferences.playlistLibraryViewMode = _currentSelectedViewModeSegment;
         break;
+    case VLCLibraryPlaylistsMusicOnlyPlaylistsSubSegment:
+        preferences.musicOnlyPlaylistLibraryViewMode = _currentSelectedViewModeSegment;
+        break;
+    case VLCLibraryPlaylistsVideoOnlyPlaylistsSubSegment:
+        preferences.videoOnlyPlaylistLibraryViewMode = _currentSelectedViewModeSegment;
+        break;
     case VLCLibraryBrowseSegment:
     case VLCLibraryBrowseBookmarkedLocationSubSegment:
         preferences.browseLibraryViewMode = _currentSelectedViewModeSegment;
@@ -384,10 +403,16 @@ static void addShadow(NSImageView *__unsafe_unretained imageView)
     [self.libraryAudioViewController presentAudioView];
 }
 
-- (void)showPlaylistLibrary
+- (void)showPlaylistLibrary:(enum vlc_ml_playlist_type_t)playlistType
 {
-    [self.toolbarDelegate layoutForSegment:VLCLibraryPlaylistsSegment];
-    [_libraryPlaylistViewController presentPlaylistsView];
+    if (playlistType == VLC_ML_PLAYLIST_TYPE_AUDIO_ONLY) {
+        [self.toolbarDelegate layoutForSegment:VLCLibraryPlaylistsMusicOnlyPlaylistsSubSegment];
+    } else if (playlistType == VLC_ML_PLAYLIST_TYPE_VIDEO_ONLY) {
+        [self.toolbarDelegate layoutForSegment:VLCLibraryPlaylistsVideoOnlyPlaylistsSubSegment];
+    } else {
+        [self.toolbarDelegate layoutForSegment:VLCLibraryPlaylistsSegment];
+    }
+    [self.libraryPlaylistViewController presentPlaylistsViewForPlaylistType:playlistType];
 }
 
 - (void)showMediaSourceLibrary


=====================================
modules/gui/macosx/library/VLCLibraryWindowNavigationSidebarViewController.m
=====================================
@@ -103,6 +103,7 @@ static NSString * const VLCLibrarySegmentCellIdentifier = @"VLCLibrarySegmentCel
 
     NSTreeNode * const targetNode = [self nodeForSegmentType:currentSegmentType];
     const NSInteger segmentIndex = [self.outlineView rowForItem:targetNode];
+    [self expandParentsOfNode:targetNode];
     [self.outlineView selectRowIndexes:[NSIndexSet indexSetWithIndex:segmentIndex]
                   byExtendingSelection:NO];
 
@@ -136,6 +137,20 @@ static NSString * const VLCLibrarySegmentCellIdentifier = @"VLCLibrarySegmentCel
     return nil;
 }
 
+- (void)expandParentsOfNode:(NSTreeNode *)targetNode
+{
+    NSMutableArray * const parentNodes = NSMutableArray.array;
+    NSTreeNode *currentNode = targetNode.parentNode;
+    while (currentNode != nil) {
+        [parentNodes insertObject:currentNode atIndex:0];
+        currentNode = currentNode.parentNode;
+    }
+
+    for (NSTreeNode * const node in parentNodes) {
+        [self.outlineView expandItem:node];
+    }
+}
+
 - (void)selectSegment:(NSInteger)segmentType
 {
     NSAssert(segmentType > VLCLibraryLowSentinelSegment &&
@@ -145,19 +160,13 @@ static NSString * const VLCLibrarySegmentCellIdentifier = @"VLCLibrarySegmentCel
     VLCLibrarySegment * const segment = [VLCLibrarySegment segmentWithSegmentType:segmentType];
     self.libraryWindow.librarySegmentType = segment.segmentType;
 
-    if (segmentType > VLCLibraryVideoSegment && segmentType <= VLCLibraryShowsVideoSubSegment) {
-        [self.outlineView expandItem:[self nodeForSegmentType:VLCLibraryVideoSegment]];
-    } else if (segmentType >= VLCLibraryMusicSegment && segmentType <= VLCLibraryGenresMusicSubSegment) {
+    if (segmentType == VLCLibraryMusicSegment) {
         [self.outlineView expandItem:[self nodeForSegmentType:VLCLibraryMusicSegment]];
-    } else if (segmentType >= VLCLibraryBrowseSegment &&
-               segmentType <= VLCLibraryBrowseBookmarkedLocationSubSegment) {
-        [self.outlineView expandItem:[self nodeForSegmentType:VLCLibraryBrowseSegment]];
-    } else if (segmentType == VLCLibraryGroupsGroupSubSegment) {
-        [self.outlineView expandItem:[self nodeForSegmentType:VLCLibraryGroupsSegment]];
     }
 
     NSTreeNode * const targetNode = [self nodeForSegmentType:segmentType];
     const NSInteger segmentIndex = [self.outlineView rowForItem:targetNode];
+    [self expandParentsOfNode:targetNode];
     [self.outlineView selectRowIndexes:[NSIndexSet indexSetWithIndex:segmentIndex]
                   byExtendingSelection:NO];
 }
@@ -181,14 +190,19 @@ static NSString * const VLCLibrarySegmentCellIdentifier = @"VLCLibrarySegmentCel
 {
     NSAssert(outlineView == _outlineView, @"VLCLibraryWindowNavigationSidebarController should only be a delegate for the libraryWindow nav sidebar outline view!");
 
-    if (proposedSelectionIndexes.count == 0 || proposedSelectionIndexes.firstIndex != VLCLibraryMusicSegment) {
-        return proposedSelectionIndexes;
-    } else {
-        [self.outlineView expandItem:[self nodeForSegmentType:VLCLibraryMusicSegment]];
-        NSTreeNode * const artistsNode = [self nodeForSegmentType:VLCLibraryArtistsMusicSubSegment];
-        const NSInteger artistsIndex = [self.outlineView rowForItem:artistsNode];
-        return [NSIndexSet indexSetWithIndex:artistsIndex];
+    if (proposedSelectionIndexes.count > 0) {
+        NSTreeNode * const node = [self.outlineView itemAtRow:proposedSelectionIndexes.firstIndex];
+        VLCLibrarySegment * const segment = (VLCLibrarySegment *)node.representedObject;
+
+        if (segment.segmentType == VLCLibraryMusicSegment) {
+            [self.outlineView expandItem:[self nodeForSegmentType:VLCLibraryMusicSegment]];
+            NSTreeNode * const artistsNode = [self nodeForSegmentType:VLCLibraryArtistsMusicSubSegment];
+            const NSInteger artistsIndex = [self.outlineView rowForItem:artistsNode];
+            return [NSIndexSet indexSetWithIndex:artistsIndex];
+        }
     }
+
+    return proposedSelectionIndexes;
 }
 
 - (void)outlineViewSelectionDidChange:(NSNotification *)notification


=====================================
modules/gui/macosx/library/VLCLibraryWindowPersistentPreferences.h
=====================================
@@ -38,6 +38,8 @@ NS_ASSUME_NONNULL_BEGIN
 @property (readwrite, nonatomic) VLCLibraryViewModeSegment songsLibraryViewMode;
 @property (readwrite, nonatomic) VLCLibraryViewModeSegment artistLibraryViewMode;
 @property (readwrite, nonatomic) VLCLibraryViewModeSegment playlistLibraryViewMode;
+ at property (readwrite, nonatomic) VLCLibraryViewModeSegment musicOnlyPlaylistLibraryViewMode;
+ at property (readwrite, nonatomic) VLCLibraryViewModeSegment videoOnlyPlaylistLibraryViewMode;
 @property (readwrite, nonatomic) VLCLibraryViewModeSegment browseLibraryViewMode;
 @property (readwrite, nonatomic) VLCLibraryViewModeSegment streamLibraryViewMode;
 @property (readwrite, nonatomic) VLCLibraryViewModeSegment groupsLibraryViewMode;


=====================================
modules/gui/macosx/library/VLCLibraryWindowPersistentPreferences.m
=====================================
@@ -32,6 +32,10 @@ NSString * const VLCLibraryGenreLibraryViewModePreferenceKey = @"GenreLibraryVie
 NSString * const VLCLibrarySongsLibraryViewModePreferenceKey = @"SongsLibraryViewMode";
 NSString * const VLCLibraryArtistLibraryViewModePreferenceKey = @"ArtistLibraryViewMode";
 NSString * const VLCLibraryPlaylistLibraryViewModePreferenceKey = @"PlaylistLibraryViewMode";
+NSString * const VLCLibraryMusicOnlyPlaylistLibraryViewModePreferenceKey = 
+    @"MusicOnlyPlaylistLibraryViewMode";
+NSString * const VLCLibraryVideoOnlyPlaylistLibraryViewModePreferenceKey = 
+    @"VideoOnlyPlaylistLibraryViewMode";
 NSString * const VLCLibraryBrowseLibraryViewModePreferenceKey = @"BrowseLibraryViewMode";
 NSString * const VLCLibraryStreamLibraryViewModePreferenceKey = @"StreamLibraryViewMode";
 NSString * const VLCLibraryGroupsLibraryViewModePreferenceKey = @"GroupsLibraryViewMode";
@@ -171,6 +175,28 @@ static VLCLibraryWindowPersistentPreferences *sharedInstance = nil;
                                               value:playlistLibraryViewMode];
 }
 
+- (VLCLibraryViewModeSegment)musicOnlyPlaylistLibraryViewMode
+{
+    return [self libraryViewModePreferenceWithKey:VLCLibraryMusicOnlyPlaylistLibraryViewModePreferenceKey];
+}
+
+- (void)setMusicOnlyPlaylistLibraryViewMode:(VLCLibraryViewModeSegment)musicOnlyPlaylistLibraryViewMode
+{
+    [self setLibraryWindowViewModePreferenceWithKey:VLCLibraryMusicOnlyPlaylistLibraryViewModePreferenceKey
+                                              value:musicOnlyPlaylistLibraryViewMode];
+}
+
+- (VLCLibraryViewModeSegment)videoOnlyPlaylistLibraryViewMode
+{
+    return [self libraryViewModePreferenceWithKey:VLCLibraryVideoOnlyPlaylistLibraryViewModePreferenceKey];
+}
+
+- (void)setVideoOnlyPlaylistLibraryViewMode:(VLCLibraryViewModeSegment)videoOnlyPlaylistLibraryViewMode
+{
+    [self setLibraryWindowViewModePreferenceWithKey:VLCLibraryVideoOnlyPlaylistLibraryViewModePreferenceKey
+                                              value:videoOnlyPlaylistLibraryViewMode];
+}
+
 - (VLCLibraryViewModeSegment)browseLibraryViewMode
 {
     return [self libraryViewModePreferenceWithKey:VLCLibraryBrowseLibraryViewModePreferenceKey];


=====================================
modules/gui/macosx/library/VLCLibraryWindowToolbarDelegate.m
=====================================
@@ -161,6 +161,8 @@ NSString * const VLCLibraryWindowTrackingSeparatorToolbarItemIdentifier =
         case VLCLibraryGroupsSegment:
         case VLCLibraryGroupsGroupSubSegment:
         case VLCLibraryPlaylistsSegment:
+        case VLCLibraryPlaylistsMusicOnlyPlaylistsSubSegment:
+        case VLCLibraryPlaylistsVideoOnlyPlaylistsSubSegment:
             [self setForwardsBackwardsToolbarItemsVisible:NO];
             [self setSortOrderToolbarItemVisible:YES];
             [self setLibrarySearchToolbarItemVisible:YES];


=====================================
modules/gui/macosx/library/playlist-library/VLCLibraryPlaylistDataSource.h
=====================================
@@ -25,6 +25,8 @@
 #import "library/VLCLibraryCollectionViewDataSource.h"
 #import "library/VLCLibraryMasterDetailViewTableViewDataSource.h"
 
+#import <vlc_media_library.h>
+
 @class VLCLibraryModel;
 
 NS_ASSUME_NONNULL_BEGIN
@@ -35,6 +37,7 @@ NS_ASSUME_NONNULL_BEGIN
 @property (readwrite) NSTableView *masterTableView;
 @property (readwrite) NSTableView *detailTableView;
 @property (readwrite, nonatomic) NSArray<NSCollectionView *> *collectionViews;
+ at property (readwrite, nonatomic) vlc_ml_playlist_type_t playlistType;
 
 @end
 


=====================================
modules/gui/macosx/library/playlist-library/VLCLibraryPlaylistDataSource.m
=====================================
@@ -65,7 +65,7 @@ typedef NS_ENUM(NSInteger, VLCLibraryDataSourceCacheAction) {
     NSNotificationCenter * const notificationCenter = NSNotificationCenter.defaultCenter;
     [notificationCenter addObserver:self
                            selector:@selector(playlistsReset:)
-                               name:VLCLibraryModelPlaylistListReset
+                               name:VLCLibraryModelPlaylistAdded
                              object:nil];
     [notificationCenter addObserver:self
                            selector:@selector(playlistUpdated:)
@@ -93,13 +93,25 @@ typedef NS_ENUM(NSInteger, VLCLibraryDataSourceCacheAction) {
 - (void)playlistDeleted:(NSNotification *)notification
 {
     NSParameterAssert(notification);
-    VLCMediaLibraryPlaylist * const playlist = (VLCMediaLibraryPlaylist *)notification.object;
-    [self cacheAction:VLCLibraryDataSourceCacheDeleteAction onPlaylist:playlist];
+    NSParameterAssert((NSNumber *)notification.object != nil);
+
+    const int64_t playlistId = [(NSNumber *)notification.object longLongValue];
+    const NSInteger playlistIdx =
+        [self.playlists indexOfObjectPassingTest:^BOOL(const VLCMediaLibraryPlaylist * const playlist,
+                                                       const NSUInteger idx,
+                                                       BOOL * const stop) {
+            return playlist.libraryID == playlistId;
+        }];
+    VLCMediaLibraryPlaylist * const playlist = self.playlists[playlistIdx];
+
+    if (playlist != nil) {
+        [self cacheAction:VLCLibraryDataSourceCacheDeleteAction onPlaylist:playlist];
+    }
 }
 
 - (void)reloadData
 {
-    self.playlists = _libraryModel.listOfPlaylists;
+    self.playlists = [self.libraryModel listOfPlaylistsOfType:self.playlistType];
     [self reloadViews];
 }
 
@@ -351,4 +363,14 @@ viewForSupplementaryElementOfKind:(NSCollectionViewSupplementaryElementKind)kind
     return VLCLibraryCollectionViewMediaItemListSupplementaryDetailViewKind;
 }
 
+- (void)setPlaylistType:(vlc_ml_playlist_type_t)playlistType
+{
+    if (self.playlistType == playlistType) {
+        return;
+    }
+
+    _playlistType = playlistType;
+    [self reloadData];
+}
+
 @end


=====================================
modules/gui/macosx/library/playlist-library/VLCLibraryPlaylistViewController.h
=====================================
@@ -22,6 +22,8 @@
 
 #import <Cocoa/Cocoa.h>
 
+#include <vlc_media_library.h>
+
 NS_ASSUME_NONNULL_BEGIN
 
 @class VLCLibraryCollectionViewDelegate;
@@ -53,6 +55,7 @@ NS_ASSUME_NONNULL_BEGIN
 - (instancetype)initWithLibraryWindow:(VLCLibraryWindow *)libraryWindow;
 
 - (void)presentPlaylistsView;
+- (void)presentPlaylistsViewForPlaylistType:(enum vlc_ml_playlist_type_t)playlistType;
 
 @end
 


=====================================
modules/gui/macosx/library/playlist-library/VLCLibraryPlaylistViewController.m
=====================================
@@ -65,15 +65,15 @@
         NSNotificationCenter * const notificationCenter = NSNotificationCenter.defaultCenter;
         [notificationCenter addObserver:self
                                selector:@selector(libraryModelUpdated:)
-                                   name:VLCLibraryModelPlaylistListReset
+                                   name:VLCLibraryModelPlaylistAdded
                                  object:nil];
         [notificationCenter addObserver:self
                                selector:@selector(libraryModelUpdated:)
                                    name:VLCLibraryModelPlaylistDeleted
                                  object:nil];
 
-        NSString * const playlistListResetLongLoadStartNotification = [VLCLibraryModelPlaylistListReset stringByAppendingString:VLCLongNotificationNameStartSuffix];
-        NSString * const playlistListResetLongLoadFinishNotification = [VLCLibraryModelPlaylistListReset stringByAppendingString:VLCLongNotificationNameFinishSuffix];
+        NSString * const playlistListResetLongLoadStartNotification = [VLCLibraryModelPlaylistAdded stringByAppendingString:VLCLongNotificationNameStartSuffix];
+        NSString * const playlistListResetLongLoadFinishNotification = [VLCLibraryModelPlaylistAdded stringByAppendingString:VLCLongNotificationNameFinishSuffix];
         NSString * const playlistDeletedLongLoadStartNotification = [VLCLibraryModelPlaylistDeleted stringByAppendingString:VLCLongNotificationNameStartSuffix];
         NSString * const playlistDeletedLongLoadFinishNotification = [VLCLibraryModelPlaylistDeleted stringByAppendingString:VLCLongNotificationNameFinishSuffix];
 
@@ -273,8 +273,30 @@
     [_libraryWindow.libraryTargetView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|[emptyLibraryView(>=572.)]|" options:0 metrics:0 views:dict]];
     [_libraryWindow.libraryTargetView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|[emptyLibraryView(>=444.)]|" options:0 metrics:0 views:dict]];
 
+    const vlc_ml_playlist_type_t playlistType = self.dataSource.playlistType;
+    NSString *placeholderPlaylistsString = nil;
+    switch (playlistType) {
+        case VLC_ML_PLAYLIST_TYPE_ALL:
+            placeholderPlaylistsString =
+                _NS("Your favorite playlists will appear here.\n"
+                    "Go to the Browse section to add playlists you love.");
+            break;
+        case VLC_ML_PLAYLIST_TYPE_AUDIO:
+        case VLC_ML_PLAYLIST_TYPE_AUDIO_ONLY:
+            placeholderPlaylistsString =
+                _NS("Your favorite music playlists will appear here.\n"
+                    "Go to the Browse section to add playlists you love.");
+            break;
+        case VLC_ML_PLAYLIST_TYPE_VIDEO:
+        case VLC_ML_PLAYLIST_TYPE_VIDEO_ONLY:
+            placeholderPlaylistsString =
+                _NS("Your favorite video playlists will appear here.\n"
+                    "Go to the Browse section to add playlists you love.");
+            break;
+    }
+
     _libraryWindow.placeholderImageView.image = [NSImage imageNamed:@"placeholder-group2"];
-    _libraryWindow.placeholderLabel.stringValue = _NS("Your favorite playlists will appear here.\nGo to the Browse section to add playlists you love.");
+    _libraryWindow.placeholderLabel.stringValue = placeholderPlaylistsString;
 }
 
 - (void)presentPlaylistLibraryView
@@ -301,7 +323,9 @@
 
 - (void)updatePresentedView
 {
-    if (VLCMain.sharedInstance.libraryController.libraryModel.numberOfPlaylists <= 0) {
+    const vlc_ml_playlist_type_t playlistType = self.dataSource.playlistType;
+    VLCLibraryModel * const libraryModel = VLCMain.sharedInstance.libraryController.libraryModel;
+    if ([libraryModel numberOfPlaylistsOfType:playlistType] <= 0) {
         [self presentPlaceholderPlaylistLibraryView];
     } else {
         [self presentPlaylistLibraryView];
@@ -314,15 +338,23 @@
     [self updatePresentedView];
 }
 
+- (void)presentPlaylistsViewForPlaylistType:(enum vlc_ml_playlist_type_t)playlistType
+{
+    self.dataSource.playlistType = playlistType;
+    [self presentPlaylistsView];
+}
+
 - (void)libraryModelUpdated:(NSNotification *)notification
 {
     NSParameterAssert(notification);
     VLCLibraryModel * const model = (VLCLibraryModel *)notification.object;
     NSAssert(model, @"Notification object should be a VLCLibraryModel");
+    const vlc_ml_playlist_type_t playlistType = self.dataSource.playlistType;
+    const size_t numberOfPlaylists = [model numberOfPlaylistsOfType:playlistType];
 
     if (_libraryWindow.librarySegmentType == VLCLibraryPlaylistsSegment &&
-        ((model.numberOfPlaylists == 0 && ![_libraryWindow.libraryTargetView.subviews containsObject:_libraryWindow.emptyLibraryView]) ||
-         (model.numberOfPlaylists > 0 && ![_libraryWindow.libraryTargetView.subviews containsObject:_collectionViewScrollView])) &&
+        ((numberOfPlaylists == 0 && ![_libraryWindow.libraryTargetView.subviews containsObject:_libraryWindow.emptyLibraryView]) ||
+         (numberOfPlaylists > 0 && ![_libraryWindow.libraryTargetView.subviews containsObject:_collectionViewScrollView])) &&
         _libraryWindow.videoViewController.view.hidden) {
 
         [self updatePresentedView];



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/f21bda0200d34d72e1a7dd702737bb52ed0d44ca...30ad95ef3872a9b14110671631f5a64a768ff91b

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/f21bda0200d34d72e1a7dd702737bb52ed0d44ca...30ad95ef3872a9b14110671631f5a64a768ff91b
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