diff options
Diffstat (limited to '')
-rw-r--r-- | src/mpdclient.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/mpdclient.c b/src/mpdclient.c index b13146f38..98743a35d 100644 --- a/src/mpdclient.c +++ b/src/mpdclient.c @@ -30,6 +30,7 @@ #include "support.h" #include "mpdclient.h" #include "options.h" +#include "strfsong.h" #undef ENABLE_FANCY_PLAYLIST_MANAGMENT_CMD_ADD /* broken with song id's */ #define ENABLE_FANCY_PLAYLIST_MANAGMENT_CMD_DELETE @@ -37,6 +38,8 @@ #define ENABLE_SONG_ID #define ENABLE_PLCHANGES +#define BUFSIZE 1024 + #define MPD_ERROR(c) (c==NULL || c->connection==NULL || c->connection->error) /* from utils.c */ @@ -66,6 +69,27 @@ compare_filelistentry_dir(gconstpointer filelist_entry1, gconstpointer filelist_ return n; } +/* sort by list-format */ +gint +compare_filelistentry_format(gconstpointer filelist_entry1, gconstpointer filelist_entry2) +{ + mpd_InfoEntity *e1, *e2; + char key1[BUFSIZE], key2[BUFSIZE]; + int n = 0; + + e1 = ((filelist_entry_t *)filelist_entry1)->entity; + e2 = ((filelist_entry_t *)filelist_entry2)->entity; + if (e1 && e2 && + e1->type == MPD_INFO_ENTITY_TYPE_SONG && + e2->type == MPD_INFO_ENTITY_TYPE_SONG) + { + strfsong(key1, BUFSIZE, LIST_FORMAT, e1->info.song); + strfsong(key2, BUFSIZE, LIST_FORMAT, e2->info.song); + n = strcmp(key1,key2); + } + return n; +} + /* Error callbacks */ static gint |