transcode 1.0.2 → 1.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +3 -0
- data/{LICENSE → LICENSE.txt} +0 -0
- data/README.md +9 -4
- data/Rakefile +1 -1
- data/lib/transcode/configurator.rb +24 -13
- data/lib/transcode/utils.rb +12 -4
- data/lib/transcode/version.rb +3 -2
- data/transcode.gemspec +3 -1
- metadata +18 -5
- data/Gemfile.lock +0 -39
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b226e860131744a93fe08350592d1ea68fe654bff97d29d16ecbc0a71120aed5
|
4
|
+
data.tar.gz: 5e4e5db31ef304fbe5936cf9bc549d760ae0a43df5de0b7588a4cb7d4e5bf0ab
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aa1c762d5a4b78c11427376fb4d137609d2260ffc74ca34106d1f795fbb5d5baa837ce5eadbb620c532f138bd614e4f2e657ecc9ca843c62237e813ef2809887
|
7
|
+
data.tar.gz: b259365085e5a20aa7f2544c46323f7f858b4a1604599493abf8b336cba1d697f977a7bc91d02fb8026c2021e443547588ae47bd5a57fc0c351cc1f55c33b22c
|
data/Gemfile
CHANGED
data/{LICENSE → LICENSE.txt}
RENAMED
File without changes
|
data/README.md
CHANGED
@@ -1,12 +1,16 @@
|
|
1
1
|
# Transcode
|
2
|
-
Tool to transcode batch of video files
|
2
|
+
Tool to transcode batch of video files.
|
3
3
|
|
4
4
|
[![Build
|
5
5
|
Status](https://travis-ci.org/rdavid/transcode.svg)](https://travis-ci.org/rdavid/transcode)
|
6
6
|
[![Build
|
7
7
|
status](https://ci.appveyor.com/api/projects/status/yqxb43ltxrjj776a?svg=true)](https://ci.appveyor.com/project/rdavid/transcode)
|
8
|
+
![Ruby](https://github.com/rdavid/transcode/workflows/Ruby/badge.svg)
|
8
9
|
[![Gem
|
9
10
|
Version](https://badge.fury.io/rb/transcode.svg)](https://badge.fury.io/rb/transcode)
|
11
|
+
|
12
|
+
[![Maintainability](https://api.codeclimate.com/v1/badges/5e21a1c1f8a3923584e3/maintainability)](https://codeclimate.com/github/rdavid/transcode/maintainability)
|
13
|
+
[![Hits-of-Code](https://hitsofcode.com/github/rdavid/transcode)](https://hitsofcode.com/view/github/rdavid/transcode)
|
10
14
|
[![License](https://img.shields.io/github/license/rdavid/transcode)](https://github.com/rdavid/transcode/blob/master/LICENSE.txt)
|
11
15
|
|
12
16
|
* [About](#about)
|
@@ -15,7 +19,7 @@ Version](https://badge.fury.io/rb/transcode.svg)](https://badge.fury.io/rb/trans
|
|
15
19
|
* [License](#license)
|
16
20
|
|
17
21
|
## About
|
18
|
-
Hi, I'm [David Rabkin](
|
22
|
+
Hi, I'm [David Rabkin](http://davi.drabk.in). I created this tool to
|
19
23
|
enhance [Don Melton](http://donmelton.com/)'s [Video
|
20
24
|
Transcoding](https://github.com/donmelton/video_transcoding/). It applies
|
21
25
|
Video Trascoding to each video file in a directory.
|
@@ -36,7 +40,7 @@ Use this command to update the package:
|
|
36
40
|
gem update transcode
|
37
41
|
|
38
42
|
### Requirements
|
39
|
-
See
|
43
|
+
See Video Transcoding's [requirements](https://github.com/donmelton/video_transcoding/blob/master/README.md?ts=2#requirements).
|
40
44
|
|
41
45
|
## Usage
|
42
46
|
transcode [options]
|
@@ -49,6 +53,7 @@ See [Video Transcoding requirements](https://github.com/donmelton/video_transcod
|
|
49
53
|
-u, --aud aud Audio stream numbers.
|
50
54
|
-t, --sub sub Subtitle stream numbers.
|
51
55
|
-w, --wid wid Width of the table.
|
56
|
+
-v, --version Show version.
|
52
57
|
|
53
58
|
### Example
|
54
59
|
transcode -d <source> -o <destination> -u 1,3,1 -t 2,1,3
|
@@ -57,5 +62,5 @@ It converts three files from source with certain audio and subtitle streams.
|
|
57
62
|
Inspect first with `-s` option to see audio and subtitle streams.
|
58
63
|
|
59
64
|
## License
|
60
|
-
Transcode is copyright [David Rabkin](http://
|
65
|
+
Transcode is copyright [David Rabkin](http://davi.drabk.in) and
|
61
66
|
available under a [2-Claus BSD license](https://github.com/rdavid/transcode/blob/master/LICENSE).
|
data/Rakefile
CHANGED
@@ -21,14 +21,22 @@ module Transcode
|
|
21
21
|
['-w', '--wid wid', 'Width of the table.', Integer, :wid]
|
22
22
|
].freeze
|
23
23
|
EXT = %i[
|
24
|
-
avi flv m4v mkv mp4 mpg mpeg ts webm vob wmv
|
24
|
+
avi flv m4v mkv mp4 mpg mpeg mov ts webm vob wmv
|
25
25
|
].map(&:to_s).join(',').freeze
|
26
26
|
|
27
|
+
def add(opt)
|
28
|
+
opt.on('-v', '--version', 'Show version.') do
|
29
|
+
puts "#{File.basename($PROGRAM_NAME)} #{VERSION} #{DATE}"
|
30
|
+
exit
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
27
34
|
def initialize
|
28
35
|
@options = {}
|
29
36
|
OptionParser.new do |o|
|
30
37
|
o.banner = "Usage: #{File.basename($PROGRAM_NAME)} [options]."
|
31
38
|
DIC.each { |f, p, d, t, k| o.on(f, p, t, d) { |i| @options[k] = i } }
|
39
|
+
add(o)
|
32
40
|
end.parse!
|
33
41
|
find_dir
|
34
42
|
find_fil
|
@@ -36,14 +44,8 @@ module Transcode
|
|
36
44
|
end
|
37
45
|
|
38
46
|
def find_dir
|
39
|
-
|
40
|
-
|
41
|
-
else
|
42
|
-
raise "No such directory: #{dir}." unless File.directory?(dir)
|
43
|
-
|
44
|
-
@options[:dir] = File.expand_path(dir)
|
45
|
-
end
|
46
|
-
@options[:out] = File.expand_path(out.nil? ? '~' : out)
|
47
|
+
@options[:dir] = File.expand_path(dir.nil? ? Dir.pwd : dir)
|
48
|
+
@options[:out] = File.expand_path(out.nil? ? Dir.pwd : out)
|
47
49
|
end
|
48
50
|
|
49
51
|
def find_fil
|
@@ -55,18 +57,26 @@ module Transcode
|
|
55
57
|
end
|
56
58
|
|
57
59
|
def validate
|
58
|
-
|
60
|
+
validate_dir(dir, false)
|
61
|
+
validate_dir(out, true)
|
62
|
+
validate_fil
|
59
63
|
validate_tit
|
60
64
|
validate_val(aud, :aud)
|
61
65
|
validate_val(sub, :sub)
|
62
66
|
raise "Width of the table should exeeds 14 symbols: #{wid}." if wid < 15
|
63
67
|
end
|
64
68
|
|
65
|
-
def
|
66
|
-
raise "#{dir}
|
69
|
+
def validate_dir(dir, isw)
|
70
|
+
raise "#{dir}: No such directory." unless File.directory?(dir)
|
71
|
+
|
72
|
+
err = isw ? File.writable?(dir) : File.readable?(dir)
|
73
|
+
raise "#{out}: Permission denied." unless err
|
74
|
+
end
|
67
75
|
|
76
|
+
def validate_fil
|
68
77
|
bad = files.reject { |f| File.readable?(f) }
|
69
|
-
raise "
|
78
|
+
raise "#{dir} doesn't have #{EXT} files or directories." if files.empty?
|
79
|
+
raise "#{bad.join(',')}: Permission denied." unless bad.empty?
|
70
80
|
end
|
71
81
|
|
72
82
|
def validate_tit # rubocop:disable Metrics/AbcSize
|
@@ -84,6 +94,7 @@ module Transcode
|
|
84
94
|
def validate_val(val, tag)
|
85
95
|
f = files.size
|
86
96
|
(@options[tag] = Array.new(f, '0')).nil? || return if val.nil?
|
97
|
+
|
87
98
|
s = val.size
|
88
99
|
if s == 1
|
89
100
|
@options[tag] = Array.new(f, val.first)
|
data/lib/transcode/utils.rb
CHANGED
@@ -5,20 +5,27 @@
|
|
5
5
|
|
6
6
|
# All methods are static.
|
7
7
|
class Utils
|
8
|
+
@sep = '~'
|
8
9
|
class << self
|
9
|
-
|
10
|
+
attr_accessor :sep
|
10
11
|
def trim(src, lim)
|
12
|
+
return '' if src.nil? || lim.nil?
|
11
13
|
return src if src.length <= lim
|
12
14
|
|
13
|
-
beg = fin = (lim -
|
15
|
+
beg = fin = (lim - @sep.length) / 2
|
14
16
|
beg -= 1 if lim.odd?
|
15
|
-
src[0..beg] +
|
17
|
+
src[0..beg] + @sep + src[-fin..-1]
|
16
18
|
end
|
17
19
|
end
|
18
20
|
end
|
19
21
|
|
20
22
|
# Returns string with humanized time interval.
|
21
23
|
class Timer
|
24
|
+
@less_sec = 'less than a second'
|
25
|
+
class << self
|
26
|
+
attr_reader :less_sec
|
27
|
+
end
|
28
|
+
|
22
29
|
DIC = [
|
23
30
|
[60, :seconds, :second],
|
24
31
|
[60, :minutes, :minute],
|
@@ -35,7 +42,8 @@ class Timer
|
|
35
42
|
end
|
36
43
|
|
37
44
|
def humanize(sec)
|
38
|
-
return '
|
45
|
+
return '' if sec.nil?
|
46
|
+
return Timer.less_sec if sec < 1
|
39
47
|
|
40
48
|
DIC.map do |cnt, nms, nm1|
|
41
49
|
next if sec <= 0
|
data/lib/transcode/version.rb
CHANGED
data/transcode.gemspec
CHANGED
@@ -7,6 +7,7 @@ require 'transcode'
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = 'transcode'
|
9
9
|
s.version = Transcode::VERSION
|
10
|
+
s.date = Transcode::DATE
|
10
11
|
s.required_ruby_version = '~> 2.6'
|
11
12
|
s.summary = 'Tools to transcode batch of video files.'
|
12
13
|
s.description = <<-HERE
|
@@ -18,11 +19,12 @@ Gem::Specification.new do |s|
|
|
18
19
|
s.homepage = 'https://github.com/rdavid/transcode'
|
19
20
|
s.files = Dir['{bin,lib}/**/*'] + Dir['[A-Z]*'] + ['transcode.gemspec']
|
20
21
|
s.executables = ['transcode']
|
21
|
-
s.extra_rdoc_files = ['LICENSE', 'README.md']
|
22
|
+
s.extra_rdoc_files = ['LICENSE.txt', 'README.md']
|
22
23
|
s.require_paths = ['lib']
|
23
24
|
s.add_runtime_dependency 'pidfile', '0.3.0'
|
24
25
|
s.add_runtime_dependency 'terminal-table', '1.8.0'
|
25
26
|
s.add_runtime_dependency 'video_transcoding', '0.25.3'
|
27
|
+
s.add_development_dependency 'minitest', '5.11.3'
|
26
28
|
s.add_development_dependency 'rake', '13.0.1'
|
27
29
|
s.add_development_dependency 'rubocop', '0.76.0'
|
28
30
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: transcode
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Rabkin
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-11-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pidfile
|
@@ -52,6 +52,20 @@ dependencies:
|
|
52
52
|
- - '='
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: 0.25.3
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: minitest
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - '='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 5.11.3
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - '='
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 5.11.3
|
55
69
|
- !ruby/object:Gem::Dependency
|
56
70
|
name: rake
|
57
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -86,12 +100,11 @@ executables:
|
|
86
100
|
- transcode
|
87
101
|
extensions: []
|
88
102
|
extra_rdoc_files:
|
89
|
-
- LICENSE
|
103
|
+
- LICENSE.txt
|
90
104
|
- README.md
|
91
105
|
files:
|
92
106
|
- Gemfile
|
93
|
-
-
|
94
|
-
- LICENSE
|
107
|
+
- LICENSE.txt
|
95
108
|
- README.md
|
96
109
|
- Rakefile
|
97
110
|
- appveyor.yml
|
data/Gemfile.lock
DELETED
@@ -1,39 +0,0 @@
|
|
1
|
-
GEM
|
2
|
-
remote: https://rubygems.org/
|
3
|
-
specs:
|
4
|
-
ast (2.4.0)
|
5
|
-
jaro_winkler (1.5.4)
|
6
|
-
parallel (1.19.1)
|
7
|
-
parser (2.7.1.3)
|
8
|
-
ast (~> 2.4.0)
|
9
|
-
pidfile (0.3.0)
|
10
|
-
rainbow (3.0.0)
|
11
|
-
rake (13.0.1)
|
12
|
-
rubocop (0.76.0)
|
13
|
-
jaro_winkler (~> 1.5.1)
|
14
|
-
parallel (~> 1.10)
|
15
|
-
parser (>= 2.6)
|
16
|
-
rainbow (>= 2.2.2, < 4.0)
|
17
|
-
ruby-progressbar (~> 1.7)
|
18
|
-
unicode-display_width (>= 1.4.0, < 1.7)
|
19
|
-
ruby-progressbar (1.10.1)
|
20
|
-
terminal-table (1.8.0)
|
21
|
-
unicode-display_width (~> 1.1, >= 1.1.1)
|
22
|
-
unicode-display_width (1.6.1)
|
23
|
-
video_transcoding (0.25.3)
|
24
|
-
|
25
|
-
PLATFORMS
|
26
|
-
ruby
|
27
|
-
|
28
|
-
DEPENDENCIES
|
29
|
-
pidfile (= 0.3.0)
|
30
|
-
rake (= 13.0.1)
|
31
|
-
rubocop (= 0.76.0)
|
32
|
-
terminal-table (= 1.8.0)
|
33
|
-
video_transcoding (= 0.25.3)
|
34
|
-
|
35
|
-
RUBY VERSION
|
36
|
-
ruby 2.6.3p62
|
37
|
-
|
38
|
-
BUNDLED WITH
|
39
|
-
2.1.4
|