# HG changeset patch # User deitarion # Date 1179301577 25200 # Node ID 57363f3ded7998e6e5a7bfb55601d2fcfffd0ffe # Parent cd9311fed796e47f8f1ef367e6c273d3a6b997be [svn] xchat-audacious.py: - One final clean-up. - Bump the version number (like I should have done two revisions ago when I fixed that bug) diff -r cd9311fed796 -r 57363f3ded79 ChangeLog --- a/ChangeLog Wed May 16 00:24:43 2007 -0700 +++ b/ChangeLog Wed May 16 00:46:17 2007 -0700 @@ -1,3 +1,13 @@ +2007-05-16 07:24:43 +0000 Stephen Sokolow + revision [4572] + A few more xchat-audacious.py corrections: + - Oops. "return None" --> "return xchat.EAT_ALL" + - Compacted the code a bit more. + + trunk/contrib/xchat-audacious.py | 16 +++++----------- + 1 file changed, 5 insertions(+), 11 deletions(-) + + 2007-05-16 06:53:07 +0000 Stephen Sokolow revision [4570] Fixes for xchat-audacious.py: diff -r cd9311fed796 -r 57363f3ded79 contrib/xchat-audacious.py --- a/contrib/xchat-audacious.py Wed May 16 00:24:43 2007 -0700 +++ b/contrib/xchat-audacious.py Wed May 16 00:46:17 2007 -0700 @@ -6,14 +6,14 @@ # - support org.freedesktop.MediaPlayer (MPRIS)? # # This script is in the public domain. -# $Id: xchat-audacious.py 4572 2007-05-16 07:24:43Z deitarion $ +# $Id: xchat-audacious.py 4574 2007-05-16 07:46:17Z deitarion $ # __module_name__ = "xchat-audacious" -__module_version__ = "1.0" +__module_version__ = "1.0.1" __module_description__ = "Get NP information from Audacious" -from dbus import Bus, DBusException, Interface +from dbus import Bus, DBusException import xchat # connect to DBus @@ -28,17 +28,16 @@ def command_np(word, word_eol, userdata): aud = get_aud() - if not aud: - return xchat.EAT_ALL - - length = aud.SongLength(aud.Position()) - length = (length > 0) and ("%d:%02d" % (length / 60, length % 60)) or "stream" + if aud: + pos = aud.Position() - xchat.command("SAY [%s | %d:%02d/%s]" % ( - aud.SongTitle(aud.Position()).encode("utf8"), - aud.Time() / 1000 / 60, aud.Time() / 1000 % 60, - length)) + length = aud.SongLength(pos) + length = (length > 0) and ("%d:%02d" % (length / 60, length % 60)) or "stream" + playSecs = aud.Time() / 1000 + xchat.command("SAY [%s | %d:%02d/%s]" % ( + aud.SongTitle(pos).encode("utf8"), + playSecs / 60, playSecs % 60, length)) return xchat.EAT_ALL def makeVoidCommand(cmd): @@ -47,30 +46,22 @@ return xchat.EAT_ALL return callback -command_next = makeVoidCommand('Advance') -command_prev = makeVoidCommand('Reverse') -command_pause = makeVoidCommand('Pause') -command_stop = makeVoidCommand('Stop') -command_play = makeVoidCommand('Play') - def command_send(word, word_eol, userdata): if len(word) < 2: print "You must provide a user to send the track to." return xchat.EAT_ALL aud = get_aud() - if not aud: - return xchat.EAT_ALL - - xchat.command('DCC SEND %s "%s"' % (word[1], aud.SongFilename(aud.Position()).encode("utf8"))) + if aud: + xchat.command('DCC SEND %s "%s"' % (word[1], aud.SongFilename(aud.Position()).encode("utf8"))) return xchat.EAT_ALL -xchat.hook_command("NP", command_np, help="Displays current playing song.") -xchat.hook_command("NEXT", command_next, help="Advances in Audacious' playlist.") -xchat.hook_command("PREV", command_prev, help="Goes backwards in Audacious' playlist.") -xchat.hook_command("PAUSE", command_pause, help="Toggles paused status.") -xchat.hook_command("STOP", command_stop, help="Stops playback.") -xchat.hook_command("PLAY", command_play, help="Begins playback.") -xchat.hook_command("SENDTRACK", command_send, help="Sends the currently playing track to a user.") +xchat.hook_command("NP", command_np, help="Displays current playing song.") +xchat.hook_command("NEXT", makeVoidCommand('Advance'), help="Advances in Audacious' playlist.") +xchat.hook_command("PREV", makeVoidCommand('Reverse'), help="Goes backwards in Audacious' playlist.") +xchat.hook_command("PAUSE", makeVoidCommand('Pause'), help="Toggles paused status.") +xchat.hook_command("STOP", makeVoidCommand('Stop'), help="Stops playback.") +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.") -print "xchat-audacious $Id: xchat-audacious.py 4572 2007-05-16 07:24:43Z deitarion $ loaded" +print "xchat-audacious $Id: xchat-audacious.py 4574 2007-05-16 07:46:17Z deitarion $ loaded" diff -r cd9311fed796 -r 57363f3ded79 src/audacious/build_stamp.c --- a/src/audacious/build_stamp.c Wed May 16 00:24:43 2007 -0700 +++ b/src/audacious/build_stamp.c Wed May 16 00:46:17 2007 -0700 @@ -1,2 +1,2 @@ #include -const gchar *svn_stamp = "20070516-4570"; +const gchar *svn_stamp = "20070516-4572";