Commit a7c18d8a authored by Jean-Paul Saman's avatar Jean-Paul Saman

Implement sort functionality on http interface. Patch by: Laurent Mutricy...

Implement sort functionality on http interface. Patch by: Laurent Mutricy <laurent dot mutricy _at_ ecl2005 dot ec-lyon dot fr>
parent 69aae8d2
......@@ -887,6 +887,17 @@ void E_(EvaluateRPN)( intf_thread_t *p_intf, mvar_t *vars,
msg_Dbg( p_intf, "requested to move playlist item %d to %d",
i_pos, i_newpos);
}
else if( !strcmp( s, "playlist_sort" ) )
{
int i_order = E_(SSPopN)( st, vars );
int i_sort = E_(SSPopN)( st, vars );
i_order = i_order % 2;
i_sort = i_sort % 9;
playlist_RecursiveNodeSort ( p_sys->p_playlist,
p_sys->p_playlist->p_general,
i_sort, i_order );
msg_Dbg( p_intf, "requested sort playlist by : %d in order : %d", i_sort, i_order );
}
else if( !strcmp( s, "vlc_volume_set" ) )
{
char *psz_vol = E_(SSPop)( st );
......
......@@ -308,10 +308,9 @@ function pl_empty()
loadXMLDoc( 'requests/status.xml?command=pl_empty', parse_status );
setTimeout( 'update_playlist()', 1000 );
}
function pl_sort()
function pl_sort( sort, order )
{
/* FIXME */
loadXMLDoc( 'requests/status.xml?command=pl_sort', parse_status );
loadXMLDoc( 'requests/status.xml?command=pl_sort&id='+order+'&val='+sort, parse_status );
setTimeout( 'update_playlist()', 1000 );
}
function pl_shuffle()
......@@ -433,18 +432,18 @@ function parse_status()
document.getElementById( 'btn_pause' ).setAttribute( 'title', 'Play' );
}
if( status.getElementsByTagName( 'random' )[0].firstChild.data == "1" )
document.getElementById( 'btn_shuffle').setAttribute( 'class', 'on' );
else
document.getElementById( 'btn_shuffle').setAttribute( 'class', 'off' );
if( status.getElementsByTagName( 'loop' )[0].firstChild.data == "1" )
document.getElementById( 'btn_loop').setAttribute( 'class', 'on' );
else
document.getElementById( 'btn_loop').setAttribute( 'class', 'off' );
if( status.getElementsByTagName( 'repeat' )[0].firstChild.data == "1" )
document.getElementById( 'btn_repeat').setAttribute( 'class', 'on' );
else
document.getElementById( 'btn_repeat').setAttribute( 'class', 'off' );
if( status.getElementsByTagName( 'random' )[0].firstChild.data == "1" )
document.getElementById( 'btn_shuffle').setAttribute( 'class', 'on' );
else
document.getElementById( 'btn_shuffle').setAttribute( 'class', 'off' );
if( status.getElementsByTagName( 'loop' )[0].firstChild.data == "1" )
document.getElementById( 'btn_loop').setAttribute( 'class', 'on' );
else
document.getElementById( 'btn_loop').setAttribute( 'class', 'off' );
if( status.getElementsByTagName( 'repeat' )[0].firstChild.data == "1" )
document.getElementById( 'btn_repeat').setAttribute( 'class', 'on' );
else
document.getElementById( 'btn_repeat').setAttribute( 'class', 'off' );
var tree = document.createElement( "ul" );
var categories = status.getElementsByTagName( 'category' );
......
......@@ -66,7 +66,7 @@
<vlc id="rpn" param1="playlist_empty" />
<vlc id="end" />
<vlc id="if" param1="command value 'pl_sort' strcmp 0 =" />
<vlc id="rpn" param1="" /> <!-- FIXME -->
<vlc id="rpn" param1="val value id value playlist_sort" />
<vlc id="end" />
<vlc id="if" param1="command value 'pl_random' strcmp 0 =" />
<vlc id="rpn" param1="'random' 'VLC_OBJECT_PLAYLIST' vlc_var_get 1 + 2 % 'random' 'VLC_OBJECT_PLAYLIST' vlc_var_set" />
......
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