Commit d7460d44 authored by Antoine Cellerier's avatar Antoine Cellerier

new "vlm_cmd" (or "vlm_command") rpn function.

Since vlm commands are often full of spaces, you need to use the ";"
command delimiter to mark the end of a command.

For example : <vlc id="rpn" param1="; broadcast name new vlm_cmd" />
parent 9bb495cb
/***************************************************************************** /*****************************************************************************
* rpn.c : RPN evaluator for the HTTP Interface * rpn.c : RPN evaluator for the HTTP Interface
***************************************************************************** *****************************************************************************
* Copyright (C) 2001-2005 the VideoLAN team * Copyright (C) 2001-2006 the VideoLAN team
* $Id$ * $Id$
* *
* Authors: Gildas Bazin <gbazin@netcourrier.com> * Authors: Gildas Bazin <gbazin@netcourrier.com>
...@@ -960,6 +960,55 @@ void E_(EvaluateRPN)( intf_thread_t *p_intf, mvar_t *vars, ...@@ -960,6 +960,55 @@ void E_(EvaluateRPN)( intf_thread_t *p_intf, mvar_t *vars,
} }
aout_VolumeGet( p_intf, &i_volume ); aout_VolumeGet( p_intf, &i_volume );
} }
else if( !strcmp( s, "vlm_command" ) || !strcmp( s, "vlm_cmd" ) )
{
char *psz_elt;
char *psz_cmd = strdup( "" );
char *psz_error;
vlm_message_t *vlm_answer;
/* make sure that we have a vlm object */
if( p_intf->p_sys->p_vlm == NULL )
p_intf->p_sys->p_vlm = vlm_New( p_intf );
/* vlm command uses the ';' delimiter
* (else we can't know when to stop) */
while( strcmp( psz_elt = E_(SSPop)( st ), "" )
&& strcmp( psz_elt, ";" ) )
{
printf( "\npsz_elt : %s", psz_elt );
char *psz_buf =
(char *)malloc( strlen( psz_cmd ) + strlen( psz_elt ) + 2 );
sprintf( psz_buf, "%s %s", psz_cmd, psz_elt );
free( psz_cmd );
free( psz_elt );
psz_cmd = psz_buf;
}
printf( "\nVLM command : %s\n\n", psz_cmd );
vlm_ExecuteCommand( p_intf->p_sys->p_vlm, psz_cmd, &vlm_answer );
if( vlm_answer->psz_value == NULL )
{
psz_error = strdup( "" );
}
else
{
psz_error = malloc( strlen(vlm_answer->psz_name) +
strlen(vlm_answer->psz_value) +
strlen( " : ") + 1 );
sprintf( psz_error , "%s : %s" , vlm_answer->psz_name,
vlm_answer->psz_value );
}
E_(mvar_AppendNewVar)( vars, "vlm_error", psz_error );
vlm_MessageDelete( vlm_answer );
free( psz_cmd );
free( psz_error );
}
else else
{ {
E_(SSPush)( st, s ); E_(SSPush)( st, s );
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment