droid_adbs 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/droid_adbs/commons/record.rb +23 -7
- data/lib/droid_adbs/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e9bacb6c0a8d65d2098ecdb7f7fd4f16868470ea
|
4
|
+
data.tar.gz: 1e648a77354315ab18ec46846cf019fd722074f3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
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
|
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 #{
|
37
|
-
|
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
|
data/lib/droid_adbs/version.rb
CHANGED
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.
|
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-
|
11
|
+
date: 2017-10-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|