# HG changeset patch # User Tomasz Mon # Date 1182527990 -7200 # Node ID 7f1b2734af367533d61db367af7fc271b5b174c0 # Parent 9f37fd52e7d0eb4eb015045dcec731ab7d05f82c# Parent f5c37e128ae538d1e8b686ec62dbf418cb44538b branch merge diff -r 9f37fd52e7d0 -r 7f1b2734af36 contrib/xchat-audacious.py --- 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 \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" diff -r 9f37fd52e7d0 -r 7f1b2734af36 src/audacious/main.c --- 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) {