vollbremsung 0.0.8 → 0.0.9

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- NmFlZDEyNzA5YWQ0NTdlZWQyMzc2ODA0ODkyMGY5NDQzZDE1NjBkNQ==
4
+ YWY1NjRkYzg4YzQ0MjA3MmQ3NmZkZDVhYWEwYWY4NTczODgwNDIzYw==
5
5
  data.tar.gz: !binary |-
6
- ODVmMDRiNTkwMDlmOTg4OWNkNDUxNzgxY2UxMDhjMTQ4NDE2ZGFiNw==
6
+ NmU3ZjYzNDIyYjk4MGQ2NjhmYmQ5MWMyMWViZTM3YjZhZWM3MTkzNw==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- NDQzYTk3NzllODgzNjdkNzNiZDQ2NTVmNWY3MDZkNTY2YzI2NmQxNmMzYmU1
10
- MzA0YWU0OTQwNTJlMWJlOTg5ZWJhZWZiZTg1YjBjYzg4Y2U1ODQ3NzE4ODI1
11
- ZGI4NWYwMDZkZDI4MzYxNTYzNGU3MDIzNjkxYTFmMDdjNjViMjM=
9
+ Yjg2MWViYzg0NGRhZjczZjQ4ZmY2ZGZhZjZhMjM4N2FkYmRlMDk5NjM2MTFi
10
+ MjdjNDE0NWI3Mzg0MjhjYjhiMmY0Y2Y0MTZlODgwZDE0YWI3OWM4ZjcwZmU3
11
+ NjYxYjZjMWM1YzBkNWZlYTE4OWU5M2NkY2M0MTY0NzIxYTFjZGM=
12
12
  data.tar.gz: !binary |-
13
- NDVhOTNkMGI1NDgxM2U3ZDA1NmY0NWQ1NjI3YmY1M2IzYThhODJiOWIxNjVh
14
- ZGM1MzIwNTFlYjk5ZmYyZmJjZjQyOTNkNjA1MjM3NmQ0Yzg1N2RmOTgyMDVl
15
- NjhmZTVlYjMxMWVmODhiOTI0ZDIzMDMyYTExZDliODdjNjc3ZDg=
13
+ MzNlYjM0Y2E2ZGMxOTE1ZmNlOWExOTI0M2ZjNDhjMDE3YmUwYmEwNDUzMmRj
14
+ NDNhZmQ2NzcyMmY5M2Y5YTQyNmYwMGZlYTAzYmIwYTM4ODBkZmViZDBjOTIz
15
+ ZTdiNzdkMzljZDI5MWQwN2QxYjYyYTE3NzgzMzBmMmI4YjBjZTQ=
data/README.md CHANGED
@@ -1,4 +1,5 @@
1
- vollbremsung
2
- ============
1
+ # vollbremsung
2
+
3
+ [![Gem Version](https://badge.fury.io/rb/vollbremsung.svg)](http://badge.fury.io/rb/vollbremsung)
3
4
 
4
5
  Handbrake bulk encoding tool
@@ -4,6 +4,7 @@
4
4
  require 'mkmf' # part of stdlib
5
5
  require 'open3'
6
6
  require 'json'
7
+ require 'optparse'
7
8
  require 'handbrake'
8
9
  require 'vollbremsung'
9
10
 
@@ -22,45 +23,47 @@ def ffprobe(file)
22
23
  end
23
24
 
24
25
  options = {}
25
- begin
26
- require 'optparse'
27
- OptionParser.new do |opts|
28
- opts.banner = Vollbremsung::USAGE
29
- opts.separator ""
30
-
31
- opts.on("-d", "--delete", "Delete source files after successful encoding") do |flag|
32
- options[:delete] = true
33
- end
34
26
 
35
- opts.on("-m", "--move", "Move source files to <FILENAME>.old after successful encoding") do |flag|
36
- options[:move] = true
37
- end
27
+ OptionParser.new do |opts|
28
+ opts.banner = Vollbremsung::USAGE
29
+ opts.separator ""
38
30
 
39
- opts.on("-r", "--recursive", "Process all file in subdirectories recursively as well") do |flag|
40
- options[:recursive] = true
41
- end
31
+ opts.on("-d", "--delete", "Delete source files after successful encoding") do |flag|
32
+ options[:delete] = true
33
+ end
42
34
 
43
- opts.on("-t", "--title", "Set the mp4 title to the filename") do |flag|
44
- options[:title] = true
45
- end
35
+ opts.on("--list-only", "List matching files only. Do not run processing") do |flag|
36
+ options[:list_only] = true
37
+ end
46
38
 
47
- opts.on_tail("-h", "--help", "Show this message") do
48
- puts opts
49
- exit
50
- end
51
- end.parse! # do the parsing. do it now!
52
- rescue LoadError
53
- puts "Option parsing not supported on your system. All options will be ignored."
54
- puts "To enable support run 'gem install optparse'"
55
- options[:delete] = false
56
- options[:move] = false
57
- options[:recursive] = false
58
- options[:title] = false
59
- end
39
+ opts.on("-m", "--move", "Move source files to <FILENAME>.old after successful encoding") do |flag|
40
+ options[:move] = true
41
+ end
42
+
43
+ opts.on("-r", "--recursive", "Process all file in subdirectories recursively as well") do |flag|
44
+ options[:recursive] = true
45
+ end
46
+
47
+ opts.on("-t", "--title", "Set the mp4 title to the filename") do |flag|
48
+ options[:title] = true
49
+ end
50
+
51
+ opts.on("--x264-preset [PRESET]", "Set the x264-preset. Default is: #{Vollbremsung::X264_DEFAULT_PRESET}") do |preset|
52
+ options[:x264_preset] = preset
53
+ end
54
+
55
+ opts.on_tail("-h", "--help", "Show this message") do
56
+ puts opts
57
+ exit
58
+ end
59
+ end.parse! # do the parsing. do it now!
60
+
61
+
62
+ options[:x264_preset] = Vollbremsung::X264_DEFAULT_PRESET if options[:x264_preset].nil?
60
63
 
61
64
 
62
65
  if ARGV[0].nil?
63
- puts "No target directory provided."
66
+ puts "No target provided."
64
67
  puts Vollbremsung::USAGE
65
68
  exit 1
66
69
  end
@@ -78,21 +81,24 @@ if options[:move] && options[:delete]
78
81
  exit 1
79
82
  end
80
83
 
81
- unless find_executable('HandbrakeCLI') || find_executable('HandBrakeCLI')
82
- puts "It seems you do not have HandbrakeCLI installed or it is not available in your $PATH."
83
- puts "Install it an run again"
84
- exit 1
85
- end
84
+ # probe for required executable
85
+ # only do this if not in list-only mode
86
+ unless options[:list_only]
87
+ unless find_executable('HandbrakeCLI') || find_executable('HandBrakeCLI')
88
+ puts "It seems you do not have HandbrakeCLI installed or it is not available in your $PATH."
89
+ puts "You can get the executable from http://handbrake.fr/downloads.php"
90
+ exit 1
91
+ end
86
92
 
87
- unless find_executable 'ffprobe'
88
- puts "It seems you do not have ffprobe installed or it is not available in your $PATH."
89
- puts "ffprobe is part of ffmpeg. Install it for your system and run again."
90
- exit 1
93
+ unless find_executable 'ffprobe'
94
+ puts "It seems you do not have ffprobe installed or it is not available in your $PATH."
95
+ puts "ffprobe is part of ffmpeg. Install it for your system and run again."
96
+ exit 1
97
+ end
91
98
  end
92
99
 
93
- File.delete 'mkmf.log' # find_executable seems to create such file in case executable is not found
94
100
 
95
- #StreamStruct = Struct.new(:count,:names)
101
+ File.delete 'mkmf.log' rescue nil# find_executable seems to create such file in case executable is not found
96
102
 
97
103
  #HANDBRAKE_OPTIONS = "--encoder x264 --quality 20.0 --aencode faac -B 160 --mixdown dpl2 --arate Auto -D 0.0 --format mp4 --markers --audio-copy-mask aac,ac3,dtshd,dts,mp3 --audio-fallback ffac3 --x264-preset veryfast --loose-anamorphic --modulus 2"
98
104
 
@@ -117,6 +123,8 @@ else
117
123
  target_files << File.absolute_path(TARGET_PATH)
118
124
  end
119
125
 
126
+ exit if options[:list_only]
127
+
120
128
  target_files.each do |infile|
121
129
 
122
130
  metadata = ffprobe(infile)
@@ -163,7 +171,7 @@ target_files.each do |infile|
163
171
  begin
164
172
  HandBrake::CLI.new.input(infile).encoder('x264').quality('20.0').aencoder('faac').
165
173
  ab('160').mixdown('dpl2').arate('Auto').drc('0.0').format('mp4').markers.
166
- audio_copy_mask('aac,ac3,dtshd,dts,mp3').audio_fallback('ffac3').x264_preset('veryfast').
174
+ audio_copy_mask('aac,ac3,dtshd,dts,mp3').audio_fallback('ffac3').x264_preset(options[:x264_preset]).
167
175
  loose_anamorphic.modulus('2').audio((1..astreams.count).to_a.join(',')).aname(astreams.names.join(',')).
168
176
  subtitle((1..sstreams.count).to_a.join(',')).output(outfile)
169
177
 
@@ -181,7 +189,7 @@ target_files.each do |infile|
181
189
  log "compression ratio: %.2f" % (outfile_size.to_f / infile_size.to_f)
182
190
 
183
191
  if options[:title]
184
- log "setting mp4 title"
192
+ log "setting MP4 title"
185
193
 
186
194
  infile_noext = File.join( File.dirname(infile), File.basename(infile,File.extname(infile)))
187
195
  tmpfile = infile_noext + ".tmp.mp4"
@@ -196,7 +204,7 @@ target_files.each do |infile|
196
204
  log "ERROR: moving #{tmpfile} to #{outfile}"
197
205
  end
198
206
  else
199
- log "ERROR: mp4 title could not be changed"
207
+ log "ERROR: MP4 title could not be changed"
200
208
  end
201
209
  end # if options[:title]
202
210
 
@@ -1,9 +1,10 @@
1
1
  module Vollbremsung
2
2
 
3
3
  USAGE = "Usage: vollbremsung [options] <target>"
4
- VERSION = '0.0.8'
5
- CONVERT_TYPES = ['mkv','avi','mov','flv','mpg','wmv']
4
+ VERSION = '0.0.9'
5
+ CONVERT_TYPES = ['mkv','avi','mov','flv','mpg','wmv','ogm']
6
6
  FFMPEG_OPTIONS = "-map 0 -acodec copy -vcodec copy -scodec copy"
7
+ X264_DEFAULT_PRESET = "veryfast"
7
8
 
8
9
  class StreamDescr < Struct.new(:count,:names)
9
10
  def initialize
@@ -19,5 +19,6 @@ Gem::Specification.new do |spec|
19
19
  spec.require_paths = ['lib']
20
20
 
21
21
  spec.required_ruby_version = '>= 1.9.3'
22
- spec.add_dependency 'handbrake', '~> 0'
22
+ spec.add_dependency 'handbrake', '~> 0.4'
23
+
23
24
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vollbremsung
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 0.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Maximilian Irro
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - ~>
18
18
  - !ruby/object:Gem::Version
19
- version: '0'
19
+ version: '0.4'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ~>
25
25
  - !ruby/object:Gem::Version
26
- version: '0'
26
+ version: '0.4'
27
27
  description: Handbrake bulk encoding tool
28
28
  email: max@disposia.org
29
29
  executables: