- int i_test = 0;
-
- if( i_mode == SORT_TITLE )
- {
- META_STRCASECMP_NAME( i, i_small );
- }
- else if( i_mode == SORT_TITLE_NUMERIC )
- {
- char *psz_i = input_item_GetName( pp_items[i]->p_input );
- char *psz_ismall =
- input_item_GetName( pp_items[i_small]->p_input );
- i_test = atoi( psz_i ) - atoi( psz_ismall );
- free( psz_i );
- free( psz_ismall );
- }
- else if( i_mode == SORT_DURATION )
- {
- i_test = input_item_GetDuration( pp_items[i]->p_input ) -
- input_item_GetDuration( pp_items[i_small]->p_input );
- }
- else if( i_mode == SORT_ARTIST )
- {
- DO_META_SORT( Artist );
- }
- else if( i_mode == SORT_GENRE )
- {
- DO_META_SORT( Genre );
- }
- else if( i_mode == SORT_ALBUM )
- {
- DO_META_SORT( Album );
- }
- else if( i_mode == SORT_TRACK_NUMBER )
- {
- DO_META_SORT_ADV( TrackNumber, VLC_TRUE );
- }
- else if( i_mode == SORT_DESCRIPTION )
- {
- DO_META_SORT( Description );
- }
- else if( i_mode == SORT_RATING )
- {
- DO_META_SORT( Rating );
- }
- else if( i_mode == SORT_ID )
- {
- i_test = pp_items[i]->i_id - pp_items[i_small]->i_id;
- }
- 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]->p_input->psz_name,
- pp_items[i_small]->p_input->psz_name );
- }
- }
-
- if( ( i_type == ORDER_NORMAL && i_test < 0 ) ||
- ( i_type == ORDER_REVERSE && i_test > 0 ) )
- {
- i_small = i;
- }