[vlc-commits] [Git][videolan/vlc][master] 5 commits: macosx: Do not trigger double reset of cached list of shows, as this is...
François Cartegnie (@fcartegnie)
gitlab at videolan.org
Fri Aug 30 10:05:39 UTC 2024
François Cartegnie pushed to branch master at VideoLAN / VLC
Commits:
e2c2dd64 by Claudio Cambra at 2024-08-30T09:45:08+00:00
macosx: Do not trigger double reset of cached list of shows, as this is already reset in resetCachedMediaItemLists
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
f70cb3bb by Claudio Cambra at 2024-08-30T09:45:08+00:00
macosx: Only reset cached list of shows on media item update/delete if the target item is a show episode
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
e71f3a4b by Claudio Cambra at 2024-08-30T09:45:08+00:00
macosx: Do not reset recents on media item add as recents are affected by history, not new items
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
c1b6ceaa by Claudio Cambra at 2024-08-30T09:45:08+00:00
macosx: When media item is added, only reset relevant cache arrays
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
4ee6f241 by Claudio Cambra at 2024-08-30T09:45:08+00:00
macosx: Reset recent lists when history has changed in library model
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
1 changed file:
- modules/gui/macosx/library/VLCLibraryModel.m
Changes:
=====================================
modules/gui/macosx/library/VLCLibraryModel.m
=====================================
@@ -102,7 +102,8 @@ NSString * const VLCLibraryModelPlaylistUpdated = @"VLCLibraryModelPlaylistUpdat
@property (readwrite, atomic) NSArray *cachedPlaylists;
@property (readwrite, atomic) NSArray *cachedListOfMonitoredFolders;
-- (void)resetCachedMediaItemLists;
+- (void)resetCachedListOfRecentMedia;
+- (void)resetCachedListOfRecentAudioMedia;
- (void)resetCachedListOfArtists;
- (void)resetCachedListOfAlbums;
- (void)resetCachedListOfGenres;
@@ -111,6 +112,7 @@ NSString * const VLCLibraryModelPlaylistUpdated = @"VLCLibraryModelPlaylistUpdat
- (void)resetCachedListOfMonitoredFolders;
- (void)resetCachedListOfPlaylists;
- (void)mediaItemThumbnailGenerated:(VLCMediaLibraryMediaItem *)mediaItem;
+- (void)handleMediaItemAddedEvent:(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;
@@ -136,16 +138,13 @@ static void libraryCallback(void *p_data, const vlc_ml_event_t *p_event)
switch(p_event->i_type)
{
case VLC_ML_EVENT_MEDIA_ADDED:
- [libraryModel resetCachedMediaItemLists];
- [libraryModel resetCachedListOfShows]; // TODO: Handle granularly
+ [libraryModel handleMediaItemAddedEvent:p_event];
break;
case VLC_ML_EVENT_MEDIA_UPDATED:
[libraryModel handleMediaItemUpdateEvent:p_event];
- [libraryModel resetCachedListOfShows]; // TODO: Handle granularly
break;
case VLC_ML_EVENT_MEDIA_DELETED:
[libraryModel handleMediaItemDeletionEvent:p_event];
- [libraryModel resetCachedListOfShows]; // TODO: Handle granularly
break;
case VLC_ML_EVENT_MEDIA_THUMBNAIL_GENERATED:
if (p_event->media_thumbnail_generated.b_success) {
@@ -208,6 +207,10 @@ static void libraryCallback(void *p_data, const vlc_ml_event_t *p_event)
case VLC_ML_EVENT_FOLDER_DELETED:
[libraryModel resetCachedListOfMonitoredFolders];
break;
+ case VLC_ML_EVENT_HISTORY_CHANGED:
+ [libraryModel resetCachedListOfRecentMedia];
+ [libraryModel resetCachedListOfRecentAudioMedia];
+ break;
default:
break;
}
@@ -675,13 +678,23 @@ static void libraryCallback(void *p_data, const vlc_ml_event_t *p_event)
});
}
-- (void)resetCachedMediaItemLists
+- (void)handleMediaItemAddedEvent:(const vlc_ml_event_t * const)p_event
{
- [self resetCachedListOfRecentMedia];
- [self resetCachedListOfRecentAudioMedia];
- [self resetCachedListOfAudioMedia];
- [self resetCachedListOfVideoMedia];
- [self resetCachedListOfShows];
+ NSParameterAssert(p_event);
+ const vlc_ml_media_t * const p_media = p_event->creation.p_media;
+ NSParameterAssert(p_media);
+
+ if (p_media->i_type == VLC_ML_MEDIA_TYPE_AUDIO || p_media->i_type == VLC_ML_MEDIA_TYPE_UNKNOWN) {
+ [self resetCachedListOfAudioMedia];
+
+ if (p_media->i_subtype == VLC_ML_MEDIA_SUBTYPE_SHOW_EPISODE) {
+ [self resetCachedListOfShows];
+ }
+ }
+
+ if (p_media->i_type == VLC_ML_MEDIA_TYPE_VIDEO || p_media->i_type == VLC_ML_MEDIA_TYPE_UNKNOWN) {
+ [self resetCachedListOfVideoMedia];
+ }
}
@@ -950,6 +963,10 @@ static void libraryCallback(void *p_data, const vlc_ml_event_t *p_event)
NSLog(@"Unknown type of media type encountered, don't know what to do in update");
break;
}
+
+ if (mediaItem.mediaSubType == VLC_ML_MEDIA_SUBTYPE_SHOW_EPISODE) {
+ [self resetCachedListOfShows];
+ }
}];
}
@@ -1000,6 +1017,10 @@ static void libraryCallback(void *p_data, const vlc_ml_event_t *p_event)
NSLog(@"Unknown type of media type encountered, don't know what to do in deletion");
break;
}
+
+ if (mediaItem.mediaSubType == VLC_ML_MEDIA_SUBTYPE_SHOW_EPISODE) {
+ [self resetCachedListOfShows];
+ }
}];
}
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/89eda42851eed8090df80b026fdfd6f0590e1ff7...4ee6f241ef614f979e7ef7c468e563d15f9923e3
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/89eda42851eed8090df80b026fdfd6f0590e1ff7...4ee6f241ef614f979e7ef7c468e563d15f9923e3
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