changeset 1125:790c3a23eea2 trunk

[svn] - allow paths like /home/nenolod/moo/ff3/ff3.nsf?6 to play subsong 6 from ff3.nsf.
author nenolod
date Sat, 03 Jun 2006 11:13:29 -0700
parents a63e0fdb3d1e
children 537e8cc47060
files Plugins/Input/console/Audacious_Driver.cpp
diffstat 1 files changed, 28 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/Plugins/Input/console/Audacious_Driver.cpp	Fri Jun 02 09:58:51 2006 -0700
+++ b/Plugins/Input/console/Audacious_Driver.cpp	Sat Jun 03 11:13:29 2006 -0700
@@ -404,7 +404,7 @@
 	if ( g_str_has_suffix( path, ".gym" ) ) // to do: is pathname in unicode?
 		return type_gym;
 	// to do: trust suffix for all file types, avoiding having to look inside files?
-	
+
 	int result = type_none;
 	if ( !memcmp( tag, "SNES", 4 ) ) result = type_spc;
 	if ( !memcmp( tag, "NESM", 4 ) ) result = type_nsf;
@@ -419,6 +419,20 @@
 {
 	Audacious_Reader in;
 	tag_t tag;
+
+	printf("path: %s\n", path);
+
+	// extract the subsong id from the virtual path
+	gchar *_path = strchr(path, '?');
+
+	if (_path != NULL && *_path == '?')
+	{
+		*_path = '\0';
+		_path++;
+	}
+
+	printf("modified path: %s\n", path);
+
 	return !in.open( path ) && !in.read( tag, sizeof tag ) && identify_file( path, tag );
 }
 
@@ -573,6 +587,19 @@
 	unload_file();
 	Audacious_Reader in;
 	tag_t tag;
+
+	// extract the subsong id from the virtual path
+	gchar *_path = strchr(path, '?');
+
+	if (_path != NULL && *_path == '?')
+	{
+		*_path = '\0';
+		_path++;
+		track = atoi(_path);
+	}
+
+	printf("path: %s\nsubsong: %d\n", path, track);
+
 	if ( in.open( path ) || in.read( tag, sizeof tag ) )
 		return;
 	int type = identify_file( path, tag );