changeset 1430:bf7d4c236d9f

Start using tuple_new_from_filename.
author Tony Vroon <chainsaw@gentoo.org>
date Fri, 10 Aug 2007 13:49:59 +0100
parents 138ea47220e8
children 6b1f888a4c52
files src/wav/wav-sndfile.c src/wav/wav-sndfile.h src/wav/wav.c src/wma/wma.c
diffstat 4 files changed, 16 insertions(+), 38 deletions(-) [+]
line wrap: on
line diff
--- a/src/wav/wav-sndfile.c	Fri Aug 10 13:16:57 2007 +0100
+++ b/src/wav/wav-sndfile.c	Fri Aug 10 13:49:59 2007 +0100
@@ -37,10 +37,12 @@
 #include <math.h>
 #include <stdio.h>
 
-#include <audacious/plugin.h>
-#include <audacious/util.h>
-#include <audacious/titlestring.h>
-#include <audacious/i18n.h>
+#include "audacious/plugin.h"
+#include "audacious/util.h"
+#include "audacious/i18n.h"
+#include "audacious/main.h"
+#include "audacious/tuple.h"
+#include "audacious/tuple_formatter.h"
 #include "audacious/output.h"
 #include "wav-sndfile.h"
 
@@ -328,19 +330,15 @@
 	(*title) = get_title(filename);
 }
 
-static TitleInput*
+static Tuple*
 get_song_tuple (gchar *filename)
 {
-	gchar *realfn = NULL; 
-	TitleInput *tuple = bmp_title_input_new();
+	Tuple *ti = tuple_new_from_filename(filename);
+	tuple_associate_string(ti, "codec", "libsndfile");
+	tuple_associate_string(ti, "quality", "lossless");
+	tuple_associate_int(ti, "length", get_song_length(filename));
 
-        realfn = g_filename_from_uri(filename, NULL, NULL);
-        tuple->file_name = g_path_get_basename(realfn ? realfn : filename);
-        tuple->file_path = g_path_get_dirname(realfn ? realfn : filename); 
-	tuple->length = get_song_length(filename);
-        g_free(realfn); realfn = NULL;
-
-	return tuple;
+	return ti;
 }
 
 static void wav_about(void)
--- a/src/wav/wav-sndfile.h	Fri Aug 10 13:16:57 2007 +0100
+++ b/src/wav/wav-sndfile.h	Fri Aug 10 13:49:59 2007 +0100
@@ -31,7 +31,7 @@
 static	void 	play_stop (InputPlayback *playback);
 static	void 	file_seek (InputPlayback *playback, int time);
 static	void 	get_song_info (char *filename, char **title, int *length);
-static	TitleInput* get_song_tuple (gchar *filename);
+static	Tuple*  get_song_tuple (gchar *filename);
 static  void    wav_about (void);
 static	void	play_pause (InputPlayback *playback, gshort p);
 static  void file_mseek (InputPlayback *playback, gulong millisecond);
--- a/src/wav/wav.c	Fri Aug 10 13:16:57 2007 +0100
+++ b/src/wav/wav.c	Fri Aug 10 13:49:59 2007 +0100
@@ -210,17 +210,7 @@
     gchar *title;
     gchar *scratch;
 
-    tuple = tuple_new();
-
-    scratch = g_path_get_basename(filename);
-    tuple_associate_string(tuple, "file-name", scratch);
-    g_free(scratch);
-
-    tuple_associate_string(tuple, "file-ext", get_extension(filename));
-
-    scratch = g_path_get_dirname(filename);
-    tuple_associate_string(tuple, "file-path", scratch);
-    g_free(scratch);
+    tuple = tuple_new_from_filename(filename);
 
     tuple_associate_string(tuple, "codec", "RIFF/WAV Audio (ADPCM)");
     tuple_associate_string(tuple, "quality", "lossless");
--- a/src/wma/wma.c	Fri Aug 10 13:16:57 2007 +0100
+++ b/src/wma/wma.c	Fri Aug 10 13:49:59 2007 +0100
@@ -245,22 +245,12 @@
 
 static Tuple *wma_get_song_tuple(gchar * filename)
 {
-    Tuple *ti = tuple_new();
+    Tuple *ti = tuple_new_from_filename(filename);
     AVFormatContext *in = NULL;
-    gchar *scratch;
 
     if (av_open_input_file(&in, str_twenty_to_space(filename), NULL, 0, NULL) < 0)
 	return NULL;
 
-    scratch = g_path_get_basename(filename);
-    tuple_associate_string(ti, "file-name", scratch);
-    g_free(scratch);
-
-    scratch = g_path_get_dirname(filename);
-    tuple_associate_string(ti, "file-path", scratch);
-    g_free(scratch);
-
-    tuple_associate_string(ti, "file-ext", extname(filename));
     tuple_associate_string(ti, "codec", "Windows Media Audio (WMA)");
     tuple_associate_string(ti, "quality", "lossy");
 
@@ -285,7 +275,7 @@
 
     av_close_input_file(in);
 
-    return tuple;
+    return ti;
 }
 
 static gchar *get_song_title(AVFormatContext *in, gchar * filename)