aboutsummaryrefslogtreecommitdiffstats
path: root/bin/populate_bing_cache
diff options
context:
space:
mode:
authorStruan Donald <struan@exo.org.uk>2011-09-09 19:24:09 +0100
committerStruan Donald <struan@exo.org.uk>2011-09-09 19:24:09 +0100
commitd1020f6d455aa729ca52d18ccb39d531a866f4fc (patch)
treea9a02c62afc20b54d8f934766b9515050de02606 /bin/populate_bing_cache
parent63e03938cbc9401eccf36bdce8f312f171559c80 (diff)
sort of working rss address stuff with db caching and populate script
Diffstat (limited to 'bin/populate_bing_cache')
-rw-r--r--bin/populate_bing_cache30
1 files changed, 30 insertions, 0 deletions
diff --git a/bin/populate_bing_cache b/bin/populate_bing_cache
new file mode 100644
index 000000000..50f7fc673
--- /dev/null
+++ b/bin/populate_bing_cache
@@ -0,0 +1,30 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+require 5.8.0;
+
+use Data::Dumper;
+
+use FixMyStreet::App;
+use FixMyStreet::Geocode::Bing;
+
+my $reports = FixMyStreet::App->model('DB::Problem')->search( {geocode
+ => undef }, { select => [qw/id geocode confirmed latitude longitude/] } );
+
+while ( my $report = $reports->next ) {
+ next unless $report->latitude && $report->longitude;
+ print $report->id . "\n";
+
+ my $j = FixMyStreet::Geocode::Bing::reverse( $report->latitude, $report->longitude );
+
+ # FIXME: something in this string causes RABX to read in 1 too many
+ # characters when pulling it back out the database and hence it explodes
+ # as it reads the ,. I have no idea why :(
+ $j->{copyright} = '';
+
+ $report->geocode( $j );
+ $report->update;
+
+ sleep 10;
+}