• Revista PROGRAMAR: Já está disponível a edição #53 da revista programar. Faz já o download aqui!

djthyrax

Audacious XChat Announcer

1 mensagem neste tópico

Plugin em Perl para o Xchat que permite controlar o Audacious.

http://213.207.236.28/scripts/xchat_audacious.pl

#!/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 
use POSIX qw(strftime);

$script_name        = "Audacious XChat Announcer";
$script_version     = "0.1";
$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 audacious` =~ /audacious/) {
	# Get current playing song information.
	$song_info = `audtool --current-song `;
	chop $song_info;

	IRC::command("/me is listening to: ".$song_info);
} else {
	IRC::print("Audacious is not currently running.");
}

return 1;
}

sub ab_next
{
# Skip to the next track.
eval `audtool --playlist-advance`;
IRC::print("Skipped to next track.");
return 1;
}

sub ab_prev
{
# Skip to the previous track.
eval `audtool --playlist-reverse`;
IRC::print("Skipped to previous track.");
return 1;
}

sub ab_play
{
# Start playback.
eval `audtool --playback-play`;
IRC::print("Started playback.");
return 1;
}

sub ab_pause
{
# Pause playback.
eval `audtool 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, Rhythmbox and XChat to a channel.");
IRC::print("  * /ab_help     - Display this help screen.");
return 1;
}

Boas conversas. :)

0

Partilhar esta mensagem


Link para a mensagem
Partilhar noutros sites

Crie uma conta ou ligue-se para comentar

Só membros podem comentar

Criar nova conta

Registe para ter uma conta na nossa comunidade. É fácil!


Registar nova conta

Entra

Já tem conta? Inicie sessão aqui.


Entrar Agora