From fca19a877f9233bab0c83657c96c50a168a1af70 Mon Sep 17 00:00:00 2001
From: karchnu <karchnu@karchnu.fr>
Date: Mon, 26 Jan 2015 00:26:05 +0100
Subject: [PATCH] =?UTF-8?q?weechat=20script=20(r=C3=A9cup=C3=A9rer=20une?=
 =?UTF-8?q?=20musique=20qui=20joue)?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 perl/get_no_v6_websites.pl | 11 ++++++-----
 perl/song.pl               | 36 ++++++++++++++++++++++++++++++++++++
 2 files changed, 42 insertions(+), 5 deletions(-)
 create mode 100644 perl/song.pl

diff --git a/perl/get_no_v6_websites.pl b/perl/get_no_v6_websites.pl
index 0690866..7d52db1 100755
--- a/perl/get_no_v6_websites.pl
+++ b/perl/get_no_v6_websites.pl
@@ -3,7 +3,7 @@ use strict;
 use warnings;
 use v5.14;
 
-die "usage : ./$0 website_list.txt" if @ARGV != 1;
+die "usage : cat website_list.txt | ./$0 > page.html" if @ARGV != 0;
 
 my @tab;
 my %dom;
@@ -43,14 +43,14 @@ sub test_ipv6 {
 
         my @var = split "\n", $ret;
         for(@var) {
-
-            chomp $ret;
             next unless /:/;
-            say $ret;
+
+            chomp;
+            say; # print the IPv6
 
             # we try to reach the website's server
             my $retping = 
-            `/bin/ping6 -i 0.5 -c 2 $ret | grep ' 0% packet loss'`;
+            `/bin/ping6 -i 0.5 -c 2 $_ | grep ' 0% packet loss'`;
             chomp $retping;
 
             if(length $retping) {
@@ -66,6 +66,7 @@ sub check_reachability {
 
     say '<!-- ';
     for(keys %dom) {
+		chomp;
         test_ipv6 $_;
     }
     say '--!>';
diff --git a/perl/song.pl b/perl/song.pl
new file mode 100644
index 0000000..54ccf7e
--- /dev/null
+++ b/perl/song.pl
@@ -0,0 +1,36 @@
+#!/usr/bin/perl -w
+use v5.14;
+use Modern::Perl;
+
+my $name = "song";
+my $info_perso = "Philippe (karchnu) Pittoli karchnu+travail (at) karchnu.fr";
+my $version = "0.1";
+my $licence = "GPL3";
+my $description = "Permet de savoir quelle est la musique qui tourne.";
+
+
+weechat::register($name, $info_perso, $version, $licence, $description, "", "");
+weechat::print("", "Bonjour, du script perl !");
+
+
+sub song {
+    my ( $data, $buffer, $args ) = @_;
+
+    my @args = split /\s+/, $args;
+
+    my $ip = "portable";
+    my $port = "6600";
+
+    $ip = $args[1] if(@args >= 2);
+    $port = $args[2] if(@args >= 3);
+
+    my $sortie = `mpc current -p $port -h $ip -f "%title% - %album% : %time%"`;
+
+    weechat::print(weechat::current_buffer(), "[cursong]\t$sortie");
+}
+
+weechat::hook_command("song", "description de mon filtre",
+    "current [host [port]]",
+    "song current [host [port]]",
+    "current"
+    , "song", "");