checking for stpcpy... yes
checking for strcasecmp... yes
checking for strdup... yes
checking for strtoul... yes
checking for tsearch... yes
checking for __argz_count... yes
checking for __argz_stringify... yes
checking for __argz_next... yes
checking for __fsetlocking... yes
checking for iconv... yes
checking for iconv declaration...
extern size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
checking for nl_langinfo and CODESET... yes
checking for LC_MESSAGES... yes
checking for bison... no
checking whether NLS is requested... yes
checking whether included gettext is requested... no
checking for GNU gettext in libc... yes
checking whether to use NLS... yes
checking where the gettext function comes from... libc
checking for pkg-config... /usr/bin/pkg-config
checking for gtk+-2.0 >= 2.4.0 gdk-2.0 >= 2.4.0 glib-2.0 >= 2.4.0... yes
checking GTK2_CFLAGS... -DXTHREADS -I/usr/include/gtk-2.0 -I/usr/lib/gtk-2.0/include -I/usr/X11R6/include -I/usr/include/atk-1.0 -I/usr/include/pango-1.0 -I/usr/include/freetype2 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include
checking GTK2_LIBS... -Wl,--export-dynamic -lgtk-x11-2.0 -latk-1.0 -lgdk-x11-2.0 -lgdk_pixbuf-2.0 -lm -lpangoxft-1.0 -lpangox-1.0 -lpango-1.0 -lgobject-2.0 -lgmodule-2.0 -ldl -lglib-2.0
checking for xmms-config... no
checking for XMMS - version >= 1.0.0... no
# search lyrics in basic database
%vars = (
"souqu" => "¸èÃû",
"souci" => $music,
"ku" => "db",
"B1" => "Ìá½»"
);
$http->prepare_post(\%vars);
$http->request("http://bbs.hjqing.com/lrc/index.asp")
or die "Unable to get document: $!";
if($http->body() =~ /ûÓÐÄãÏëÕҵĸè´Ê/){
# try the addtion database
glob $http = new HTTP:ite;
%vars = (
"souqu" => "¸èÃû",
"souci" => $music,
"ku" => "dbadd",
"B1" => "Ìá½»"
);
$http->prepare_post(\%vars);
$http->request("http://bbs.hjqing.com/lrc/index.asp")
or die "Unable to get documents $!";
$http->body() =~ /ûÓÐÄãÏëÕҵĸè´Ê/ && die("find nothing");
}
@lines = split(/\n/, $http->body());
open(INFOFILE, ">/tmp/$music.lrc.info")
or die "Can not open info file to wirte";
open(OUTFILE, ">$lyrics_file")
or die "Can not open lyrics file to write";
$count = 0;
for($index = 0; $index < @lines; $index ++){
if($lines[$index] =~ /^\[.*$/){
# write the lyrics content to the file
$lines[$index] =~ s/<\/textarea>//;
print OUTFILE ("$lines[$index]\n");
}elsif($lines[$index] =~ /½øÒ»²½ËÑË÷/){
$index ++;
for(; $index < @lines; $index ++){
# add more infomation
if($lines[$index] =~ /<\/textarea>/){
last;
}else{
print INFOFILE ("$lines[$index]\n");
$count ++;
}
}
# just get lyrics list or first download and more than one file found
if(@ARGV == 3
&& ($ARGV[2] == "list" || ($ARGV[2] == "first" && $count > 1))){
close(OUTFILE);
unlink($lyrics_file);
exit;
}