droid_adbs 0.2.3 → 0.3.0

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: b6618b90f562f8188892e365e970d7fc363a9f5d
4
- data.tar.gz: 5805b153c147b9154748c3392149c301c83fcd3a
3
+ metadata.gz: 9c4b9995b5360dcd0f0b365f2470ff0581ff20b3
4
+ data.tar.gz: a44dedfe861f11e05e82dff1f46e9ff07fe6d6aa
5
5
  SHA512:
6
- metadata.gz: fd1af12508608ce063f23d8ba0341a5b3bc6a0b28c5e08e3ecb63e5e3099932c35256c63dc53a83f917a0f3911c260166c5d3accfdd427a237df590695b32c49
7
- data.tar.gz: 006e236dc3e48170805a65b526b33803c3d2cadd5f889c2303818b1e5f7ac9ffed0aa662f1b839b3c2e4fcfda20a5c35aaa0df5b087cd78b5d2dfef6725899f2
6
+ metadata.gz: e4ab7fbe52d27ab9bfb84a7c36f31a6a15fc5bc8159d50c06dc43d947ac9cff1bed1d72f525e1e9024e06a8a6ec44e6c86fc26734ff04a2f70c7ef762e719542
7
+ data.tar.gz: 5cb39d96f41b48b5a284994e0c5a8d6ccbb610aebd5a3201cd439d4d8d9043b4fb7c5c291b587eaa227107686a3236961aab3fd2df16d8fc85bad94dcd788e2a
@@ -7,6 +7,7 @@ require "droid_adbs/commons/wm"
7
7
  require "droid_adbs/commons/grant"
8
8
  require "droid_adbs/commons/logcat"
9
9
  require "droid_adbs/commons/dumpsys"
10
+ require "droid_adbs/commons/record"
10
11
  require "droid_adbs/aapt"
11
12
 
12
13
  module DroidAdbs
@@ -0,0 +1,44 @@
1
+ module DroidAdbs
2
+ module ScreenRecord
3
+ class Recording
4
+ attr_accessor :bit_rate, :size
5
+
6
+ private
7
+
8
+ attr_accessor :file_name, :recording
9
+
10
+ public
11
+
12
+ def initialize(device_serial: nil, bit_rate: 3000000, size: "1280x720")
13
+ @bit_rate = bit_rate
14
+ @size = size
15
+
16
+ ::DroidAdbs.device_serial = device_serial if device_serial
17
+ @recording = false
18
+ end
19
+
20
+ def record(file_name:)
21
+ raise "Recording on the other process" if @recording
22
+
23
+ @file_name = file_name
24
+
25
+ @recording = true
26
+ @process_id = fork do
27
+ exec "#{::DroidAdbs.shell} screenrecord --bit-rate #{@bit_rate} --size #{@size} /sdcard/#{@file_name}.mp4"
28
+ end
29
+ end
30
+
31
+ def kill
32
+ Process.kill(:SIGINT, @process_id)
33
+ @recording = false
34
+
35
+ # Download the video
36
+ system "#{::DroidAdbs.adb_serial} pull /sdcard/#{@file_name}.mp4 #{Dir.pwd}"
37
+ sleep 5 # To finish pull command
38
+
39
+ # Delete the video from the device
40
+ system "#{::DroidAdbs.shell} rm /sdcard/#{@file_name}.mp4"
41
+ end
42
+ end
43
+ end
44
+ end # module Android
@@ -1,3 +1,3 @@
1
1
  module DroidAdbs
2
- VERSION = "0.2.3"
2
+ VERSION = "0.3.0"
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.2.3
4
+ version: 0.3.0
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-05-29 00:00:00.000000000 Z
11
+ date: 2017-10-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -77,6 +77,7 @@ files:
77
77
  - lib/droid_adbs/commons/grant.rb
78
78
  - lib/droid_adbs/commons/ime.rb
79
79
  - lib/droid_adbs/commons/logcat.rb
80
+ - lib/droid_adbs/commons/record.rb
80
81
  - lib/droid_adbs/commons/settings.rb
81
82
  - lib/droid_adbs/commons/wm.rb
82
83
  - lib/droid_adbs/version.rb