- if( i_mode == SORT_TITLE )
- {
- i_test = strcasecmp( pp_items[i]->p_input->psz_name,
- pp_items[i_small]->p_input->psz_name );
- }
- else if( i_mode == SORT_TITLE_NUMERIC )
- {
- i_test = atoi( pp_items[i]->p_input->psz_name ) -
- atoi( pp_items[i_small]->p_input->psz_name );
- }
- else if( i_mode == SORT_DURATION )
- {
- i_test = pp_items[i]->p_input->i_duration -
- pp_items[i_small]->p_input->i_duration;
- }
- else if( i_mode == SORT_AUTHOR )
- {
- char *psz_a = pp_items[i]->p_input->p_meta->psz_artist;
- char *psz_b = pp_items[i_small]->p_input->p_meta->psz_artist;
- 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;
- }
- // both are nodes
- else if( pp_items[i]->i_children >= 0 &&
- pp_items[i_small]->i_children >= 0 )
- {
- i_test = strcasecmp( pp_items[i]->p_input->psz_name,
- pp_items[i_small]->p_input->psz_name );
- }
- else if( psz_a == NULL && psz_b != NULL )
- {
- i_test = 1;
- }
- else if( psz_a != NULL && psz_b == NULL )
- {
- i_test = -1;
- }
- else if( psz_a == NULL && psz_b == NULL )
- {
- i_test = strcasecmp( pp_items[i]->p_input->psz_name,
- pp_items[i_small]->p_input->psz_name );
- }
- else
- {
- i_test = strcmp( psz_b, psz_a );
- }
- }
- else if( i_mode == SORT_ALBUM )
- {
- char *psz_a = pp_items[i]->p_input->p_meta->psz_album;
- char *psz_b = pp_items[i_small]->p_input->p_meta->psz_album;
- 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;
- }
- // both are nodes
- else if( pp_items[i]->i_children >= 0 &&
- pp_items[i_small]->i_children >= 0 )
- {
- i_test = strcasecmp( pp_items[i]->p_input->psz_name,
- pp_items[i_small]->p_input->psz_name );
- }
- else if( psz_a == NULL && psz_b != NULL )
- {
- i_test = 1;
- }
- else if( psz_a != NULL && psz_b == NULL )
- {
- i_test = -1;
- }
- else if( psz_a == NULL && psz_b == NULL )
- {
- i_test = strcasecmp( pp_items[i]->p_input->psz_name,
- pp_items[i_small]->p_input->psz_name );
- }
- else
- {
- i_test = strcmp( psz_b, psz_a );
- }
- }
- else if( i_mode == SORT_TITLE_NODES_FIRST )
- {
- /* Alphabetic sort, all nodes first */