droid_adbs 0.3.0 → 0.3.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9c4b9995b5360dcd0f0b365f2470ff0581ff20b3
4
- data.tar.gz: a44dedfe861f11e05e82dff1f46e9ff07fe6d6aa
3
+ metadata.gz: e9bacb6c0a8d65d2098ecdb7f7fd4f16868470ea
4
+ data.tar.gz: 1e648a77354315ab18ec46846cf019fd722074f3
5
5
  SHA512:
6
- metadata.gz: e4ab7fbe52d27ab9bfb84a7c36f31a6a15fc5bc8159d50c06dc43d947ac9cff1bed1d72f525e1e9024e06a8a6ec44e6c86fc26734ff04a2f70c7ef762e719542
7
- data.tar.gz: 5cb39d96f41b48b5a284994e0c5a8d6ccbb610aebd5a3201cd439d4d8d9043b4fb7c5c291b587eaa227107686a3236961aab3fd2df16d8fc85bad94dcd788e2a
6
+ metadata.gz: ac3ca8d6593a7efee0d5f9853c9760f4da532d6d76b242a9e6aa9296c156272938edaffcb970cb291e8d0d1d57ab867bc2a11b85f2096860ff55c0a8774b3b14
7
+ data.tar.gz: 4881b5438c5c97c0dc638c0a152bd6323b3ae271b5ab76a2ae9ee541542a569babf363e2ceac7b7aba680d5e629d3298fbcdfcaac0e34503792f012e660ddf0c
@@ -9,36 +9,52 @@ module DroidAdbs
9
9
 
10
10
  public
11
11
 
12
- def initialize(device_serial: nil, bit_rate: 3000000, size: "1280x720")
12
+ def initialize(device_serial: nil, bit_rate: 3000000, size: "1280x720", time_limit: 180)
13
13
  @bit_rate = bit_rate
14
14
  @size = size
15
+ @time_limit = time_limit
15
16
 
16
17
  ::DroidAdbs.device_serial = device_serial if device_serial
17
18
  @recording = false
18
19
  end
19
20
 
20
- def record(file_name:)
21
+ def start(file_name: "droid_adbs_video")
22
+ validate_recordable?
21
23
  raise "Recording on the other process" if @recording
22
24
 
23
25
  @file_name = file_name
24
26
 
25
27
  @recording = true
26
28
  @process_id = fork do
27
- exec "#{::DroidAdbs.shell} screenrecord --bit-rate #{@bit_rate} --size #{@size} /sdcard/#{@file_name}.mp4"
29
+ exec "#{::DroidAdbs.shell} screenrecord --time-limit #{@time_limit} --bit-rate #{@bit_rate} --size #{@size} /sdcard/#{@file_name}.mp4"
28
30
  end
29
31
  end
30
32
 
31
- def kill
33
+ def stop
34
+ validate_recordable?
32
35
  Process.kill(:SIGINT, @process_id)
33
36
  @recording = false
37
+ end
34
38
 
39
+ def pull(export_to: "#{Dir.pwd}/droid_adbs_video.mp4")
35
40
  # Download the video
36
- system "#{::DroidAdbs.adb_serial} pull /sdcard/#{@file_name}.mp4 #{Dir.pwd}"
37
- sleep 5 # To finish pull command
41
+ system "#{::DroidAdbs.adb_serial} pull /sdcard/#{@file_name}.mp4 #{export_to}"
42
+ end
38
43
 
44
+ def delete
39
45
  # Delete the video from the device
40
46
  system "#{::DroidAdbs.shell} rm /sdcard/#{@file_name}.mp4"
41
47
  end
48
+
49
+ private
50
+
51
+ def validate_recordable?
52
+ unless ::DroidAdbs::Devices.device_build_version_sdk.to_i >= 19
53
+ raise "The command require over KitKat(API Level 19)"
54
+ end
55
+
56
+ true
57
+ end
42
58
  end
43
59
  end
44
- end # module Android
60
+ end # module Android
@@ -1,3 +1,3 @@
1
1
  module DroidAdbs
2
- VERSION = "0.3.0"
2
+ VERSION = "0.3.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: droid_adbs
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kazuaki MATSUO
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-10-16 00:00:00.000000000 Z
11
+ date: 2017-10-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler