weechat script (récupérer une musique qui joue)
parent
a1b12e63a9
commit
fca19a877f
|
@ -3,7 +3,7 @@ use strict;
|
||||||
use warnings;
|
use warnings;
|
||||||
use v5.14;
|
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 @tab;
|
||||||
my %dom;
|
my %dom;
|
||||||
|
@ -43,14 +43,14 @@ sub test_ipv6 {
|
||||||
|
|
||||||
my @var = split "\n", $ret;
|
my @var = split "\n", $ret;
|
||||||
for(@var) {
|
for(@var) {
|
||||||
|
|
||||||
chomp $ret;
|
|
||||||
next unless /:/;
|
next unless /:/;
|
||||||
say $ret;
|
|
||||||
|
chomp;
|
||||||
|
say; # print the IPv6
|
||||||
|
|
||||||
# we try to reach the website's server
|
# we try to reach the website's server
|
||||||
my $retping =
|
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;
|
chomp $retping;
|
||||||
|
|
||||||
if(length $retping) {
|
if(length $retping) {
|
||||||
|
@ -66,6 +66,7 @@ sub check_reachability {
|
||||||
|
|
||||||
say '<!-- ';
|
say '<!-- ';
|
||||||
for(keys %dom) {
|
for(keys %dom) {
|
||||||
|
chomp;
|
||||||
test_ipv6 $_;
|
test_ipv6 $_;
|
||||||
}
|
}
|
||||||
say '--!>';
|
say '--!>';
|
||||||
|
|
|
@ -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", "");
|
Loading…
Reference in New Issue