| next | | Go to the next playlist element
| previous | | Got to the previous playlist element
| add | mrl(string) | Add a mrl to the playlist
- | del | item(integer)| Del an element of the playlist
+ | delete | item(integer)| Deletes an (list of) element of the playlist
| empty | | Empty the playlist
| close | id(hexa) | Close a specific connection
| shutdown | | Quit vlc
Fields:
- current : 1 if currently selected else 0
- index : the index value (to be used for example for the
- "del" control command.
+ "delete" control command.
- name
- "informations" : Create informations for the current playing
* http.c : http mini-server ;)
*****************************************************************************
* Copyright (C) 2001 VideoLAN
- * $Id: http.c,v 1.24 2003/10/21 01:05:32 titer Exp $
+ * $Id: http.c,v 1.25 2003/11/02 19:26:30 gbazin Exp $
*
* Authors: Gildas Bazin <gbazin@netcourrier.com>
* Laurent Aimar <fenrir@via.ecp.fr>
uint8_t *p_request, int i_request,
uint8_t **pp_data, int *pi_data );
-static void uri_extract_value( char *psz_uri, char *psz_name,
- char *psz_value, int i_value_max );
+static char *uri_extract_value( char *psz_uri, char *psz_name,
+ char *psz_value, int i_value_max );
static void uri_decode_url_encoded( char *psz );
/*****************************************************************************
/* playlist management */
{ "add", MVLC_ADD },
- { "del", MVLC_DEL },
+ { "delete", MVLC_DEL },
{ "empty", MVLC_EMPTY },
/* admin control */
}
case MVLC_DEL:
{
- int i_item;
- char item[512];
+ int i_item, *p_items = NULL, i_nb_items = 0;
+ char item[512], *p_parser = p_request;
- uri_extract_value( p_request, "item", item, 512 );
- i_item = atoi( item );
+ /* Get the list of items to delete */
+ while( (p_parser =
+ uri_extract_value( p_parser, "item", item, 512 )) )
+ {
+ if( !*item ) continue;
- playlist_Delete( p_sys->p_playlist, i_item );
- msg_Dbg( p_intf, "requested playlist del: %d", i_item );
+ i_item = atoi( item );
+ p_items = realloc( p_items, i_nb_items+1 );
+ p_items[i_nb_items] = i_item;
+ i_nb_items++;
+ }
+
+ /* The items need to be deleted from in reversed order */
+ if( i_nb_items )
+ {
+ int i;
+ for( i = 0; i < i_nb_items; i++ )
+ {
+ int j, i_index = 0;
+ for( j = 0; j < i_nb_items; j++ )
+ {
+ if( p_items[j] > p_items[i_index] )
+ i_index = j;
+ }
+
+ playlist_Delete( p_sys->p_playlist,
+ p_items[i_index] );
+ msg_Dbg( p_intf, "requested playlist delete: %d",
+ p_items[i_index] );
+ p_items[i_index] = -1;
+ }
+ }
+
+ if( p_items ) free( p_items );
break;
}
case MVLC_EMPTY:
/****************************************************************************
* uri parser
****************************************************************************/
-static void uri_extract_value( char *psz_uri, char *psz_name,
- char *psz_value, int i_value_max )
+static char *uri_extract_value( char *psz_uri, char *psz_name,
+ char *psz_value, int i_value_max )
{
char *p;
{
strncpy( psz_value, "", i_value_max );
}
+ p += i_len;
}
else
{
strncpy( psz_value, "", i_value_max );
}
+
+ return p;
}
static void uri_decode_url_encoded( char *psz )
}
}
}
-
-
-
<meta http-equiv="refresh" content="0;URL=/" />
<vlc id="end" />
- <vlc id="control" param1="stop,pause,previous,next,add,sout,play,del,empty" />
+ <vlc id="control" param1="stop,pause,previous,next,add,sout,play,delete,empty" />
<vlc id="set" param1="sout" param2="string" />
</head>
<body>
<div class="sectitle">VLC Playlist</div>
<div class="section">
- <table>
+ <form method="get" action="">
+ <table>
<vlc id="foreach" param1="pl" param2="playlist" />
<tr class="<vlc id="if" param1="2 pl.index % 0 =" />ligne1<vlc id="else" />ligne2<vlc id="end" />">
<td>
+ <input type=checkbox name="item" value="<vlc id="value" param1="pl.index" />">
<vlc id="if" param1="pl.current" />
<b>
<vlc id="end" />
<vlc id="end" />
</td></tr>
<vlc id="end" />
- </table>
+ </table>
+ <td><input type="submit" name="control" value="delete" /></td>
+ </form>
</div>
<hr/>
<p> <vlc id="value" param1="copyright" /> </p>