Mercurial > audlegacy
changeset 2740:a67712c75069 trunk
[svn] - add an xchat script which wraps our DBus API using dbus-python.
author | nenolod |
---|---|
date | Fri, 11 May 2007 17:20:46 -0700 |
parents | 953001c668ae |
children | e4c08b7023a0 |
files | ChangeLog contrib/xchat-audacious.py src/audacious/build_stamp.c |
diffstat | 3 files changed, 45 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Fri May 11 16:27:54 2007 -0700 +++ b/ChangeLog Fri May 11 17:20:46 2007 -0700 @@ -1,3 +1,12 @@ +2007-05-11 23:27:54 +0000 Giacomo Lozito <james@develia.org> + revision [4504] + - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed + trunk/src/audacious/Makefile | 2 + trunk/src/audacious/auddrct.c | 115 ++++++++++++++++++++++++++++++++++++++++++ + trunk/src/audacious/auddrct.h | 36 +++++++++++++ + 3 files changed, 153 insertions(+) + + 2007-05-11 20:02:49 +0000 William Pitcock <nenolod@sacredspiral.co.uk> revision [4502] - call SongFrames not SongLength
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/contrib/xchat-audacious.py Fri May 11 17:20:46 2007 -0700 @@ -0,0 +1,35 @@ +# +# X-Chat Audacious for Audacious 1.4 and later +# This uses the native Audacious D-Bus interface. +# +# To consider later: +# - support org.freedesktop.MediaPlayer (MPRIS)? +# + +__module_name__ = "xchat-audacious" +__module_version__ = "1.0" +__module_description__ = "Get NP information from Audacious" + +from dbus import Bus, Interface +import xchat + +# connect to DBus +bus = Bus(Bus.TYPE_SESSION) + +def command_np(word, word_eol, userdata): + aud = bus.get_object('org.atheme.audacious', '/org/atheme/audacious') + + # this seems to be best, probably isn't! + length = "stream" + if aud.SongLength(aud.Position()) > 0: + length = "%d:%02d" % (aud.SongLength(aud.Position()) / 60, + aud.SongLength(aud.Position()) % 60) + + xchat.command("SAY [%s | %d:%02d/%s]" % ( + aud.SongTitle(aud.Position()), + aud.Time() / 1000 / 60, aud.Time() / 1000 % 60, + length)) + + return xchat.EAT_ALL + +xchat.hook_command("NP", command_np, help="Displays current playing song.")