tunees 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/tunees/application.rb +83 -1
- data/lib/tunees/commander.rb +4 -5
- data/lib/tunees/version.rb +1 -1
- data/tunees.gemspec +1 -0
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ff5b5067a291104d41fe24c62570a5a02fd6ff2c
|
4
|
+
data.tar.gz: a890feace1671cf7431d69516bf1b4b3e10eb3b0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b9cdd6552a365e5f2111d66cf8362ba405f33f82cf8c037140f20e6dbd9069c8aee331e9ead15d4c7f793df8d0d2110db355de665278f03cb4576f1e46abe9fc
|
7
|
+
data.tar.gz: 4dd8c22b67de39b32368d58ba6d6a9ccdeb1f6bbba9e7281ec7288dbf23aca6a2f5129c81a43b11f0a416964a1c1f029b08131121faabee5a427239eec7dc657
|
data/lib/tunees/application.rb
CHANGED
@@ -8,7 +8,14 @@ module Tunees
|
|
8
8
|
def self.execute(method, *args)
|
9
9
|
Commander.run <<-JXA.strip_heredoc
|
10
10
|
var app = Application("iTunes")
|
11
|
-
app.#{method}()
|
11
|
+
return app.#{method}(#{args.join(",")})
|
12
|
+
JXA
|
13
|
+
end
|
14
|
+
|
15
|
+
def self.set_property(property, value)
|
16
|
+
Commander.run <<-JXA.strip_heredoc
|
17
|
+
var app = Application("iTunes")
|
18
|
+
app.#{property} = #{value}
|
12
19
|
JXA
|
13
20
|
end
|
14
21
|
|
@@ -40,5 +47,80 @@ module Tunees
|
|
40
47
|
execute(camel_cased_method, *args)
|
41
48
|
end
|
42
49
|
end
|
50
|
+
|
51
|
+
# Application elements
|
52
|
+
%w(
|
53
|
+
airplayDevices
|
54
|
+
browserWindows
|
55
|
+
encoders
|
56
|
+
eqPresets
|
57
|
+
eqWindows
|
58
|
+
playlistWindows
|
59
|
+
sources
|
60
|
+
audioCDPlaylists
|
61
|
+
audioCDTracks
|
62
|
+
libraryPlaylists
|
63
|
+
fileTracks
|
64
|
+
urlTracks
|
65
|
+
sharedTracks
|
66
|
+
playlists
|
67
|
+
tracks
|
68
|
+
artworks
|
69
|
+
radioTunerPlaylists
|
70
|
+
urlTracks
|
71
|
+
userPlaylists
|
72
|
+
fileTracks
|
73
|
+
urlTracks
|
74
|
+
sharedTracks
|
75
|
+
visuals
|
76
|
+
windows
|
77
|
+
).uniq.each do |camel_cased_element|
|
78
|
+
method = camel_cased_element.underscore
|
79
|
+
define_singleton_method(method) do
|
80
|
+
execute(camel_cased_element)
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
# Application properties
|
85
|
+
[
|
86
|
+
[:airplayEnabled, false],
|
87
|
+
[:converting, false],
|
88
|
+
[:currentAirPlayDevices, true],
|
89
|
+
[:currentEncoder, true],
|
90
|
+
[:currentEQPreset, true],
|
91
|
+
[:currentPlaylist, false],
|
92
|
+
[:currentStreamTitle, false],
|
93
|
+
[:currentStreamURL, false],
|
94
|
+
[:currentTrack, false],
|
95
|
+
[:currentVisual, true],
|
96
|
+
[:eqEnabled, true],
|
97
|
+
[:fixedIndexing, true],
|
98
|
+
[:frontmost, true],
|
99
|
+
[:fullScreen, true],
|
100
|
+
[:name, false],
|
101
|
+
[:mute, true],
|
102
|
+
[:playerPosition, true],
|
103
|
+
[:playerState, false],
|
104
|
+
[:selection, false],
|
105
|
+
[:soundVolume, true],
|
106
|
+
[:version, false],
|
107
|
+
[:visualsEnabled, true],
|
108
|
+
[:visualSize, true],
|
109
|
+
[:iadIdentifier, false],
|
110
|
+
].each do |camel_cased_property, writable|
|
111
|
+
method = camel_cased_property.to_s.underscore
|
112
|
+
|
113
|
+
# reader
|
114
|
+
define_singleton_method(method) do
|
115
|
+
execute(camel_cased_property.to_s)
|
116
|
+
end
|
117
|
+
|
118
|
+
# writer
|
119
|
+
if writable
|
120
|
+
define_singleton_method("#{method}=") do |value|
|
121
|
+
set_property(camel_cased_property.to_s, value)
|
122
|
+
end
|
123
|
+
end
|
124
|
+
end
|
43
125
|
end
|
44
126
|
end
|
data/lib/tunees/commander.rb
CHANGED
@@ -1,11 +1,10 @@
|
|
1
|
+
require 'execjs/runtimes/jxa'
|
2
|
+
ExecJS.runtime = ExecJS::Runtimes::JXA
|
3
|
+
|
1
4
|
module Tunees
|
2
5
|
class Commander
|
3
6
|
def self.run(script)
|
4
|
-
|
5
|
-
io.puts script
|
6
|
-
io.close_write
|
7
|
-
io.gets
|
8
|
-
end
|
7
|
+
ExecJS.exec(script)
|
9
8
|
end
|
10
9
|
end
|
11
10
|
end
|
data/lib/tunees/version.rb
CHANGED
data/tunees.gemspec
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tunees
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- meganemura
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-11-
|
11
|
+
date: 2015-11-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -24,6 +24,20 @@ dependencies:
|
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: execjs-runtimes-jxa
|
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'
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
42
|
name: bundler
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|