#!/usr/bin/perl -w # On irc.qeast.net, there's a channel called #hqa where you can go # to download fansubbed anime. Their preferred method of # distribution is ftp, and a list of participating ftp sites can # be recieved by typing "!HQA-list" in the channel. # # The following script will take this list of ftp sites and # reformat it into ncftp bookmark format before printing it to # STDOUT. This output can be appended to ~/.ncftp/bookmarks. # # Then, if you use zsh 4.x (or greater) and have completions # turned on, typing `ncftp [TAB]` should present you with list of # bookmarks to choose from. Zsh's completions can be enabled by # running `autoload -U compinit; compinit`. use strict; sub ip { my $host = shift; my $ip; if ($host =~ /^d/) { $ip = $host; } else { my $dat = gethostbyname($host); if (defined($dat)) { $ip = join('.', unpack('CCCC', $dat)); } else { $ip = ""; } } $ip; } my $fn = shift || "hqa-list.txt"; open(IN, $fn) || die($!); while () { last if /^Name/; } my @line = ; shift(@line); *F = *STDOUT; foreach (@line) { my ($name, $host, $port, $login, $pass) = split(/\s+/, $_); printf F ( "%s,%s,%s,,,%s,I,%d,%d,1,1,1,1,%s,,,,,,S,-1\n", $name, $host, $login, "", $port, 0, ip($host), ); } exit 0;