changeset 1734:5e47a0c1b969

- updated libconsole plugin subtune code
author Giacomo Lozito <james@develia.org>
date Wed, 19 Sep 2007 02:25:05 +0200
parents e60cfd9e3d48
children 35f8a5fbd1b6
files src/console/Audacious_Driver.cxx
diffstat 1 files changed, 20 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/console/Audacious_Driver.cxx	Wed Sep 19 01:03:24 2007 +0200
+++ b/src/console/Audacious_Driver.cxx	Wed Sep 19 02:25:05 2007 +0200
@@ -110,7 +110,7 @@
 		*args = '\0';
 		// TODO: use func with better error reporting, and perhaps don't
 		// truncate path if there is no number after ?
-		track = atoi( args + 1 );
+		track = atoi( args + 1 ) - 1;
 		track_specified = true;
 	}
 
@@ -217,7 +217,9 @@
 		if ( info.track_count > 1 )
 		{
 			tuple_associate_int(ti, FIELD_TRACK_NUMBER, NULL, track + 1);
-			tuple_associate_int(ti, -1, "subsong", track);
+			tuple_associate_int(ti, -1, "subsong", track + 1);
+			tuple_associate_int(ti, FIELD_SUBSONG_ID, NULL, track + 1);
+			tuple_associate_int(ti, FIELD_SUBSONG_NUM, NULL, info.track_count);
 		}
 		tuple_associate_string(ti, FIELD_COPYRIGHT, NULL, info.copyright);
 		tuple_associate_string(ti, -1, "console", info.system);
@@ -444,6 +446,8 @@
 	File_Handler fh( path, fd, TRUE );
 	if ( fh.type )
 	{
+		result = 1;
+		/*
 		if ( fh.track_specified || fh.type->track_count == 1 )
 		{
 			// don't even need to read file if track is specified or
@@ -470,6 +474,7 @@
 				result = -1;
 			}
 		}
+		*/
 	}
 	else if (fh.track_specified)
 	{
@@ -479,6 +484,16 @@
 	return result;
 }
 
+static Tuple *probe_for_tuple(gchar *filename, VFSFile *fd)
+{
+	if (!is_our_file_from_vfs(filename, fd))
+		return NULL;
+
+	vfs_rewind(fd);
+
+	return get_song_tuple(filename);
+}
+
 // Setup
 
 static void console_init(void)
@@ -538,7 +553,9 @@
 	NULL,
 	NULL,
 	is_our_file_from_vfs,
-	(gchar **)gme_fmts
+	(gchar **)gme_fmts,
+	NULL,
+	probe_for_tuple
 };
 
 InputPlugin *console_iplist[] = { &console_ip, NULL };