changeset 1732:4bdb8621853e

- updated sid plugin to use subsong-num and subsong-id
author Giacomo Lozito <james@develia.org>
date Tue, 18 Sep 2007 19:13:12 +0200
parents 38375d565192
children e60cfd9e3d48
files src/sid/xmms-sid.c src/sid/xmms-sid.h src/sid/xs_init.c
diffstat 3 files changed, 18 insertions(+), 47 deletions(-) [+]
line wrap: on
line diff
--- a/src/sid/xmms-sid.c	Tue Sep 18 18:03:11 2007 +0200
+++ b/src/sid/xmms-sid.c	Tue Sep 18 19:13:12 2007 +0200
@@ -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;
 }
 
 
@@ -676,6 +633,7 @@
 	tuple_associate_string(pResult, FIELD_ARTIST, NULL, pInfo->sidComposer);
 	tuple_associate_string(pResult, FIELD_GENRE, NULL, "SID-tune");
 	tuple_associate_string(pResult, FIELD_COPYRIGHT, NULL, pInfo->sidCopyright);
+	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 +675,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 +712,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 18:03:11 2007 +0200
+++ b/src/sid/xmms-sid.h	Tue Sep 18 19:13:12 2007 +0200
@@ -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 18:03:11 2007 +0200
+++ b/src/sid/xs_init.c	Tue Sep 18 19:13:12 2007 +0200
@@ -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 };