From 4c09ec03e2afd5ba98d34be91fdb5cecaa965ce2 Mon Sep 17 00:00:00 2001 From: Kentaro Kuribayashi Date: Thu, 25 Mar 2010 13:05:04 +0900 Subject: [PATCH] =?UTF-8?q?app=E3=81=AB=E3=81=97=E3=81=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Gyazolife.app/Contents/Info.plist | 14 ++++++++++ Gyazolife.app/Contents/MacOS/core.sh | 4 +++ Gyazolife.app/Contents/MacOS/gyazolife | 26 +++++++++++++++++++ README.md | 36 ++++++++++++++++++++++++++ 4 files changed, 80 insertions(+) create mode 100644 Gyazolife.app/Contents/Info.plist create mode 100755 Gyazolife.app/Contents/MacOS/core.sh create mode 100755 Gyazolife.app/Contents/MacOS/gyazolife create mode 100644 README.md diff --git a/Gyazolife.app/Contents/Info.plist b/Gyazolife.app/Contents/Info.plist new file mode 100644 index 0000000..7a544de --- /dev/null +++ b/Gyazolife.app/Contents/Info.plist @@ -0,0 +1,14 @@ + + + + + CFBundleExecutable + core.sh + CFBundleIconFile + icon.icns + CFBundlePackageType + APPL + CFBundleSignature + ???? + + diff --git a/Gyazolife.app/Contents/MacOS/core.sh b/Gyazolife.app/Contents/MacOS/core.sh new file mode 100755 index 0000000..aa8ff71 --- /dev/null +++ b/Gyazolife.app/Contents/MacOS/core.sh @@ -0,0 +1,4 @@ +#!/bin/sh + +/Applications/Gyazolife.app/Contents/MacOS/gyazolife & +exit 0 diff --git a/Gyazolife.app/Contents/MacOS/gyazolife b/Gyazolife.app/Contents/MacOS/gyazolife new file mode 100755 index 0000000..18b45cc --- /dev/null +++ b/Gyazolife.app/Contents/MacOS/gyazolife @@ -0,0 +1,26 @@ +#!/usr/bin/env perl +use strict; +use warnings; +use Config::Pit; +use WebService::Hatena::Fotolife; + +my $config = pit_get('hatena.ne.jp'); +my $filename = '/tmp/gyazolife.png'; +unlink $filename if -e $filename; + +if (!system "screencapture -i $filename") { + my $hatena = WebService::Hatena::Fotolife->new; + $hatena->username($config->{username}); + $hatena->password($config->{password}); + + my ($date) = $hatena->createEntry( + title => $ARGV[0], + filename => $filename, + folder => $config->{fotolife}{folder} || '', + ) =~ /(\d{14})$/; + my $url = sprintf "http://f.hatena.ne.jp/%s/%s", $config->{username}, $date; + + unlink $filename; + system "echo $url | pbcopy"; + system "open $url"; +} diff --git a/README.md b/README.md new file mode 100644 index 0000000..9944086 --- /dev/null +++ b/README.md @@ -0,0 +1,36 @@ +# Gyazolife + +gyazoっぽい感じでフォトライフにスクリーンショットをアップロードします。 + +## 依存モジュール + +以下のモジュールをあらかじめCPANからインストールしてください。 + +- WebService::Hatena::Fotolife +- Config::Pit + +## 使い方 + +Config::PitをCPANらインストールした後、 + + $ ppit set hatena.ne.jp + +とすると、エディタが起動するので、以下のようなYAMLを記述してください。 + + --- + "username": はてなID + "password": パスワード + "fotolife": + "folder": アップロード先フォルダ(なければ空でいいです) + +あとは、Gyazolife.appを/Application以下にコピーして適当に実行してください。 + +## COPYRIGHT AND LICENSE (The MIT License) + +Copyright (c) Kintaro Kuribayashi + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.