changeset 1519:9e7980b7abad

Actually read string-based metadata for tuplez.
author Tony Vroon <chainsaw@gentoo.org>
date Thu, 23 Aug 2007 23:19:11 +0100
parents abdb27a70322
children fc246407b2ad
files src/wav/wav-sndfile.c
diffstat 1 files changed, 10 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/wav/wav-sndfile.c	Thu Aug 23 18:26:44 2007 +0300
+++ b/src/wav/wav-sndfile.c	Thu Aug 23 23:19:11 2007 +0100
@@ -126,7 +126,16 @@
 
 	realfn = g_filename_from_uri(filename, NULL, NULL);
 	tmp_sndfile = sf_open (realfn ? realfn : filename, SFM_READ, &tmp_sfinfo);
-	tuple_associate_string(ti, "title", g_path_get_basename(realfn ? realfn : filename));
+	if ( sf_get_string(tmp_sndfile, SF_STR_TITLE) == NULL)
+		tuple_associate_string(ti, "title", g_path_get_basename(realfn ? realfn : filename));
+	else
+		tuple_associate_string(ti, "title", sf_get_string(tmp_sndfile, SF_STR_TITLE));
+
+	tuple_associate_string(ti, "artist", sf_get_string(tmp_sndfile, SF_STR_ARTIST));
+	tuple_associate_string(ti, "comment", sf_get_string(tmp_sndfile, SF_STR_COMMENT));
+	tuple_associate_string(ti, "date", sf_get_string(tmp_sndfile, SF_STR_DATE));
+	tuple_associate_string(ti, "software", sf_get_string(tmp_sndfile, SF_STR_SOFTWARE));
+
 	g_free(realfn); realfn = NULL;
 
 	if (!tmp_sndfile)
@@ -305,7 +314,6 @@
 {
 	Tuple *tuple;
 	gchar *title;
-	gchar *realfn = NULL;
 
 	tuple = tuple_new_from_filename(filename);
 	fill_song_tuple(filename, tuple);