itunestweet 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +10 -0
- data/.rspec +2 -0
- data/.travis.yml +4 -0
- data/Gemfile +9 -0
- data/LICENSE.txt +21 -0
- data/README.md +53 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/itunestweet +4 -0
- data/bin/setup +8 -0
- data/exe/itunestweet +3 -0
- data/itunestweet.gemspec +37 -0
- data/lib/itunestweet.rb +36 -0
- data/lib/itunestweet/version.rb +3 -0
- data/script/itunestweet.rb +32 -0
- metadata +144 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: e520e09c1b90c48af20caf5e6605b531b98206ed
|
4
|
+
data.tar.gz: a1fde693241ef6b66836e611176b4a62f1e47815
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 8eab3188b4015e15bc2889321412dff17784b0dc0f1e044bd669af56ebc1db9fecd65ce40ae6332269a64b1cc888d6d2a6be7e748452ed4e27b5d670b431ac34
|
7
|
+
data.tar.gz: e399a79e3f3fd9c9d17f7c8fbe911222f277e7578645e855ca6a4bc23cb4f74723b468ae57e0b428ef133ae935291cb0c288da26a4e9b8dbf6135a3dc920499a
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2015 ayase-skyhigh
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,53 @@
|
|
1
|
+
# ItunesTweet
|
2
|
+
|
3
|
+
Tweet Playing Music in iTunes.
|
4
|
+
|
5
|
+
## Platform
|
6
|
+
|
7
|
+
OSX 10.10~
|
8
|
+
|
9
|
+
## Installation
|
10
|
+
|
11
|
+
Add this line to your application's Gemfile:
|
12
|
+
|
13
|
+
```ruby
|
14
|
+
gem 'itunestweet'
|
15
|
+
```
|
16
|
+
|
17
|
+
And then execute:
|
18
|
+
|
19
|
+
$ bundle
|
20
|
+
|
21
|
+
Or install it yourself as:
|
22
|
+
|
23
|
+
$ gem install itunestweet
|
24
|
+
|
25
|
+
|
26
|
+
Add your .bashrc or .zshrc.
|
27
|
+
|
28
|
+
```
|
29
|
+
## Twitter API keys
|
30
|
+
export IT_CONSUMER_KEY="CONSUMER_KEY"
|
31
|
+
export IT_CONSUMER_SECRET="CONSUMER_SECRET"
|
32
|
+
export IT_ACCESS_TOKEN="ACCESS_TOKEN"
|
33
|
+
export IT_ACCESS_SECRET="ACCESS_SECRET"
|
34
|
+
```
|
35
|
+
|
36
|
+
## Usage
|
37
|
+
|
38
|
+
Click Terminal.app , And Execute Command.
|
39
|
+
|
40
|
+
```bash
|
41
|
+
$ itunestweet
|
42
|
+
```
|
43
|
+
|
44
|
+
|
45
|
+
## Contributing
|
46
|
+
|
47
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/ayase-skyhigh/itunestweet.
|
48
|
+
|
49
|
+
|
50
|
+
## License
|
51
|
+
|
52
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
53
|
+
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "itunestweet"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start
|
data/bin/itunestweet
ADDED
data/bin/setup
ADDED
data/exe/itunestweet
ADDED
data/itunestweet.gemspec
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'itunestweet/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "itunestweet"
|
8
|
+
spec.version = Itunestweet::VERSION
|
9
|
+
spec.authors = ["Sho Ayase"]
|
10
|
+
spec.email = ["sho_ayase@srockstyle.com"]
|
11
|
+
|
12
|
+
spec.summary = %q{Tweet iTunes Playing Sound Name. }
|
13
|
+
spec.description = %q{Tweet iTunes Playing Sound in Cli}
|
14
|
+
spec.homepage = "http://skyparametric.com"
|
15
|
+
spec.license = "MIT"
|
16
|
+
|
17
|
+
# Prevent pushing this gem to RubyGems.org by setting 'allowed_push_host', or
|
18
|
+
# delete this section to allow pushing this gem to any host.
|
19
|
+
# if spec.respond_to?(:metadata)
|
20
|
+
# spec.metadata['allowed_push_host'] = "https://rubygems.org/'"
|
21
|
+
# else
|
22
|
+
# raise "RubyGems 2.0 or newer is required to protect against public gem pushes."
|
23
|
+
# end
|
24
|
+
|
25
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
26
|
+
spec.bindir = "exe"
|
27
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
28
|
+
spec.executables << 'itunestweet'
|
29
|
+
spec.require_paths = ["lib"]
|
30
|
+
|
31
|
+
spec.add_development_dependency "bundler", "~> 1.11"
|
32
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
33
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
34
|
+
spec.add_development_dependency "itunes-client", "~> 0.2.0"
|
35
|
+
spec.add_development_dependency "twitter", "~> 5.15.0"
|
36
|
+
spec.add_development_dependency "enver", "~> 1.0.0"
|
37
|
+
end
|
data/lib/itunestweet.rb
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
require "itunestweet/version"
|
2
|
+
require 'itunes-client'
|
3
|
+
require 'enver'
|
4
|
+
require 'twitter'
|
5
|
+
include Itunes
|
6
|
+
|
7
|
+
module Itunestweet
|
8
|
+
|
9
|
+
def self.exec
|
10
|
+
## Load Env
|
11
|
+
env = Enver.load do
|
12
|
+
string :it_consumer_key
|
13
|
+
string :it_consumer_secret
|
14
|
+
string :it_access_token
|
15
|
+
string :it_access_secret
|
16
|
+
end
|
17
|
+
|
18
|
+
## Twitter Client
|
19
|
+
client = Twitter::REST::Client.new do |config|
|
20
|
+
config.consumer_key = env.it_consumer_key
|
21
|
+
config.consumer_secret = env.it_consumer_secret
|
22
|
+
config.access_token = env.it_access_token
|
23
|
+
config.access_token_secret = env.it_access_secret
|
24
|
+
end
|
25
|
+
|
26
|
+
## Tweet only playing
|
27
|
+
if Player.playing?
|
28
|
+
## 曲の取得
|
29
|
+
current_track = Player.current_track
|
30
|
+
## create tweet
|
31
|
+
tweet = "BGM '#{current_track.name} in [#{current_track.album}]' by #{current_track.artist}. #iTunesTweet"
|
32
|
+
|
33
|
+
client.update(tweet)
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
#/usr/bin/env -ruby
|
2
|
+
require 'pp'
|
3
|
+
require 'itunes-client'
|
4
|
+
require 'enver'
|
5
|
+
require 'twitter'
|
6
|
+
include Itunes
|
7
|
+
|
8
|
+
## Load Env
|
9
|
+
env = Enver.load do
|
10
|
+
string :it_consumer_key
|
11
|
+
string :it_consumer_secret
|
12
|
+
string :it_access_token
|
13
|
+
string :it_access_secret
|
14
|
+
end
|
15
|
+
|
16
|
+
## Twitter Client
|
17
|
+
client = Twitter::REST::Client.new do |config|
|
18
|
+
config.consumer_key = env.it_consumer_key
|
19
|
+
config.consumer_secret = env.it_consumer_secret
|
20
|
+
config.access_token = env.it_access_token
|
21
|
+
config.access_token_secret = env.it_access_secret
|
22
|
+
end
|
23
|
+
|
24
|
+
## Tweet only playing
|
25
|
+
if Player.playing?
|
26
|
+
## 曲の取得
|
27
|
+
current_track = Player.current_track
|
28
|
+
## create tweet
|
29
|
+
tweet = "BGM '#{current_track.name} in [#{current_track.album}]' by #{current_track.artist}. #iTunesTweet"
|
30
|
+
|
31
|
+
client.update(tweet)
|
32
|
+
end
|
metadata
ADDED
@@ -0,0 +1,144 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: itunestweet
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Sho Ayase
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-12-24 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.11'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.11'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '3.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '3.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: itunes-client
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 0.2.0
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 0.2.0
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: twitter
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 5.15.0
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 5.15.0
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: enver
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: 1.0.0
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: 1.0.0
|
97
|
+
description: Tweet iTunes Playing Sound in Cli
|
98
|
+
email:
|
99
|
+
- sho_ayase@srockstyle.com
|
100
|
+
executables:
|
101
|
+
- itunestweet
|
102
|
+
extensions: []
|
103
|
+
extra_rdoc_files: []
|
104
|
+
files:
|
105
|
+
- ".gitignore"
|
106
|
+
- ".rspec"
|
107
|
+
- ".travis.yml"
|
108
|
+
- Gemfile
|
109
|
+
- LICENSE.txt
|
110
|
+
- README.md
|
111
|
+
- Rakefile
|
112
|
+
- bin/console
|
113
|
+
- bin/itunestweet
|
114
|
+
- bin/setup
|
115
|
+
- exe/itunestweet
|
116
|
+
- itunestweet.gemspec
|
117
|
+
- lib/itunestweet.rb
|
118
|
+
- lib/itunestweet/version.rb
|
119
|
+
- script/itunestweet.rb
|
120
|
+
homepage: http://skyparametric.com
|
121
|
+
licenses:
|
122
|
+
- MIT
|
123
|
+
metadata: {}
|
124
|
+
post_install_message:
|
125
|
+
rdoc_options: []
|
126
|
+
require_paths:
|
127
|
+
- lib
|
128
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
129
|
+
requirements:
|
130
|
+
- - ">="
|
131
|
+
- !ruby/object:Gem::Version
|
132
|
+
version: '0'
|
133
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
134
|
+
requirements:
|
135
|
+
- - ">="
|
136
|
+
- !ruby/object:Gem::Version
|
137
|
+
version: '0'
|
138
|
+
requirements: []
|
139
|
+
rubyforge_project:
|
140
|
+
rubygems_version: 2.4.8
|
141
|
+
signing_key:
|
142
|
+
specification_version: 4
|
143
|
+
summary: Tweet iTunes Playing Sound Name.
|
144
|
+
test_files: []
|