av 0.0.2 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4eb96469037b44a476417432ba11e3487c8e5d48
4
- data.tar.gz: 1beaccbfdc03404ab940ec6f0a9dac36e2cfcd0c
3
+ metadata.gz: 7fba45a60d49e120bdaf9d2e27d2b6a82353f35e
4
+ data.tar.gz: 06a7fc08a643988726ce5ac463f6758cd27e69f4
5
5
  SHA512:
6
- metadata.gz: 378c8cf269006953df35555e2c36438b2cd82a565fe5c1bf72a46aed469cbb92097519dbddbe26a9f728b8df98ac32bd915f5dea53c7818dc2d0dfb69ef5329b
7
- data.tar.gz: bff6b5805a553aa1a62d2abf3e6ae365f124b0e75f12ecd476fe9f4fe8cc7f8fdf67d89f85c2326f0e31bca41bf4a6f9161d1b76d1a7f873f90553af2311f53b
6
+ metadata.gz: d6b7f5ffc96ca1dc66bd591b440381e253045d506cb17b51c90791b073bc124865e27b0c6879ad914839891848bda7fd3a095a3741a11d5a03caaa8077cfe0c1
7
+ data.tar.gz: 8e2f30438d202dcf0da6c80bfded898d83fd357f3c8040b01ad11d84ebb6ab52222fc894ad17b3beff4741a70812ad52e0daa89b08307fdf0459486ff2a24ce0
@@ -0,0 +1,6 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.1.2
4
+ before_install:
5
+ - sudo apt-get update -qq
6
+ - sudo apt-get install -y libav-tools
data/README.md CHANGED
@@ -1,6 +1,7 @@
1
- # Av
1
+ [![Build Status](https://travis-ci.org/ruby-av/av.svg?branch=master)](https://travis-ci.org/ruby-av/av)
2
+ # AV
2
3
 
3
- TODO: Write a gem description
4
+ A Ruby Programmable interface for
4
5
 
5
6
  ## Installation
6
7
 
data/Rakefile CHANGED
@@ -1,2 +1,7 @@
1
1
  require "bundler/gem_tasks"
2
+ require "rake"
3
+ require "rspec/core/rake_task"
2
4
 
5
+ RSpec::Core::RakeTask.new(:spec)
6
+ task test: :spec
7
+ task default: :spec
data/lib/av.rb CHANGED
@@ -1,16 +1,15 @@
1
1
  require "av/version"
2
2
  require "av/exceptions"
3
- require "cocaine"
3
+ require "av/cli"
4
4
  require "av/commands/ffmpeg"
5
5
  require "av/commands/avconv"
6
+ require "cocaine"
6
7
 
7
8
  module Av
8
9
  extend self
9
10
 
10
11
  def cli
11
- return @cli if @cli
12
- @cli = load_av_library
13
- @cli
12
+ ::Av::Cli.new
14
13
  end
15
14
 
16
15
  def quiet
@@ -41,19 +40,4 @@ module Av
41
40
  return false
42
41
  end
43
42
  end
44
-
45
- def load_av_library
46
- found = []
47
- found << 'ffmpeg' if detect_command('ffmpeg')
48
- found << 'avconv' if detect_command('avprobe')
49
- Av.log("Found: #{found.inspect}")
50
- if found.empty?
51
- raise Av::UnableToDetect, "Unable to detect any supported library"
52
- else
53
- found.each do |library|
54
- @cli = Object.const_get('Av').const_get('Commands').const_get(library.capitalize).new
55
- end
56
- end
57
- @cli
58
- end
59
43
  end
@@ -0,0 +1,24 @@
1
+ module Av
2
+ class Cli
3
+ attr_accessor :command
4
+
5
+ def initialize
6
+ found = []
7
+ found << 'ffmpeg' if ::Av.detect_command('ffmpeg')
8
+ found << 'avconv' if ::Av.detect_command('avprobe')
9
+ ::Av.log("Found: #{found.inspect}")
10
+ if found.empty?
11
+ raise Av::UnableToDetect, "Unable to detect any supported library"
12
+ else
13
+ found.each do |library|
14
+ @command = Object.const_get('Av').const_get('Commands').const_get(library.capitalize).new
15
+ end
16
+ end
17
+ end
18
+
19
+ protected
20
+ def method_missing name, *args, &block
21
+ @command.send(name, *args, &block)
22
+ end
23
+ end
24
+ end
@@ -17,6 +17,7 @@ module Av
17
17
 
18
18
  def filter_volume vol
19
19
  @input_params << "-af volume=volume=#{vol}"
20
+ self
20
21
  end
21
22
  end
22
23
  end
@@ -13,9 +13,9 @@ module Av
13
13
  attr_accessor :destination
14
14
 
15
15
  def initialize
16
- @input_params = []
17
- @output_params = []
18
- @default_params = []
16
+ reset_input_filters
17
+ reset_output_filters
18
+ reset_default_filters
19
19
  end
20
20
 
21
21
  def add_source src
@@ -26,6 +26,32 @@ module Av
26
26
  @destination = dest
27
27
  end
28
28
 
29
+ def reset_input_filters
30
+ @input_params = []
31
+ end
32
+
33
+ def reset_output_filters
34
+ @output_params = []
35
+ end
36
+
37
+ def reset_default_filters
38
+ @output_params = []
39
+ end
40
+
41
+ def add_input_filters hash
42
+ hash.each do |k,v|
43
+ @input_params << "-#{k} #{v}"
44
+ end
45
+ self
46
+ end
47
+
48
+ def add_output_filters hash
49
+ hash.each do |k,v|
50
+ @output_params << "-#{k} #{v}"
51
+ end
52
+ self
53
+ end
54
+
29
55
  def command_line
30
56
  raise Av::CommandError if (@source.nil? && @destination.nil?) || @command_name.nil?
31
57
 
@@ -23,6 +23,7 @@ module Av
23
23
 
24
24
  def filter_volume vol
25
25
  @input_params << "-af volume=#{vol}"
26
+ self
26
27
  end
27
28
  end
28
29
  end
@@ -1,3 +1,3 @@
1
1
  module Av
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.6"
3
3
  end
@@ -1,7 +1,8 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe Av do
4
- it { expect(Av.cli).to be_kind_of Av::Commands::Base }
4
+ it { expect(Av.cli).to be_kind_of Av::Cli }
5
+ it { expect(Av.cli).not_to eq Av.cli }
5
6
  it { expect { Av.cli.run }.to raise_error Av::CommandError }
6
7
 
7
8
  describe 'run' do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: av
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Omar Abdel-Wahab
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-09-07 00:00:00.000000000 Z
11
+ date: 2014-09-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -74,12 +74,14 @@ extensions: []
74
74
  extra_rdoc_files: []
75
75
  files:
76
76
  - .gitignore
77
+ - .travis.yml
77
78
  - Gemfile
78
79
  - LICENSE.txt
79
80
  - README.md
80
81
  - Rakefile
81
82
  - av.gemspec
82
83
  - lib/av.rb
84
+ - lib/av/cli.rb
83
85
  - lib/av/commands/avconv.rb
84
86
  - lib/av/commands/base.rb
85
87
  - lib/av/commands/ffmpeg.rb