changeset 2855:7f1b2734af36 trunk

branch merge
author Tomasz Mon <desowin@gmail.com>
date Fri, 22 Jun 2007 17:59:50 +0200
parents 9f37fd52e7d0 (current diff) f5c37e128ae5 (diff)
children c4d07471f647
files
diffstat 2 files changed, 93 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/contrib/xchat-audacious.py	Fri Jun 22 17:38:06 2007 +0200
+++ b/contrib/xchat-audacious.py	Fri Jun 22 17:59:50 2007 +0200
@@ -64,4 +64,62 @@
 xchat.hook_command("PLAY",  makeVoidCommand('Play'),    help="Begins playback.")
 xchat.hook_command("SENDTRACK", command_send, help="Syntax: /SENDTRACK <nick>\nSends the currently playing track to a user.")
 
+# IRC+PP support section
+
+# XChat is lame and does not give us a server list.
+def get_servers():
+	chanlist = xchat.get_list("channels")
+	servlist = []
+
+	for i in chanlist:
+		if i.server not in servlist:
+			servlist.append(i.server)
+
+	return servlist
+
+ignore_services = 0;
+def ignore_service_errors_cb(word, word_eol, userdata):
+	global ignore_services
+
+	if ignore_services == 1:
+		return xchat.EAT_ALL
+
+	return xchat.EAT_NONE
+
+xchat.hook_print("Notice", ignore_service_errors_cb)
+
+def unset_ignore_services(userdata=None):
+	global ignore_services
+
+	ignore_services = 0
+	return 1
+
+last_title = None
+
+def presence_notification_dispatch(userdata=None):
+	global ignore_services, last_title
+
+	aud = get_aud()
+
+	ignore_services = 1
+	if aud:
+		pos = aud.Position()
+
+		title = aud.SongTitle(pos).encode("utf8")
+
+		if title != last_title:
+			slist = get_servers()
+			for i in slist:
+				ctx = xchat.find_context(i)
+
+				ctx.command("nickserv set qproperty np %s" % (title))
+
+			last_title = title
+
+	return 1
+
+presence_notification_dispatch()
+xchat.hook_timer(3000, presence_notification_dispatch)
+xchat.hook_timer(500, unset_ignore_services)
+
 print "xchat-audacious $Id: xchat-audacious.py 4574 2007-05-16 07:46:17Z deitarion $ loaded"
--- a/src/audacious/main.c	Fri Jun 22 17:38:06 2007 +0200
+++ b/src/audacious/main.c	Fri Jun 22 17:59:50 2007 +0200
@@ -53,6 +53,7 @@
 #  include "audctrl.h"
 #endif
 
+#include "auddrct.h"
 #include "dnd.h"
 #include "effect.h"
 #include "ui_equalizer.h"
@@ -998,6 +999,40 @@
 
         if (options->playcd)
             play_medium();
+    } else {
+        if (options->rew)
+            audacious_drct_playlist_prev();
+
+        if (options->play)
+            audacious_drct_play();
+
+        if (options->pause)
+            audacious_drct_pause();
+
+        if (options->stop)
+            audacious_drct_stop();
+
+        if (options->fwd)
+            audacious_drct_playlist_next();
+
+        if (options->play_pause) {
+            if (audacious_drct_get_paused())
+                audacious_drct_play();
+            else
+                audacious_drct_pause();
+        }
+
+        if (options->show_jump_box)
+            audacious_drct_show_jtf_box();
+
+        if (options->mainwin)
+            audacious_drct_main_win_toggle(TRUE);
+
+        if (options->activate)
+            audacious_drct_activate();
+
+        if (options->playcd)
+            play_medium();
     }
 
     if(remote) {