Hi all
First, thanks for a great little application which I found works well.
Since all my playlists are listed in random order in the selection, I've
attached a small patch that sorts them alphabetically in spl_list(). It
was suggest on IRC that I use a g_ptr function to sort the list once
it's been retrieved from disk but since I am currently (pending CentOS
6) unable to get mpd to compile, I had to compose this patch and test it
separately. I believe it should work but it is untested as part of mpd
itself. My version uses scandir() to return the list in alpha order to
start with. If this is not acceptable then I'll resubmit once CentOS 6
hits the streets and I can get the various toolsets installed that mpd
requires :-(
Thanks.
--- src/stored_playlist.orig 2011-04-18 20:59:40.000000000 +0100
+++ src/stored_playlist.c 2011-04-18 23:46:24.000000000 +0100
@@ -109,27 +109,28 @@
spl_list(void)
{
const char *parent_path_fs = map_spl_path();
- DIR *dir;
- struct dirent *ent;
+ int entries, n;
+ struct dirent **ent;
GPtrArray *list;
struct stored_playlist_info *playlist;
if (parent_path_fs == NULL)
return NULL;
- dir = opendir(parent_path_fs);
- if (dir == NULL)
+ entries = scandir(parent_path_fs, &ent, 0, alphasort);
+ if (entries < 0)
return NULL;
list = g_ptr_array_new();
- while ((ent = readdir(dir)) != NULL) {
- playlist = load_playlist_info(parent_path_fs, ent->d_name);
+ for (n = 0; n < entries; n++) {
+ playlist = load_playlist_info(parent_path_fs, ent[n]->d_name);
+ free(ent[n]);
if (playlist != NULL)
g_ptr_array_add(list, playlist);
}
+ free(ent);
- closedir(dir);
return list;
}
------------------------------------------------------------------------------
Benefiting from Server Virtualization: Beyond Initial Workload
Consolidation -- Increasing the use of server virtualization is a top
priority.Virtualization can reduce costs, simplify management, and improve
application availability and disaster protection. Learn more about boosting
the value of server virtualization. http://p.sf.net/sfu/vmware-sfdev2dev
_______________________________________________
Musicpd-dev-team mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/musicpd-dev-team