changeset 859:df6712e1959d trunk

[svn] - Also determine a change by track name, patch by nixphoeni.
author nenolod
date Tue, 21 Mar 2006 09:22:14 -0800
parents 66df1cf8b82f
children ee25017cb472
files Plugins/General/song_change/song_change.c
diffstat 1 files changed, 12 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/Plugins/General/song_change/song_change.c	Mon Mar 20 10:57:25 2006 -0800
+++ b/Plugins/General/song_change/song_change.c	Tue Mar 21 09:22:14 2006 -0800
@@ -494,25 +494,34 @@
 	int pos;
 	gboolean playing;
 	static char *previous_file = NULL;
+	static char *previous_track = NULL;
 	static gboolean cmd_after_already_run = FALSE;
 	char *current_file;
+	char *current_track;
 
 	GDK_THREADS_ENTER();
 
 	playing = xmms_remote_is_playing(sc_gp.xmms_session);
 	pos = xmms_remote_get_playlist_pos(sc_gp.xmms_session);
 	current_file = xmms_remote_get_playlist_file(sc_gp.xmms_session, pos);
+	current_track = xmms_remote_get_playlist_title(sc_gp.xmms_session, pos);
 	
 	if ((pos != previous_song ||
 	     (!previous_file && current_file) ||
 	     (previous_file && !current_file) ||
 	     (previous_file && current_file &&
-	      strcmp(previous_file, current_file))) &&
+	      strcmp(previous_file, current_file)) ||
+	     (!previous_track && current_track) ||
+	     (previous_track && !current_track) ||
+	     (previous_track && current_track &&
+	      strcmp(previous_track, current_track))) &&
 	    xmms_remote_get_output_time(sc_gp.xmms_session) > 0)
 	{
 		do_command(cmd_line, current_file, pos);
 		g_free(previous_file);
+		g_free(previous_track);
 		previous_file = g_strdup(current_file);
+		previous_track = g_strdup(current_track);
 		previous_song = pos;
 		cmd_after_already_run = FALSE;
 	}
@@ -538,7 +547,9 @@
 			do_command(cmd_line_end, current_file, pos);
 		possible_pl_end = FALSE;
 		g_free(previous_file);
+		g_free(previous_track);
 		previous_file = NULL;
+		previous_track = NULL;
 	}
 
 	g_free(current_file);