Commit 3d599783 authored by Antoine Cellerier's avatar Antoine Cellerier

Fix playlist_item_t.i_id vs input_item_t.i_id mess in HTTP interface. (Looks...

Fix playlist_item_t.i_id vs input_item_t.i_id mess in HTTP interface. (Looks like this was new in 0.9.0. Having 2 differents integer ids, one being used to play and the other needed to delete the item is kind of awkward.)
parent 234fc4e3
...@@ -410,13 +410,13 @@ void E_(MacroDo)( httpd_file_sys_t *p_args, ...@@ -410,13 +410,13 @@ void E_(MacroDo)( httpd_file_sys_t *p_args,
{ {
if( p_items[j] == if( p_items[j] ==
ARRAY_VAL(p_sys->p_playlist->items,i) ARRAY_VAL(p_sys->p_playlist->items,i)
->p_input->i_id) ->i_id)
break; break;
} }
if( j == i_nb_items ) if( j == i_nb_items )
{ {
playlist_DeleteFromInput( p_sys->p_playlist, playlist_DeleteFromInput( p_sys->p_playlist,
p_sys->p_playlist->items.p_elems[i]->p_input->i_id, p_sys->p_playlist->items.p_elems[i]->i_id,
VLC_FALSE ); VLC_FALSE );
msg_Dbg( p_intf, "requested playlist delete: %d", msg_Dbg( p_intf, "requested playlist delete: %d",
i ); i );
......
...@@ -494,8 +494,8 @@ void E_(EvaluateRPN)( intf_thread_t *p_intf, mvar_t *vars, ...@@ -494,8 +494,8 @@ void E_(EvaluateRPN)( intf_thread_t *p_intf, mvar_t *vars,
int i_id = E_(SSPopN)( st, vars ); int i_id = E_(SSPopN)( st, vars );
int i_ret; int i_ret;
i_ret = playlist_Control( p_sys->p_playlist, PLAYLIST_VIEWPLAY, VLC_TRUE, i_ret = playlist_Control( p_sys->p_playlist, PLAYLIST_VIEWPLAY,
NULL, VLC_TRUE, NULL,
playlist_ItemGetById( p_sys->p_playlist, playlist_ItemGetById( p_sys->p_playlist,
i_id, VLC_TRUE ) ); i_id, VLC_TRUE ) );
msg_Dbg( p_intf, "requested playlist item: %i", i_id ); msg_Dbg( p_intf, "requested playlist item: %i", i_id );
...@@ -837,7 +837,7 @@ void E_(EvaluateRPN)( intf_thread_t *p_intf, mvar_t *vars, ...@@ -837,7 +837,7 @@ void E_(EvaluateRPN)( intf_thread_t *p_intf, mvar_t *vars,
char *mrl = E_(SSPop)( st ); char *mrl = E_(SSPop)( st );
char *tmp; char *tmp;
input_item_t *p_input; input_item_t *p_input;
int i_id; int i_ret;
tmp = E_(ToUTF8)( p_intf, psz_name ); tmp = E_(ToUTF8)( p_intf, psz_name );
free( psz_name ); free( psz_name );
...@@ -850,17 +850,17 @@ void E_(EvaluateRPN)( intf_thread_t *p_intf, mvar_t *vars, ...@@ -850,17 +850,17 @@ void E_(EvaluateRPN)( intf_thread_t *p_intf, mvar_t *vars,
if( !p_input || !p_input->psz_uri || !*p_input->psz_uri ) if( !p_input || !p_input->psz_uri || !*p_input->psz_uri )
{ {
i_id = VLC_EGENERIC; i_ret = VLC_EGENERIC;
msg_Dbg( p_intf, "invalid requested mrl: %s", mrl ); msg_Dbg( p_intf, "invalid requested mrl: %s", mrl );
} }
else else
{ {
i_id = playlist_AddInput( p_sys->p_playlist, p_input, i_ret = playlist_AddInput( p_sys->p_playlist, p_input,
PLAYLIST_APPEND, PLAYLIST_END, VLC_TRUE, PLAYLIST_APPEND, PLAYLIST_END, VLC_TRUE,
VLC_FALSE); VLC_FALSE);
msg_Dbg( p_intf, "requested mrl add: %s", mrl ); msg_Dbg( p_intf, "requested mrl add: %s", mrl );
} }
E_(SSPushN)( st, i_id ); E_(SSPushN)( st, i_ret );
free( mrl ); free( mrl );
free( psz_name ); free( psz_name );
...@@ -873,9 +873,20 @@ void E_(EvaluateRPN)( intf_thread_t *p_intf, mvar_t *vars, ...@@ -873,9 +873,20 @@ void E_(EvaluateRPN)( intf_thread_t *p_intf, mvar_t *vars,
else if( !strcmp( s, "playlist_delete" ) ) else if( !strcmp( s, "playlist_delete" ) )
{ {
int i_id = E_(SSPopN)( st, vars ); int i_id = E_(SSPopN)( st, vars );
playlist_DeleteFromInput( p_sys->p_playlist, i_id, VLC_FALSE ); playlist_item_t *p_item = playlist_ItemGetById( p_sys->p_playlist,
i_id, VLC_FALSE );
if( p_item )
{
playlist_DeleteFromInput( p_sys->p_playlist,
p_item->p_input->i_id, VLC_FALSE );
msg_Dbg( p_intf, "requested playlist delete: %d", i_id ); msg_Dbg( p_intf, "requested playlist delete: %d", i_id );
} }
else
{
msg_Dbg( p_intf, "couldn't find playlist item to delete (%d)",
i_id );
}
}
else if( !strcmp( s, "playlist_move" ) ) else if( !strcmp( s, "playlist_move" ) )
{ {
/*int i_newpos =*/ E_(SSPopN)( st, vars ); /*int i_newpos =*/ E_(SSPopN)( st, vars );
......
...@@ -432,7 +432,7 @@ void E_(PlaylistListNode)( intf_thread_t *p_intf, playlist_t *p_pl, ...@@ -432,7 +432,7 @@ void E_(PlaylistListNode)( intf_thread_t *p_intf, playlist_t *p_pl,
E_(mvar_AppendNewVar)( itm, "current", "0" ); E_(mvar_AppendNewVar)( itm, "current", "0" );
} }
sprintf( value, "%d", p_node->p_input->i_id ); sprintf( value, "%d", p_node->i_id );
E_(mvar_AppendNewVar)( itm, "index", value ); E_(mvar_AppendNewVar)( itm, "index", value );
psz = E_(FromUTF8)( p_intf, p_node->p_input->psz_name ); psz = E_(FromUTF8)( p_intf, p_node->p_input->psz_name );
...@@ -478,7 +478,7 @@ void E_(PlaylistListNode)( intf_thread_t *p_intf, playlist_t *p_pl, ...@@ -478,7 +478,7 @@ void E_(PlaylistListNode)( intf_thread_t *p_intf, playlist_t *p_pl,
sprintf( value, "Node" ); sprintf( value, "Node" );
E_(mvar_AppendNewVar)( itm, "type", value ); E_(mvar_AppendNewVar)( itm, "type", value );
sprintf( value, "%d", p_node->p_input->i_id ); sprintf( value, "%d", p_node->i_id );
E_(mvar_AppendNewVar)( itm, "index", value ); E_(mvar_AppendNewVar)( itm, "index", value );
sprintf( value, "%d", p_node->i_children); sprintf( value, "%d", p_node->i_children);
......
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