[vlc-devel] [PATCH 1/2] core: added sort by date (prepare for playlist fix)

Filip Roséen filip at atch.se
Thu Dec 8 00:23:18 CET 2016


Hi Marcel,

The `diff` in which this email is a reply to should be sent as
properly generated by `git format-patch`, to make it easier for
someone to merge it.

Please see the below links for further information:

  - [Git - git-format-patch Documentation](https://git-scm.com/docs/git-format-patch)
  - [Git - git-send-email Documentation](https://git-scm.com/docs/git-send-email)

In regards to the contents of the `diff`(s), it *LGTM*.

On 2016-11-30 21:37, Marcel Schnirring wrote:

> Applied recommendation by Filip Roséen and used return value.
> ---
>  include/vlc_playlist.h                       |  3 ++-
>  src/playlist/sort.c                          | 14 ++++++++++++--
>  2 files changed, 14 insertions(+), 3 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,12 +226,22 @@ 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 = proto_SORT_ALBUM( first, second );
> +
> +    return i_ret;
> +}
> +
>  SORTFN( SORT_ARTIST, first, second )
>  {
>      int i_ret = meta_sort( first, second, vlc_meta_Artist, false );
> -    /* Items came from the same artist: compare the albums */
> +    /* Items came from the same artist: compare the dates */
>      if( i_ret == 0 )
> -        i_ret = proto_SORT_ALBUM( first, second );
> +        i_ret = proto_SORT_DATE( first, second );
> 
>     return i_ret;
> }
> --
> 2.7.4
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20161208/9c5b70eb/attachment.html>


More information about the vlc-devel mailing list