I find it very annoying that xmms does not sort the files in directories according to filenames when added to the playlist. A possible fix: ------------------------------ CUT HERE ---------------------------------------- diff -urN xmms-1.2.7/xmms/playlist.c xmms-1.2.7-p1/xmms/playlist.c --- xmms-1.2.7/xmms/playlist.c 2003-06-19 19:49:47.000000000 +0200 +++ xmms-1.2.7-p1/xmms/playlist.c 2003-06-19 19:46:56.000000000 +0200 @@ -307,6 +307,17 @@ } } +static gint sort_dir_cmpfunc(const char * a_filename, const char * b_filename) +{ + if (strchr(a_filename, '/')) + a_filename = strrchr(a_filename, '/') + 1; + + if (strchr(b_filename,'/')) + b_filename = strrchr(b_filename, '/') + 1; + + return strcasecmp(a_filename, b_filename); +} + static guint playlist_ins_dir_real(gchar * path, glong pos) { DIR *dir; @@ -314,7 +325,7 @@ struct stat statbuf; gchar *temp; guint entries = 0; - GList *list; + GList *list, *node; if (path[strlen(path) - 1] != '/') temp = g_strconcat(path, "/", NULL); @@ -322,22 +333,7 @@ temp = g_strdup(path); if ((list = input_scan_dir(temp)) != NULL) - { - GList *node; - g_free(temp); - node = list; - while (node) - { - __playlist_ins(node->data, pos); - entries++; - if (pos >= 0) - pos++; - g_free(node->data); - node = g_list_next(node); - } - g_list_free(list); - return entries; - } + goto add_files; if ((dir = opendir(path)) == NULL) { @@ -354,8 +350,10 @@ filename = g_strconcat(temp, dirent->d_name, NULL); - if (stat(filename, &statbuf) < 0) - goto next; + if (stat(filename, &statbuf) < 0) { + g_free(filename); + continue; + } if (S_ISDIR(statbuf.st_mode)) { @@ -367,16 +365,25 @@ } else if (input_check_file(filename)) { - __playlist_ins(filename, pos); - entries++; - if (pos >= 0) - pos++; + list = g_list_append(list, filename); } - next: - g_free(filename); } closedir(dir); + +add_files: g_free(temp); + list = g_list_sort(list, (GCompareFunc) sort_dir_cmpfunc); + node = list; + while (node) + { + __playlist_ins(node->data, pos); + entries++; + if (pos >= 0) + pos++; + g_free(node->data); + node = g_list_next(node); + } + g_list_free(list); return entries; } ------------------------------ CUT HERE ---------------------------------------- I also have a complete package with patch/ebuild... but I don't know how to post that here.
Created attachment 13592 [details] patch+ebuild Enable PORTAGE_OVERLAY in /etc/make.conf Extract the tarball to /usr/local/portage cd /usr/local/portage/media-sound/xmms ebuild xmms-1.2.7-r22 digest emerge xmms-1.2.7-r22
Frederik - this is probably the kind of thing that needs to be sent upstream. You should probably send this patch to the xmms maintainers if you haven't done so already.
done
killing the ticket. it really does belong upstream.