]> git.sesse.net Git - vlc/blobdiff - modules/misc/notify/growl_udp.c
Add a function to get the Title and fallback to the name if the title is empty.
[vlc] / modules / misc / notify / growl_udp.c
index ea6e1c5a4f05c8935119f83f8694f583d2d66b15..3ef0e9e76addcca3951638e179b6ad6235e1df96 100644 (file)
@@ -73,11 +73,11 @@ vlc_module_begin ()
     set_description( N_("Growl UDP Notification Plugin") )
 
     add_string( "growl-server", SERVER_DEFAULT, NULL,
-                SERVER_TEXT, SERVER_LONGTEXT, false );
+                SERVER_TEXT, SERVER_LONGTEXT, false )
     add_password( "growl-password", PASS_DEFAULT, NULL,
-                PASS_TEXT, PASS_LONGTEXT, false );
+                PASS_TEXT, PASS_LONGTEXT, false )
     add_integer( "growl-port", 9887, NULL,
-                PORT_TEXT, PORT_LONGTEXT, true );
+                PORT_TEXT, PORT_LONGTEXT, true )
 
     set_capability( "interface", 0 )
     set_callbacks( Open, Close )
@@ -91,7 +91,7 @@ static int Open( vlc_object_t *p_this )
     intf_thread_t *p_intf = (intf_thread_t *)p_this;
 
     playlist_t *p_playlist = pl_Hold( p_intf );
-    var_AddCallback( p_playlist, "playlist-current", ItemChange, p_intf );
+    var_AddCallback( p_playlist, "item-current", ItemChange, p_intf );
     pl_Release( p_intf );
 
     RegisterToGrowl( p_this );
@@ -104,7 +104,7 @@ static int Open( vlc_object_t *p_this )
 static void Close( vlc_object_t *p_this )
 {
     playlist_t *p_playlist = pl_Hold( p_this );
-    var_DelCallback( p_playlist, "playlist-current", ItemChange, p_this );
+    var_DelCallback( p_playlist, "item-current", ItemChange, p_this );
     pl_Release( p_this );
 }
 
@@ -142,17 +142,12 @@ static int ItemChange( vlc_object_t *p_this, const char *psz_var,
     /* Playing something ... */
     input_item_t *p_item = input_GetItem( p_input );
 
-    psz_title = input_item_GetTitle( p_item );
-    if( psz_title == NULL || EMPTY_STR( psz_title ) )
+    psz_title = input_item_GetTitleFbName( p_item );
+    if( EMPTY_STR( psz_title ) )
     {
         free( psz_title );
-        psz_title = input_item_GetName( input_GetItem( p_input ) );
-        if( psz_title == NULL || EMPTY_STR( psz_title ) )
-        {
-            free( psz_title );
-            vlc_object_release( p_input );
-            return VLC_SUCCESS;
-        }
+        vlc_object_release( p_input );
+        return VLC_SUCCESS;
     }
 
     psz_artist = input_item_GetArtist( p_item );