Package: xmms Version: 1.2.10-2 Severity: wishlist Tags: patch There's a patch for 1.2.7 to remove duplicate entries in the playlist at http://www.lehigh.edu/~tfc4/xmms-patch.html I adjusted the patch to cleanly apply to 1.2.10. Please apply it.
-- System Information: Debian Release: 3.1 APT prefers unstable APT policy: (500, 'unstable') Architecture: i386 (i686) Kernel: Linux 2.4.27 Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968) Versions of packages xmms depends on: ii libc6 2.3.2.ds1-20 GNU C Library: Shared libraries an ii libglib1.2 1.2.10-9 The GLib library of C routines ii libgtk1.2 1.2.10-17 The GIMP Toolkit set of widgets fo ii libice6 4.3.0.dfsg.1-12.0.1 Inter-Client Exchange library ii libsm6 4.3.0.dfsg.1-12.0.1 X Window System Session Management ii libx11-6 4.3.0.dfsg.1-12.0.1 X Window System protocol client li ii libxext6 4.3.0.dfsg.1-12.0.1 X Window System miscellaneous exte ii libxi6 4.3.0.dfsg.1-12.0.1 X Window System Input extension li ii xlibs 4.3.0.dfsg.1-12 X Keyboard Extension (XKB) configu -- no debconf information
diff -u -r -i xmms-1.2.10-orig/xmms/playlist.c xmms-1.2.10/xmms/playlist.c --- xmms-1.2.10-orig/xmms/playlist.c 2004-02-23 21:31:43.000000000 +0100 +++ xmms-1.2.10/xmms/playlist.c 2005-03-05 00:52:50.000000000 +0100 @@ -1949,6 +1949,72 @@ } } +void playlistwin_remove_dups() +{ + GList *node, *next_node, *curr_pos, *temp, *next_temp; + PlaylistEntry *entry, *temp_entry; + gboolean list_changed = FALSE; + + PL_LOCK(); + node = playlist; + while (node) + { + /* A dead file is a file that is not readable. */ + entry = (PlaylistEntry *) node->data; + + temp = g_list_next(node); + while(temp) + { + next_temp = g_list_next(temp); + temp_entry = (PlaylistEntry *) temp->data; + + /* Is this a duplicate filename entry? */ + if (entry && temp_entry + && entry!=temp_entry + && strcmp(entry->filename, temp_entry->filename)==0) + { + list_changed = TRUE; + curr_pos = g_list_find(playlist, playlist_position); + if (temp == curr_pos) + { + if (get_input_playing()) + { + /* Don't remove the currently + playing song */ + temp = next_temp; + continue; + } + if (g_list_next(curr_pos)) + playlist_position = curr_pos->next->data; + else if (g_list_previous(curr_pos)) + playlist_position = curr_pos->prev->data; + else if (temp != playlist) + playlist_position = playlist->data; + else + playlist_position = NULL; + } + + playlist = g_list_remove_link(playlist, temp); + g_free(temp_entry->title); + g_free(temp_entry->filename); + g_free(temp->data); + g_list_free_1(temp); + } + temp = next_temp; + } + next_node = g_list_next(node); + node = next_node; + } + PL_UNLOCK(); + + if (list_changed) + { + playlist_generate_shuffle_list(); + playlistwin_update_list(); + } + +} + void playlist_get_total_time(gulong *total_time, gulong *selection_time, gboolean *total_more, gboolean *selection_more) { GList *list; diff -u -r -i xmms-1.2.10-orig/xmms/playlist.h xmms-1.2.10/xmms/playlist.h --- xmms-1.2.10-orig/xmms/playlist.h 2004-01-17 01:22:17.000000000 +0100 +++ xmms-1.2.10/xmms/playlist.h 2005-03-05 00:52:48.000000000 +0100 @@ -74,6 +74,7 @@ void playlist_reverse(void); void playlist_random(void); void playlist_remove_dead_files(void); +void playlist_remove_dups(void); void playlist_fileinfo_current(void); void playlist_fileinfo(gint pos); void playlist_delete_index(glong index); diff -u -r -i xmms-1.2.10-orig/xmms/playlistwin.c xmms-1.2.10/xmms/playlistwin.c --- xmms-1.2.10-orig/xmms/playlistwin.c 2004-02-23 21:31:43.000000000 +0100 +++ xmms-1.2.10/xmms/playlistwin.c 2005-03-05 00:52:51.000000000 +0100 @@ -137,13 +137,14 @@ enum { - PLAYLISTWIN_REMOVE_DEAD_FILES, PLAYLISTWIN_PHYSICALLY_DELETE + PLAYLISTWIN_REMOVE_DEAD_FILES, PLAYLISTWIN_PHYSICALLY_DELETE, PLAYLISTWIN_REMOVE_DUPS }; GtkItemFactoryEntry playlistwin_sub_menu_entries[] = { {N_("/Remove Dead Files"), NULL, playlistwin_sub_menu_callback, PLAYLISTWIN_REMOVE_DEAD_FILES, "<Item>"}, {N_("/Physically Delete Files"), NULL, playlistwin_sub_menu_callback, PLAYLISTWIN_PHYSICALLY_DELETE, "<Item>"}, + {N_("/Remove Duplicate Files"), NULL, playlistwin_sub_menu_callback, PLAYLISTWIN_REMOVE_DUPS, "<Item>"}, }; static const int playlistwin_sub_menu_entries_num = @@ -1791,6 +1792,9 @@ case PLAYLISTWIN_PHYSICALLY_DELETE: playlistwin_physically_delete(); break; + case PLAYLISTWIN_REMOVE_DUPS: + playlistwin_remove_dups(); + break; } }