changeset 1242:0f89ebbf890a trunk

[svn] - get_song_tuple() implementation (scrobblerific!)
author nenolod
date Wed, 14 Jun 2006 23:19:56 -0700
parents 924181beaa91
children 7c765d74d643
files ChangeLog Plugins/Input/console/Audacious_Driver.cpp
diffstat 2 files changed, 57 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Wed Jun 14 23:08:51 2006 -0700
+++ b/ChangeLog	Wed Jun 14 23:19:56 2006 -0700
@@ -1,3 +1,14 @@
+2006-06-15 06:08:51 +0000  William Pitcock <nenolod@nenolod.net>
+  revision [1396]
+  - flac_get_tuple()
+  
+
+  Changes:        Modified:
+  +2 -1           trunk/Plugins/Input/flac/plugin.c  
+  +14 -20         trunk/Plugins/Input/flac/tag.c  
+  +1 -0           trunk/Plugins/Input/flac/tag.h  
+
+
 2006-06-15 06:01:39 +0000  William Pitcock <nenolod@nenolod.net>
   revision [1394]
   - some fixes
--- a/Plugins/Input/console/Audacious_Driver.cpp	Wed Jun 14 23:08:51 2006 -0700
+++ b/Plugins/Input/console/Audacious_Driver.cpp	Wed Jun 14 23:19:56 2006 -0700
@@ -507,6 +507,50 @@
 	g_free(path2);
 }
 
+// Get tuple
+
+static TitleInput *get_song_tuple( char *path )
+{
+	int track = 0; // to do: way to select other tracks
+	
+	// extract the subsong id from the virtual path
+	gchar *path2 = g_strdup(path);
+	gchar *_path = strchr(path2, '?');
+
+	if (_path != NULL && *_path == '?')
+	{
+		*_path = '\0';
+		_path++;
+		track = atoi(_path);
+	}	
+
+	Audacious_Reader in;
+	tag_t tag;
+	if ( in.open( path2 ) || in.read( tag, sizeof tag ) )
+		return NULL;
+	
+	int type = identify_file( path2, tag );
+	if ( !type )
+		return NULL;
+	
+	track_info_t info;
+	if ( begin_get_info( path2, &info ) )
+		return NULL;
+	info.track = track;
+	
+	switch ( type )
+	{
+		case type_nsf: get_info_t( tag, in, &info, (Nsf_Emu::header_t*) 0 ); break;
+		case type_gbs: get_info_t( tag, in, &info, (Gbs_Emu::header_t*) 0 ); break;
+		case type_gym: get_info_t( tag, in, &info, (Gym_Emu::header_t*) 0 ); break;
+		case type_vgm: get_info_t( tag, in, &info, (Vgm_Emu::header_t*) 0 ); break;
+		case type_spc: get_info_t( tag, in, &info, (Spc_Emu::header_t*) 0 ); break;
+		case type_nsfe:get_info_t( tag, in, &info, (Nsfe_Emu::header_t*)0 ); break;
+	}
+
+	return info.ti;
+}
+
 // Playback
 
 static void* play_loop_track( gpointer )
@@ -812,7 +856,8 @@
 	NULL,
 	get_song_info,
 	NULL,
-	NULL
+	NULL,
+	get_song_tuple,
 };
 
 extern "C" InputPlugin *get_iplugin_info(void)