2007-11-21
Fotolife uploader like Gyazo
#!/opt/local/bin/perl use YAML; use IPC::Run qw(run); use WebService::Hatena::Fotolife; # config file must be YAML-formatted: # hatena_id: your-hatena-id # hatena_password: your-hatena-password my $conf = YAML::LoadFile('/Users/kentaro/.online_accounts'); my $filename = '/tmp/screencapture.png'; if (run(['screencapture', '-i', $filename])) { my $hatena = WebService::Hatena::Fotolife->new; $hatena->username($conf->{hatena_id}); $hatena->password($conf->{hatena_password}); my ($date) = $hatena->createEntry( title => $ARGV[0], filename => $filename, ) =~ /(\d{14})$/; my $url = sprintf "http://f.hatena.ne.jp/%s/%s", $conf->{hatena_id}, $date; run(['echo', $url], '|', [qw(pbcopy)]); print "Successfully uploaded: $url\n"; }
コメントを書く