small xmms patch

Federico Grau <[email protected]>
Newsgroups gmane.comp.multimedia.xmms.devel
Message-ID <[email protected]>
Hello,

Attached is a small patch (against the current cvs) to add two simple new
command line options to cvs.  "-S" or "--shuffle" will toggle the shuffle
option from the command line and "-l" or "--list" will print the current song
to stdout.

I find them useful.  Can they be added to the official xmms tree?

thank you,
donfede

ps.  It was not clear to me from the web-page, the faq, or the source README
where the right place is to send patches.

-- 
DON'T ATTACK IRAQ!  http://www.votenowar.org/   http://www.stopwar.org.uk/
xmms_list_shuffle.patch (text/plain, 2.3 KB)
Index: xmms/main.c
===================================================================
RCS file: /cvs/xmms/xmms/main.c,v
retrieving revision 1.128
diff -u -r1.128 main.c
--- xmms/main.c	27 Oct 2002 18:33:54 -0000	1.128
+++ xmms/main.c	11 Nov 2002 05:22:44 -0000
@@ -3125,6 +3125,8 @@
 	{"enqueue", 0, NULL, 'e'},
 	{"show-main-window", 0, NULL, 'm'},
 	{"version", 0, NULL, 'v'},
+	{"list", 0, NULL, 'l'},
+	{"shuffle", 0, NULL, 'S'},
 	{0, 0, 0, 0}
 };
 
@@ -3139,6 +3141,12 @@
 	fprintf(stderr, "\n-n, --session		");
 	/* -n, --session switch */
 	fprintf(stderr, _("Select XMMS session (Default: 0)"));
+	fprintf(stderr, "\n-l, --list		");
+	/* -l, --list switch */
+	fprintf(stderr, _("List current song info"));
+	fprintf(stderr, "\n-S, --shuffle		");
+	/* -S, --shuffle switch */
+	fprintf(stderr, _("Togle playlist shuffle setting"));
 	fprintf(stderr, "\n-r, --rew		");
 	/* -r, --rew switch */
 	fprintf(stderr, _("Skip backwards in playlist"));
@@ -3173,7 +3181,7 @@
 struct cmdlineopt {
 	GList *filenames;
 	gint session;
-	gboolean play, stop, pause, fwd, rew, play_pause;
+	gboolean play, stop, pause, fwd, rew, play_pause, list, shuffle;
 	gboolean enqueue, mainwin, remote;
 };
 
@@ -3184,7 +3192,7 @@
 
 	memset(opt, 0, sizeof(struct cmdlineopt));
 	opt->session = -1;
-	while ((c = getopt_long(argc, argv, "hn:rpusfemvt", long_options, NULL)) != -1)
+	while ((c = getopt_long(argc, argv, "hn:rpusfemvtlS", long_options, NULL)) != -1)
 	{
 		switch (c)
 		{
@@ -3194,6 +3202,12 @@
 			case 'n':
 				opt->session = atoi(optarg);
 				break;
+			case 'S':
+				opt->shuffle = TRUE;
+				break;
+			case 'l':
+				opt->list = TRUE;
+				break;
 			case 'r':
 				opt->rew = TRUE;
 				break;
@@ -3265,6 +3279,23 @@
 		if (!opt->enqueue)
 			xmms_remote_play(opt->session);
 	}
+	if (opt->list)
+    {
+        gint list_pos;
+        gchar *list_title;
+        gchar *list_filename;
+
+        list_pos = xmms_remote_get_playlist_pos(opt->session);
+        list_title = xmms_remote_get_playlist_title(opt->session, list_pos);
+        list_filename = xmms_remote_get_playlist_file(opt->session, list_pos);
+        fprintf(stderr, _("title=%s\n"
+                  "filename=%s\n"), list_title, list_filename);
+    }
+	if (opt->shuffle)
+    {
+        xmms_remote_toggle_shuffle(opt->session);
+    }
+
 	if (opt->rew)
 		xmms_remote_playlist_prev(opt->session);
 	if (opt->play)
signature.asc (application/pgp-signature, 232 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQE9z0A2x+yU3uQx8M4RAuAQAJ9IMnEvKO7tThFGGYwn5eFL+syIOwCglsqy
3sN0VOL6fewmuDFtASP9+fA=
=X6sC
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.