- for( i_position = 0; i_position < i_items -1 ; i_position ++ )
- {
- i_small = i_position;
- for( i = i_position + 1 ; i< i_items ; i++)
- {
- int i_test = 0;
-
- if( i_mode == SORT_TITLE )
- {
- i_test = strcasecmp( pp_items[i]->input.psz_name,
- pp_items[i_small]->input.psz_name );
- }
- else if( i_mode == SORT_TITLE_NUMERIC )
- {
- i_test = atoi( pp_items[i]->input.psz_name ) -
- atoi( pp_items[i_small]->input.psz_name );
- }
- else if( i_mode == SORT_DURATION )
- {
- i_test = pp_items[i]->input.i_duration -
- pp_items[i_small]->input.i_duration;
- }
- else if( i_mode == SORT_AUTHOR )
- {
- msg_Err( p_playlist,"META SORT not implemented" );
- }
- else if( i_mode == SORT_TITLE_NODES_FIRST )
- {
- /* Alphabetic sort, all nodes first */
-
- if( pp_items[i]->i_children == -1 &&
- pp_items[i_small]->i_children >= 0 )
- {
- i_test = 1;
- }
- else if( pp_items[i]->i_children >= 0 &&
- pp_items[i_small]->i_children == -1 )
- {
- i_test = -1;
- }
- else
- {
- i_test = strcasecmp( pp_items[i]->input.psz_name,
- pp_items[i_small]->input.psz_name );
- }
- }
-
- if( ( i_type == ORDER_NORMAL && i_test < 0 ) ||
- ( i_type == ORDER_REVERSE && i_test > 0 ) )
- {
- i_small = i;
- }
- }
- p_temp = pp_items[i_position];
- pp_items[i_position] = pp_items[i_small];
- pp_items[i_small] = p_temp;
- }
- return VLC_SUCCESS;
+SORTFN( SORT_DESCRIPTION, first, second )
+{
+ return meta_sort( first, second, vlc_meta_Description, false );