Hey guys,
i have one Irssi script, based on C, but my bot uses TCL. Is it possible to convert script from C to TCL?
code:
#!/usr/bin/perl
my $ch = shift;
my $n2ita = 0;
if ($ch eq "etv") {
$ch = 1;
$kanal = "ETV";
}
elsif ($ch eq "kanal2")
{
$ch = 2;
$kanal = "Kanal 2";
}
elsif ($ch eq "tv3")
{
$ch = 3;
$kanal = "TV 3";
}
else
{
print " Tundmatu kanal. Valikud on etv, kanal2, tv3\n";
exit 0;
}
my $url = "http://www.w3.ee/index.php?id=54";
my @page = `lynx -display_charset=UTF-8 -crawl -width=20000 -source $url | grep -A 6 header`;
foreach(@page) {
next if(/^\s*$/);
$n2ita = 1 if(/$ch/);
s/^\s*//;
s/<tr>/\n/g;
s/<\/tr>/\n/g;
# s/<[^>]*>/;/g;
# s/<.b>/;/g;
# s/<.td>/;/g;
# s/\s\s*/ /g;
s/ä/ä/g;
s/ü/ü/g;
s/Ã\//Ü/g;
s/õ/õ/g;
s/ÃU/Õ/g;
s/ö/ö/g;
s/ž/¸/g;
s/â/"/g;
s/õ/õ/g;
s/<[^>]*>/;/g;
s/Ã/Ü/g;
# s/^(.{389}).*$/\1.../;
# s/--//g;
push(@kava,$_);
}
$a = join(" ", @kava);
$a = substr($a, 4, -13);
@saade = split(/;/, "$a");
#print @kava;
if ($ch eq "1") {
print "Kanal: [" . $kanal ."] Saade: [" . @saade[35] . "] Algas: [" . @saade[32] . "] Kirjeldus: [" . @saade[37] . "] Aeg: [" . @saade[38] . "]\n";
}
elsif ($ch eq "2")
{
print "Kanal: [" . $kanal ."] Saade: [" . @saade[49] . "] Algas: [" . @saade[46] . "] Kirjeldus: [" . @saade[51] . "] Aeg: [" . @saade[52] . "]\n";
}
elsif ($ch eq "3")
{
print "Kanal: [" . $kanal ."] Saade: [" . @saade[63] . "] Algas: [" . @saade[60] . "] Kirjeldus: [" . @saade[65] . "] Aeg: [" . @saade[66] . "]\n";
}
#print @kava;
Or is there so kind people, who could write it into tcl?
It takes on-air tv shows information from w3.ee site and privmsg it to user.