char *filename = (char*) cmd_arg->argument;
char fullname[1024];
int flush = 1;
+ char *service;
if ( filename[0] == '!' )
{
filename ++;
}
- if ( filename[0] == '/' )
- filename++;
+ service = strchr( filename, ':' );
+ if ( service != NULL )
+ {
+ service = filename;
+ filename = strchr( service, ':' );
+ *filename ++ = '\0';
+
+ if ( strlen( cmd_arg->root_dir ) && filename[0] == '/' )
+ filename++;
+
+ snprintf( fullname, 1023, "%s:%s%s", service, cmd_arg->root_dir, filename );
+ }
+ else
+ {
+ if ( strlen( cmd_arg->root_dir ) && filename[0] == '/' )
+ filename++;
- snprintf( fullname, 1023, "%s%s", cmd_arg->root_dir, filename );
+ snprintf( fullname, 1023, "%s%s", cmd_arg->root_dir, filename );
+ }
if (unit == NULL)
return RESPONSE_INVALID_UNIT;
else
{
- int64_t in = -1, out = -1;
+ int32_t in = -1, out = -1;
if ( valerie_tokeniser_count( cmd_arg->tokeniser ) == 5 )
{
in = atol( valerie_tokeniser_get_string( cmd_arg->tokeniser, 3 ) );
char *filename = (char*) cmd_arg->argument;
char fullname[1024];
- if ( filename[0] == '/' )
+ if ( strlen( cmd_arg->root_dir ) && filename[0] == '/' )
filename++;
snprintf( fullname, 1023, "%s%s", cmd_arg->root_dir, filename );
return RESPONSE_SUCCESS;
}
+int miracle_wipe( command_argument cmd_arg )
+{
+ miracle_unit unit = miracle_get_unit(cmd_arg->unit);
+
+ if (unit == NULL)
+ return RESPONSE_INVALID_UNIT;
+ else
+ {
+ if ( miracle_unit_wipe( unit ) != valerie_ok )
+ return RESPONSE_BAD_FILE;
+ }
+ return RESPONSE_SUCCESS;
+}
+
+int miracle_clear( command_argument cmd_arg )
+{
+ miracle_unit unit = miracle_get_unit(cmd_arg->unit);
+
+ if (unit == NULL)
+ return RESPONSE_INVALID_UNIT;
+ else
+ {
+ if ( miracle_unit_clear( unit ) != valerie_ok )
+ return RESPONSE_BAD_FILE;
+ }
+ return RESPONSE_SUCCESS;
+}
+
int miracle_move( command_argument cmd_arg )
{
miracle_unit unit = miracle_get_unit(cmd_arg->unit);
char *filename = (char*) cmd_arg->argument;
char fullname[1024];
- if ( filename[0] == '/' )
+ if ( strlen( cmd_arg->root_dir ) && filename[0] == '/' )
filename++;
snprintf( fullname, 1023, "%s%s", cmd_arg->root_dir, filename );
return RESPONSE_INVALID_UNIT;
else
{
- int64_t in = -1, out = -1;
+ int32_t in = -1, out = -1;
if ( valerie_tokeniser_count( cmd_arg->tokeniser ) == 5 )
{
in = atol( valerie_tokeniser_get_string( cmd_arg->tokeniser, 3 ) );
return RESPONSE_SUCCESS;
}
+int miracle_push( command_argument cmd_arg, mlt_service service )
+{
+ miracle_unit unit = miracle_get_unit(cmd_arg->unit);
+ if ( unit != NULL && service != NULL )
+ if ( miracle_unit_append_service( unit, service ) == valerie_ok )
+ return RESPONSE_SUCCESS;
+ return RESPONSE_BAD_FILE;
+}
+
+int miracle_receive( command_argument cmd_arg, char *doc )
+{
+ mlt_producer producer = mlt_factory_producer( "westley-xml", doc );
+ miracle_unit unit = miracle_get_unit(cmd_arg->unit);
+ if ( unit != NULL && producer != NULL )
+ {
+ if ( miracle_unit_append_service( unit, MLT_PRODUCER_SERVICE( producer ) ) == valerie_ok )
+ {
+ mlt_producer_close( producer );
+ return RESPONSE_SUCCESS;
+ }
+ }
+ mlt_producer_close( producer );
+ return RESPONSE_BAD_FILE;
+}
+
int miracle_play( command_argument cmd_arg )
{
miracle_unit unit = miracle_get_unit(cmd_arg->unit);
if ( unit == NULL )
return RESPONSE_INVALID_UNIT;
else
- {
- miracle_unit_play( unit, 0 );
miracle_unit_terminate( unit );
- }
return RESPONSE_SUCCESS;
}
int miracle_transfer( command_argument cmd_arg )
{
- /*
- dv_unit src_unit = miracle_get_unit(cmd_arg->unit);
+ miracle_unit src_unit = miracle_get_unit(cmd_arg->unit);
int dest_unit_id = -1;
char *string = (char*) cmd_arg->argument;
if ( string != NULL && ( string[ 0 ] == 'U' || string[ 0 ] == 'u' ) && strlen( string ) > 1 )
if ( src_unit != NULL && dest_unit_id != -1 )
{
- dv_unit dest_unit = miracle_get_unit( dest_unit_id );
- if ( dest_unit != NULL && !dv_unit_is_offline(dest_unit) && dest_unit != src_unit )
+ miracle_unit dest_unit = miracle_get_unit( dest_unit_id );
+ if ( dest_unit != NULL && !miracle_unit_is_offline(dest_unit) && dest_unit != src_unit )
{
- dv_unit_transfer( dest_unit, src_unit );
+ miracle_unit_transfer( dest_unit, src_unit );
return RESPONSE_SUCCESS;
}
}
- */
return RESPONSE_INVALID_UNIT;
}