]> git.sesse.net Git - vlc/blobdiff - modules/misc/notify/growl.c
Input access locking, part 2.
[vlc] / modules / misc / notify / growl.c
index 4d69d90cdd1c8c4d5d39b5c433eb4e2f814439d4..c021b199e53852bb51e91b7db17e3f54ca8fcc4a 100644 (file)
 #include <stdlib.h>                                      /* malloc(), free() */
 
 #include <vlc/vlc.h>
-#include <vlc/intf.h>
+#include <vlc_interface.h>
+#include <vlc_playlist.h>
 #include <vlc_meta.h>
-#include <network.h>
+#include <vlc_network.h>
 #include <errno.h>
 #include <vlc_md5.h>
 
@@ -52,19 +53,15 @@ static int CheckAndSend( vlc_object_t *p_this, uint8_t* p_data, int i_offset );
  * Module descriptor
  ****************************************************************************/
 
-/// \bug [String] REmove all "Growl" in short desc
-
 #define SERVER_DEFAULT "127.0.0.1"
-#define SERVER_TEXT N_("Growl server")
+#define SERVER_TEXT N_("Server")
 #define SERVER_LONGTEXT N_("This is the host to which Growl notifications " \
    "will be sent. By default, notifications are sent locally." )
 #define PASS_DEFAULT ""
-#define PASS_TEXT N_("Growl password")
-/// \bug [String] Password on the Growl server.
-#define PASS_LONGTEXT N_("Growl password on the server.")
-#define PORT_TEXT N_("Growl UDP port")
-/// \bug [String] UDP port on the Growl server
-#define PORT_LONGTEXT N_("Growl UDP port on the server.")
+#define PASS_TEXT N_("Password")
+#define PASS_LONGTEXT N_("Growl password on the Growl server.")
+#define PORT_TEXT N_("UDP port")
+#define PORT_LONGTEXT N_("Growl UDP port on the Growl server.")
 
 vlc_module_begin();
     set_category( CAT_INTERFACE );
@@ -127,24 +124,23 @@ static int ItemChange( vlc_object_t *p_this, const char *psz_var,
     if( !p_input ) return VLC_SUCCESS;
     vlc_object_yield( p_input );
 
-    if( p_input->b_dead || !p_input->input.p_item->psz_name )
+    char *psz_name = input_item_GetName( input_GetItem( p_input ) );
+    if( p_input->b_dead || !psz_name )
     {
         /* Not playing anything ... */
+        free( psz_name );
         vlc_object_release( p_input );
         return VLC_SUCCESS;
     }
+    free( psz_name );
 
     /* Playing something ... */
-    psz_artist = p_input->input.p_item->p_meta->psz_artist ?
-                  strdup( p_input->input.p_item->p_meta->psz_artist ) :
-                  strdup( "" );
-    psz_album = p_input->input.p_item->p_meta->psz_album ?
-                  strdup( p_input->input.p_item->p_meta->psz_album ) :
-                  strdup( "" );
-    psz_title = strdup( p_input->input.p_item->psz_name );
+    psz_artist = input_item_GetArtist( input_GetItem( p_input ) );
+    if( psz_artist == NULL ) psz_artist = strdup( "" );
+    psz_album = input_item_GetAlbum( input_GetItem( p_input ) ) ;
+    if( psz_album == NULL ) psz_album = strdup( "" );
+    psz_title = input_item_GetName( input_GetItem( p_input ) );
     if( psz_title == NULL ) psz_title = strdup( N_("(no title)") );
-    if( psz_artist == NULL ) psz_artist = strdup( N_("(no artist)") );
-    if( psz_album == NULL ) psz_album = strdup( N_("(no album)") );
     snprintf( psz_tmp, GROWL_MAX_LENGTH, "%s %s %s",
               psz_title, psz_artist, psz_album );
     free( psz_title );
@@ -277,7 +273,7 @@ static int CheckAndSend( vlc_object_t *p_this, uint8_t* p_data, int i_offset )
          return VLC_EGENERIC;
     }
 
-    net_StopRecv( i_handle );
+    shutdown( i_handle, SHUT_RD );
     if( send( i_handle, p_data, i_offset, 0 )
           == -1 )
     {