X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=modules%2Fcontrol%2Fhttp.c;h=624de5ebc1861d5cffb94d43658bbad138283310;hb=49913218cb1dcc91a1e7ac4dfe7993aac7114adf;hp=687660f4e84308864fe1c8f46243f684388731f1;hpb=5f5d4e185d7c5603300e8f276e63f682845c5469;p=vlc diff --git a/modules/control/http.c b/modules/control/http.c index 687660f4e8..624de5ebc1 100644 --- a/modules/control/http.c +++ b/modules/control/http.c @@ -2,7 +2,7 @@ * http.c : http mini-server ;) ***************************************************************************** * Copyright (C) 2001 VideoLAN - * $Id: http.c,v 1.14 2003/07/12 00:56:18 fenrir Exp $ + * $Id: http.c,v 1.17 2003/07/23 01:13:47 gbazin Exp $ * * Authors: Gildas Bazin * Laurent Aimar @@ -25,6 +25,14 @@ /***************************************************************************** * Preamble *****************************************************************************/ +/* + * TODO: + * + * - clean up ? + * - doc ! (mouarf ;) + * + */ + #include #include #include @@ -943,7 +951,7 @@ static mvar_t *mvar_FileSetNew( char *name, char *psz_dir ) /* convert all / to native separator */ #if defined( WIN32 ) - while( p = strchr( psz_dir, '/' ) ) + while( (p = strchr( psz_dir, '/' )) ) { *p = '\\'; } @@ -1079,8 +1087,13 @@ static mvar_t *mvar_FileSetNew( char *name, char *psz_dir ) mvar_AppendNewVar( f, "size", tmp ); /* FIXME memory leak FIXME */ +#ifdef HAVE_CTIME_R ctime_r( &stat_info.st_mtime, tmp ); mvar_AppendNewVar( f, "date", tmp ); +#else + mvar_AppendNewVar( f, "date", ctime( &stat_info.st_mtime ) ); +#endif + #else mvar_AppendNewVar( f, "type", "unknown" ); mvar_AppendNewVar( f, "size", "unknown" ); @@ -1231,6 +1244,8 @@ enum macroType MVLC_NEXT, MVLC_PREVIOUS, MVLC_ADD, + MVLC_DEL, + MVLC_EMPTY, MVLC_CLOSE, MVLC_SHUTDOWN, @@ -1261,8 +1276,12 @@ StrToMacroTypeTab [] = { "stop", MVLC_STOP }, { "pause", MVLC_PAUSE }, { "next", MVLC_NEXT }, - { "prevous", MVLC_PREVIOUS }, + { "previous", MVLC_PREVIOUS }, + + /* playlist management */ { "add", MVLC_ADD }, + { "del", MVLC_DEL }, + { "empty", MVLC_EMPTY }, /* admin control */ { "close", MVLC_CLOSE }, @@ -1373,16 +1392,40 @@ static void MacroDo( httpd_file_callback_args_t *p_args, p_sys->p_playlist->i_index - 1 ); msg_Dbg( p_intf, "requested playlist next" ); break; + + /* playlist management */ case MVLC_ADD: { char mrl[512]; uri_extract_value( p_request, "mrl", mrl, 512 ); uri_decode_url_encoded( mrl ); - playlist_Add( p_sys->p_playlist, mrl, + playlist_Add( p_sys->p_playlist, mrl, NULL, 0, PLAYLIST_APPEND, PLAYLIST_END ); msg_Dbg( p_intf, "requested playlist add: %s", mrl ); break; } + case MVLC_DEL: + { + int i_item; + char item[512]; + + uri_extract_value( p_request, "item", item, 512 ); + i_item = atoi( item ); + + playlist_Delete( p_sys->p_playlist, i_item ); + msg_Dbg( p_intf, "requested playlist del: %d", i_item ); + break; + } + case MVLC_EMPTY: + { + while( p_sys->p_playlist->i_size > 0 ) + { + playlist_Delete( p_sys->p_playlist, 0 ); + } + msg_Dbg( p_intf, "requested playlist empty" ); + break; + } + /* admin function */ case MVLC_CLOSE: {