changeset 308:1bf162c7b4b9 trunk

[svn] - cuesheet plugin improvements via hiro @ audacious boards
author nenolod
date Sat, 25 Nov 2006 19:48:27 -0800
parents 5648731be0fd
children b7aab7965968
files ChangeLog src/cue/cuesheet.c
diffstat 2 files changed, 32 insertions(+), 24 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Fri Nov 24 03:27:57 2006 -0800
+++ b/ChangeLog	Sat Nov 25 19:48:27 2006 -0800
@@ -1,3 +1,10 @@
+2006-11-24 11:27:57 +0000  Tony Vroon <chainsaw@gentoo.org>
+  revision [670]
+  Path saving functionality by TiCPU on #audacious. Whitespace fixed, again.
+  trunk/src/paranormal/cfg.c |   14 +++++++++++++-
+  1 file changed, 13 insertions(+), 1 deletion(-)
+
+
 2006-11-24 04:20:01 +0000  William Pitcock <nenolod@nenolod.net>
   revision [668]
   - pluginize the transport layer.
--- a/src/cue/cuesheet.c	Fri Nov 24 03:27:57 2006 -0800
+++ b/src/cue/cuesheet.c	Sat Nov 25 19:48:27 2006 -0800
@@ -23,6 +23,7 @@
 #include <audacious/output.h>
 #include <audacious/playlist.h>
 #include <audacious/vfs.h>
+#include <audacious/util.h>
 
 #define MAX_CUE_LINE_LENGTH 1000
 #define MAX_CUE_TRACKS 1000
@@ -126,7 +127,10 @@
 
 static gint get_time(void)
 {
-	return cue_ip.output->output_time();
+	if (real_ip)
+		return real_ip->get_time();
+
+	return -1;
 }
 
 static void play(gchar *uri)
@@ -164,6 +168,8 @@
         gchar *path2 = g_strdup(uri + 6);
         gchar *_path = strchr(path2, '?');
 	gint track = 0;
+	gint file_length = 0;
+
 	InputPlugin *dec;
 	TitleInput *phys_tuple, *out;
 
@@ -184,7 +190,10 @@
 	if (dec == NULL)
 		return NULL;
 
-	phys_tuple = dec->get_song_tuple(cue_file);
+	if (dec->get_song_tuple)
+		phys_tuple = dec->get_song_tuple(cue_file);
+	else
+		phys_tuple = input_get_song_tuple(cue_file);
 
 	out = bmp_title_input_new();
 
@@ -294,6 +303,8 @@
 		real_ip->output = cue_ip.output;
 		real_ip->play_file(cue_file);
 		real_ip->seek(finetune_seek ? finetune_seek / 1000 : cue_tracks[track].index / 1000 + 1);
+		real_ip->get_song_info(cue_file, NULL, &file_length);
+		cue_tracks[last_cue_track].index = file_length;
 	}
 
 	finetune_seek = 0;
@@ -331,6 +342,9 @@
 	gint time = get_output_time();
 	gboolean dir = FALSE;
 
+	if (time == -1)
+		time = G_MAXINT;
+
 	while (time < cue_tracks[cur_cue_track].index)
 	{
 		cur_cue_track--;
@@ -399,17 +413,11 @@
 
 		if (strcasecmp(line+p, "PERFORMER") == 0) {
 			fix_cue_argument(line+q);
-			if (last_cue_track == 0) {
-				if (!g_utf8_validate(line + q, -1, NULL)) {
-					cue_performer = g_locale_to_utf8 (line + q, -1, NULL, NULL, NULL);
-				} else
-					cue_performer = g_strdup(line+q);
-			} else {
-				if (!g_utf8_validate(line + q, -1, NULL)) {
-					cue_tracks[last_cue_track-1].performer = g_locale_to_utf8 (line + q, -1, NULL, NULL, NULL);
-				} else
-					cue_tracks[last_cue_track-1].performer = g_strdup(line+q);
-			}
+
+			if (last_cue_track == 0)
+				cue_performer = str_to_utf8(line + q);
+			else
+				cue_tracks[last_cue_track - 1].performer = str_to_utf8(line + q);
 		}
 		else if (strcasecmp(line+p, "FILE") == 0) {
 			gchar *tmp = g_path_get_dirname(f);
@@ -419,17 +427,10 @@
 		}
 		else if (strcasecmp(line+p, "TITLE") == 0) {
 			fix_cue_argument(line+q);
-			if (last_cue_track == 0) {
-				if (!g_utf8_validate(line + q, -1, NULL)) {
-					cue_title = g_locale_to_utf8 (line + q, -1, NULL, NULL, NULL);
-				} else
-					cue_title = g_strdup(line+q);
-			} else {
-				if (!g_utf8_validate(line + q, -1, NULL)) {
-					cue_tracks[last_cue_track-1].title = g_locale_to_utf8 (line + q, -1, NULL, NULL, NULL);
-				} else
-					cue_tracks[last_cue_track-1].title = g_strdup(line+q);
-			}
+			if (last_cue_track == 0)
+				cue_title = str_to_utf8(line + q);
+			else
+				cue_tracks[last_cue_track-1].title = str_to_utf8(line + q);
 		}
 		else if (strcasecmp(line+p, "TRACK") == 0) {
 			gint track;