[vlc-commits] [Git][videolan/vlc][master] macosx: Provide media library types with fallback titles in case they have none

Steve Lhomme (@robUx4) gitlab at videolan.org
Tue May 9 06:24:06 UTC 2023



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
d7e841bc by Claudio Cambra at 2023-05-09T06:06:06+00:00
macosx: Provide media library types with fallback titles in case they have none

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

- - - - -


1 changed file:

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


Changes:

=====================================
modules/gui/macosx/library/VLCLibraryDataTypes.m
=====================================
@@ -325,6 +325,10 @@ static NSArray<VLCMediaLibraryArtist *> *fetchArtistsForLibraryItem(library_arti
         self.smallArtworkMRL = self.smallArtworkGenerated ? toNSStr(p_artist->thumbnails[VLC_ML_THUMBNAIL_SMALL].psz_mrl) : nil;
 
         _name = toNSStr(p_artist->psz_name);
+        if ([_name isEqualToString:@""]) {
+            _name = _NS("Unknown Artist");
+        }
+
         _shortBiography = toNSStr(p_artist->psz_shortbio);
         _musicBrainzID = toNSStr(p_artist->psz_mb_id);
         _numberOfAlbums = p_artist->i_nb_album;
@@ -411,6 +415,10 @@ static NSArray<VLCMediaLibraryArtist *> *fetchArtistsForLibraryItem(library_arti
         self.smallArtworkMRL = self.smallArtworkGenerated ? toNSStr(p_album->thumbnails[VLC_ML_THUMBNAIL_SMALL].psz_mrl) : nil;
 
         _title = toNSStr(p_album->psz_title);
+        if ([_title isEqualToString:@""]) {
+            _title = _NS("Unknown Album");
+        }
+
         _summary = toNSStr(p_album->psz_summary);
         _artistName = toNSStr(p_album->psz_artist);
         _artistID = p_album->i_artist_id;
@@ -473,6 +481,10 @@ static NSArray<VLCMediaLibraryArtist *> *fetchArtistsForLibraryItem(library_arti
         self.smallArtworkMRL = self.smallArtworkGenerated ? toNSStr(p_genre->thumbnails[VLC_ML_THUMBNAIL_SMALL].psz_mrl) : nil;
 
         _name = toNSStr(p_genre->psz_name);
+        if ([_name isEqualToString:@""]) {
+            _name = _NS("Unknown Genre");
+        }
+
         _numberOfTracks = p_genre->i_nb_tracks;
     }
     return self;
@@ -650,9 +662,13 @@ static NSArray<VLCMediaLibraryArtist *> *fetchArtistsForLibraryItem(library_arti
         _playCount = p_mediaItem->i_playcount;
         _lastPlayedDate = p_mediaItem->i_last_played_date;
         _progress = p_mediaItem->f_progress;
-        _title = toNSStr(p_mediaItem->psz_title);
         _favorited = p_mediaItem->b_is_favorite;
 
+        _title = toNSStr(p_mediaItem->psz_title);
+        if ([_title isEqualToString:@""]) {
+            _title = _NS("Unknown Media Item");
+        }
+
         switch (p_mediaItem->i_subtype) {
             case VLC_ML_MEDIA_SUBTYPE_MOVIE:
                 _movie = [[VLCMediaLibraryMovie alloc] initWithMovie:&p_mediaItem->movie];



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

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/d7e841bc39b370276f256962fae89d5766f53b4e
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