| 1 |
#!/usr/bin/perl -w
|
| 2 |
|
| 3 |
use strict;
|
| 4 |
use utf8;
|
| 5 |
|
| 6 |
|
| 7 |
=head1 NAME
|
| 8 |
|
| 9 |
dl10n-spider -- crawl translator mailing lists (and BTS) for status updates
|
| 10 |
|
| 11 |
=head1 SYNOPSIS
|
| 12 |
|
| 13 |
dl10n-spider [options] [lang]+
|
| 14 |
|
| 15 |
=head1 DESCRIPTION
|
| 16 |
|
| 17 |
This script parses the debian-l10n-E<lt>languageE<gt> mailing list
|
| 18 |
archives. It looks for emails which title follow a specific format
|
| 19 |
indicating what the author intend to translate, or the current status of
|
| 20 |
his work on this translation.
|
| 21 |
|
| 22 |
Those informations are saved to a dl10n database which can then be used to
|
| 23 |
build a l10n coordination page or any other useless statistics.
|
| 24 |
|
| 25 |
=cut
|
| 26 |
|
| 27 |
use Getopt::Long; #to parse the args
|
| 28 |
use Debian::L10n::Spider;
|
| 29 |
|
| 30 |
|
| 31 |
my $progname = $0;
|
| 32 |
$progname = $1 if $progname =~ m,([^/])+$,;
|
| 33 |
|
| 34 |
my $VERSION = "4.0"; # External Version Number
|
| 35 |
my $BANNER = "Debian l10n infrastructure -- mailing list spider v$VERSION"; # Version Banner - text form
|
| 36 |
|
| 37 |
my $cmdline_year = undef;
|
| 38 |
my $cmdline_month = undef;
|
| 39 |
my $cmdline_msg = undef;
|
| 40 |
my $cmdline_file = undef;
|
| 41 |
my $check_bts=0;
|
| 42 |
|
| 43 |
|
| 44 |
=head1 Command line option parsing
|
| 45 |
|
| 46 |
=over
|
| 47 |
|
| 48 |
=item General options:
|
| 49 |
|
| 50 |
=over
|
| 51 |
|
| 52 |
=item -h, --help
|
| 53 |
|
| 54 |
display short help text
|
| 55 |
|
| 56 |
=item -V, --version
|
| 57 |
|
| 58 |
display version and exit
|
| 59 |
|
| 60 |
=item --check-bts
|
| 61 |
|
| 62 |
check the BTS
|
| 63 |
|
| 64 |
=back
|
| 65 |
|
| 66 |
=item Begin point of the crawling:
|
| 67 |
|
| 68 |
=over
|
| 69 |
|
| 70 |
=item --year=YYYY
|
| 71 |
|
| 72 |
=item --month=MM
|
| 73 |
|
| 74 |
=item --message=msg
|
| 75 |
|
| 76 |
=back
|
| 77 |
|
| 78 |
if not specified, will crawl for new messages.
|
| 79 |
|
| 80 |
=item Database to fill:
|
| 81 |
|
| 82 |
=over
|
| 83 |
|
| 84 |
=item --sdb=STATUS_FILE
|
| 85 |
|
| 86 |
use STATUS_FILE as status file (instead of $STATUS_FILE)
|
| 87 |
|
| 88 |
=back
|
| 89 |
|
| 90 |
=back
|
| 91 |
|
| 92 |
=cut
|
| 93 |
|
| 94 |
# This is put into a block to avoid main namespace pollution
|
| 95 |
{
|
| 96 |
sub syntax_msg {
|
| 97 |
my $message = shift;
|
| 98 |
if (defined $message) {
|
| 99 |
print "$progname: $message\n";
|
| 100 |
} else {
|
| 101 |
print "$BANNER\n";
|
| 102 |
}
|
| 103 |
print <<EOF
|
| 104 |
Syntax: $0 [options] [lang]+
|
| 105 |
General options:
|
| 106 |
-h, --help display short help text
|
| 107 |
-V, --version display version and exit
|
| 108 |
--check-bts check the BTS
|
| 109 |
|
| 110 |
Begin point of the crawling:
|
| 111 |
--year=YYYY
|
| 112 |
--month=MM
|
| 113 |
--message=msg
|
| 114 |
|
| 115 |
If not specified, will crawl for new messages.
|
| 116 |
|
| 117 |
Database to fill:
|
| 118 |
--sdb=STATUS_FILE use STATUS_FILE as status file
|
| 119 |
EOF
|
| 120 |
;
|
| 121 |
|
| 122 |
if (defined $message) {
|
| 123 |
exit 1;
|
| 124 |
} else {
|
| 125 |
exit 0;
|
| 126 |
}
|
| 127 |
}
|
| 128 |
|
| 129 |
|
| 130 |
# Display Version Banner
|
| 131 |
# Options: -V|--version, --print-version
|
| 132 |
sub banner {
|
| 133 |
if ($_[0] eq 'print-version') {
|
| 134 |
print "$VERSION\n";
|
| 135 |
} else {
|
| 136 |
print "$BANNER\n";
|
| 137 |
}
|
| 138 |
exit 0;
|
| 139 |
}
|
| 140 |
|
| 141 |
# Hash used to process commandline options
|
| 142 |
my %opthash = (
|
| 143 |
# ------------------ general options
|
| 144 |
"help|h" => \&syntax_msg,
|
| 145 |
"version|V" => \&banner,
|
| 146 |
"check-bts" => \$check_bts,
|
| 147 |
|
| 148 |
# ------------------ configuration options
|
| 149 |
"year=s" => \$cmdline_year,
|
| 150 |
"month=s" => \$cmdline_month,
|
| 151 |
"message=s" => \$cmdline_msg,
|
| 152 |
|
| 153 |
"sdb=s" => \$cmdline_file,
|
| 154 |
);
|
| 155 |
|
| 156 |
|
| 157 |
# init commandline parser
|
| 158 |
Getopt::Long::config('bundling', 'no_getopt_compat', 'no_auto_abbrev');
|
| 159 |
|
| 160 |
# process commandline options
|
| 161 |
GetOptions(%opthash)
|
| 162 |
or syntax_msg("error parsing options");
|
| 163 |
}
|
| 164 |
|
| 165 |
|
| 166 |
my @langs = @ARGV;
|
| 167 |
|
| 168 |
Spider::spider($cmdline_year, $cmdline_month, $cmdline_msg, $check_bts, $cmdline_file, @langs);
|
| 169 |
|
| 170 |
=head1 LICENSE
|
| 171 |
|
| 172 |
This program is free software; you can redistribute it and/or modify it under
|
| 173 |
the terms of the GNU General Public License as published by the Free Software
|
| 174 |
Foundation; either version 2 of the License, or (at your option) any later
|
| 175 |
version.
|
| 176 |
|
| 177 |
This program is distributed in the hope that it will be useful, but WITHOUT ANY
|
| 178 |
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
| 179 |
PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
| 180 |
# You should have received a copy of the GNU General Public License
|
| 181 |
along with this program; if not, write to the Free Software Foundation, Inc.,
|
| 182 |
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
| 183 |
|
| 184 |
=head1 COPYRIGHT (C)
|
| 185 |
|
| 186 |
2003,2004 Tim Dijkstra
|
| 187 |
2004 Nicolas Bertolissio
|
| 188 |
2004 Martin Quinson
|
| 189 |
|
| 190 |
=cut
|
| 191 |
|
| 192 |
1;
|