av 0.1.2 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/av.rb +10 -4
- data/lib/av/commands/base.rb +3 -3
- data/lib/av/engine.rb +7 -0
- data/lib/av/logger.rb +17 -0
- data/lib/av/version.rb +1 -1
- data/spec/av/base_spec.rb +12 -3
- data/spec/support/assets/image.png +0 -0
- metadata +6 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2680b92872fd043f4f223ccaad0d7b667c8e9e51
|
4
|
+
data.tar.gz: 29f2a2d421492496ba12f0942845cefe817069eb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 94ed1426a502750e3e2b8e336d89805f64ef6f136655adf5caa37596d6689762e1b9f5952f7b9bdbb192f9ab96d6e3c4582eca0a373baa49d357da774af50947
|
7
|
+
data.tar.gz: ce444930d672df1b1c5805909bde0c9934ac84c95538d437ccadf939a8f41dfeb667334e2ae67d9b477e9602c8b85d1e2dd72aeb143a48faf85c161fc76e61bb
|
data/lib/av.rb
CHANGED
@@ -1,15 +1,25 @@
|
|
1
1
|
require "av/version"
|
2
2
|
require "av/exceptions"
|
3
|
+
require "av/logger"
|
3
4
|
require "av/cli"
|
4
5
|
require "av/param_hash"
|
5
6
|
require "av/commands/ffmpeg"
|
6
7
|
require "av/commands/avconv"
|
7
8
|
require "cocaine"
|
9
|
+
require "av/engine" if defined?(Rails)
|
8
10
|
|
9
11
|
module Av
|
10
12
|
extend self
|
13
|
+
extend Logger
|
14
|
+
|
15
|
+
def options
|
16
|
+
@options ||= {
|
17
|
+
log: false
|
18
|
+
}
|
19
|
+
end
|
11
20
|
|
12
21
|
def cli(options = {})
|
22
|
+
@options = options unless options.empty?
|
13
23
|
::Av::Cli.new(options)
|
14
24
|
end
|
15
25
|
|
@@ -21,8 +31,4 @@ module Av
|
|
21
31
|
raise Av::CommandError, "error while running command #{line}: #{e}"
|
22
32
|
end
|
23
33
|
end
|
24
|
-
|
25
|
-
def log message
|
26
|
-
puts "[AV] #{message}"
|
27
|
-
end
|
28
34
|
end
|
data/lib/av/commands/base.rb
CHANGED
@@ -104,8 +104,8 @@ module Av
|
|
104
104
|
if line =~ /Video:(.*)/
|
105
105
|
v = $1.to_s
|
106
106
|
size = v.match(/\d{3,5}x\d{3,5}/).to_s
|
107
|
-
meta[:size] = size
|
108
|
-
meta[:aspect] = size.split('x').first.to_f / size.split('x').last.to_f
|
107
|
+
meta[:size] = size unless size.empty?
|
108
|
+
meta[:aspect] = size.split('x').first.to_f / size.split('x').last.to_f if meta[:size]
|
109
109
|
end
|
110
110
|
# Matching Duration: 00:01:31.66, start: 0.000000, bitrate: 10404 kb/s
|
111
111
|
if line =~ /Duration:(\s.?(\d*):(\d*):(\d*\.\d*))/
|
@@ -115,7 +115,7 @@ module Av
|
|
115
115
|
meta[:rotate] = $1.to_i
|
116
116
|
end
|
117
117
|
end
|
118
|
-
meta
|
118
|
+
meta unless meta.empty?
|
119
119
|
end
|
120
120
|
|
121
121
|
def output_format format
|
data/lib/av/engine.rb
ADDED
data/lib/av/logger.rb
ADDED
data/lib/av/version.rb
CHANGED
data/spec/av/base_spec.rb
CHANGED
@@ -5,10 +5,19 @@ describe Av::Commands::Base do
|
|
5
5
|
let(:source) { File.new(Dir.pwd + '/spec/support/assets/sample.mp4').path }
|
6
6
|
|
7
7
|
describe '.identify' do
|
8
|
-
|
8
|
+
describe 'supported files' do
|
9
|
+
let(:meta) { subject.identify source }
|
9
10
|
|
10
|
-
|
11
|
-
|
11
|
+
it { expect(meta).to be_a Hash }
|
12
|
+
it { expect(meta.keys).to include :size, :fps, :length, :aspect }
|
13
|
+
end
|
14
|
+
|
15
|
+
describe 'unsupported files' do
|
16
|
+
let(:unsupported) { File.new(Dir.pwd + '/spec/support/assets/image.png').path }
|
17
|
+
let(:meta) { subject.identify unsupported }
|
18
|
+
|
19
|
+
it { expect(meta).to be_nil }
|
20
|
+
end
|
12
21
|
end
|
13
22
|
|
14
23
|
describe '.add_input_param' do
|
Binary file
|
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.
|
4
|
+
version: 0.4.0
|
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-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -85,7 +85,9 @@ files:
|
|
85
85
|
- lib/av/commands/avconv.rb
|
86
86
|
- lib/av/commands/base.rb
|
87
87
|
- lib/av/commands/ffmpeg.rb
|
88
|
+
- lib/av/engine.rb
|
88
89
|
- lib/av/exceptions.rb
|
90
|
+
- lib/av/logger.rb
|
89
91
|
- lib/av/param_hash.rb
|
90
92
|
- lib/av/version.rb
|
91
93
|
- spec/av/av_spec.rb
|
@@ -93,6 +95,7 @@ files:
|
|
93
95
|
- spec/av/base_spec.rb
|
94
96
|
- spec/av/ffmpeg_spec.rb
|
95
97
|
- spec/spec_helper.rb
|
98
|
+
- spec/support/assets/image.png
|
96
99
|
- spec/support/assets/sample.mp4
|
97
100
|
homepage: https://github.com/ruby-av
|
98
101
|
licenses:
|
@@ -124,4 +127,5 @@ test_files:
|
|
124
127
|
- spec/av/base_spec.rb
|
125
128
|
- spec/av/ffmpeg_spec.rb
|
126
129
|
- spec/spec_helper.rb
|
130
|
+
- spec/support/assets/image.png
|
127
131
|
- spec/support/assets/sample.mp4
|