blob: d81df9321e82dc5bc74c752a7c590d0abef7cbd2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
#!/usr/bin/env perl
use strict;
use warnings;
BEGIN {
use File::Basename qw(dirname);
use File::Spec;
my $d = dirname(File::Spec->rel2abs($0));
require "$d/../setenv.pl";
}
use FixMyStreet::DB;
use Open311::PopulateServiceList;
use Getopt::Long::Descriptive;
my ($opt, $usage) = describe_options(
'%c %o',
['body|b:s', "body name to only fetch this body"],
['verbose|v', "print out all services as they are found"],
['warn|w', "output warnings about any issues"],
['help', "print usage message and exit" ],
);
$usage->die if $opt->help;
my $bodies = FixMyStreet::DB->resultset('Body')->search( {
# Until Oxfordshire does
name => { -not_in => [ 'Oxfordshire County Council' ] },
send_method => 'Open311'
} );
if ($opt->body) {
$bodies = $bodies->search({ name => $opt->body });
}
my $verbose = 0;
$verbose = 1 if $opt->warn;
$verbose = 2 if $opt->verbose;
my $p = Open311::PopulateServiceList->new( bodies => $bodies, verbose => $verbose );
$p->process_bodies;
|