Skip to content

Instantly share code, notes, and snippets.

@bobpp
Last active December 18, 2015 01:19
Show Gist options
  • Save bobpp/5703431 to your computer and use it in GitHub Desktop.
Save bobpp/5703431 to your computer and use it in GitHub Desktop.
FM Aichi studio image capture

FM-Aichi Studio image capture

install

$ carton install

how to use

$ carton exec perl gistfile1.pl

how to stop

Ctrl + C

requires 'LWP::UserAgent';
use strict;
use warnings;
use LWP::UserAgent;
use Time::Local;
use POSIX qw/strftime/;
my $lwp = LWP::UserAgent->new;
while (1) {
my $now = strftime('%Y%m%d%H%M%S', localtime());
my $res = $lwp->get('http://fma.co.jp/camera/image5.jpg');
if ($res->is_success) {
open my $fh, "> $now.jpg";
print $fh $res->content;
close $fh;
}
sleep 1;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment