aboutsummaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
Diffstat (limited to 'bin')
-rwxr-xr-xbin/import-flickr25
-rwxr-xr-xbin/make_emptyhomes_po14
-rwxr-xr-xbin/problem-creation-graph6
3 files changed, 19 insertions, 26 deletions
diff --git a/bin/import-flickr b/bin/import-flickr
index a6521fed5..10ccba7ed 100755
--- a/bin/import-flickr
+++ b/bin/import-flickr
@@ -6,7 +6,7 @@
# Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved.
# Email: matthew@mysociety.org. WWW: http://www.mysociety.org
#
-# $Id: import-flickr,v 1.7 2008-05-06 14:21:43 matthew Exp $
+# $Id: import-flickr,v 1.8 2008-10-09 14:20:53 matthew Exp $
use strict;
require 5.8.0;
@@ -18,6 +18,7 @@ use lib "$FindBin::Bin/../../perllib";
use File::Slurp;
use LWP::Simple;
+use Utils;
use mySociety::AuthToken;
use mySociety::Config;
use mySociety::DBHandle qw(dbh select_all);
@@ -38,7 +39,7 @@ BEGIN {
my $key = mySociety::Config::get('FLICKR_API');
my $url = 'http://api.flickr.com/services/rest/?method=flickr.photos.search&tags=fixmystreet&extras=geo,machine_tags&api_key=' . $key . '&user_id=';
-my $ids = select_all('select nsid from flickr');
+my $ids = select_all("select nsid from partial_user where service='flickr'");
my $result = '';
foreach (@$ids) {
my $api_lookup = get($url . $_->{nsid});
@@ -70,7 +71,7 @@ while ($result =~ /<photo id="([^"]*)" owner="([^"]*)" secret="([^"]*)" server="
sub problem_create {
my ($photo_id, $owner, $title, $lat, $lon, $image) = @_;
- my ($name, $email) = dbh()->selectrow_array('select name, email from flickr where nsid=?', {}, $owner);
+ my ($name, $email) = dbh()->selectrow_array("select name, email from partial_user where service='flickr' and nsid=?", {}, $owner);
my ($easting, $northing) = (0,0);
$name ||= '';
my $areas = '';
@@ -84,28 +85,20 @@ sub problem_create {
$areas = ',' . join(',', sort keys %$areas) . ',';
}
my $id = dbh()->selectrow_array("select nextval('problem_id_seq')");
- # This is horrid
- my $s = dbh()->prepare("insert into problem
+ Utils::workaround_pg_bytea("insert into problem
(id, postcode, easting, northing, title, detail, name,
email, phone, photo, state, used_map, anonymous, category, areas)
values
- (?, '', ?, ?, ?, '', ?, ?, '', ?, 'flickr', 't', 'f', '', ?)");
- $s->bind_param(1, $id);
- $s->bind_param(2, $easting);
- $s->bind_param(3, $northing);
- $s->bind_param(4, $title);
- $s->bind_param(5, $name);
- $s->bind_param(6, $email);
- $s->bind_param(7, $image, { pg_type => DBD::Pg::PG_BYTEA });
- $s->bind_param(8, $areas);
- $s->execute();
+ (?, '', ?, ?, ?, '', ?, ?, '', ?, 'partial', 't', 'f', '', ?)", 7,
+ $id, $easting, $northing, $title, $name, $email, $image, $areas
+ );
dbh()->do('insert into flickr_imported (id, problem_id) values (?, ?)', {}, $photo_id, $id);
# XXX: Needs to only send email once to user per batch of photos, not one per photo?
my $template = File::Slurp::read_file("$FindBin::Bin/../templates/emails/flickr-submit");
my %h = ();
- my $token = mySociety::AuthToken::store('flickr', $id);
+ my $token = mySociety::AuthToken::store('partial', $id);
$h{name} = $name;
$h{url} = mySociety::Config::get('BASE_URL') . '/L/' . $token;
diff --git a/bin/make_emptyhomes_po b/bin/make_emptyhomes_po
index 462af7485..5df24928e 100755
--- a/bin/make_emptyhomes_po
+++ b/bin/make_emptyhomes_po
@@ -56,22 +56,22 @@ while(<MAINPO>) {
$buffer =~ s/^msgid "/msgstr "/;
}
- # Basics
+ # Basics
$buffer =~ s/FixMyStreet/Empty Homes Agency/g;
$buffer =~ s/\bproblem\b/empty property/g;
$buffer =~ s/\bProblem\b/Empty property/g;
$buffer =~ s/\bproblems\b/empty properties/g;
$buffer =~ s/\bProblems\b/Empty properties/g;
- $buffer =~ s/a empty/an empty/g;
- $buffer =~ s/fixed/returned to use/g;
+ $buffer =~ s/a empty/an empty/g;
+ $buffer =~ s/fixed/returned to use/g;
- $buffer =~ s/Recently put back into use empty properties/Recent empty properties put back into use/;
- $buffer =~ s/New empty properties/New empty property reports/;
- $buffer =~ s/Older empty properties/Older empty property reports/;
+ $buffer =~ s/Recently put back into use empty properties/Recent empty properties put back into use/;
+ $buffer =~ s/New empty properties/New empty property reports/;
+ $buffer =~ s/Older empty properties/Older empty property reports/;
$buffer =~ s/Report, view, or discuss local empty properties/Report and view empty properties/;
$buffer =~ s/\(like graffiti.*\)/ /;
- $buffer =~ s/(Please enter your full name).*? -/$1 -/;
+ $buffer =~ s/(Please enter your full name).*? -/$1 -/;
$buffer =~ s/We send it to the council on your behalf/The details will be sent directly to the right person in the local council for them to take action/;
$buffer =~ s/To find out what local alerts we have for you/To find out what local alerts we have in your area, council or ward/;
diff --git a/bin/problem-creation-graph b/bin/problem-creation-graph
index b039b4256..6aabdecbd 100755
--- a/bin/problem-creation-graph
+++ b/bin/problem-creation-graph
@@ -5,7 +5,7 @@
# Copyright (c) 2008 UK Citizens Online Democracy. All rights reserved.
# Email: francis@mysociety.org. WWW: http://www.mysociety.org/
#
-# $Id: problem-creation-graph,v 1.3 2008-04-11 11:27:32 francis Exp $
+# $Id: problem-creation-graph,v 1.4 2008-10-09 14:20:53 matthew Exp $
GPLOT_OUTPUT="set terminal png font 'Vera.ttf' 9 size 1200,400"
EXTENSION=".png"
@@ -51,7 +51,7 @@ grab_data "where state not in ('unconfirmed', 'confirmed', 'fixed', 'hidden')" $
#or state = 'confirmed'
#or state = 'fixed'
#or state = 'hidden'
-#or state = 'flickr'
+#or state = 'partial'
cat >$GPSCRIPT <<END
@@ -82,7 +82,7 @@ cat >$GPSCRIPT <<END
"$SOURCEB" using 1:2 with impulses lt 4 lw 15 title "confirmed",\
"$SOURCEC" using 1:2 with impulses lt 5 lw 15 title "fixed",\
"$SOURCED" using 1:2 with impulses lt 6 lw 15 title "hidden",\
- "$SOURCEE" using 1:2 with impulses lt 7 lw 15 title "flickr (and any other types)",\
+ "$SOURCEE" using 1:2 with impulses lt 7 lw 15 title "partial (and any other types)",\
"< awk 'BEGIN { n = 0 } { n += \$2; print \$1, \$2, n; }' $SOURCEA" using 1:3 axes x1y2 with lines lt 2 title "cumulative total number of problems"
END
#echo "gpscript $GPSCRIPT"