+ int i_test = 0;
+
+ if( sort_mode == SORT_TITLE )
+ {
+ META_STRCASECMP_NAME( );
+ }
+ else if( sort_mode == SORT_TITLE_NUMERIC )
+ {
+ char *psz_i = input_item_GetName( (*(playlist_item_t **)first)->p_input );
+ char *psz_ismall =
+ input_item_GetName( (*(playlist_item_t **)second)->p_input );
+ i_test = atoi( psz_i ) - atoi( psz_ismall );
+ free( psz_i );
+ free( psz_ismall );
+ }
+ else if( sort_mode == SORT_DURATION )
+ {
+ i_test = input_item_GetDuration( (*(playlist_item_t **)first)->p_input ) -
+ input_item_GetDuration( (*(playlist_item_t **)second)->p_input );
+ }
+ else if( sort_mode == SORT_ARTIST )
+ {
+ DO_META_SORT( Artist );
+ /* sort by artist, album, tracknumber */
+ if( i_test == 0 )
+ DO_META_SORT( Album );
+ if( i_test == 0 )
+ DO_META_SORT_ADV( TrackNumber, true );
+ }
+ else if( sort_mode == SORT_GENRE )
+ {
+ DO_META_SORT( Genre );
+ }
+ else if( sort_mode == SORT_ALBUM )
+ {
+ DO_META_SORT( Album );
+ /* Sort by tracknumber if albums are the same */
+ if( i_test == 0 )
+ DO_META_SORT_ADV( TrackNumber, true );
+ }
+ else if( sort_mode == SORT_TRACK_NUMBER )
+ {
+ DO_META_SORT_ADV( TrackNumber, true );
+ }
+ else if( sort_mode == SORT_DESCRIPTION )
+ {
+ DO_META_SORT( Description );
+ }
+ else if( sort_mode == SORT_ID )
+ {
+ i_test = (*(playlist_item_t **)first)->i_id - (*(playlist_item_t **)second)->i_id;
+ }
+ else if( sort_mode == SORT_TITLE_NODES_FIRST )