changeset 1736:35f8a5fbd1b6

Automated merge with ssh://hg.atheme.org//hg/audacious-plugins
author William Pitcock <nenolod@atheme.org>
date Tue, 18 Sep 2007 19:39:41 -0500
parents f0b53c4db5ba (current diff) 5e47a0c1b969 (diff)
children b729c7a72c20 3572d3444a7c 29d0e4435e0e
files
diffstat 4 files changed, 40 insertions(+), 50 deletions(-) [+]
line wrap: on
line diff
--- a/src/console/Audacious_Driver.cxx	Tue Sep 18 19:39:35 2007 -0500
+++ b/src/console/Audacious_Driver.cxx	Tue Sep 18 19:39:41 2007 -0500
@@ -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 };
--- a/src/sid/xmms-sid.c	Tue Sep 18 19:39:35 2007 -0500
+++ b/src/sid/xmms-sid.c	Tue Sep 18 19:39:41 2007 -0500
@@ -304,59 +304,16 @@
 
 gint xs_is_our_file_vfs(gchar *pcFilename, t_xs_file *f)
 {
-	gint tmpResult = 0, tmpDummy = 0;
 	assert(xs_status.sidPlayer);
 
 	/* Check the filename */
 	if (pcFilename == NULL)
 		return 0;
-
-#ifdef LULZ
-	/* FIXME! ATTENTION! Subtune addition is now temporarily disabled
-	 * again, due to following reason: the way it currently is "supposed"
-	 * to be done is horribly broken and causes an "infinite recursive
-	 * addition loop" in some cases. - ccr
-	 */
-	if (xs_has_tracknumber(pcFilename) != NULL)
+	
+	if (xs_status.sidPlayer->plrProbe(f))
 		return 1;
-#endif
-	
-	if (xs_status.sidPlayer->plrProbe(f)) {
-#ifdef LULZ
-		t_xs_tuneinfo *pInfo;
-		
-		pInfo = xs_status.sidPlayer->plrGetSIDInfo(pcFilename);
-		
-		if (pInfo->nsubTunes > 1) {
-			gint i;
-			for (i = 1; i <= pInfo->nsubTunes; i++) {
-				gchar *tmpStr = g_strdup_printf("%s?%d", pcFilename, i);
-				gboolean doAdd = FALSE;
-					
-				if (xs_cfg.subAutoMinOnly) {
-					if (i == pInfo->startTune ||
-						pInfo->subTunes[i - 1].tuneLength >= xs_cfg.subAutoMinTime)
-						doAdd = TRUE;
-				} else
-					doAdd = TRUE;
-					
-				if (doAdd)
-					playlist_add_url(playlist_get_active(), tmpStr);
-
-				g_free(tmpStr);
-			}
-
-			tmpResult = -1;
-		} else
-			tmpResult = 1;
-			
-		xs_tuneinfo_free(pInfo);
-#else
-		tmpResult = 1;
-#endif
-	}
-		
-	return tmpResult;
+	else
+		return 0;
 }
 
 
@@ -677,6 +634,9 @@
 	tuple_associate_string(pResult, FIELD_GENRE, NULL, "SID-tune");
 	tuple_associate_string(pResult, FIELD_COPYRIGHT, NULL, pInfo->sidCopyright);
 
+	if (xs_cfg.subAutoEnable)
+		tuple_associate_int(pResult, FIELD_SUBSONG_NUM, NULL, pInfo->nsubTunes);
+
 	tuple_associate_int(pResult, -1, "subtunes", pInfo->nsubTunes);
 	tuple_associate_string(pResult, -1, "sid-format", pInfo->sidFormat);
 
@@ -717,6 +677,7 @@
 		subTune = 1;
 
 	tuple_associate_int(pResult, -1, "subtune", subTune);
+	tuple_associate_int(pResult, FIELD_SUBSONG_ID, NULL, subTune);
 	tuple_associate_int(pResult, FIELD_TRACK_NUMBER, NULL, subTune);
 
 	if (xs_cfg.titleOverride)
@@ -753,3 +714,13 @@
 
 	return tmpResult;
 }
+
+Tuple *xs_probe_for_tuple(gchar *filename, t_xs_file *fd)
+{
+    if (!xs_is_our_file_vfs(filename, fd))
+        return NULL;
+
+    vfs_rewind(fd);
+
+    return xs_get_song_tuple(filename);
+}
--- a/src/sid/xmms-sid.h	Tue Sep 18 19:39:35 2007 -0500
+++ b/src/sid/xmms-sid.h	Tue Sep 18 19:39:41 2007 -0500
@@ -178,6 +178,7 @@
 void	xs_seek(InputPlayback *, gint);
 gint	xs_get_time(InputPlayback *);
 Tuple *	xs_get_song_tuple(gchar *);
+Tuple *	xs_probe_for_tuple(gchar *, t_xs_file *);
 void	xs_about(void);
 
 void	xs_error(const char *, ...);
--- a/src/sid/xs_init.c	Tue Sep 18 19:39:35 2007 -0500
+++ b/src/sid/xs_init.c	Tue Sep 18 19:39:41 2007 -0500
@@ -46,6 +46,7 @@
 	.is_our_file = xs_is_our_file,			/* Check file */
 	.is_our_file_from_vfs = xs_is_our_file_vfs,	/* VFS */
 	.vfs_extensions = xs_sid_fmts,			/* File ext assist */
+	.probe_for_tuple = xs_probe_for_tuple
 };
 
 static InputPlugin *sid_iplist[] = { &xs_plugin_ip, NULL };