]> git.sesse.net Git - vlc/commitdiff
Implement sort functionality on http interface. Patch by: Laurent Mutricy <laurent...
authorJean-Paul Saman <jpsaman@videolan.org>
Fri, 17 Mar 2006 14:34:06 +0000 (14:34 +0000)
committerJean-Paul Saman <jpsaman@videolan.org>
Fri, 17 Mar 2006 14:34:06 +0000 (14:34 +0000)
modules/control/http/rpn.c
share/http/js/functions.js
share/http/requests/status.xml

index 393002731d8a57cbcce9c0d72ffe262941b50aee..691e8e3b28ba358046c8d1dd991e8490ee661e22 100644 (file)
@@ -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 );
index cc99f016b49c37284c808c3bf4129d9b704aa1cb..94bada86d8b6f9a2c969e5c41ebb6c7a8a7c4038 100644 (file)
@@ -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' );
index a0f70e5c0bd432a74be96d804defa52c6c0eec49..4f5f931bb68214a158cd11611b6c4af9a2df98df 100644 (file)
@@ -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" />