video_converter 0.6.6 → 0.6.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -79,12 +79,18 @@ module VideoConverter
79
79
  end
80
80
 
81
81
  def output_groups(outputs)
82
- groups = []
83
- outputs.select { |output| output.type == 'playlist' }.each do |playlist|
82
+ # qualities with the same group param are one group
83
+ groups = Hash.new([])
84
+ outputs.each { |output| groups[output.group] += [output] if output.group.present? }
85
+ groups = groups.values
86
+
87
+ # qualities of one playlist are one group
88
+ (outputs - groups.flatten).select { |output| output.type == 'playlist' }.each do |playlist|
84
89
  paths = playlist.streams.map { |stream| stream[:path] }
85
90
  groups << outputs.select { |output| paths.include?(output.filename) }.unshift(playlist)
86
91
  end
87
- # qualities without playlist are separate groups
92
+
93
+ # other outputs are separate groups
88
94
  (outputs - groups.flatten).each { |output| groups << [output] }
89
95
  groups
90
96
  end
@@ -9,7 +9,7 @@ module VideoConverter
9
9
  self.log = 'converter.log'
10
10
  self.keyframe_interval_in_seconds = 4
11
11
 
12
- attr_accessor :work_dir, :filename, :log, :type, :chunks_dir, :ffmpeg_output, :path, :streams, :width, :height, :one_pass, :rotate, :faststart, :thumbnails, :uid, :options
12
+ attr_accessor :chunks_dir, :faststart, :ffmpeg_output, :filename, :group, :height, :log, :one_pass, :options, :path, :rotate, :streams, :thumbnails, :type, :uid, :width, :work_dir
13
13
 
14
14
  def initialize params = {}
15
15
  self.work_dir = File.join(self.class.work_dir, params[:uid])
@@ -26,7 +26,7 @@ module VideoConverter
26
26
  self.ffmpeg_output = File.join(work_dir, filename)
27
27
  end
28
28
  raise ArgumentError.new('Invalid type') unless %w(default segmented playlist).include?(type)
29
- [:path, :streams, :width, :height, :one_pass, :rotate, :faststart, :thumbnails].each { |attr| self.send("#{attr}=", params[attr]) }
29
+ [:path, :streams, :width, :height, :one_pass, :rotate, :faststart, :thumbnails, :group].each { |attr| self.send("#{attr}=", params[attr]) }
30
30
  [:video_bitrate, :audio_bitrate].each { |bitrate| params[bitrate] = "#{params[bitrate]}k" if params[bitrate].is_a?(Numeric) }
31
31
 
32
32
  # options will be substituted to convertation commands
@@ -1,3 +1,3 @@
1
1
  module VideoConverter
2
- VERSION = "0.6.6"
2
+ VERSION = "0.6.7"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: video_converter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.6
4
+ version: 0.6.7
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-07-16 00:00:00.000000000 Z
12
+ date: 2014-07-17 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: video_screenshoter
@@ -140,7 +140,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
140
140
  version: '0'
141
141
  segments:
142
142
  - 0
143
- hash: -3100160635854991743
143
+ hash: -687398470917858121
144
144
  required_rubygems_version: !ruby/object:Gem::Requirement
145
145
  none: false
146
146
  requirements:
@@ -149,7 +149,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
149
149
  version: '0'
150
150
  segments:
151
151
  - 0
152
- hash: -3100160635854991743
152
+ hash: -687398470917858121
153
153
  requirements:
154
154
  - ffmpeg, version 1.2 or greated configured with libx264 and libfaac
155
155
  - live_segmenter to convert to hls