free( p_sys ); \
return VLC_ENOMEM;
-
if( !p_sys )
{
MEM_ERROR
i_post_socket = net_ConnectTCP( p_this,
p_sys->psz_submit_host, p_sys->i_submit_port);
+ if ( i_post_socket == -1 )
+ {
+ /* If connection fails, we assume we must handshake again */
+ time( &p_sys->time_next_exchange );
+ p_sys->time_next_exchange += DEFAULT_INTERVAL;
+ p_sys->b_handshaked = VLC_FALSE;
+ vlc_mutex_unlock( &p_sys->lock );
+ continue;
+ }
+
/* we transmit the data */
i_net_ret = net_Printf(
VLC_OBJECT(p_this), i_post_socket, NULL,
p_sys->p_current_song->psz_i = encode_URI_component( psz_date );
p_sys->p_current_song->time_playing = epoch;
- p_sys->b_paused = ( p_input->b_dead || !input_GetItem(p_input)->psz_name )
+ char *psz_name = input_item_GetName( input_GetItem( p_input ) );
+ p_sys->b_paused = ( p_input->b_dead || !psz_name )
? VLC_TRUE : VLC_FALSE;
+ free( psz_name );
vlc_mutex_unlock( &p_sys->lock );
var_Change( p_input, "video-es", VLC_VAR_CHOICESCOUNT, &video_val, NULL );
if( ( video_val.i_int > 0 ) || \
- ( input_GetItem(p_input)->i_type == ITEM_TYPE_NET ) )
+ ( input_GetItem( p_input )->i_type == ITEM_TYPE_NET ) )
{
msg_Dbg( p_this, "Not an audio only local file -> no submission");
vlc_object_release( p_input );
return VLC_SUCCESS; \
}
+ char *psz_meta;
#define ALLOC_ITEM_META( a, b ) \
- if ( input_GetItem(p_input)->b ) \
+ psz_meta = input_item_Get##b( input_GetItem( p_input ) ) \
+ if( psz_meta ) \
{ \
- a = encode_URI_component( \
- input_GetItem(p_input)->b ); \
+ a = encode_URI_component( psz_meta ); \
if( !a ) \
{ \
+ free( psz_meta ); \
FREE_INPUT_AND_CHARS \
return VLC_ENOMEM; \
} \
+ free( psz_meta ); \
}
i_status = input_GetItem(p_input)->p_meta->i_status;
- b_waiting = VLC_TRUE;
-/* TODO: meta data fetching doesn't work atm
vlc_mutex_lock( &p_sys->lock );
b_waiting = p_sys->b_waiting_meta;
vlc_mutex_unlock( &p_sys->lock );
-*/
- /* TODO: item preparsing is buggy on drag&drop and command line arguments
if( i_status & ( !b_waiting ? ITEM_PREPARSED : ITEM_META_FETCHED ) )
- */
- if( 1 )
{
- ALLOC_ITEM_META( psz_artist, p_meta->psz_artist )
+ ALLOC_ITEM_META( psz_artist, Artist )
else
{
msg_Dbg( p_this, "No artist.." );
WAIT_METADATA_FETCHING( psz_artist )
}
-
- ALLOC_ITEM_META( psz_title, psz_name )
+ psz_meta = input_item_GetName( input_GetItem( p_input ) );
+ if( psz_meta )
+ {
+ psz_title = encode_URI_component( psz_meta );
+ if( !psz_title )
+ {
+ free( psz_meta );
+ FREE_INPUT_AND_CHARS
+ return VLC_ENOMEM;
+ }
+ free( psz_meta );
+ }
else
{
msg_Dbg( p_this, "No track name.." );
WAIT_METADATA_FETCHING( psz_title );
}
- ALLOC_ITEM_META( psz_album, p_meta->psz_album )
+ ALLOC_ITEM_META( psz_album, Album )
else
psz_album = calloc( 1, 1 );
- ALLOC_ITEM_META( psz_trackid, p_meta->psz_trackid )
+ ALLOC_ITEM_META( psz_trackid, TrackID )
else
psz_trackid = calloc( 1, 1 );