Presume a tus amigos del IRC lo que estás escuchando con este pequeño pero versátil script que aprovecha la herramienta audtool de Audacious que muestra toda la información de lo que estamos escuchando.
El script es una modificación del realizado por Milad Rastian (perdonen por poner ese link, no tengo su dirección original), y ahora aprovecha algunas características de Audacious que al parecer no existían por ese entonces. No solo muestra el título de la canción, sino también el artista, álbum, duración actual y total y la ubicación en nuestro directorio. Puede que el binario de Audacious cambie dependiendo de la distro utilizada, pero este funciona en Arch Linux.
#!/usr/bin/perl -w# Audacious XChat Announcer 0.1# (C) Copyright 2007 – Milad Rastian <milad AT rastian dot com># Thanks to Tim Denholm for his Rhythmbox XChat Announcer Plugin## This program is free software; you can redistribute it and/or modify# it under the terms of the GNU General Public License as published by# the Free Software Foundation; either version 2 of the License, or# (at your option) any later version.## This program is distributed in the hope that it will be useful,# but WITHOUT ANY WARRANTY; without even the implied warranty of# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the# GNU General Public License for more details.## You should have received a copy of the GNU General Public License# along with this program; if not, write to the Free Software# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA#How To Use ?#Just copy this file in ~/.xchat2 and in IRC write /ab_help to more help
# Modificado por David Kantun#Para usuarios de Audacious, XChat y Arch Linux. Para otras distros es posible#que el nombre del binario audacious cambie. Pueden hacer las correcciones#como yo las hice sin problema alguno. Quejas al autor original del script
# Como debes usarlo?#Copia este archivo en ~/.xchat2 y escribe /ab_help en XChat para informacion#sobre su uso.# Que tiene de nuevo?#Se agrego soporte para mostrar el titulo, autor, longitud y ubicación del#archivo de musica a reproducir.use POSIX qw(strftime);$script_name = “Audacious XChat Announcer”;$script_version = “0.2″;$script_description = “Announces the current playing song information from Audacious in XChat.”;$audacious_version = `audacious –version`;$audacious_version =~ s/Gnome\saudacious\s//;chop $audacious_version;IRC::register($script_name,$script_version,$script_description,”");IRC::print(“Loaded \002″.$script_name.”\002:”);IRC::print(“Use \002/ab_help\002 to display a list of commands.”);IRC::add_command_handler(“ab_announce”,”ab_announce”);IRC::add_command_handler(“ab_next”,”ab_next”);IRC::add_command_handler(“ab_prev”,”ab_prev”);IRC::add_command_handler(“ab_play”,”ab_play”);IRC::add_command_handler(“ab_pause”,”ab_pause”);IRC::add_command_handler(“ab_version”,”ab_version”);IRC::add_command_handler(“ab_help”,”ab_help”);sub ab_announce{if (`ps -C audacious2` =~ /audacious2/) {# Get current playing song information.$song_info = `audtool2 –current-song-tuple-data title `;chop $song_info;$artist_info = `audtool2 –current-song-tuple-data artist `;chop $artist_info;$album_info = `audtool2 –current-song-tuple-data album `;chop $album_info;$path_info = `audtool2 –current-song-tuple-data file-path `;chop $path_info;$name_info = `audtool2 –current-song-tuple-data file-name `;chop $name_info;$currentl_info = `audtool2 –current-song-output-length `;chop $currentl_info;$length_info = `audtool2 –current-song-length `;chop $length_info;IRC::command(“/me \002is listening to:\002 “.$artist_info.”\002 – \002″.$song_info.”\002 [\002".$album_info."\002]. <> [\002".$currentl_info."\002/\002".$length_info."\002] <> Location: \002″.$path_info.$name_info);} else {IRC::print(“Audacious is not currently running.”);}return 1;}sub ab_next{# Skip to the next track.eval `audtool2 –playlist-advance`;IRC::print(“Skipped to next track.”);return 1;}sub ab_prev{# Skip to the previous track.eval `audtool2 –playlist-reverse`;IRC::print(“Skipped to previous track.”);return 1;}sub ab_play{# Start playback.eval `audtool2 –playback-play`;IRC::print(“Started playback.”);return 1;}sub ab_pause{# Pause playback.eval `audtool2 playback-pause`;IRC::print(“Paused playback.”);return 1;}sub ab_version{# Display version information to a channel.IRC::command(“/me is using “.$script_name.” “.$script_version.” with Audacious “.$audacious_version.” and XChat “.IRC::get_info(0));return 1;}sub ab_help{# Display help screen.IRC::print(“\002\037″.$script_name.” Help:\037\002″);IRC::print(” \002About:\002″);IRC::print(” * Author: Milad Rastian <milad\@rastian.com>”);IRC::print(” * URL: http://fritux.com/”);IRC::print(” * Script Version: ”.$script_version);IRC::print(” * Audacious Version: “.$rhythmbox_version);IRC::print(” * XChat Version: “.IRC::get_info(0));IRC::print(” \002Commands:\002″);IRC::print(” * /ab_announce – Display the current song playing to a channel.”);IRC::print(” * /ab_next – Skip to the next track.”);IRC::print(” * /ab_prev – Skip to the previous track.”);IRC::print(” * /ab_play – Start playback.”);IRC::print(” * /ab_pause - Pause playback.”);IRC::print(” * /ab_version - Display version information for the script, Audacious and XChat to a channel.”);IRC::print(” * /ab_help – Display this help screen.”);return 1;}