Skip to content

Commit

Permalink
added fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
hillfields committed Sep 1, 2017
1 parent dfaf6ea commit b7927ff
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 8 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ Features
* Save log output for Android or iOS.
* Display device information or save it to a file.
* Install or Uninstall applications from devices.
* Capture device vitals (Android Only) for app and system performance.
* Checkout the latest release notes [here](https://github.com/isonic1/flick/releases).

Reason
Expand Down Expand Up @@ -112,7 +113,7 @@ Usage:
$ flick maanger -a uninstall -p (ios or android) -n com.package.name

$ flick vitals --help
$ flick vitals -n com.package.name
$ flick vitals -p android -n com.awsome-package.name

##Demo
<img src="https://www.dropbox.com/s/9be37gc1c2dlxa6/flick-demo.gif?raw=1" width="600">
Expand Down
4 changes: 3 additions & 1 deletion bin/flick
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
require_relative '../lib/flick'
require 'commander/import'

program :version, '0.3.6'
program :version, '0.4.0'
program :description, 'A CLI to capture screenshots, video, logs, and device info for Android (Devices & Emulators) and iOS (Devices).'

command :video do |c|
Expand All @@ -19,10 +19,12 @@ command :video do |c|
c.option '-n', '--name NAME', String, 'Set name of output file, Default: UDID'
c.option '-q', '--unique UNIQUE', 'Pull only unique screenshots. Significantly speeds up the pulling process. Default: true'
c.option '-f', '--format FORMAT', String, 'Set output format (mp4 or gif). Default: mp4'
c.option '-r', '--rate RATE', String, 'Set the framerate (in seconds) when converting screenshots to video. Default: 1'
c.option '-o', '--outdir OUTDIR', String, "Set output directory. Default is #{Dir.pwd}"
c.action do |args, options|
options.default \
:seconds => 0.5, #Seconds per screenshot.
:rate => 1, #Seconds per framerate for screenshot to video conversion.
:count => 500, #This is a safety check to stop runaway screenshot process.
:extend => false, #Extend android video recording (for REAL devices and os >= 4.4) past 180 seconds.
:unique => true, #defaults to pulling only unique screenshots. Speeds up pulling process from device.
Expand Down
10 changes: 7 additions & 3 deletions lib/flick/android.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module Flick
class Android
attr_accessor :udid, :flick_dir, :dir_name, :name, :outdir, :unique, :limit, :specs
attr_accessor :udid, :flick_dir, :dir_name, :name, :outdir, :unique, :limit, :specs, :size

def initialize options
Flick::Checker.system_dependency "adb"
Expand All @@ -27,7 +27,11 @@ def remove_bad_characters string
def create_flick_dirs
Flick::System.setup_system_dir "#{Dir.home}/.flick"
Flick::System.setup_system_dir flick_dir
%x(adb -s #{udid} shell 'mkdir #{dir_name}')
message = %x(adb -s #{udid} shell 'mkdir #{dir_name}').split(":").last.strip
if message == "Read-only file system"
puts "\nDevice: '#{udid}' is a 'Read-only file system'! Flick cannot write to the sdcard folder. Aborting...\n".red
abort
end
end

def clear_files
Expand Down Expand Up @@ -92,7 +96,7 @@ def get_vitals package
stats = JSON.generate({ app_stats: { memory_mb: memory(package), cpu_per: cpu(package) }, system_stats: system_stats })
json = JSON.parse stats
puts json
return json
json
else
puts packages
puts "\n#{package} was not found on device #{udid}! Please choose one from above. e.g. #{packages.sample}\n".red
Expand Down
2 changes: 1 addition & 1 deletion lib/flick/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module Flick
VERSION = "0.3.6"
VERSION = "0.4.0"
end
5 changes: 3 additions & 2 deletions lib/flick/video.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
class Video

attr_accessor :action, :platform, :driver, :image_count, :seconds, :extended, :udid, :format
attr_accessor :action, :platform, :driver, :image_count, :seconds, :rate, :extended, :udid, :format

def initialize options
Flick::Checker.action options[:action]
Expand All @@ -16,6 +16,7 @@ def initialize options
end
self.image_count = options[:count]
self.seconds = options[:seconds].to_f
self.rate = options[:rate].to_f
self.extended = options[:extend].to_b
self.udid = self.driver.udid
self.format = options[:format]
Expand Down Expand Up @@ -143,7 +144,7 @@ def mp4

def convert_images_to_mp4
remove_zero_byte_images
%x(ffmpeg -loglevel quiet -framerate 1 -pattern_type glob -i '#{driver.flick_dir}/screenshot-#{udid}*.png' -c:v libx264 -pix_fmt yuv420p #{driver.flick_dir}/#{driver.name}.mp4)
%x(ffmpeg -loglevel quiet -framerate #{rate} -pattern_type glob -i '#{driver.flick_dir}/screenshot-#{udid}*.png' -c:v libx264 -pix_fmt yuv420p #{driver.flick_dir}/#{driver.name}.mp4)
end

def remove_zero_byte_images
Expand Down

0 comments on commit b7927ff

Please sign in to comment.