viddl 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/viddl.rb +1 -1
- data/lib/viddl/video/clip.rb +15 -11
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: affcaf293c945b5477ebc9f744076b4c5486045e
|
4
|
+
data.tar.gz: 9d76fb34d7753d40a946c4270da37cd1ccbbcacd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3d848ff07b6999ad231bfd95cac4253d4d35d306274123b2961a60e11eaf64807d678581c2be2a9b8dc0cfa42e8b18dacabdee857a497e1d6cde9deb1e59f4b1
|
7
|
+
data.tar.gz: a51ca3083636af978521ba5d975bf0ae2c74e4c6ca2445f8b3045b1d304d00d8224c6d0128cdd45071f07be04e36d63d08af3d9d8850f2340fe0937ba2527ef8
|
data/lib/viddl.rb
CHANGED
data/lib/viddl/video/clip.rb
CHANGED
@@ -74,10 +74,10 @@ module Viddl
|
|
74
74
|
# @option options [Pathname, String] :output_path Path where clip will be written
|
75
75
|
# @return [String]
|
76
76
|
def command_line(options = {})
|
77
|
-
if options.
|
77
|
+
if options.empty? || options.keys == [:output_path]
|
78
78
|
# when there are no clip options, the source file can just be copied
|
79
|
-
# over to the output file
|
80
|
-
populate_output_path
|
79
|
+
# over to the output file path without using ffmpeg
|
80
|
+
populate_output_path(options)
|
81
81
|
"cp #{@source_path} #{@path.to_s}"
|
82
82
|
else
|
83
83
|
formatted_opts = options_formatted(options)
|
@@ -109,8 +109,11 @@ module Viddl
|
|
109
109
|
# @option options [Hash] :crop The desired crop parameters (:x, :y, :width, :height)
|
110
110
|
# @return [Hash]
|
111
111
|
def options_formatted(options = {})
|
112
|
+
options.delete_if { |k, v| v.nil? }
|
112
113
|
mod_options = MODULES.map { |mod| mod.options_formatted(options) }
|
113
|
-
mod_options.inject(:merge)
|
114
|
+
formatted_options = mod_options.inject(:merge)
|
115
|
+
formatted_options[:output_path] = options[:output_path]
|
116
|
+
formatted_options
|
114
117
|
end
|
115
118
|
|
116
119
|
# Set the clip path
|
@@ -124,20 +127,21 @@ module Viddl
|
|
124
127
|
# @option options [Pathname, String] :output_path Path where clip will be written
|
125
128
|
# @return [String]
|
126
129
|
def populate_output_path(options = {})
|
127
|
-
base = @source_path
|
128
|
-
|
129
|
-
|
130
|
+
base = Pathname.new(@source_path).basename.to_s
|
131
|
+
if options.empty?
|
132
|
+
result = base
|
133
|
+
else
|
130
134
|
name, ext = *base.split(".")
|
131
|
-
|
135
|
+
if options[:output_path].nil? || File.directory?(options[:output_path])
|
132
136
|
tokens = ""
|
133
137
|
MODULES.each do |mod|
|
134
138
|
token = mod.filename_token(options)
|
135
139
|
tokens += "-#{token}" unless token.nil?
|
136
140
|
end
|
137
|
-
|
138
|
-
"#{
|
141
|
+
result = options[:output_path].nil? ? "" : "#{options[:output_path].to_s}/"
|
142
|
+
result += "#{name}#{tokens}.#{ext}"
|
139
143
|
elsif !options[:output_path].nil?
|
140
|
-
"#{options[:output_path]}.#{ext}"
|
144
|
+
result = "#{options[:output_path].to_s}.#{ext}"
|
141
145
|
end
|
142
146
|
end
|
143
147
|
@path = Pathname.new(result)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: viddl
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ari Russo
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-05-
|
11
|
+
date: 2017-05-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|