changeset 1341:4ca99d2be90e

Titles are now built using tuples, with the preferred format
author Calin Crisan ccrisan@gmail.com
date Tue, 24 Jul 2007 00:48:58 +0300
parents 7bb2692b3be9
children ebded68de2dd
files src/cdaudio-ng/Makefile src/cdaudio-ng/cdaudio-ng.c
diffstat 2 files changed, 14 insertions(+), 25 deletions(-) [+]
line wrap: on
line diff
--- a/src/cdaudio-ng/Makefile	Mon Jul 23 21:59:13 2007 +0300
+++ b/src/cdaudio-ng/Makefile	Tue Jul 24 00:48:58 2007 +0300
@@ -10,6 +10,6 @@
 
 OBJECTS = ${SOURCES:.c=.o}
 
-CFLAGS += $(PICFLAGS) $(GTK_CFLAGS) $(GLIB_CFLAGS) $(PANGO_CFLAGS) $(CDIO_CFLAGS) $(CDDB_CFLAGS) -I../../intl -I../.. -Wall -g3 -ggdb
+CFLAGS += $(PICFLAGS) $(GTK_CFLAGS) $(GLIB_CFLAGS) $(PANGO_CFLAGS) $(CDIO_CFLAGS) $(CDDB_CFLAGS) -I../../intl -I../..
 
 include ../../mk/objective.mk
--- a/src/cdaudio-ng/cdaudio-ng.c	Mon Jul 23 21:59:13 2007 +0300
+++ b/src/cdaudio-ng/cdaudio-ng.c	Tue Jul 24 00:48:58 2007 +0300
@@ -66,6 +66,7 @@
 static void				cdaudio_get_song_info(gchar *filename, gchar **title, gint *length);
 static TitleInput		*cdaudio_get_song_tuple(gchar *filename);
 
+static TitleInput		*create_tuple_from_trackinfo(char *filename);
 static void				*dae_playing_thread_core(dae_params_t *pdae_params);
 static int				calculate_track_length(int startlsn, int endlsn);
 static int				find_trackno_from_filename(char *filename);
@@ -499,17 +500,10 @@
 		}
 	}
 
-	char title[DEF_STRING_LEN];
-
-	if (strlen(trackinfo[trackno].performer) > 0) {
-		strcpy(title, trackinfo[trackno].performer);
-		strcat(title, " - ");
-	}
-	else
-		strcpy(title, "");
-	strcat(title, trackinfo[trackno].name);
+	char *title = xmms_get_titlestring(xmms_get_gentitle_format(), create_tuple_from_trackinfo(pinputplayback->filename));
 
 	inputplugin.set_info(title, calculate_track_length(trackinfo[trackno].startlsn, trackinfo[trackno].endlsn), 128000, 44100, 2);
+	free(title);
 }
 
 void cdaudio_stop(InputPlayback *pinputplayback)
@@ -709,17 +703,8 @@
 		printf("cdaudio-ng: cdaudio_get_song_info(\"%s\")\n", filename);
 
 	int trackno = find_trackno_from_filename(filename);
-	char *thetitle = (char *) malloc(DEF_STRING_LEN);
 
-	if (strlen(trackinfo[trackno].performer) > 0) {
-		strcpy(thetitle, trackinfo[trackno].performer);
-		strcat(thetitle, " - ");
-	}
-	else
-		strcpy(thetitle, "");
-	strcat(thetitle, trackinfo[trackno].name);
-
-	*title = thetitle;
+	*title = xmms_get_titlestring(xmms_get_gentitle_format(), create_tuple_from_trackinfo(filename));
 	*length = calculate_track_length(trackinfo[trackno].startlsn, trackinfo[trackno].endlsn);
 }
 
@@ -728,10 +713,17 @@
 	if (debug)
 		printf("cdaudio-ng: cdaudio_get_song_tuple(\"%s\")\n", filename);
 
-	TitleInput *tuple = bmp_title_input_new();
+	return create_tuple_from_trackinfo(filename);
+}
+
+
+	/* auxiliar functions */
 
-		/* return information about the requested track */
+TitleInput *create_tuple_from_trackinfo(char *filename)
+{
+	TitleInput *tuple = bmp_title_input_new();
 	int trackno = find_trackno_from_filename(filename);
+
 	if (trackno < firsttrackno || trackno > lasttrackno)
 		return NULL;
 
@@ -749,9 +741,6 @@
 	return tuple;
 }
 
-
-	/* auxiliar functions */
-
 void *dae_playing_thread_core(dae_params_t *pdae_params)
 {
 	unsigned char *buffer = (unsigned char *) malloc(CDDA_DAE_FRAMES * CDIO_CD_FRAMESIZE_RAW);