]> git.sesse.net Git - vlc/commitdiff
notify: Don't use empty metadata
authorRafaël Carré <funman@videolan.org>
Sat, 25 Aug 2007 01:12:49 +0000 (01:12 +0000)
committerRafaël Carré <funman@videolan.org>
Sat, 25 Aug 2007 01:12:49 +0000 (01:12 +0000)
Don't put not translated string in the popup

modules/misc/notify/notify.c

index 0fb539f4dbdc9685d80a97fcb42da588ce606829..b923795024117d71f2ef0091b59aac45fff3cb4d 100644 (file)
@@ -157,23 +157,37 @@ static int ItemChange( vlc_object_t *p_this, const char *psz_var,
     psz_artist = input_item_GetArtist( input_GetItem( p_input ) );
     psz_album = input_item_GetAlbum( input_GetItem( p_input ) ) ;
     psz_title = input_item_GetTitle( input_GetItem( p_input ) );
-    if( psz_title == NULL )
+    if( ( psz_title == NULL ) || EMPTY_STR( psz_title ) )
+    {
+        free( psz_title );
         psz_title = input_item_GetName( input_GetItem( p_input ) );
-    if( psz_title == NULL )
+    }
+    if( ( psz_title == NULL ) || EMPTY_STR( psz_title ) )
     {  /* Not enough metadata ... */
+        free( psz_title );
         free( psz_artist );
         free( psz_album );
         vlc_object_release( p_input );
         return VLC_SUCCESS;
     }
+    if( EMPTY_STR( psz_artist ) )
+    {
+        free( psz_artist );
+        psz_artist = NULL;
+    }
+    if( EMPTY_STR( psz_album ) )
+    {
+        free( psz_album );
+        psz_album = NULL;
+    }
 
     vlc_object_release( p_input );
 
     if( psz_artist && psz_album )
-        snprintf( psz_tmp, MAX_LENGTH, "<b>%s</b>\nBy %s\n[%s]",
+        snprintf( psz_tmp, MAX_LENGTH, "<b>%s</b>\n%s\n[%s]",
                   psz_title, psz_artist, psz_album );
     else if( psz_artist )
-        snprintf( psz_tmp, MAX_LENGTH, "<b>%s</b>\nBy %s",
+        snprintf( psz_tmp, MAX_LENGTH, "<b>%s</b>\n%s",
                   psz_title, psz_artist );
     else
         snprintf( psz_tmp, MAX_LENGTH, "<b>%s</b>", psz_title );