#!/usr/bin/perl -w # Rhythmbox XChat Announcer 0.2 # (c) Copyright 2006 - Tim Denholm # # 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 use POSIX qw(strftime); $script_name = "Rhythmbox XChat Announcer"; $script_version = "0.2"; $script_description = "Announces the current playing song information from Rhythmbox in XChat."; $rhythmbox_version = `rhythmbox --version`; $rhythmbox_version =~ s/Gnome\srhythmbox\s//; chop $rhythmbox_version; IRC::register($script_name,$script_version,$script_description,""); IRC::print("Loaded \002".$script_name."\002:"); IRC::add_command_handler("song","rb_announce"); sub rb_announce { if (`ps -C rhythmbox` =~ /rhythmbox/) { # Get current playing song information. $song_info = `rhythmbox-client --print-playing-format "%ta - %tt [%at]"`; chop $song_info; IRC::command("/me is listening to: ".$song_info); } else { IRC::print("Rhythmbox is not currently running."); } return 1; }