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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 66e31989753b84b73e0d25c3e149082feebccabf
4
- data.tar.gz: 91f347e53cc61ca868b757184370d2d354c2726c
3
+ metadata.gz: 8e8bb7515664f4109bda345540d3596f505eb16a
4
+ data.tar.gz: 1497a72c295d8785635aabd9a27de12d7d0352b6
5
5
  SHA512:
6
- metadata.gz: f98bce7464db042a3b758b90af3c5ad153f3c443b1a55416340b5b7fef3349be7af0b0b1f7744f46096fcea2281544c34c1ac6398f0b40e3c37b7adfd4a24a4a
7
- data.tar.gz: e7298aeece3a259de2c3c259f8813dfe4cf1d4972fd286a347c29aa465ed777c7274986d60ef4dc64cae8a6c1d156af7831b3552b71211622445eaa38d0ae084
6
+ metadata.gz: 711e07bbeddd2e76455811a8b840811273e3210868490b300f68bba1c4d43374a7718488c1780bc7d7892bae55ed72bfe16f16c1052ad30b29aa4e1b73aeaf99
7
+ data.tar.gz: a1a9ecc0b5b54b73334fe0d8c4b092e596151f47c99a425428db03524949c42ffb99bef9e76b7320402b530a6a5f6624f47ff5f201f2ebef94c0231867373367
@@ -16,23 +16,31 @@ module Sonycam
16
16
 
17
17
  desc 'list QUERY', 'List all API or search'
18
18
  def list query
19
- api = API.new DeviceDescription.new(DD_PATH).api_url(:camera)
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
- api = API.new DeviceDescription.new(DD_PATH).api_url(:camera)
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
- api = API.new DeviceDescription.new(DD_PATH).api_url(:camera)
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
@@ -1,33 +1,33 @@
1
1
  module Sonycam
2
2
  module Error
3
3
  MAPPING = {
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,
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 => :Unauthorized,
24
- 403 => :Forbidden,
25
- 404 => :NotFound,
26
- 406 => :NotAcceptable,
27
- 413 => :RequestEntityTooLarge,
28
- 414 => :RequestURITooLong,
29
- 501 => :NotImplemented,
30
- 503 => :ServiceUnavailable
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|
@@ -1,3 +1,3 @@
1
1
  module Sonycam
2
- VERSION = '0.0.1'
2
+ VERSION = '1.0.0'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sonycam
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tony Jian