changeset 1932:532bb9b2bef6 trunk

[svn] - return -1 if audacious server is not running - add playback-seek, playback-seek-relative
author nenolod
date Sat, 04 Nov 2006 13:50:43 -0800
parents 111f30d09ef2
children f582d426471d
files ChangeLog audtool/audtool.c audtool/audtool.h
diffstat 3 files changed, 46 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Sat Nov 04 04:56:41 2006 -0800
+++ b/ChangeLog	Sat Nov 04 13:50:43 2006 -0800
@@ -1,3 +1,13 @@
+2006-11-04 12:56:41 +0000  Yoshiki Yazawa <yaz@cc.rim.or.jp>
+  revision [2819]
+  audtool improvement:
+  - print playlist titles in current codeset.
+  - justify multi byte characters correctly in playlist-display and playqueue-display.
+  
+  trunk/audtool/audtool.c |   56 +++++++++++++++++++++++++++++++++++++++++++-----
+  1 file changed, 51 insertions(+), 5 deletions(-)
+
+
 2006-11-04 02:47:00 +0000  William Pitcock <nenolod@nenolod.net>
   revision [2817]
   - merge debian's manpage with ours, and improve overall spelling and grammar
--- a/audtool/audtool.c	Sat Nov 04 04:56:41 2006 -0800
+++ b/audtool/audtool.c	Sat Nov 04 13:50:43 2006 -0800
@@ -74,6 +74,8 @@
 	{"playback-paused", playback_paused, "returns OK if audacious is paused"},
 	{"playback-stopped", playback_stopped, "returns OK if audacious is stopped"},
 	{"playback-status", playback_status, "returns the playback status"},
+	{"playback-seek", playback_seek, "performs an absolute seek"},
+	{"playback-seek-relative", playback_seek_relative, "performs a seek relative to the current position"},
 	{"<sep>", NULL, "Volume control"},
 	{"get-volume", get_volume, "returns the current volume level in percent"},
 	{"set-volume", set_volume, "sets the current volume level in percent"},
@@ -99,7 +101,7 @@
 		g_print("%s: usage: %s <command>\n", argv[0], argv[0]);
 		g_print("%s: use `%s help' to get a listing of available commands.\n",
 			argv[0], argv[0]);
-		exit(0);
+		exit(-2);
 	}
 
 	remote_uri = getenv("AUDTOOL_REMOTE_URI");
@@ -109,7 +111,7 @@
 		&& g_strcasecmp("list-handlers", argv[1]))
 	{
 		g_print("%s: audacious server is not running!\n", argv[0]);
-		exit(0);
+		exit(-1);
 	}
 
 	for (i = 0; handlers[i].name != NULL; i++)
@@ -331,6 +333,36 @@
 	}
 }
 
+void playback_seek(gint session, gint argc, gchar **argv)
+{
+	if (argc < 3)
+	{
+		g_print("%s: invalid parameters for playback-seek.\n", argv[0]);
+		g_print("%s: syntax: %s playback-seek <position>\n", argv[0], argv[0]);
+		return;
+	}
+
+	xmms_remote_jump_to_time(session, atoi(argv[2]) * 1000);
+}
+
+void playback_seek_relative(gint session, gint argc, gchar **argv)
+{
+	gint oldtime, newtime, diff;
+
+	if (argc < 3)
+	{
+		g_print("%s: invalid parameters for playback-seek-relative.\n", argv[0]);
+		g_print("%s: syntax: %s playback-seek <position>\n", argv[0], argv[0]);
+		return;
+	}
+
+	oldtime = xmms_remote_get_output_time(session) / 1000;
+	diff = atoi(argv[2]);
+	newtime = oldtime + diff;
+
+	xmms_remote_jump_to_time(session, newtime);
+}
+
 void playlist_add_url_string(gint session, gint argc, gchar **argv)
 {
 	if (argc < 3)
--- a/audtool/audtool.h	Sat Nov 04 04:56:41 2006 -0800
+++ b/audtool/audtool.h	Sat Nov 04 13:50:43 2006 -0800
@@ -76,6 +76,8 @@
 extern void playback_paused(gint, gint, gchar **);
 extern void playback_stopped(gint, gint, gchar **);
 extern void playback_status(gint, gint, gchar **);
+extern void playback_seek(gint, gint, gchar **);
+extern void playback_seek_relative(gint, gint, gchar **);
 extern void show_preferences_window(gint, gint, gchar **);
 extern void show_jtf_window(gint, gint, gchar **);
 extern void shutdown_audacious_server(gint, gint, gchar **);