mkv2m4v 1.0.0 → 1.1.0
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.
- checksums.yaml +4 -4
- data/README.md +7 -0
- data/lib/mkv2m4v.rb +35 -4
- data/lib/mkv2m4v/version.rb +1 -1
- 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: a9a02e4e57fb5988822557f0b373eee08a97305e
|
4
|
+
data.tar.gz: c967e78ab6f3608a2b86ae8f231f3d2ec6a0eb68
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9e07d02159eedf36585c9a5befba5f0fea49c2f598de0060681030c231d0e35c73ec3ba2166502e946932a4590fdec864d010f12958613661a4a4ee66bda597d
|
7
|
+
data.tar.gz: af1df65b2e9aad67e28dc3ff73b392c818c8a3291ffd5a16fe3388a57ba02030ba0d6e890d4a89c9ba4d5913b3e1daacbcf119da7fe23c146bc8ff6deadf3037
|
data/README.md
CHANGED
@@ -34,6 +34,13 @@ should install automatically. If not, you should manually install `ffmpeg`:_
|
|
34
34
|
$ brew install ffmpeg --with-tools
|
35
35
|
```
|
36
36
|
|
37
|
+
If you have any trouble after installing the mkdv2m4v gem, you can test the
|
38
|
+
dependencies using the `--check` argument:
|
39
|
+
|
40
|
+
```bash
|
41
|
+
$ mkv2m4v --check
|
42
|
+
```
|
43
|
+
|
37
44
|
## Usage
|
38
45
|
|
39
46
|
```bash
|
data/lib/mkv2m4v.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
require "mkv2m4v/version"
|
2
2
|
require "mkv2m4v/file"
|
3
3
|
require "trollop"
|
4
|
+
require "colorize"
|
4
5
|
|
5
6
|
module Mkv2m4v
|
6
7
|
class Command
|
@@ -25,20 +26,50 @@ module Mkv2m4v
|
|
25
26
|
end
|
26
27
|
|
27
28
|
def parse_options
|
28
|
-
|
29
|
+
parser = Trollop::Parser.new do
|
29
30
|
version Mkv2m4v::VersionDescription
|
30
31
|
banner [Mkv2m4v::Description, Mkv2m4v::Usage].join("\n")
|
31
|
-
opt :info,
|
32
|
-
opt :lang,
|
33
|
-
opt :dir,
|
32
|
+
opt :info, "Print media info only"
|
33
|
+
opt :lang, "Preferred languages, comma separated", :type => :string, :default => "English"
|
34
|
+
opt :dir, "Destination directory (default: same dir as source mkv)", :type => :string
|
35
|
+
opt :check, "Check dependencies"
|
34
36
|
end
|
37
|
+
@options = Trollop::with_standard_exception_handling(parser) { parser.parse ARGV }
|
35
38
|
parse_languages
|
36
39
|
@filenames = ARGV
|
40
|
+
|
41
|
+
|
42
|
+
check_dependencies_and_exit if @options[:check]
|
43
|
+
parser.educate if @filenames.empty?
|
37
44
|
end
|
38
45
|
|
39
46
|
def parse_languages
|
40
47
|
@options[:languages] =
|
41
48
|
@options[:lang].split(/\s*,\s*/).map { |lang| Iso639[lang] }.compact
|
42
49
|
end
|
50
|
+
|
51
|
+
def check_dependencies_and_exit
|
52
|
+
results = []
|
53
|
+
results << check_dependency("mediainfo", "--Version", "media-info", :exit_status => 255)
|
54
|
+
results << check_dependency("MP4Box", "-version", "gpac")
|
55
|
+
results << check_dependency("mkvextract", "--version", "mkvtoolnix", :requirements => "version >= 6 required")
|
56
|
+
results << check_dependency("ffmpeg", "-version", "ffmpeg --with-tools")
|
57
|
+
exit results.count(false)
|
58
|
+
end
|
59
|
+
|
60
|
+
def check_dependency(command, version_arg, brew_arg, options = {})
|
61
|
+
requirements = options.delete(:requirements)
|
62
|
+
exit_status = options.delete(:exit_status)
|
63
|
+
|
64
|
+
puts "Checking #{command}...".magenta
|
65
|
+
success = system(command, version_arg) || $?.exitstatus == exit_status
|
66
|
+
if success
|
67
|
+
print " ...Installed. ".green
|
68
|
+
puts requirements.to_s.yellow.on_black
|
69
|
+
else
|
70
|
+
$stderr.puts "Missing #{command}. Please `brew install #{brew_arg}`".white.on_red
|
71
|
+
end
|
72
|
+
success
|
73
|
+
end
|
43
74
|
end
|
44
75
|
end
|
data/lib/mkv2m4v/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mkv2m4v
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryan McGeary
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-04-
|
11
|
+
date: 2014-04-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: trollop
|