flick 0.3.1 → 0.3.2

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: 25b3b0bb28400f0565fbefc0d417669209bd4ced
4
- data.tar.gz: 4a160eaf8cc1795844a13b750d422c6b49e6026c
3
+ metadata.gz: 8fefe51010559fb70ada5f8286e5136f5b9aca04
4
+ data.tar.gz: 8e97d55ae591cfe30d9c94c52c4de2f7fb40cf9c
5
5
  SHA512:
6
- metadata.gz: e5ba77b5cc0d06dd1d67f449f1f435e3cb85b61e4237b77a9a46e0206b6e53ece52f5322c80b89a6ecbb5995c70aa51d2d3b91283abbe6c540733e44550b9ac7
7
- data.tar.gz: 32ec8cc036ab3138bbd9f1a6da07c1b0fb864f2e988a47631a0e835eb26f2defd30daa33921d6e40e529d7a7b755bb44ac11f6ad682f41703fb512b22c362c4d
6
+ metadata.gz: d4cf40f34b70b122f25d6422b61e5d0032c28d2a5784fd72cee8cdf0a76f4bdc98851b870209687adb19af27a9b7895bd935c132c4abc5bc2c2f5817bd63d813
7
+ data.tar.gz: a6533405fc53ce22ec840faee7fd44d11f3ce3dc52aa223e13bfaa03d4bcfd84b4e86c88d76f4dfef9d740faabdb76bbbee25dd971f023d5977af6024971db7f
data/bin/flick CHANGED
@@ -2,7 +2,7 @@
2
2
  require_relative '../lib/flick'
3
3
  require 'commander/import'
4
4
 
5
- program :version, '0.3.1'
5
+ program :version, '0.3.2'
6
6
  program :description, 'A CLI to capture screenshots, video, logs, and device info for Android (Devices & Emulators) and iOS (Devices).'
7
7
 
8
8
  command :video do |c|
@@ -143,7 +143,7 @@ module Flick
143
143
  hash.uniq! { |e| e[:md5] }
144
144
  hash.map { |file| file[:file] }
145
145
  end
146
-
146
+
147
147
  def pull_files type
148
148
  if unique
149
149
  files = unique_files type
@@ -151,7 +151,10 @@ module Flick
151
151
  files = %x(adb -s #{udid} shell "ls #{dir_name}/#{type}*").split("\r\n")
152
152
  end
153
153
  return if files.empty?
154
- Parallel.map(files, in_threads: 10) { |file| pull_file file, flick_dir }
154
+ Parallel.map(files, in_threads: 10) do |file|
155
+ pull_file file, flick_dir
156
+ Flick::System.wait_for_file 10, "#{flick_dir}/#{file.split("/").last}"
157
+ end
155
158
  end
156
159
  end
157
160
  end
@@ -44,6 +44,14 @@ module Flick
44
44
  pids = self.find_pid string
45
45
  self.kill_pids pids
46
46
  end
47
+
48
+ def self.wait_for_file time, file
49
+ start = Time.now
50
+ until File.exists? file
51
+ puts "Waiting for #{file} to exist..."
52
+ sleep 1; break if Time.now - start > time
53
+ end
54
+ end
47
55
 
48
56
  def self.video_length file
49
57
  (`ffmpeg -i #{file} 2>&1 | grep Duration | cut -d ' ' -f 4 | sed s/,//`).strip
@@ -1,3 +1,3 @@
1
1
  module Flick
2
- VERSION = "0.3.1"
2
+ VERSION = "0.3.2"
3
3
  end
@@ -92,8 +92,8 @@ class Video
92
92
 
93
93
  def stop_record
94
94
  Flick::System.kill_process "video", udid #kills recording
95
- sleep 5 #wait for video process to finish
96
- driver.pull_files "video"
95
+ sleep 5 #wait for video process to completely finish on device.
96
+ driver.pull_files "video"
97
97
  files = Dir.glob("#{driver.flick_dir}/video*.mp4")
98
98
  if files.empty?
99
99
  puts "\nError! No video files found in #{driver.flick_dir}\n".red
@@ -104,7 +104,7 @@ class Video
104
104
  if format == "gif"
105
105
  gif
106
106
  else
107
- File.rename "#{driver.flick_dir}/#{driver.name}.mp4", "#{driver.outdir}/#{driver.name}.mp4"
107
+ File.rename "#{driver.flick_dir}/#{driver.name}.mp4", "#{driver.outdir}/#{driver.name}.mp4" #moves file from .flick to output dir.
108
108
  end
109
109
  end
110
110
 
@@ -145,22 +145,13 @@ class Video
145
145
  File.rename "#{driver.flick_dir}/#{driver.name}.mp4", "#{driver.outdir}/#{driver.name}.mp4" unless format == "gif"
146
146
  end
147
147
 
148
- def wait_for_file file
149
- start = Time.now
150
- until File.exists? file
151
- sleep 1; break if Time.now - start > 30
152
- end
153
- end
154
-
155
148
  def convert_images_to_mp4
156
149
  remove_zero_byte_images
157
150
  %x(ffmpeg -loglevel quiet -framerate 1 -pattern_type glob -i '#{driver.flick_dir}/screenshot*.png' -c:v libx264 -pix_fmt yuv420p #{driver.flick_dir}/#{driver.name}.mp4)
158
- wait_for_file "#{driver.flick_dir}/#{driver.name}.mp4"
151
+ Flick::System.wait_for_file 30, "#{driver.flick_dir}/#{driver.name}.mp4"
159
152
  end
160
153
 
161
154
  def remove_zero_byte_images
162
- Dir.glob("#{driver.flick_dir}/screenshot*.png").each do |f|
163
- File.delete f if File.zero? f
164
- end
155
+ Dir.glob("#{driver.flick_dir}/screenshot*.png").each { |f| File.delete f if File.zero? f }
165
156
  end
166
157
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: flick
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Justin
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-09-22 00:00:00.000000000 Z
11
+ date: 2016-10-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler