av 0.0.2 → 0.0.6
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 +4 -4
- data/.travis.yml +6 -0
- data/README.md +3 -2
- data/Rakefile +5 -0
- data/lib/av.rb +3 -19
- data/lib/av/cli.rb +24 -0
- data/lib/av/commands/avconv.rb +1 -0
- data/lib/av/commands/base.rb +29 -3
- data/lib/av/commands/ffmpeg.rb +1 -0
- data/lib/av/version.rb +1 -1
- data/spec/av/av_spec.rb +2 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7fba45a60d49e120bdaf9d2e27d2b6a82353f35e
|
4
|
+
data.tar.gz: 06a7fc08a643988726ce5ac463f6758cd27e69f4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d6b7f5ffc96ca1dc66bd591b440381e253045d506cb17b51c90791b073bc124865e27b0c6879ad914839891848bda7fd3a095a3741a11d5a03caaa8077cfe0c1
|
7
|
+
data.tar.gz: 8e2f30438d202dcf0da6c80bfded898d83fd357f3c8040b01ad11d84ebb6ab52222fc894ad17b3beff4741a70812ad52e0daa89b08307fdf0459486ff2a24ce0
|
data/.travis.yml
ADDED
data/README.md
CHANGED
data/Rakefile
CHANGED
data/lib/av.rb
CHANGED
@@ -1,16 +1,15 @@
|
|
1
1
|
require "av/version"
|
2
2
|
require "av/exceptions"
|
3
|
-
require "
|
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
|
-
|
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
|
data/lib/av/cli.rb
ADDED
@@ -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
|
data/lib/av/commands/avconv.rb
CHANGED
data/lib/av/commands/base.rb
CHANGED
@@ -13,9 +13,9 @@ module Av
|
|
13
13
|
attr_accessor :destination
|
14
14
|
|
15
15
|
def initialize
|
16
|
-
|
17
|
-
|
18
|
-
|
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
|
|
data/lib/av/commands/ffmpeg.rb
CHANGED
data/lib/av/version.rb
CHANGED
data/spec/av/av_spec.rb
CHANGED
@@ -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::
|
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.
|
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-
|
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
|