twitterpunch 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE +20 -0
- data/README.md +110 -0
- data/bin/twitterpunch +82 -0
- data/lib/twitterpunch.rb +3 -0
- data/lib/twitterpunch/configuration.rb +67 -0
- data/lib/twitterpunch/logger.rb +34 -0
- data/lib/twitterpunch/poster.rb +21 -0
- data/lib/twitterpunch/streamer.rb +63 -0
- data/resources/Twitterpunch.workflow/Contents/Info.plist +8 -0
- data/resources/Twitterpunch.workflow/Contents/QuickLook/Thumbnail.png +0 -0
- data/resources/Twitterpunch.workflow/Contents/document.wflow +194 -0
- data/resources/say.vbs +4 -0
- metadata +146 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: ba9e98cad4bdd2f862bae14d2748481537a86969
|
4
|
+
data.tar.gz: bfeeb93d6c2d9123c116411c341fc7bb7d9570c4
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: ee6ab95ecaacb496975e50752219257aa21cc540ddbb8c33278da800f60371a0e6978b11741bfd2af624a52b890fcd9c30bb0f8aea863d3c7960230f9f15599e
|
7
|
+
data.tar.gz: 13b3444517740d22b3332922a64082d0a604d5e83de7628b2abb5d90c91e47ff6cd6bf4cea64816e46084a100a49c6ad29e30015d825c4945f0245b327593bfa
|
data/LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2014 Ben Ford <binford2k@gmail.com>
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,110 @@
|
|
1
|
+
Twitterpunch
|
2
|
+
===============
|
3
|
+
|
4
|
+
Twitterpunch is designed to work with PhotoBooth and OS X Folder Actions.
|
5
|
+
When this script is called with the name of an image file, it will post the
|
6
|
+
image to Twitter, along with a message randomly chosen from a list and a
|
7
|
+
specified hashtag.
|
8
|
+
|
9
|
+
If you call the script with the --stream argument instead, it will listen
|
10
|
+
for tweets to that hashtag and download them to a specified directory. If
|
11
|
+
the tweet came from another user, Twitterpunch will speak it aloud.
|
12
|
+
|
13
|
+
Configuration
|
14
|
+
===========
|
15
|
+
|
16
|
+
Configure the program via the `~/.twitterpunch.yaml` YAML file. This file should
|
17
|
+
look similar to the example below.
|
18
|
+
|
19
|
+
---
|
20
|
+
:twitter:
|
21
|
+
:consumer_key: <consumer key>
|
22
|
+
:consumer_secret: <consumer secret>
|
23
|
+
:access_token: <access token>
|
24
|
+
:access_token_secret: <access secret>
|
25
|
+
:messages:
|
26
|
+
- Hello there
|
27
|
+
- I'm a posting fool
|
28
|
+
- minimally viable product
|
29
|
+
:hashtag: BestHalloweenPartyEver
|
30
|
+
:handle: FassFord
|
31
|
+
:photodir: ~/Pictures/twitterpunch/
|
32
|
+
:logfile: /Users/ben/.twitterpunch.log
|
33
|
+
:sendsound: /System/Library/PrivateFrameworks/ToneLibrary.framework/Versions/A/Resources/AlertTones/tweet_sent.caf
|
34
|
+
|
35
|
+
A skeleton configuration file, with access tokens from Twitter, can be generated
|
36
|
+
by running the program with the `--genconfig` flag.
|
37
|
+
|
38
|
+
Usage
|
39
|
+
==========
|
40
|
+
|
41
|
+
### Using OS X PhotoBooth
|
42
|
+
|
43
|
+
1. Start PhotoBooth at least once to generate its library.
|
44
|
+
1. Install the Twitterpunch Folder Action
|
45
|
+
* `twitterpunch --install`
|
46
|
+
* It may claim that it could not be attached, fear not.
|
47
|
+
1. Profit!
|
48
|
+
* _and by that, I mean take some shots with PhotoBooth!_
|
49
|
+
|
50
|
+
#### Troubleshooting.
|
51
|
+
|
52
|
+
1. Make sure the folder action is installed properly
|
53
|
+
1. Use the Finder to navigate to `~/Pictures/`
|
54
|
+
1. Right click on the `Photo Booth Library` icon and choose _Show Package Contents_.
|
55
|
+
1. Right click on the `Pictures` folder and choose `Services > Folder Actions Setup`
|
56
|
+
1. Make sure that the `Twitterpunch` action is attached.
|
57
|
+
1. Install the folder action
|
58
|
+
1. Open the `resources` folder of this gem.
|
59
|
+
* Likely to be found in `/Library/Ruby/Gems/2.0.0/gems/twitterpunch-#{version}/resources/`.
|
60
|
+
1. Double click on the `Twitterpunch` folder action and install it.
|
61
|
+
* It may claim that it could not be attached, fear not.
|
62
|
+
|
63
|
+
### Using something else
|
64
|
+
|
65
|
+
Configure the program you are using for your photo shoot to call Twitterpunch
|
66
|
+
each time it snaps a photo. Pass the name of the new photo as a command line
|
67
|
+
argument. Alternatively, you could batch them, as Twitterpunch can accept
|
68
|
+
multiple files at once.
|
69
|
+
|
70
|
+
[ben@ganymede] ~ $ twitterpunch photo.jpg
|
71
|
+
|
72
|
+
### Viewing the Twitter stream
|
73
|
+
|
74
|
+
Currently Twitterpunch doesn't display photos directly. It simply downloads them
|
75
|
+
and stuffs them into the configured `:photodir`. Twitterpunch will run on OS X or
|
76
|
+
Windows equally well. Simply configure it on the computer that will act as the
|
77
|
+
Twitter display and then run in streaming mode. Tweets that come from any other
|
78
|
+
user will be spoken aloud.
|
79
|
+
|
80
|
+
[ben@ganymede] ~ $ twitterpunch --stream
|
81
|
+
|
82
|
+
There are currently two decent viewing options I am aware of.
|
83
|
+
|
84
|
+
* Windows background image:
|
85
|
+
* Configure the Windows background to randomly cycle through photos in a directory.
|
86
|
+
* Hide desktop icons.
|
87
|
+
* Hide the taskbar.
|
88
|
+
* Disable screensaver and power savings.
|
89
|
+
* Drawbacks: You're using Windows and you have to install Ruby & RubyGems manually.
|
90
|
+
* OS X screensaver:
|
91
|
+
* Choose one of the sexy screensavers and configure it to show photos from the `:photodir`
|
92
|
+
* Set screensaver to a super short timeout.
|
93
|
+
* Disable power savings.
|
94
|
+
* Drawbacks: The screensaver doesn't reload dynamically, so I have to kick it
|
95
|
+
and you'll see it reloading each time a new tweet comes in.
|
96
|
+
|
97
|
+
Limitations
|
98
|
+
===========
|
99
|
+
|
100
|
+
* It currently requires manual setup for Folder Actions.
|
101
|
+
* It currently requires an external viewer, such as a screensaver.
|
102
|
+
|
103
|
+
|
104
|
+
Contact
|
105
|
+
=======
|
106
|
+
|
107
|
+
* Author: Ben Ford
|
108
|
+
* Email: binford2k@gmail.com
|
109
|
+
* Twitter: @binford2k
|
110
|
+
* IRC (Freenode): binford2k
|
data/bin/twitterpunch
ADDED
@@ -0,0 +1,82 @@
|
|
1
|
+
#! /usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'twitter'
|
5
|
+
require 'optparse'
|
6
|
+
require "net/http"
|
7
|
+
require 'yaml'
|
8
|
+
|
9
|
+
require 'twitterpunch'
|
10
|
+
|
11
|
+
configfile = File.expand_path('~/.twitterpunch.yaml')
|
12
|
+
config = YAML.load_file(configfile) rescue {}
|
13
|
+
|
14
|
+
optparse = OptionParser.new { |opts|
|
15
|
+
opts.banner = "Usage : twitterpunch [--debug] [--stream] [--install] [--version] [filename]
|
16
|
+
|
17
|
+
Twitterpunch is designed to work with PhotoBooth and OS X Folder Actions.
|
18
|
+
When this script is called with the name of an image file, it will post the
|
19
|
+
image to Twitter, along with a randomly chosen message and a hashtag.
|
20
|
+
|
21
|
+
If you call the script with the --stream argument instead, it will listen
|
22
|
+
for tweets to that hashtag and download them to a specified directory. If
|
23
|
+
the tweet came from another user, Twitterpunch will speak it aloud.
|
24
|
+
|
25
|
+
"
|
26
|
+
|
27
|
+
opts.on("-d", "--debug", "Choose an alternate provisioning backend.") do
|
28
|
+
config[:debug] = true
|
29
|
+
end
|
30
|
+
|
31
|
+
opts.on("-s", "--stream", "Stream tweets from the specified hashtag.") do
|
32
|
+
config[:action] = :stream
|
33
|
+
end
|
34
|
+
|
35
|
+
opts.on("-g", "--genconfig", "Create a default configuration file.") do
|
36
|
+
config[:action] = :configure
|
37
|
+
end
|
38
|
+
|
39
|
+
opts.on("-i", "--install", "Install the Folder Action workflow (OS X only).") do
|
40
|
+
config[:action] = :install
|
41
|
+
end
|
42
|
+
|
43
|
+
opts.on("-v", "--version", "Display version information.") do
|
44
|
+
puts "Twitterpunch v#{Twitterpunch::VERSION}"
|
45
|
+
exit 0
|
46
|
+
end
|
47
|
+
|
48
|
+
opts.separator('')
|
49
|
+
|
50
|
+
opts.on("-h", "--help", "Displays this help") do
|
51
|
+
puts opts
|
52
|
+
exit
|
53
|
+
end
|
54
|
+
}
|
55
|
+
optparse.parse!
|
56
|
+
|
57
|
+
config[:resources] = File.expand_path("#{File.dirname(__FILE__)}/../resources")
|
58
|
+
config[:action] = :post if ARGV.size > 0 and config[:action].nil?
|
59
|
+
|
60
|
+
case config[:action]
|
61
|
+
when :stream
|
62
|
+
require 'twitterpunch/streamer'
|
63
|
+
client = Twitterpunch::Streamer.new(config)
|
64
|
+
client.stream
|
65
|
+
|
66
|
+
when :post
|
67
|
+
require 'twitterpunch/poster'
|
68
|
+
client = Twitterpunch::Poster.new(config)
|
69
|
+
client.post(ARGV)
|
70
|
+
|
71
|
+
when :configure
|
72
|
+
require 'twitterpunch/configuration'
|
73
|
+
cfg = Twitterpunch::Configuration.new(configfile).save
|
74
|
+
puts "Please edit #{configfile} to configure."
|
75
|
+
|
76
|
+
when :install
|
77
|
+
system('open', "#{config[:resources]}/Twitterpunch.workflow")
|
78
|
+
|
79
|
+
else
|
80
|
+
puts "Run twitterpunch --help for usage."
|
81
|
+
exit 1
|
82
|
+
end
|
data/lib/twitterpunch.rb
ADDED
@@ -0,0 +1,67 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'oauth'
|
3
|
+
require 'yaml'
|
4
|
+
|
5
|
+
module Twitterpunch
|
6
|
+
class Configuration
|
7
|
+
|
8
|
+
def initialize(file)
|
9
|
+
@configfile = file
|
10
|
+
|
11
|
+
puts "Set up your application at https://twitter.com/apps/"
|
12
|
+
puts "then enter your 'Consumer key' and 'Consumer secret':"
|
13
|
+
|
14
|
+
print "Consumer key: "
|
15
|
+
@consumer_key = STDIN.readline.chomp
|
16
|
+
print "Consumer secret: "
|
17
|
+
@consumer_secret = STDIN.readline.chomp
|
18
|
+
|
19
|
+
consumer = OAuth::Consumer.new(
|
20
|
+
@consumer_key,
|
21
|
+
@consumer_secret,
|
22
|
+
{
|
23
|
+
:site => 'https://api.twitter.com/',
|
24
|
+
:scheme => :header,
|
25
|
+
})
|
26
|
+
|
27
|
+
request_token = consumer.get_request_token
|
28
|
+
|
29
|
+
puts "Visit #{request_token.authorize_url} in your browser to authorize the app"
|
30
|
+
# if we're on a Mac, open the page automatically
|
31
|
+
system("open #{request_token.authorize_url} 2>/dev/null")
|
32
|
+
|
33
|
+
print "Please enter the PIN you are given: "
|
34
|
+
pin = STDIN.readline.chomp
|
35
|
+
|
36
|
+
@access_token = request_token.get_access_token(:oauth_verifier => pin)
|
37
|
+
end
|
38
|
+
|
39
|
+
def save
|
40
|
+
config = YAML.load_file(@configfile) rescue defaults
|
41
|
+
|
42
|
+
config[:twitter] = {
|
43
|
+
:consumer_key => "#{@consumer_key}",
|
44
|
+
:consumer_secret => "#{@consumer_secret}",
|
45
|
+
:access_token => "#{@access_token.token}",
|
46
|
+
:access_token_secret => "#{@access_token.secret}"
|
47
|
+
}
|
48
|
+
|
49
|
+
File.open(@configfile, 'w') {|f| f.write(config.to_yaml) }
|
50
|
+
end
|
51
|
+
|
52
|
+
def defaults
|
53
|
+
{
|
54
|
+
:messages => [
|
55
|
+
"Hello there",
|
56
|
+
"I'm a posting fool",
|
57
|
+
"minimally viable product"
|
58
|
+
],
|
59
|
+
:hashtag => "BestHalloweenPartyEver",
|
60
|
+
:handle => "fassford",
|
61
|
+
:photodir => "~/Pictures/twitterpunch/",
|
62
|
+
:logfile => '/var/log/twitterpunch',
|
63
|
+
:sendsound => "/System/Library/PrivateFrameworks/ToneLibrary.framework/Versions/A/Resources/AlertTones/tweet_sent.caf",
|
64
|
+
}
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'colorize'
|
3
|
+
require 'logger'
|
4
|
+
require 'fileutils'
|
5
|
+
|
6
|
+
module Twitterpunch
|
7
|
+
class Logger
|
8
|
+
def initialize(config)
|
9
|
+
@options = config
|
10
|
+
@logger = ::Logger.new(config[:logfile])
|
11
|
+
|
12
|
+
@logger.level = config[:debug] ? ::Logger::DEBUG : ::Logger::INFO
|
13
|
+
end
|
14
|
+
|
15
|
+
def error(message)
|
16
|
+
puts message.red
|
17
|
+
@logger.error(message)
|
18
|
+
end
|
19
|
+
|
20
|
+
def debug(message)
|
21
|
+
return unless @options[:debug]
|
22
|
+
puts message.yellow
|
23
|
+
@logger.debug(message)
|
24
|
+
end
|
25
|
+
|
26
|
+
def info(message)
|
27
|
+
puts message.green unless @options[:quiet]
|
28
|
+
end
|
29
|
+
|
30
|
+
def log(username, message)
|
31
|
+
@logger.info(sprintf("%15s: %s", username, message))
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'twitter'
|
3
|
+
|
4
|
+
module Twitterpunch
|
5
|
+
class Poster
|
6
|
+
def initialize(config)
|
7
|
+
@config = config
|
8
|
+
@client = Twitter::REST::Client.new(config[:twitter])
|
9
|
+
end
|
10
|
+
|
11
|
+
def post(files)
|
12
|
+
files.each do |img|
|
13
|
+
|
14
|
+
message = "#{@config[:messages].sample} ##{@config[:hashtag]}"
|
15
|
+
@client.update_with_media(message, File.new(File.expand_path(img)))
|
16
|
+
|
17
|
+
system("afplay #{@config[:sendsound]}")
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,63 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'yaml'
|
3
|
+
require 'twitter'
|
4
|
+
require "net/http"
|
5
|
+
|
6
|
+
require 'twitterpunch/logger'
|
7
|
+
|
8
|
+
module Twitterpunch
|
9
|
+
class Streamer
|
10
|
+
def initialize(config)
|
11
|
+
@config = config
|
12
|
+
@client = Twitter::Streaming::Client.new(config[:twitter])
|
13
|
+
@logger = Twitterpunch::Logger.new(config)
|
14
|
+
@output = File.expand_path(config[:photodir])
|
15
|
+
|
16
|
+
FileUtils.mkdir_p(@output) unless File.directory?(@output)
|
17
|
+
end
|
18
|
+
|
19
|
+
def stream
|
20
|
+
begin
|
21
|
+
@client.filter(:track => @config[:hashtag]) do |tweet|
|
22
|
+
if tweet.is_a?(Twitter::Tweet)
|
23
|
+
@logger.info(tweet.text)
|
24
|
+
@logger.log(tweet.user.screen_name, tweet.text)
|
25
|
+
|
26
|
+
|
27
|
+
unless tweet.user.screen_name == @config[:handle]
|
28
|
+
message = "#{tweet.user.name} says #{tweet.text.gsub(/ http\S*/,'').gsub(/#\S*/,'')}"
|
29
|
+
|
30
|
+
case RUBY_PLATFORM
|
31
|
+
when /mingw|cygwin/
|
32
|
+
system('cscript', "#{@config[:resources]}/say.vbs", message)
|
33
|
+
when /darwin/
|
34
|
+
system('say', message)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
if tweet.media?
|
39
|
+
uri = tweet.media.first.media_uri
|
40
|
+
|
41
|
+
http = Net::HTTP.new(uri.host, uri.port)
|
42
|
+
request = Net::HTTP::Get.new(uri.request_uri)
|
43
|
+
response = http.request(request)
|
44
|
+
|
45
|
+
File.open("#{@output}/#{File.basename uri.path}", 'wb') do |file|
|
46
|
+
file.write(response.body)
|
47
|
+
end
|
48
|
+
|
49
|
+
# OS X screensaver doesn't reload images dynamically. This kinda sucks.
|
50
|
+
if RUBY_PLATFORM =~ /darwin/
|
51
|
+
system('osascript', '-e', 'tell application "System Events" to stop current screen saver')
|
52
|
+
system('osascript', '-e', 'tell application "System Events" to start current screen saver')
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
rescue Interrupt => e
|
58
|
+
@logger.error "Exiting: #{e.message}"
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
end
|
63
|
+
end
|
Binary file
|
@@ -0,0 +1,194 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
3
|
+
<plist version="1.0">
|
4
|
+
<dict>
|
5
|
+
<key>AMApplicationBuild</key>
|
6
|
+
<string>409</string>
|
7
|
+
<key>AMApplicationVersion</key>
|
8
|
+
<string>2.5</string>
|
9
|
+
<key>AMDocumentVersion</key>
|
10
|
+
<string>2</string>
|
11
|
+
<key>actions</key>
|
12
|
+
<array>
|
13
|
+
<dict>
|
14
|
+
<key>action</key>
|
15
|
+
<dict>
|
16
|
+
<key>AMAccepts</key>
|
17
|
+
<dict>
|
18
|
+
<key>Container</key>
|
19
|
+
<string>List</string>
|
20
|
+
<key>Optional</key>
|
21
|
+
<true/>
|
22
|
+
<key>Types</key>
|
23
|
+
<array>
|
24
|
+
<string>com.apple.cocoa.string</string>
|
25
|
+
</array>
|
26
|
+
</dict>
|
27
|
+
<key>AMActionVersion</key>
|
28
|
+
<string>2.0.3</string>
|
29
|
+
<key>AMApplication</key>
|
30
|
+
<array>
|
31
|
+
<string>Automator</string>
|
32
|
+
</array>
|
33
|
+
<key>AMParameterProperties</key>
|
34
|
+
<dict>
|
35
|
+
<key>COMMAND_STRING</key>
|
36
|
+
<dict/>
|
37
|
+
<key>CheckedForUserDefaultShell</key>
|
38
|
+
<dict/>
|
39
|
+
<key>inputMethod</key>
|
40
|
+
<dict/>
|
41
|
+
<key>shell</key>
|
42
|
+
<dict/>
|
43
|
+
<key>source</key>
|
44
|
+
<dict/>
|
45
|
+
</dict>
|
46
|
+
<key>AMProvides</key>
|
47
|
+
<dict>
|
48
|
+
<key>Container</key>
|
49
|
+
<string>List</string>
|
50
|
+
<key>Types</key>
|
51
|
+
<array>
|
52
|
+
<string>com.apple.cocoa.string</string>
|
53
|
+
</array>
|
54
|
+
</dict>
|
55
|
+
<key>ActionBundlePath</key>
|
56
|
+
<string>/System/Library/Automator/Run Shell Script.action</string>
|
57
|
+
<key>ActionName</key>
|
58
|
+
<string>Run Shell Script</string>
|
59
|
+
<key>ActionParameters</key>
|
60
|
+
<dict>
|
61
|
+
<key>COMMAND_STRING</key>
|
62
|
+
<string>twitterpunch "$@"
|
63
|
+
</string>
|
64
|
+
<key>CheckedForUserDefaultShell</key>
|
65
|
+
<true/>
|
66
|
+
<key>inputMethod</key>
|
67
|
+
<integer>1</integer>
|
68
|
+
<key>shell</key>
|
69
|
+
<string>/bin/bash</string>
|
70
|
+
<key>source</key>
|
71
|
+
<string></string>
|
72
|
+
</dict>
|
73
|
+
<key>BundleIdentifier</key>
|
74
|
+
<string>com.apple.RunShellScript</string>
|
75
|
+
<key>CFBundleVersion</key>
|
76
|
+
<string>2.0.3</string>
|
77
|
+
<key>CanShowSelectedItemsWhenRun</key>
|
78
|
+
<false/>
|
79
|
+
<key>CanShowWhenRun</key>
|
80
|
+
<true/>
|
81
|
+
<key>Category</key>
|
82
|
+
<array>
|
83
|
+
<string>AMCategoryUtilities</string>
|
84
|
+
</array>
|
85
|
+
<key>Class Name</key>
|
86
|
+
<string>RunShellScriptAction</string>
|
87
|
+
<key>InputUUID</key>
|
88
|
+
<string>DB163A54-D2F3-40DB-B7F7-9D384EF50448</string>
|
89
|
+
<key>Keywords</key>
|
90
|
+
<array>
|
91
|
+
<string>Shell</string>
|
92
|
+
<string>Script</string>
|
93
|
+
<string>Command</string>
|
94
|
+
<string>Run</string>
|
95
|
+
<string>Unix</string>
|
96
|
+
</array>
|
97
|
+
<key>OutputUUID</key>
|
98
|
+
<string>B8E24806-125F-40F8-8545-355BF4B1F0BA</string>
|
99
|
+
<key>UUID</key>
|
100
|
+
<string>CD6A48B8-845B-4B58-ACB1-DB6A5FDEAAB9</string>
|
101
|
+
<key>UnlocalizedApplications</key>
|
102
|
+
<array>
|
103
|
+
<string>Automator</string>
|
104
|
+
</array>
|
105
|
+
<key>arguments</key>
|
106
|
+
<dict>
|
107
|
+
<key>0</key>
|
108
|
+
<dict>
|
109
|
+
<key>default value</key>
|
110
|
+
<integer>0</integer>
|
111
|
+
<key>name</key>
|
112
|
+
<string>inputMethod</string>
|
113
|
+
<key>required</key>
|
114
|
+
<string>0</string>
|
115
|
+
<key>type</key>
|
116
|
+
<string>0</string>
|
117
|
+
<key>uuid</key>
|
118
|
+
<string>0</string>
|
119
|
+
</dict>
|
120
|
+
<key>1</key>
|
121
|
+
<dict>
|
122
|
+
<key>default value</key>
|
123
|
+
<string></string>
|
124
|
+
<key>name</key>
|
125
|
+
<string>source</string>
|
126
|
+
<key>required</key>
|
127
|
+
<string>0</string>
|
128
|
+
<key>type</key>
|
129
|
+
<string>0</string>
|
130
|
+
<key>uuid</key>
|
131
|
+
<string>1</string>
|
132
|
+
</dict>
|
133
|
+
<key>2</key>
|
134
|
+
<dict>
|
135
|
+
<key>default value</key>
|
136
|
+
<false/>
|
137
|
+
<key>name</key>
|
138
|
+
<string>CheckedForUserDefaultShell</string>
|
139
|
+
<key>required</key>
|
140
|
+
<string>0</string>
|
141
|
+
<key>type</key>
|
142
|
+
<string>0</string>
|
143
|
+
<key>uuid</key>
|
144
|
+
<string>2</string>
|
145
|
+
</dict>
|
146
|
+
<key>3</key>
|
147
|
+
<dict>
|
148
|
+
<key>default value</key>
|
149
|
+
<string></string>
|
150
|
+
<key>name</key>
|
151
|
+
<string>COMMAND_STRING</string>
|
152
|
+
<key>required</key>
|
153
|
+
<string>0</string>
|
154
|
+
<key>type</key>
|
155
|
+
<string>0</string>
|
156
|
+
<key>uuid</key>
|
157
|
+
<string>3</string>
|
158
|
+
</dict>
|
159
|
+
<key>4</key>
|
160
|
+
<dict>
|
161
|
+
<key>default value</key>
|
162
|
+
<string>/bin/sh</string>
|
163
|
+
<key>name</key>
|
164
|
+
<string>shell</string>
|
165
|
+
<key>required</key>
|
166
|
+
<string>0</string>
|
167
|
+
<key>type</key>
|
168
|
+
<string>0</string>
|
169
|
+
<key>uuid</key>
|
170
|
+
<string>4</string>
|
171
|
+
</dict>
|
172
|
+
</dict>
|
173
|
+
<key>isViewVisible</key>
|
174
|
+
<true/>
|
175
|
+
<key>location</key>
|
176
|
+
<string>309.000000:253.000000</string>
|
177
|
+
<key>nibPath</key>
|
178
|
+
<string>/System/Library/Automator/Run Shell Script.action/Contents/Resources/English.lproj/main.nib</string>
|
179
|
+
</dict>
|
180
|
+
<key>isViewVisible</key>
|
181
|
+
<true/>
|
182
|
+
</dict>
|
183
|
+
</array>
|
184
|
+
<key>connectors</key>
|
185
|
+
<dict/>
|
186
|
+
<key>workflowMetaData</key>
|
187
|
+
<dict>
|
188
|
+
<key>folderActionFolderPath</key>
|
189
|
+
<string>~/Pictures/Photo Booth Library/Pictures</string>
|
190
|
+
<key>workflowTypeIdentifier</key>
|
191
|
+
<string>com.apple.Automator.folderAction</string>
|
192
|
+
</dict>
|
193
|
+
</dict>
|
194
|
+
</plist>
|
data/resources/say.vbs
ADDED
metadata
ADDED
@@ -0,0 +1,146 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: twitterpunch
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Ben Ford
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-10-27 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: twitter
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - '>='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - '>='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: oauth
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: colorize
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - '>='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
description: "Twitterpunch\n===============\n\nTwitterpunch is designed to work with
|
56
|
+
PhotoBooth and OS X Folder Actions.\nWhen this script is called with the name of
|
57
|
+
an image file, it will post the\nimage to Twitter, along with a message randomly
|
58
|
+
chosen from a list and a\nspecified hashtag.\n\nIf you call the script with the
|
59
|
+
--stream argument instead, it will listen\nfor tweets to that hashtag and download
|
60
|
+
them to a specified directory. If\nthe tweet came from another user, Twitterpunch
|
61
|
+
will speak it aloud.\n\nConfiguration\n===========\n\nConfigure the program via
|
62
|
+
the `~/.twitterpunch.yaml` YAML file. This file should\nlook similar to the example
|
63
|
+
below.\n\n ---\n :twitter:\n :consumer_key: <consumer key>\n :consumer_secret:
|
64
|
+
<consumer secret>\n :access_token: <access token>\n :access_token_secret:
|
65
|
+
<access secret>\n :messages:\n - Hello there\n - I'm a posting fool\n -
|
66
|
+
minimally viable product\n :hashtag: BestHalloweenPartyEver\n :handle: FassFord\n
|
67
|
+
\ :photodir: ~/Pictures/twitterpunch/\n :logfile: /Users/ben/.twitterpunch.log\n
|
68
|
+
\ :sendsound: /System/Library/PrivateFrameworks/ToneLibrary.framework/Versions/A/Resources/AlertTones/tweet_sent.caf\n\nA
|
69
|
+
skeleton configuration file, with access tokens from Twitter, can be generated\nby
|
70
|
+
running the program with the `--genconfig` flag.\n\nUsage \n==========\n\n### Using
|
71
|
+
OS X PhotoBooth\n\n1. Start PhotoBooth at least once to generate its library.\n1.
|
72
|
+
Install the Twitterpunch Folder Action\n * `twitterpunch --install`\n * It
|
73
|
+
may claim that it could not be attached, fear not.\n1. Profit!\n * _and by that,
|
74
|
+
I mean take some shots with PhotoBooth!_\n\n#### Troubleshooting.\n\n1. Make sure
|
75
|
+
the folder action is installed properly\n 1. Use the Finder to navigate to `~/Pictures/`\n
|
76
|
+
\ 1. Right click on the `Photo Booth Library` icon and choose _Show Package Contents_.\n
|
77
|
+
\ 1. Right click on the `Pictures` folder and choose `Services > Folder Actions
|
78
|
+
Setup`\n 1. Make sure that the `Twitterpunch` action is attached.\n1. Install
|
79
|
+
the folder action\n 1. Open the `resources` folder of this gem.\n * Likely
|
80
|
+
to be found in `/Library/Ruby/Gems/2.0.0/gems/twitterpunch-#{version}/resources/`.\n
|
81
|
+
\ 1. Double click on the `Twitterpunch` folder action and install it.\n *
|
82
|
+
It may claim that it could not be attached, fear not.\n\n### Using something else\n\nConfigure
|
83
|
+
the program you are using for your photo shoot to call Twitterpunch\neach time it
|
84
|
+
snaps a photo. Pass the name of the new photo as a command line\nargument. Alternatively,
|
85
|
+
you could batch them, as Twitterpunch can accept\nmultiple files at once.\n\n [ben@ganymede]
|
86
|
+
~ $ twitterpunch photo.jpg\n\n### Viewing the Twitter stream\n\nCurrently Twitterpunch
|
87
|
+
doesn't display photos directly. It simply downloads them\nand stuffs them into
|
88
|
+
the configured `:photodir`. Twitterpunch will run on OS X or\nWindows equally well.
|
89
|
+
Simply configure it on the computer that will act as the \nTwitter display and then
|
90
|
+
run in streaming mode. Tweets that come from any other\nuser will be spoken aloud.\n\n
|
91
|
+
\ [ben@ganymede] ~ $ twitterpunch --stream\n\nThere are currently two decent viewing
|
92
|
+
options I am aware of.\n\n* Windows background image:\n * Configure the Windows
|
93
|
+
background to randomly cycle through photos in a directory.\n * Hide desktop
|
94
|
+
icons.\n * Hide the taskbar.\n * Disable screensaver and power savings.\n
|
95
|
+
\ * Drawbacks: You're using Windows and you have to install Ruby & RubyGems manually.\n*
|
96
|
+
OS X screensaver:\n * Choose one of the sexy screensavers and configure it to
|
97
|
+
show photos from the `:photodir`\n * Set screensaver to a super short timeout.\n
|
98
|
+
\ * Disable power savings.\n * Drawbacks: The screensaver doesn't reload dynamically,
|
99
|
+
so I have to kick it\n and you'll see it reloading each time a new tweet comes
|
100
|
+
in.\n\nLimitations\n===========\n\n* It currently requires manual setup for Folder
|
101
|
+
Actions.\n* It currently requires an external viewer, such as a screensaver.\n\n\nContact\n=======\n\n*
|
102
|
+
Author: Ben Ford\n* Email: binford2k@gmail.com\n* Twitter: @binford2k\n* IRC (Freenode):
|
103
|
+
binford2k\n"
|
104
|
+
email: binford2k@gmail.com
|
105
|
+
executables:
|
106
|
+
- twitterpunch
|
107
|
+
extensions: []
|
108
|
+
extra_rdoc_files: []
|
109
|
+
files:
|
110
|
+
- LICENSE
|
111
|
+
- README.md
|
112
|
+
- bin/twitterpunch
|
113
|
+
- lib/twitterpunch.rb
|
114
|
+
- lib/twitterpunch/configuration.rb
|
115
|
+
- lib/twitterpunch/logger.rb
|
116
|
+
- lib/twitterpunch/poster.rb
|
117
|
+
- lib/twitterpunch/streamer.rb
|
118
|
+
- resources/Twitterpunch.workflow/Contents/Info.plist
|
119
|
+
- resources/Twitterpunch.workflow/Contents/QuickLook/Thumbnail.png
|
120
|
+
- resources/Twitterpunch.workflow/Contents/document.wflow
|
121
|
+
- resources/say.vbs
|
122
|
+
homepage: http://binford2k.com
|
123
|
+
licenses: []
|
124
|
+
metadata: {}
|
125
|
+
post_install_message:
|
126
|
+
rdoc_options: []
|
127
|
+
require_paths:
|
128
|
+
- lib
|
129
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
130
|
+
requirements:
|
131
|
+
- - '>='
|
132
|
+
- !ruby/object:Gem::Version
|
133
|
+
version: '0'
|
134
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - '>='
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0'
|
139
|
+
requirements: []
|
140
|
+
rubyforge_project:
|
141
|
+
rubygems_version: 2.2.2
|
142
|
+
signing_key:
|
143
|
+
specification_version: 4
|
144
|
+
summary: A simple tool to automate the posting and streaming of PhotoBooth shots over
|
145
|
+
Twitter.
|
146
|
+
test_files: []
|