Commit 3935c13b authored by zorglub's avatar zorglub
Browse files

Implement SORT_AUTHOR. Closes #196

parent df73e4b3
......@@ -972,12 +972,14 @@ void Playlist::OnSort( wxCommandEvent& event )
switch( event.GetId() )
{
case SortTitle_Event:
playlist_RecursiveNodeSort( p_playlist, playlist_ItemGetById( p_playlist, p_wxitem->i_id ),
SORT_TITLE_NODES_FIRST, ORDER_NORMAL );
playlist_RecursiveNodeSort( p_playlist,
playlist_ItemGetById( p_playlist, p_wxitem->i_id ),
SORT_TITLE_NODES_FIRST, ORDER_NORMAL );
break;
case RSortTitle_Event:
playlist_RecursiveNodeSort( p_playlist, playlist_ItemGetById( p_playlist, p_wxitem->i_id ),
SORT_TITLE_NODES_FIRST, ORDER_REVERSE );
playlist_RecursiveNodeSort( p_playlist,
playlist_ItemGetById( p_playlist, p_wxitem->i_id ),
SORT_TITLE_NODES_FIRST, ORDER_REVERSE );
}
UnlockPlaylist( p_intf->p_sys, p_playlist );
......
......@@ -185,7 +185,46 @@ int playlist_ItemArraySort( playlist_t *p_playlist, int i_items,
}
else if( i_mode == SORT_AUTHOR )
{
msg_Err( p_playlist,"META SORT not implemented" );
char *psz_a = vlc_input_item_GetInfo(
&pp_items[i]->input,
_( "Meta-information"), _("Artist") );
char *psz_b = vlc_input_item_GetInfo(
&pp_items[i_small]->input,
_( "Meta-information"), _("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]->input.psz_name,
pp_items[i_small]->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]->input.psz_name,
pp_items[i_small]->input.psz_name );
}
else
{
i_test = strcmp( psz_b, psz_a );
}
}
else if( i_mode == SORT_TITLE_NODES_FIRST )
{
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment