[vlc-devel] [PATCH] playlist: added column date to detailed view (fixes #14926)

Marcel Schnirring ms at marcel-schnirring.de
Sun Nov 20 23:03:41 CET 2016


---
 include/vlc_playlist.h                       |  3 ++-
 src/playlist/sort.c                          | 14 +++++++++++++-
 3 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/include/vlc_playlist.h b/include/vlc_playlist.h
index 5fef490..742372c 100644
--- a/include/vlc_playlist.h
+++ b/include/vlc_playlist.h
@@ -186,7 +186,8 @@ struct playlist_t
     DEF( SORT_DESCRIPTION )\
     DEF( SORT_RATING )\
     DEF( SORT_URI )\
-    DEF( SORT_DISC_NUMBER )
+    DEF( SORT_DISC_NUMBER )\
+    DEF( SORT_DATE )

 #define DEF( s ) s,
 enum
diff --git a/src/playlist/sort.c b/src/playlist/sort.c
index 588bd35..68c15a5 100644
--- a/src/playlist/sort.c
+++ b/src/playlist/sort.c
@@ -226,6 +226,19 @@ SORTFN( SORT_ALBUM, first, second )
     return i_ret;
 }

+SORTFN( SORT_DATE, first, second )
+{
+    int i_ret = meta_sort( first, second, vlc_meta_Date, true );
+    /* Items came from the same date: compare the albums */
+    if( i_ret == 0 )
+        i_ret = meta_sort( first, second, vlc_meta_Album, false );
+    /* Items came from the same album: compare the track numbers */
+    if( i_ret == 0 )
+        i_ret = meta_sort( first, second, vlc_meta_TrackNumber, true );
+
+    return i_ret;
+}
+
 SORTFN( SORT_ARTIST, first, second )
 {
     int i_ret = meta_sort( first, second, vlc_meta_Artist, false );
@@ -361,4 +374,3 @@ static const sortfn_t sorting_fns[NUM_SORT_FNS][2] =
 #define DEF( a ) { cmp_a_##a, cmp_d_##a },
 { VLC_DEFINE_SORT_FUNCTIONS };
 #undef  DEF
-
--
2.7.4


More information about the vlc-devel mailing list