Skip to content

Commit 2a0ae59

Browse files
committed
Merge branch 'master' of https://github.com/abeverley/wihlo
2 parents 7327d15 + 1305558 commit 2a0ae59

File tree

2 files changed

+46
-2
lines changed

2 files changed

+46
-2
lines changed

bin/read.pl

+1-2
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,11 @@
3131
use LWP::UserAgent;
3232
use URI;
3333
use Ouch;
34-
use Config::YAML;
3534
use Try::Tiny;
3635

3736
sub rainin($);
3837

39-
my $config = Config::YAML->new(config => "config.yml");
38+
my $config = config;
4039

4140
my %arg_hsh;
4241
$arg_hsh{baudrate} = $config->{stations}->{vp}->{baudrate};

bin/webcam.pl

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
#!/usr/bin/env perl
2+
3+
=pod
4+
Wihlo - Web-based weather logging and display software
5+
Copyright (C) 2015 A Beverley
6+
7+
This program is free software: you can redistribute it and/or modify
8+
it under the terms of the GNU Affero General Public License as
9+
published by the Free Software Foundation, either version 3 of the
10+
License, or (at your option) any later version.
11+
12+
This program is distributed in the hope that it will be useful,
13+
but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15+
GNU Affero General Public License for more details.
16+
17+
You should have received a copy of the GNU Affero General Public License
18+
along with this program. If not, see <http://www.gnu.org/licenses/>.
19+
=cut
20+
21+
use FindBin;
22+
use lib "$FindBin::Bin/../lib";
23+
24+
use Dancer2;
25+
use Dancer2::Plugin::DBIC qw(schema resultset rset);
26+
use DateTime;
27+
use Image::Magick;
28+
use LWP::Simple qw//;
29+
use Wihlo::Schema;
30+
31+
my $image = LWP::Simple::get("http://192.168.1.201/img/snapshot.cgi");
32+
33+
my $imgm = Image::Magick->new(magick => 'jpg');
34+
$imgm->BlobToImage($image);
35+
$imgm->Resize(width => '64', height => '64');
36+
$imgm->write(filename => 'xx.jpg');
37+
my $thumbnail = $imgm->ImageToBlob;
38+
39+
rset('Webcam')->create({
40+
time => DateTime->now,
41+
image => $image,
42+
thumbnail => $thumbnail,
43+
});
44+
45+
1;

0 commit comments

Comments
 (0)