sonycam 0.0.1 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/sonycam/cli.rb +14 -6
- data/lib/sonycam/error.rb +23 -23
- data/lib/sonycam/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: 8e8bb7515664f4109bda345540d3596f505eb16a
|
4
|
+
data.tar.gz: 1497a72c295d8785635aabd9a27de12d7d0352b6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 711e07bbeddd2e76455811a8b840811273e3210868490b300f68bba1c4d43374a7718488c1780bc7d7892bae55ed72bfe16f16c1052ad30b29aa4e1b73aeaf99
|
7
|
+
data.tar.gz: a1a9ecc0b5b54b73334fe0d8c4b092e596151f47c99a425428db03524949c42ffb99bef9e76b7320402b530a6a5f6624f47ff5f201f2ebef94c0231867373367
|
data/lib/sonycam/cli.rb
CHANGED
@@ -16,23 +16,31 @@ module Sonycam
|
|
16
16
|
|
17
17
|
desc 'list QUERY', 'List all API or search'
|
18
18
|
def list query
|
19
|
-
|
20
|
-
puts api.request(:getAvailableApiList)['result'].first.select{|method| method =~ /#{query}/i }
|
19
|
+
puts api_client.request(:getAvailableApiList)['result'].first.select{|method| method =~ /#{query}/i }
|
21
20
|
end
|
22
21
|
|
23
22
|
desc 'api METHOD PARAMS', 'Send API request'
|
24
23
|
def api method, *params
|
25
|
-
|
26
|
-
jj api.request(method, *params)
|
24
|
+
jj api_client.request(method, *params)
|
27
25
|
end
|
28
26
|
|
29
27
|
desc 'liveview', 'Start Liveview and output to STDOUT'
|
30
28
|
def liveview
|
31
|
-
|
32
|
-
liveview_url = api.request('startLiveview')['result'][0]
|
29
|
+
liveview_url = api_client.request('startLiveview')['result'][0]
|
33
30
|
Liveview.stream(liveview_url) do |packet|
|
34
31
|
puts packet[:payload_data][:jpeg_data]
|
35
32
|
end
|
36
33
|
end
|
34
|
+
|
35
|
+
no_tasks do
|
36
|
+
def api_client
|
37
|
+
return @api_client if @api_client.is_a? API
|
38
|
+
unless File.exist?(DD_PATH)
|
39
|
+
puts "Can not find #{DD_PATH}, start scanning..."
|
40
|
+
invoke :scan, []
|
41
|
+
end
|
42
|
+
@api_client = API.new DeviceDescription.new(DD_PATH).api_url(:camera)
|
43
|
+
end
|
44
|
+
end
|
37
45
|
end
|
38
46
|
end
|
data/lib/sonycam/error.rb
CHANGED
@@ -1,33 +1,33 @@
|
|
1
1
|
module Sonycam
|
2
2
|
module Error
|
3
3
|
MAPPING = {
|
4
|
-
1
|
5
|
-
2
|
6
|
-
3
|
7
|
-
4
|
8
|
-
5
|
9
|
-
6
|
10
|
-
7
|
11
|
-
8
|
12
|
-
9
|
13
|
-
10
|
14
|
-
11
|
15
|
-
12
|
16
|
-
13
|
17
|
-
14
|
18
|
-
15
|
4
|
+
1 => :Any,
|
5
|
+
2 => :Timeout,
|
6
|
+
3 => :IllegalArgument,
|
7
|
+
4 => :IllegalDataFormat,
|
8
|
+
5 => :IllegalRequest,
|
9
|
+
6 => :IllegalResponse,
|
10
|
+
7 => :IllegalState,
|
11
|
+
8 => :IllegalType,
|
12
|
+
9 => :IndexOutOfBounds,
|
13
|
+
10 => :NoSuchElement,
|
14
|
+
11 => :NoSuchField,
|
15
|
+
12 => :NoSuchMethod,
|
16
|
+
13 => :NULLPointer,
|
17
|
+
14 => :UnsupportedVersion,
|
18
|
+
15 => :UnsupportedOperation,
|
19
19
|
40400 => :Shootingfail,
|
20
20
|
40401 => :CameraNotReady,
|
21
21
|
40402 => :AlreadyRunningPollingAPI147,
|
22
22
|
40403 => :StillCapturingNotFinished,
|
23
|
-
401
|
24
|
-
403
|
25
|
-
404
|
26
|
-
406
|
27
|
-
413
|
28
|
-
414
|
29
|
-
501
|
30
|
-
503
|
23
|
+
401 => :Unauthorized,
|
24
|
+
403 => :Forbidden,
|
25
|
+
404 => :NotFound,
|
26
|
+
406 => :NotAcceptable,
|
27
|
+
413 => :RequestEntityTooLarge,
|
28
|
+
414 => :RequestURITooLong,
|
29
|
+
501 => :NotImplemented,
|
30
|
+
503 => :ServiceUnavailable
|
31
31
|
}
|
32
32
|
|
33
33
|
MAPPING.each_value do |error_name|
|
data/lib/sonycam/version.rb
CHANGED