controlio 0.0.7 → 0.0.8
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 +4 -4
- data/Gemfile.lock +1 -1
- data/lib/commands/picture.rb +4 -3
- data/lib/commands/play.rb +2 -2
- data/lib/commands/screenshot.rb +4 -3
- data/lib/controlio/client.rb +1 -1
- data/lib/controlio/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3d8973dbe79ebc59b14c1eecd0e71053ed5363d7
|
4
|
+
data.tar.gz: f9d61d52b7188af909b38e56a010cb45588c2580
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 81a2fa84046aa86587ee1a2a4c81dfbb08e9075e2d879d2fb45441edb626ce2f16cfa6746541f5a868196a716b4007881f5f083b7688169ee16dcad375041650
|
7
|
+
data.tar.gz: 2facf1e92d73edb5c376c872574c3da25b36ce4fd1ab699f1f97e41467f31e9fdc02c28502eb7d3c89f4dd8e17842118fbdbd8780a2ee1d7a3019d47fb4fa358
|
data/Gemfile.lock
CHANGED
data/lib/commands/picture.rb
CHANGED
@@ -1,16 +1,17 @@
|
|
1
1
|
require 'rest_client'
|
2
|
+
require 'tempfile'
|
2
3
|
|
3
4
|
module Commands
|
4
5
|
class Picture
|
5
|
-
FILE_LOCATION = "/tmp/tmp.jpg"
|
6
6
|
|
7
7
|
def initialize(args, settings)
|
8
8
|
@api_root = settings.get('api_root')
|
9
|
+
@file = Tempfile.new(['picture', '.jpg'])
|
9
10
|
end
|
10
11
|
|
11
12
|
def go
|
12
|
-
`#{File.expand_path("#{File.dirname(__FILE__)}/../../sbin/controlio-imagesnap")} -q #{
|
13
|
-
response = RestClient.post "#{@api_root}/upload", file: File.new(
|
13
|
+
`#{File.expand_path("#{File.dirname(__FILE__)}/../../sbin/controlio-imagesnap")} -q #{@file.path}`
|
14
|
+
response = RestClient.post "#{@api_root}/upload", file: File.new(@file.path, 'rb')
|
14
15
|
@url = JSON.load(response)['url']
|
15
16
|
end
|
16
17
|
|
data/lib/commands/play.rb
CHANGED
@@ -8,12 +8,12 @@ module Commands
|
|
8
8
|
|
9
9
|
def go
|
10
10
|
`osascript -e 'tell application "#{@app}" to launch'`
|
11
|
-
sleep 1
|
11
|
+
sleep 1.5
|
12
12
|
`osascript -e 'tell application "#{@app}" to play'`
|
13
13
|
end
|
14
14
|
|
15
15
|
def respond
|
16
|
-
|
16
|
+
sleep 5
|
17
17
|
"Now playing: #{`osascript -e 'tell application "#{@app}" to get the name of the current track'`}".chomp rescue ""
|
18
18
|
end
|
19
19
|
|
data/lib/commands/screenshot.rb
CHANGED
@@ -1,16 +1,17 @@
|
|
1
1
|
require 'rest_client'
|
2
|
+
require 'tempfile'
|
2
3
|
|
3
4
|
module Commands
|
4
5
|
class Screenshot
|
5
|
-
FILE_LOCATION = "/tmp/tmp.jpg"
|
6
6
|
|
7
7
|
def initialize(args, settings)
|
8
8
|
@api_root = settings.get('api_root')
|
9
|
+
@file = Tempfile.new(['screenshot', '.jpg'])
|
9
10
|
end
|
10
11
|
|
11
12
|
def go
|
12
|
-
`screencapture -t jpg -x #{
|
13
|
-
response = RestClient.post "#{@api_root}/upload", file: File.new(
|
13
|
+
`screencapture -t jpg -x #{@file.path}`
|
14
|
+
response = RestClient.post "#{@api_root}/upload", file: File.new(@file.path, 'rb')
|
14
15
|
@url = JSON.load(response)['url']
|
15
16
|
end
|
16
17
|
|
data/lib/controlio/client.rb
CHANGED
@@ -21,7 +21,6 @@ module Controlio
|
|
21
21
|
puts "Running #{klass} (#{args})"
|
22
22
|
instance = klass.new(args, @settings)
|
23
23
|
spawn_and_timeout instance
|
24
|
-
send instance.respond, instance.media?
|
25
24
|
else
|
26
25
|
send "Command '#{c['message']}' was not found!"
|
27
26
|
end
|
@@ -36,6 +35,7 @@ module Controlio
|
|
36
35
|
def spawn_and_timeout(instance)
|
37
36
|
pid = fork do
|
38
37
|
instance.go
|
38
|
+
send instance.respond, instance.media?
|
39
39
|
end
|
40
40
|
Process.detach pid
|
41
41
|
pid2 = fork do
|
data/lib/controlio/version.rb
CHANGED