Modification et traduction du script rhythmbox xchat announcer

Description

Voila
Je me suis amusé à traduire le script perl pour Xchat
J'ai ajouté aussi quelques fonctions comme l'annonce sur plusieurs chans et un timer de 30 minute qui annonce sur tout les chans

Par contre je sais qu'il faudrait le moyen de choisir le temps pour le timer mais je n'ai pas trouvé comment demandé une valeur à l'utilisateur pour spécifier l'argument en perl
Ainsi que de ne pas lancer le timer plusieurs fois et une fonction arrêt
Bref je ne connais pas le perl et j'ai fait au mieux donc modifier et envoyé moi des modifs sa serrais sympa
:)

Source / Exemple :


#!/usr/bin/perl -w

# Rhythmbox XChat Announcer 0.3.1
# (c) Copyright 2006, 2007 - Tim Denholm <tim@codestorm.net>
#
# 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
############################################################################
# Traduction et modification TrHiL-KiL                                     #
# gsmtrhilkil@gmail.com                                                    #
############################################################################

use POSIX qw(strftime);

$script_name        = "Annonceur Rhythmbox XChat";
$script_version     = "0.3.2";
$script_description = "Annonce les informations en cours de lecture chanson de Rhythmbox dans XChat.";
$rhythmbox_traductionmodif = "Traduction et modification par TrHiLKiL";
$rhythmbox_version = `Rhythmbox --version`;
$rhythmbox_version =~ s/GNOME\srhythmbox\s//;
chop $rhythmbox_version;

Xchat::register($script_name,$script_version,$script_description,$rhythmbox_traduction,"");

Xchat::print("Loaded \002".$script_name."\002:");
Xchat::print("Utilisez \002 /rb_aide \002 pour afficher une liste de commandes.");

Xchat::hook_command("arb",		"arb");
Xchat::hook_command("rb",		"rb_announce");
Xchat::hook_command("rb_annonce",	"rb_announce");
Xchat::hook_command("rbtous",	        "rb_announceall");
Xchat::hook_command("rb_annoncetous",	"rb_announceall");
Xchat::hook_command("rb_repetition",   "rb_announcerep");
Xchat::hook_command("rb_rep",	         "rb_announcerep");
Xchat::hook_command("rb_suivant",	"rb_next");
Xchat::hook_command("rb_precedent",	"rb_prev");
Xchat::hook_command("rb_play",		"rb_play");
Xchat::hook_command("rb_pause",		"rb_pause");
Xchat::hook_command("rb_version",	"rb_version");
Xchat::hook_command("rb_aide",		"rb_help");

sub arb
{
	# Check if a rhythmbox process exists.	
	if (`ps -C rhythmbox` =~ /rhythmbox/) {
		# Get current playing song information.
		$song_info = `rhythmbox-client --print-playing-format %ta\\ -\\ %at\\ -\\ %tt\\ -\\ "(%te/%td)"`;
		chop $song_info;

		Xchat::command("ame est à l'écoute:: ".$song_info);
	} else {
		Xchat::print("Rhythmbox n'est pas en cours d'exécution.");
	}

	return 1;
}

sub rb_announce
{
	# Check if a rhythmbox process exists.	
	if (`ps -C rhythmbox` =~ /rhythmbox/) {
		# Get current playing song information.
		$song_info = `rhythmbox-client --print-playing-format %ta\\ -\\ %at\\ -\\ %tt\\ -\\ "(%te/%td)"`;
		chop $song_info;

		Xchat::command("me est à l'écoute: ".$song_info);
	} else {
		Xchat::print("Rhythmbox n'est pas en cours d'exécution.");
	}

	return 1;
}
sub rb_announcerepall
{
	# Check if a rhythmbox process exists.	
	if (`ps -C rhythmbox` =~ /rhythmbox/) {
		# Get current playing song information.
		$song_info = `rhythmbox-client --print-playing-format %ta\\ -\\ %at\\ -\\ %tt\\ -\\ "(%te/%td)"`;
		chop $song_info;

		Xchat::command("timer -repeat 0 1800  ame est à l'écoute: ".$song_info);
	} else {
		Xchat::print("Rhythmbox n'est pas en cours d'exécution.");
	}

	return 1;
}
sub rb_announceall
{
	# Check if a rhythmbox process exists.	
	if (`ps -C rhythmbox` =~ /rhythmbox/) {
		# Get current playing song information.
		$song_info = `rhythmbox-client --print-playing-format %ta\\ -\\ %at\\ -\\ %tt\\ -\\ "(%te/%td)"`;
		chop $song_info;

		Xchat::command("ame est à l'écoute: ".$song_info);
	} else {
		Xchat::print("Rhythmbox n'est pas en cours d'exécution.");
	}

	return 1;
}

sub rb_next
{
	# Skip to the next track.
	eval `rhythmbox-client --next`;
	Xchat::print("S'est arrêté à la piste suivante.");
	return 1;
}

sub rb_prev
{
	# Skip to the previous track.
	eval `rhythmbox-client --previous`;
	Xchat::print("S'est arrêté à la piste précédente..");
	return 1;
}

sub rb_play
{
	# Start playback.
	eval `rhythmbox-client --play`;
	Xchat::print("Commencé la lecture.");
	return 1;
}

sub rb_pause
{
	# Pause playback.
	eval `rhythmbox-client --pause`;
	Xchat::print("La lecture en pause.");
	return 1;
}

sub rb_version
{
	# Display version information to a channel.
	Xchat::command("me utilise ".$script_name." ".$script_version." avec Rhythmbox ".$rhythmbox_traductionmodif." ".$rhythmbox_version." et XChat ".Xchat::get_info("version"));
	return 1;
}

sub rb_help
{
	# Display help screen.
	Xchat::print("\002\037".$script_name." Help:\037\002");
	Xchat::print(" \002About:\002");
	Xchat::print("  * Author: Tim Denholm <tim\@codestrorm.net>");
	Xchat::print("  * URL:    http://www.ircfr.com/codes/MODIFICATION-TRADUCTION-SCRIPT-RHYTHMBOX-XCHAT-ANNOUNCER_52648.aspx");
        Xchat::print("  * Script Version:    ".$script_version);
        Xchat::print("  * traduction et modification:    ".$rhythmbox_traductionmodif);
	Xchat::print("  * Rhythmbox Version: ".$rhythmbox_version);
	Xchat::print("  * XChat Version:     ".Xchat::get_info("version"));
	Xchat::print(" \002Commands:\002");
	Xchat::print("  * /rb          - idem que /rb_announce.");
        Xchat::print("  * /rbtous      - idem que /rb_annoncetous.");
	Xchat::print("  * /rb_annonce - Afficher la chanson en cours de lecture à un canal.");
        Xchat::print("  * /rb_annoncetous - Afficher la chanson en cours de lecture à tout les canaux.");
        Xchat::print("  * /rb_rep - Timer qui affiche la chanson en cours de lecture à tout les canaux toute les 30 minutes.");
        Xchat::print("  * /rb_repetition - Timer qui affiche la chanson en cours de lecture à tout les canaux toute les 30 minutes.");
        Xchat::print("  * /rb_suivant     - Passer à la piste suivante.");
	Xchat::print("  * /rb_precedent     - Passer à la piste précédente.");
	Xchat::print("  * /rb_play     - Lancez la lecture.");
	Xchat::print("  * /rb_pause    - Pause de la lecture.");
	Xchat::print("  * /rb_version  - Affiche la version du script, Rhythmbox et XChat à un canal.");
	Xchat::print("  * /rb_aide     - Afficher cet écran d'aide.");
	return 1;
}

Codes Sources

A voir également

Vous n'êtes pas encore membre ?

inscrivez-vous, c'est gratuit et ça prend moins d'une minute !

Les membres obtiennent plus de réponses que les utilisateurs anonymes.

Le fait d'être membre vous permet d'avoir un suivi détaillé de vos demandes et codes sources.

Le fait d'être membre vous permet d'avoir des options supplémentaires.