viddl 0.0.6 → 0.0.7

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.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/viddl.rb +1 -1
  3. data/lib/viddl/video/clip.rb +15 -11
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a2474d0bc504bb605725febe654e803ab51baa57
4
- data.tar.gz: 4bbd1e2bbbe269122691b9b383417af3b13c77b7
3
+ metadata.gz: affcaf293c945b5477ebc9f744076b4c5486045e
4
+ data.tar.gz: 9d76fb34d7753d40a946c4270da37cd1ccbbcacd
5
5
  SHA512:
6
- metadata.gz: 97afe601385b8684e41a328536145936d932d6313278c05b27d45ecbd71270955221a3abba8ffaf98c6a7d61c8043724215830ae2deed07584c1e610e708f7b3
7
- data.tar.gz: 523e05c2da825af75243e9489ff7358ee8d1aa965060a0da179f3fadaa1988bf9bce1384a9664515be30866930270331de692540ce3443086e9d126a9a0eff96
6
+ metadata.gz: 3d848ff07b6999ad231bfd95cac4253d4d35d306274123b2961a60e11eaf64807d678581c2be2a9b8dc0cfa42e8b18dacabdee857a497e1d6cde9deb1e59f4b1
7
+ data.tar.gz: a51ca3083636af978521ba5d975bf0ae2c74e4c6ca2445f8b3045b1d304d00d8224c6d0128cdd45071f07be04e36d63d08af3d9d8850f2340fe0937ba2527ef8
data/lib/viddl.rb CHANGED
@@ -17,6 +17,6 @@ module Viddl
17
17
 
18
18
  extend self
19
19
 
20
- VERSION = "0.0.6"
20
+ VERSION = "0.0.7"
21
21
 
22
22
  end
@@ -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.values.compact.empty?
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 location without using ffmpeg
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.scan(/#{Download::TEMPDIR}\/(.*)/).flatten.first
128
- result = base
129
- if !options.values.flatten.compact.empty?
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
- result = if options[:output_path].nil? || File.directory?(options[:output_path])
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
- path = "#{options[:output_path]}/" unless options[:output_path].nil?
138
- "#{path}#{name}#{tokens}.#{ext}"
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.6
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-18 00:00:00.000000000 Z
11
+ date: 2017-05-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake