Commit 28563cf1 authored by Clément Stenac's avatar Clément Stenac

Sort-by-album patch by Pierre Marc Dumuid

parent b879e009
...@@ -34,7 +34,7 @@ Colin Simmonds <colin_simmonds at Mac.lover.org> - compile fix for Mac OS X ...@@ -34,7 +34,7 @@ Colin Simmonds <colin_simmonds at Mac.lover.org> - compile fix for Mac OS X
Damian Ivereigh <damian at cisco.com> - ac3dec uninitialized data structure fix Damian Ivereigh <damian at cisco.com> - ac3dec uninitialized data structure fix
Damien Fouilleul <damien.fouilleul at laposte.net> - DirectShow input improvements Damien Fouilleul <damien.fouilleul at laposte.net> - DirectShow input improvements
Daniel Fischer <dan at subsignal dot org> - Shoutcast output support Daniel Fischer <dan at subsignal dot org> - Shoutcast output support
Daniel Strnger <vlc at schmaller d0t de> - M3U improvements Daniel Strnger <vlc at schmaller d0t de> - M3U and playlist improvements
David Kennedy <dkennedy at tinytoad.com> - X11 fullscreen patch David Kennedy <dkennedy at tinytoad.com> - X11 fullscreen patch
David Weber <david_weber at gmx.de> - Mac OS X interface design & graphics (v0.5.0) David Weber <david_weber at gmx.de> - Mac OS X interface design & graphics (v0.5.0)
Davor Orel <syntheticamac at yahoo.it> - Mac OS X icons Davor Orel <syntheticamac at yahoo.it> - Mac OS X icons
...@@ -89,6 +89,7 @@ Olivier Pomel <pomel at via.ecp.fr> - original VLC code ...@@ -89,6 +89,7 @@ Olivier Pomel <pomel at via.ecp.fr> - original VLC code
yvind Kolbu <oyvindk at world-online.no> - FreeBSD patches yvind Kolbu <oyvindk at world-online.no> - FreeBSD patches
Paul Mackerras <paulus at linuxcare.com.au> - AltiVec IDCT and motion Paul Mackerras <paulus at linuxcare.com.au> - AltiVec IDCT and motion
Philippe Van Hecke <philippe at belnet dot be> - SAP header hash patch Philippe Van Hecke <philippe at belnet dot be> - SAP header hash patch
Pierre Marc Dumuid <pierre.dumuid at adelaide dot edu dot au> - Playlist patches
Rgis Duchesne <regis at via.ecp.fr> - original VLC code Rgis Duchesne <regis at via.ecp.fr> - original VLC code
Remco Poortinga <poortinga at telin.nl> - IPv6 multicast patch Remco Poortinga <poortinga at telin.nl> - IPv6 multicast patch
Rene Gollent <rgollent at u.arizona.edu> - BeOS interface fix Rene Gollent <rgollent at u.arizona.edu> - BeOS interface fix
......
...@@ -108,6 +108,7 @@ struct playlist_view_t ...@@ -108,6 +108,7 @@ struct playlist_view_t
#define VIEW_FIRST_SORTED 4 #define VIEW_FIRST_SORTED 4
#define VIEW_S_AUTHOR 4 #define VIEW_S_AUTHOR 4
#define VIEW_S_GENRE 5 #define VIEW_S_GENRE 5
#define VIEW_S_ALBUM 6
#define VIEW_LAST_SORTED 10 #define VIEW_LAST_SORTED 10
...@@ -232,6 +233,7 @@ struct playlist_add_t ...@@ -232,6 +233,7 @@ struct playlist_add_t
#define SORT_RANDOM 5 #define SORT_RANDOM 5
#define SORT_DURATION 6 #define SORT_DURATION 6
#define SORT_TITLE_NUMERIC 7 #define SORT_TITLE_NUMERIC 7
#define SORT_ALBUM 8
#define ORDER_NORMAL 0 #define ORDER_NORMAL 0
#define ORDER_REVERSE 1 #define ORDER_REVERSE 1
...@@ -351,6 +353,7 @@ VLC_EXPORT( int, playlist_ItemAddOption, (playlist_item_t *, const char *) ); ...@@ -351,6 +353,7 @@ VLC_EXPORT( int, playlist_ItemAddOption, (playlist_item_t *, const char *) );
#define playlist_SortID(p, i) playlist_Sort( p, SORT_ID, i) #define playlist_SortID(p, i) playlist_Sort( p, SORT_ID, i)
#define playlist_SortTitle(p, i) playlist_Sort( p, SORT_TITLE, i) #define playlist_SortTitle(p, i) playlist_Sort( p, SORT_TITLE, i)
#define playlist_SortAuthor(p, i) playlist_Sort( p, SORT_AUTHOR, i) #define playlist_SortAuthor(p, i) playlist_Sort( p, SORT_AUTHOR, i)
#define playlist_SortAlbum(p, i) playlist_Sort( p, SORT_ALBUM, i)
#define playlist_SortGroup(p, i) playlist_Sort( p, SORT_GROUP, i) #define playlist_SortGroup(p, i) playlist_Sort( p, SORT_GROUP, i)
VLC_EXPORT( int, playlist_Sort, ( playlist_t *, int, int) ); VLC_EXPORT( int, playlist_Sort, ( playlist_t *, int, int) );
VLC_EXPORT( int, playlist_Move, ( playlist_t *, int, int ) ); VLC_EXPORT( int, playlist_Move, ( playlist_t *, int, int ) );
......
...@@ -1219,6 +1219,8 @@ wxMenu * Playlist::ViewMenu() ...@@ -1219,6 +1219,8 @@ wxMenu * Playlist::ViewMenu()
wxU(_("Normal") ) ); wxU(_("Normal") ) );
p_view_menu->Append( FirstView_Event + VIEW_S_AUTHOR, p_view_menu->Append( FirstView_Event + VIEW_S_AUTHOR,
wxU(_("Sorted by artist") ) ); wxU(_("Sorted by artist") ) );
p_view_menu->Append( FirstView_Event + VIEW_S_ALBUM,
wxU(_("Sorted by Album") ) );
return p_view_menu; return p_view_menu;
} }
......
...@@ -40,7 +40,7 @@ int playlist_ItemArraySort( playlist_t *p_playlist, int i_items, ...@@ -40,7 +40,7 @@ int playlist_ItemArraySort( playlist_t *p_playlist, int i_items,
/** /**
* Sort the playlist. * Sort the playlist.
* \param p_playlist the playlist * \param p_playlist the playlist
* \param i_mode: SORT_ID, SORT_TITLE, SORT_AUTHOR, SORT_RANDOM * \param i_mode: SORT_ID, SORT_TITLE, SORT_AUTHOR, SORT_ALBUM, SORT_RANDOM
* \param i_type: ORDER_NORMAL or ORDER_REVERSE (reversed order) * \param i_type: ORDER_NORMAL or ORDER_REVERSE (reversed order)
* \return VLC_SUCCESS on success * \return VLC_SUCCESS on success
*/ */
...@@ -86,7 +86,7 @@ int playlist_Sort( playlist_t * p_playlist , int i_mode, int i_type ) ...@@ -86,7 +86,7 @@ int playlist_Sort( playlist_t * p_playlist , int i_mode, int i_type )
* *
* \param p_playlist the playlist * \param p_playlist the playlist
* \param p_node the node to sort * \param p_node the node to sort
* \param i_mode: SORT_ID, SORT_TITLE, SORT_AUTHOR, SORT_RANDOM * \param i_mode: SORT_ID, SORT_TITLE, SORT_AUTHOR, SORT_ALBUM, SORT_RANDOM
* \param i_type: ORDER_NORMAL or ORDER_REVERSE (reversed order) * \param i_type: ORDER_NORMAL or ORDER_REVERSE (reversed order)
* \return VLC_SUCCESS on success * \return VLC_SUCCESS on success
*/ */
...@@ -110,7 +110,7 @@ int playlist_NodeSort( playlist_t * p_playlist , playlist_item_t *p_node, ...@@ -110,7 +110,7 @@ int playlist_NodeSort( playlist_t * p_playlist , playlist_item_t *p_node,
* *
* \param p_playlist the playlist * \param p_playlist the playlist
* \param p_node the node to sort * \param p_node the node to sort
* \param i_mode: SORT_ID, SORT_TITLE, SORT_AUTHOR, SORT_RANDOM * \param i_mode: SORT_ID, SORT_TITLE, SORT_AUTHOR, SORT_ALBUM, SORT_RANDOM
* \param i_type: ORDER_NORMAL or ORDER_REVERSE (reversed order) * \param i_type: ORDER_NORMAL or ORDER_REVERSE (reversed order)
* \return VLC_SUCCESS on success * \return VLC_SUCCESS on success
*/ */
...@@ -226,6 +226,49 @@ int playlist_ItemArraySort( playlist_t *p_playlist, int i_items, ...@@ -226,6 +226,49 @@ int playlist_ItemArraySort( playlist_t *p_playlist, int i_items,
i_test = strcmp( psz_b, psz_a ); i_test = strcmp( psz_b, psz_a );
} }
} }
else if( i_mode == SORT_ALBUM )
{
char *psz_a = vlc_input_item_GetInfo(
&pp_items[i]->input,
_( "Meta-information"), _("Album/movie/show title") );
char *psz_b = vlc_input_item_GetInfo(
&pp_items[i_small]->input,
_( "Meta-information"), _("Album/movie/show title") );
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 ) else if( i_mode == SORT_TITLE_NODES_FIRST )
{ {
/* Alphabetic sort, all nodes first */ /* Alphabetic sort, all nodes first */
...@@ -284,6 +327,11 @@ int playlist_NodeGroup( playlist_t * p_playlist , int i_view, ...@@ -284,6 +327,11 @@ int playlist_NodeGroup( playlist_t * p_playlist , int i_view,
psz_search = vlc_input_item_GetInfo( &pp_items[i]->input, psz_search = vlc_input_item_GetInfo( &pp_items[i]->input,
_("Meta-information"), _( "Artist" ) ); _("Meta-information"), _( "Artist" ) );
} }
else if ( i_mode == SORT_ALBUM )
{
psz_search = vlc_input_item_GetInfo( &pp_items[i]->input,
_("Meta-information"), _( "Album/movie/show title" ) );
}
else if ( i_mode == SORT_GENRE ) else if ( i_mode == SORT_GENRE )
{ {
psz_search = vlc_input_item_GetInfo( &pp_items[i]->input, psz_search = vlc_input_item_GetInfo( &pp_items[i]->input,
......
...@@ -187,6 +187,7 @@ int playlist_ViewUpdate( playlist_t *p_playlist, int i_view) ...@@ -187,6 +187,7 @@ int playlist_ViewUpdate( playlist_t *p_playlist, int i_view)
switch( i_view ) switch( i_view )
{ {
case VIEW_S_AUTHOR: i_sort_type = SORT_AUTHOR;break; case VIEW_S_AUTHOR: i_sort_type = SORT_AUTHOR;break;
case VIEW_S_ALBUM: i_sort_type = SORT_ALBUM;break;
case VIEW_S_GENRE: i_sort_type = SORT_GENRE;break; case VIEW_S_GENRE: i_sort_type = SORT_GENRE;break;
default: i_sort_type = SORT_AUTHOR; default: i_sort_type = SORT_AUTHOR;
} }
......
Markdown is supported
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