transcode 1.0.5 → 1.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.
- checksums.yaml +4 -4
- data/LICENSE +1 -1
- data/README.adoc +114 -38
- data/bin/transcode +7 -3
- data/lib/transcode/configurator.rb +22 -21
- data/lib/transcode/reporter.rb +4 -3
- data/lib/transcode/string.rb +14 -0
- data/lib/transcode/timer.rb +40 -0
- data/lib/transcode/transcoder.rb +32 -12
- data/lib/transcode/utils.rb +3 -47
- data/lib/transcode/version.rb +4 -4
- data/lib/transcode.rb +2 -2
- metadata +54 -26
- data/.github/dependabot.yml +0 -13
- data/.github/styles/config/vocabularies/Base/accept.txt +0 -5
- data/.github/workflows/actionlint.yml +0 -24
- data/.github/workflows/rake.yml +0 -37
- data/.github/workflows/reuse.yml +0 -18
- data/.github/workflows/rubocop.yml +0 -22
- data/.github/workflows/typos.yml +0 -18
- data/.github/workflows/vale.yml +0 -21
- data/.github/workflows/yamllint.yml +0 -21
- data/.gitignore +0 -13
- data/.travis.yml +0 -14
- data/.vale.ini +0 -7
- data/Gemfile +0 -13
- data/Gemfile.lock +0 -54
- data/LICENSES/0BSD.txt +0 -5
- data/REUSE.toml +0 -14
- data/Rakefile +0 -11
- data/_typos.toml +0 -4
- data/appveyor.yml +0 -28
- data/test/test_utils.rb +0 -30
- data/transcode.gemspec +0 -28
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 31614466613fcca1314cfdba740f375f534fc2f2496e97849dfa7708eb2439f8
|
|
4
|
+
data.tar.gz: 062fc1cdb39ea866cfb4f16769f4f2cd0e0db7c997112b77d9eb86eaafe85efd
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 949aa013995bfc786523ff0c13a0077b05f53e591eaccb4263708437e8f49dcc2ac754811ad5af90a52dcd951900e876ea252985772e0aeb30199874654629a8
|
|
7
|
+
data.tar.gz: 2f34e87bd48e5a8bc145c3016740e635da095b1a78a651ee34e597a6402e97286973e9874871ffd067a4469be9b62cc77a2d35fbaacea43e2b9a3ebbd090f068
|
data/LICENSE
CHANGED
data/README.adoc
CHANGED
|
@@ -2,19 +2,19 @@
|
|
|
2
2
|
:toc: macro
|
|
3
3
|
:!toc-title:
|
|
4
4
|
// URLs:
|
|
5
|
-
:img-
|
|
6
|
-
:img-gem: https://badge.fury.io/rb/transcode.svg
|
|
5
|
+
:img-gem: https://img.shields.io/gem/v/transcode?color=dfaf8f&labelColor=555555&logo=rubygems&logoColor=dcdccc&style=flat
|
|
7
6
|
:img-hoc: https://hitsofcode.com/github/rdavid/transcode?branch=master&label=hits%20of%20code
|
|
8
|
-
:img-license: https://img.shields.io/github/license/rdavid/transcode?color=
|
|
9
|
-
:img-rake: https://
|
|
10
|
-
:
|
|
7
|
+
:img-license: https://img.shields.io/github/license/rdavid/transcode?color=94bff3&labelColor=555555&logo=data%3Aimage%2Fsvg%2Bxml%3Bbase64%2CPHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNCAyNCI%2BPHRleHQgeD0iMTIiIHk9IjIwIiBmb250LWZhbWlseT0iSGVsdmV0aWNhLEFyaWFsLHNhbnMtc2VyaWYiIGZvbnQtc2l6ZT0iMjgiIHRleHQtYW5jaG9yPSJtaWRkbGUiIGZpbGw9IiNkY2RjY2MiPiYjMTY5OzwvdGV4dD48L3N2Zz4%3D&style=flat
|
|
8
|
+
:img-rake: https://img.shields.io/github/actions/workflow/status/rdavid/transcode/rake.yml?branch=master&label=rake&color=7f9f7f&labelColor=555555&logo=github&logoColor=dcdccc&style=flat
|
|
9
|
+
:img-rubocop: https://img.shields.io/github/actions/workflow/status/rdavid/transcode/rubocop.yml?branch=master&color=8cd0d3&label=rubocop&labelColor=555555&logo=rubocop&logoColor=dcdccc&style=flat
|
|
11
10
|
:url-cv: http://cv.rabkin.co.il
|
|
12
11
|
:url-gem: https://badge.fury.io/rb/transcode
|
|
13
12
|
:url-hoc: https://hitsofcode.com/view/github/rdavid/transcode?branch=master
|
|
14
13
|
:url-license: https://github.com/rdavid/transcode/blob/master/LICENSES/0BSD.txt
|
|
15
|
-
:url-melton: https://lisamelton
|
|
14
|
+
:url-melton: https://github.com/lisamelton/video_transcoding
|
|
16
15
|
:url-rake: https://github.com/rdavid/transcode/actions/workflows/rake.yml
|
|
17
16
|
:url-reuse: https://github.com/fsfe/reuse-action
|
|
17
|
+
:url-rubocop: https://github.com/rdavid/transcode/actions/workflows/rubocop.yml
|
|
18
18
|
:url-requirements: https://github.com/lisamelton/video_transcoding/blob/master/README.md?ts=2#requirements
|
|
19
19
|
:url-ruby: https://www.ruby-lang.org/en/documentation/installation
|
|
20
20
|
:url-video: https://github.com/lisamelton/video_transcoding
|
|
@@ -23,37 +23,68 @@
|
|
|
23
23
|
|
|
24
24
|
= Transcode
|
|
25
25
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
26
|
+
[subs=attributes+]
|
|
27
|
+
++++
|
|
28
|
+
<div align="right">
|
|
29
|
+
<a href="{url-rake}"><img src="{img-rake}" alt="rake"></a>
|
|
30
|
+
<a href="{url-rubocop}"><img src="{img-rubocop}" alt="rubocop"></a>
|
|
31
|
+
<a href="{url-gem}"><img src="{img-gem}" alt="gem version"></a>
|
|
32
|
+
<a href="{url-hoc}"><img src="{img-hoc}" alt="hits of code"></a>
|
|
33
|
+
<a href="{url-license}"><img src="{img-license}" alt="license"></a>
|
|
34
|
+
</div>
|
|
35
|
+
++++
|
|
31
36
|
|
|
32
37
|
toc::[]
|
|
33
38
|
|
|
39
|
+
ifdef::pages-build[]
|
|
40
|
+
++++
|
|
41
|
+
<div id="repo-link">
|
|
42
|
+
<a href="https://github.com/rdavid/transcode" aria-label="GitHub repository" target="_blank" rel="noopener">
|
|
43
|
+
<svg viewBox="0 0 16 16" width="18" height="18" fill="currentColor" aria-hidden="true">
|
|
44
|
+
<path d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.01 8.01 0 0 0 16 8c0-4.42-3.58-8-8-8Z"/>
|
|
45
|
+
</svg>
|
|
46
|
+
</a>
|
|
47
|
+
</div>
|
|
48
|
+
++++
|
|
49
|
+
endif::[]
|
|
50
|
+
|
|
34
51
|
== About
|
|
35
52
|
|
|
36
|
-
Transcode
|
|
37
|
-
|
|
38
|
-
|
|
53
|
+
Transcode converts a whole directory of video files in one run from the
|
|
54
|
+
command line.
|
|
55
|
+
It wraps {url-melton}[Lisa Melton's] {url-video}[Video Transcoding], which
|
|
56
|
+
converts one file per invocation.
|
|
57
|
+
Transcode applies that same workflow to every video in a directory with one
|
|
58
|
+
command.
|
|
59
|
+
|
|
60
|
+
Transcode can:
|
|
61
|
+
|
|
62
|
+
* Convert an entire directory to `.m4v` in a single run.
|
|
63
|
+
* Select the main audio and burned-in subtitle stream for each file.
|
|
64
|
+
* Extract audio to `.mp3`.
|
|
65
|
+
* Scan files to list their available audio and subtitle streams.
|
|
66
|
+
* Print a summary table of the results.
|
|
39
67
|
|
|
40
|
-
|
|
68
|
+
It recognizes these input formats: `avi`, `flv`, `m2ts`, `m4v`, `mkv`,
|
|
69
|
+
`mp4`, `mpg`, `mpeg`, `mov`, `ts`, `webm`, `vob`, and `wmv`.
|
|
41
70
|
|
|
42
|
-
|
|
43
|
-
It is packaged as a Gem and require Ruby version 3.2 or later.
|
|
44
|
-
See {url-ruby}[Installing Ruby] if you don't have the proper version on your
|
|
45
|
-
platform.
|
|
71
|
+
== Install
|
|
46
72
|
|
|
47
|
-
|
|
73
|
+
Transcode ships as a Ruby gem and requires Ruby 3.2 or later.
|
|
74
|
+
It runs on macOS, GNU/Linux, Windows, and any other system Ruby
|
|
75
|
+
supports.
|
|
76
|
+
See {url-ruby}[Installing Ruby] if your platform lacks Ruby 3.2+.
|
|
77
|
+
|
|
78
|
+
Install with:
|
|
48
79
|
|
|
49
80
|
[,sh]
|
|
50
81
|
----
|
|
51
82
|
gem install transcode
|
|
52
83
|
----
|
|
53
84
|
|
|
54
|
-
==
|
|
85
|
+
== Update
|
|
55
86
|
|
|
56
|
-
|
|
87
|
+
Update with:
|
|
57
88
|
|
|
58
89
|
[,sh]
|
|
59
90
|
----
|
|
@@ -62,40 +93,85 @@ gem update transcode
|
|
|
62
93
|
|
|
63
94
|
== Requirements
|
|
64
95
|
|
|
65
|
-
See Video Transcoding's {url-requirements}[requirements]
|
|
96
|
+
See Video Transcoding's {url-requirements}[requirements] for external
|
|
97
|
+
dependencies.
|
|
66
98
|
|
|
67
|
-
==
|
|
99
|
+
== Using
|
|
68
100
|
|
|
69
101
|
[,sh]
|
|
70
102
|
----
|
|
71
103
|
transcode [options]
|
|
72
|
-
-a, --act
|
|
73
|
-
-
|
|
74
|
-
-
|
|
75
|
-
-
|
|
76
|
-
-
|
|
77
|
-
-
|
|
78
|
-
-
|
|
79
|
-
-
|
|
80
|
-
-
|
|
81
|
-
-
|
|
104
|
+
-a, --act Performs actual encoding.
|
|
105
|
+
-u, --aud aud Sets the audio stream numbers.
|
|
106
|
+
-d, --dir dir Sets the directory to transcode.
|
|
107
|
+
-m, --mp3 Converts files to MP3.
|
|
108
|
+
-o, --out out Sets the output directory.
|
|
109
|
+
-s, --sca Scans files in the directory.
|
|
110
|
+
-t, --sub sub Sets the subtitle stream numbers.
|
|
111
|
+
-i, --tit tit Sets the title number.
|
|
112
|
+
-v, --version Shows the version.
|
|
113
|
+
-w, --wid wid Sets the output table width.
|
|
82
114
|
----
|
|
83
115
|
|
|
84
|
-
|
|
116
|
+
Transcode performs a dry run by default.
|
|
117
|
+
It prints the commands it would run and a summary table without changing any
|
|
118
|
+
files.
|
|
119
|
+
Adding `--act` starts the encoding.
|
|
120
|
+
|
|
121
|
+
Without `--dir` and `--out`, Transcode reads from and writes to the current
|
|
122
|
+
directory.
|
|
123
|
+
The `--aud` and `--sub` options take comma-separated stream numbers: one
|
|
124
|
+
value applies to every file, or each file takes its own value.
|
|
125
|
+
|
|
126
|
+
== Examples
|
|
127
|
+
|
|
128
|
+
Scan the source directory to inspect the available audio and subtitle
|
|
129
|
+
streams:
|
|
130
|
+
|
|
131
|
+
[,sh]
|
|
132
|
+
----
|
|
133
|
+
transcode --sca --dir [source]
|
|
134
|
+
----
|
|
135
|
+
|
|
136
|
+
Transcode three files from `[source]` to `[destination]` with the selected
|
|
137
|
+
audio and subtitle streams.
|
|
138
|
+
Add `--act` once the plan looks right:
|
|
85
139
|
|
|
86
140
|
[,sh]
|
|
87
141
|
----
|
|
88
142
|
transcode \
|
|
143
|
+
--act \
|
|
89
144
|
--aud 1,3,1 \
|
|
90
145
|
--dir [source] \
|
|
91
146
|
--out [destination] \
|
|
92
147
|
--sub 2,1,3
|
|
93
148
|
----
|
|
94
149
|
|
|
95
|
-
|
|
96
|
-
|
|
150
|
+
Extract the audio of every file in the current directory to `.mp3`:
|
|
151
|
+
|
|
152
|
+
[,sh]
|
|
153
|
+
----
|
|
154
|
+
transcode --mp3 --act
|
|
155
|
+
----
|
|
97
156
|
|
|
98
157
|
== License
|
|
99
158
|
|
|
100
|
-
`transcode`
|
|
159
|
+
`transcode` carries copyright by {url-cv}[David Rabkin] and ships under a
|
|
101
160
|
{url-license}[Zero-Clause BSD license].
|
|
161
|
+
|
|
162
|
+
ifdef::pages-build[]
|
|
163
|
+
++++
|
|
164
|
+
<footer id="site-footer">
|
|
165
|
+
<div class="footer-left">
|
|
166
|
+
<img src="favicon.svg" alt="" width="20" height="20">
|
|
167
|
+
<span>transcode by <a href="http://cv.rabkin.co.il" target="_blank" rel="noopener">David Rabkin</a></span>
|
|
168
|
+
</div>
|
|
169
|
+
<div class="footer-links">
|
|
170
|
+
<a href="https://github.com/rdavid/transcode" target="_blank" rel="noopener">GitHub</a>
|
|
171
|
+
<a href="https://badge.fury.io/rb/transcode" target="_blank" rel="noopener">RubyGems</a>
|
|
172
|
+
<a href="https://github.com/rdavid/transcode/releases" target="_blank" rel="noopener">Releases</a>
|
|
173
|
+
<a href="https://github.com/rdavid/transcode/blob/master/LICENSES/0BSD.txt" target="_blank" rel="noopener">0BSD License</a>
|
|
174
|
+
</div>
|
|
175
|
+
</footer>
|
|
176
|
+
++++
|
|
177
|
+
endif::[]
|
data/bin/transcode
CHANGED
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
#!/usr/bin/env ruby
|
|
2
2
|
# frozen_string_literal: true
|
|
3
3
|
|
|
4
|
-
# vi:
|
|
5
|
-
# SPDX-FileCopyrightText: 2018-
|
|
4
|
+
# vi: et lbr sw=2 ts=2 tw=79 wrap
|
|
5
|
+
# SPDX-FileCopyrightText: 2018-2026 David Rabkin
|
|
6
6
|
# SPDX-License-Identifier: 0BSD
|
|
7
7
|
|
|
8
8
|
require_relative '../lib/transcode'
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
begin
|
|
11
|
+
Transcode::Transcoder.new.do
|
|
12
|
+
rescue StandardError => e
|
|
13
|
+
abort "transcode: #{e.message}"
|
|
14
|
+
end
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
# vi:
|
|
4
|
-
# SPDX-FileCopyrightText: 2018-
|
|
3
|
+
# vi: et lbr sw=2 ts=2 tw=79 wrap
|
|
4
|
+
# SPDX-FileCopyrightText: 2018-2026 David Rabkin
|
|
5
5
|
# SPDX-License-Identifier: 0BSD
|
|
6
6
|
|
|
7
7
|
require 'optparse'
|
|
8
|
+
require_relative 'string'
|
|
8
9
|
|
|
9
10
|
module Transcode
|
|
10
11
|
# Handles input parameters.
|
|
@@ -12,22 +13,22 @@ module Transcode
|
|
|
12
13
|
attr_reader :files
|
|
13
14
|
|
|
14
15
|
DIC = [
|
|
15
|
-
['-a', '--act', '
|
|
16
|
-
['-
|
|
17
|
-
['-
|
|
18
|
-
['-
|
|
19
|
-
['-
|
|
20
|
-
['-
|
|
21
|
-
['-
|
|
22
|
-
['-
|
|
23
|
-
['-w', '--wid wid', '
|
|
16
|
+
['-a', '--act', 'Performs actual encoding.', nil, :act],
|
|
17
|
+
['-u', '--aud aud', 'Sets the audio stream numbers.', Array, :aud],
|
|
18
|
+
['-d', '--dir dir', 'Sets the directory to transcode.', String, :dir],
|
|
19
|
+
['-m', '--mp3', 'Converts files to MP3.', nil, :mp3],
|
|
20
|
+
['-o', '--out out', 'Sets the output directory.', String, :out],
|
|
21
|
+
['-s', '--sca', 'Scans files in the directory.', nil, :sca],
|
|
22
|
+
['-t', '--sub sub', 'Sets the subtitle stream numbers.', Array, :sub],
|
|
23
|
+
['-i', '--tit tit', 'Sets the title number.', Array, :tit],
|
|
24
|
+
['-w', '--wid wid', 'Sets the output table width.', Integer, :wid]
|
|
24
25
|
].freeze
|
|
25
|
-
EXT = %
|
|
26
|
+
EXT = %w[
|
|
26
27
|
avi flv m2ts m4v mkv mp4 mpg mpeg mov ts webm vob wmv
|
|
27
|
-
].
|
|
28
|
+
].join(',').freeze
|
|
28
29
|
|
|
29
30
|
def add(opt)
|
|
30
|
-
opt.on('-v', '--version', '
|
|
31
|
+
opt.on('-v', '--version', 'Shows the version.') do
|
|
31
32
|
puts "#{File.basename($PROGRAM_NAME)} #{VERSION} #{DATE}"
|
|
32
33
|
exit
|
|
33
34
|
end
|
|
@@ -54,8 +55,7 @@ module Transcode
|
|
|
54
55
|
@files = Dir.glob("#{dir}/*.{#{EXT}}").select { |f| File.file? f }
|
|
55
56
|
sub = !mp3?
|
|
56
57
|
@files += Dir.glob("#{dir}/*").select { |f| File.directory? f } if sub
|
|
57
|
-
@files.sort_by!
|
|
58
|
-
@files.sort_by!(&:swapcase)
|
|
58
|
+
@files.sort_by! { |f| f.swapcase.naturalized }
|
|
59
59
|
end
|
|
60
60
|
|
|
61
61
|
def validate
|
|
@@ -65,19 +65,19 @@ module Transcode
|
|
|
65
65
|
validate_tit
|
|
66
66
|
validate_val(aud, :aud)
|
|
67
67
|
validate_val(sub, :sub)
|
|
68
|
-
raise "Width of the table
|
|
68
|
+
raise "Width of the table must exceed 14 characters: #{wid}." if wid < 15
|
|
69
69
|
end
|
|
70
70
|
|
|
71
71
|
def validate_dir(dir, isw)
|
|
72
72
|
raise "#{dir}: No such directory." unless File.directory?(dir)
|
|
73
73
|
|
|
74
74
|
err = isw ? File.writable?(dir) : File.readable?(dir)
|
|
75
|
-
raise "#{
|
|
75
|
+
raise "#{dir}: Permission denied." unless err
|
|
76
76
|
end
|
|
77
77
|
|
|
78
78
|
def validate_fil
|
|
79
79
|
bad = files.reject { |f| File.readable?(f) }
|
|
80
|
-
raise "#{dir}
|
|
80
|
+
raise "#{dir} has no #{EXT} files or directories." if files.empty?
|
|
81
81
|
raise "#{bad.join(',')}: Permission denied." unless bad.empty?
|
|
82
82
|
end
|
|
83
83
|
|
|
@@ -101,7 +101,7 @@ module Transcode
|
|
|
101
101
|
if s == 1
|
|
102
102
|
@options[tag] = Array.new(f, val.first)
|
|
103
103
|
else
|
|
104
|
-
raise "#{tag}
|
|
104
|
+
raise "#{tag} count #{s} doesn't match file count #{f}." unless s == f
|
|
105
105
|
end
|
|
106
106
|
end
|
|
107
107
|
|
|
@@ -137,9 +137,10 @@ module Transcode
|
|
|
137
137
|
@options[:sub]
|
|
138
138
|
end
|
|
139
139
|
|
|
140
|
+
# Returns the table width, falling back to the terminal width when the
|
|
141
|
+
# option is not set.
|
|
140
142
|
def wid
|
|
141
143
|
if @options[:wid].nil?
|
|
142
|
-
# Reads current terminal width.
|
|
143
144
|
wid = `tput cols`
|
|
144
145
|
wid.to_s.empty? ? 79 : wid.to_i
|
|
145
146
|
else
|
data/lib/transcode/reporter.rb
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
# vi:
|
|
4
|
-
# SPDX-FileCopyrightText: 2018-
|
|
3
|
+
# vi: et lbr sw=2 ts=2 tw=79 wrap
|
|
4
|
+
# SPDX-FileCopyrightText: 2018-2026 David Rabkin
|
|
5
5
|
# SPDX-License-Identifier: 0BSD
|
|
6
6
|
|
|
7
7
|
require 'terminal-table'
|
|
8
|
+
require_relative 'timer'
|
|
8
9
|
require_relative 'utils'
|
|
9
10
|
|
|
10
11
|
module Transcode
|
|
11
|
-
# Formats and prints
|
|
12
|
+
# Formats and prints the summary table.
|
|
12
13
|
class Reporter
|
|
13
14
|
def initialize(act, tit, wid)
|
|
14
15
|
@act = act
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# vi: et lbr sw=2 ts=2 tw=79 wrap
|
|
4
|
+
# SPDX-FileCopyrightText: 2018-2026 David Rabkin
|
|
5
|
+
# SPDX-License-Identifier: 0BSD
|
|
6
|
+
|
|
7
|
+
# Adds a natural sort method. It converts a string such as "Filename 10"
|
|
8
|
+
# into an array with floats in place of numbers, ["Filename", 10.0], as
|
|
9
|
+
# suggested in https://stackoverflow.com/q/4078906.
|
|
10
|
+
class String
|
|
11
|
+
def naturalized
|
|
12
|
+
scan(/[^\d.]+|[\d.]+/).map { |f| f.match?(/\d+(\.\d+)?/) ? f.to_f : f }
|
|
13
|
+
end
|
|
14
|
+
end
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# vi: et lbr sw=2 ts=2 tw=79 wrap
|
|
4
|
+
# SPDX-FileCopyrightText: 2018-2026 David Rabkin
|
|
5
|
+
# SPDX-License-Identifier: 0BSD
|
|
6
|
+
|
|
7
|
+
# Measures elapsed time and reports it as a humanized string.
|
|
8
|
+
class Timer
|
|
9
|
+
@less_sec = 'less than a second'
|
|
10
|
+
class << self
|
|
11
|
+
attr_reader :less_sec
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
DIC = [
|
|
15
|
+
[60, :seconds, :second],
|
|
16
|
+
[60, :minutes, :minute],
|
|
17
|
+
[24, :hours, :hour],
|
|
18
|
+
[1000, :days, :day]
|
|
19
|
+
].freeze
|
|
20
|
+
|
|
21
|
+
def initialize
|
|
22
|
+
@sta = Time.now
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def read
|
|
26
|
+
humanize(Time.now - @sta)
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def humanize(sec)
|
|
30
|
+
return '' if sec.nil?
|
|
31
|
+
return Timer.less_sec if sec < 1
|
|
32
|
+
|
|
33
|
+
DIC.filter_map do |cnt, nms, nm1|
|
|
34
|
+
next if sec <= 0
|
|
35
|
+
|
|
36
|
+
sec, n = sec.divmod(cnt)
|
|
37
|
+
"#{n.to_i} #{n.to_i == 1 ? nm1 : nms}"
|
|
38
|
+
end.compact.reverse.join(' ')
|
|
39
|
+
end
|
|
40
|
+
end
|
data/lib/transcode/transcoder.rb
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
# vi:
|
|
4
|
-
# SPDX-FileCopyrightText: 2018-
|
|
3
|
+
# vi: et lbr sw=2 ts=2 tw=79 wrap
|
|
4
|
+
# SPDX-FileCopyrightText: 2018-2026 David Rabkin
|
|
5
5
|
# SPDX-License-Identifier: 0BSD
|
|
6
6
|
|
|
7
7
|
require 'English'
|
|
@@ -17,7 +17,8 @@ module Transcode
|
|
|
17
17
|
@rep = Reporter.new(@cfg.act?, "#{@cfg.dir} -> #{@cfg.out}", @cfg.wid)
|
|
18
18
|
end
|
|
19
19
|
|
|
20
|
-
# Runs command and prints output
|
|
20
|
+
# Runs a command and prints its output as it arrives. Returns true on
|
|
21
|
+
# success.
|
|
21
22
|
def run(cmd)
|
|
22
23
|
cmd += ' 2>&1'
|
|
23
24
|
puts "Run: #{cmd}."
|
|
@@ -28,8 +29,8 @@ module Transcode
|
|
|
28
29
|
end
|
|
29
30
|
|
|
30
31
|
def m4v_cmd(file, aud, sub, tit)
|
|
31
|
-
c = 'transcode-video --m4v --no-log --preset veryslow'\
|
|
32
|
-
"
|
|
32
|
+
c = 'transcode-video --m4v --no-log --preset veryslow ' \
|
|
33
|
+
"--output #{@cfg.out}"
|
|
33
34
|
unless tit == '0'
|
|
34
35
|
c += "/#{File.basename(file.shellescape)}-#{tit}.m4v"
|
|
35
36
|
c += " --title #{tit}"
|
|
@@ -39,9 +40,10 @@ module Transcode
|
|
|
39
40
|
c + " #{file.shellescape}"
|
|
40
41
|
end
|
|
41
42
|
|
|
42
|
-
# Converts
|
|
43
|
-
#
|
|
44
|
-
# [
|
|
43
|
+
# Converts file, audio, subtitle, and title arrays into an array of
|
|
44
|
+
# pairs:
|
|
45
|
+
# [ file1, [ aud1, sub1, tit1 ] ]
|
|
46
|
+
# [ file2, [ aud2, sub2, tit2 ] ]
|
|
45
47
|
def data
|
|
46
48
|
@data ||= @cfg.files.zip([@cfg.aud, @cfg.sub, @cfg.tit].transpose)
|
|
47
49
|
end
|
|
@@ -53,10 +55,28 @@ module Transcode
|
|
|
53
55
|
end
|
|
54
56
|
end
|
|
55
57
|
|
|
58
|
+
def mp3_dst(file)
|
|
59
|
+
"#{@cfg.out}/#{File.basename(file, '.*')}.mp3"
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
# Skips files whose destination MP3 already exists, so reruns only
|
|
63
|
+
# convert what's missing.
|
|
64
|
+
def mp3_files
|
|
65
|
+
@cfg.files.reject do |f|
|
|
66
|
+
dst = mp3_dst(f)
|
|
67
|
+
File.exist?(dst).tap { |exists| warn "Skip: #{f} exists as #{dst}." if exists }
|
|
68
|
+
end
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
# -q:a 0 requests libmp3lame's highest VBR quality (V0), letting
|
|
72
|
+
# bitrate adapt to content complexity instead of spending a fixed
|
|
73
|
+
# rate on simple passages. No -ar is given, so ffmpeg keeps the
|
|
74
|
+
# source's sample rate when libmp3lame supports it directly (44100,
|
|
75
|
+
# 48000, 32000, and others), instead of downsampling every file,
|
|
76
|
+
# most commonly 48kHz video audio, to 44100.
|
|
56
77
|
def mp3_cmd(file)
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
"#{@cfg.out}/#{File.basename(file, '.*')}.mp3"
|
|
78
|
+
"ffmpeg -nostdin -i #{file.shellescape} -ac 2 -f mp3 -q:a 0 -vn " \
|
|
79
|
+
"#{mp3_dst(file)}"
|
|
60
80
|
end
|
|
61
81
|
|
|
62
82
|
def scn_cmd(file)
|
|
@@ -65,7 +85,7 @@ module Transcode
|
|
|
65
85
|
|
|
66
86
|
def do
|
|
67
87
|
if @cfg.mp3?
|
|
68
|
-
|
|
88
|
+
mp3_files.each { |f| @rep.add(f, @cfg.act? ? run(mp3_cmd(f)) : true) }
|
|
69
89
|
elsif @cfg.sca?
|
|
70
90
|
@cfg.files.each { |f| @rep.add(f, run(scn_cmd(f))) }
|
|
71
91
|
else
|
data/lib/transcode/utils.rb
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
# vi:
|
|
4
|
-
# SPDX-FileCopyrightText: 2018-
|
|
3
|
+
# vi: et lbr sw=2 ts=2 tw=79 wrap
|
|
4
|
+
# SPDX-FileCopyrightText: 2018-2026 David Rabkin
|
|
5
5
|
# SPDX-License-Identifier: 0BSD
|
|
6
6
|
|
|
7
7
|
require 'ellipsized'
|
|
8
8
|
|
|
9
|
-
#
|
|
9
|
+
# Provides string helpers as class methods.
|
|
10
10
|
class Utils
|
|
11
11
|
@sep = '~'
|
|
12
12
|
class << self
|
|
@@ -17,47 +17,3 @@ class Utils
|
|
|
17
17
|
end
|
|
18
18
|
end
|
|
19
19
|
end
|
|
20
|
-
|
|
21
|
-
# Returns string with humanized time interval.
|
|
22
|
-
class Timer
|
|
23
|
-
@less_sec = 'less than a second'
|
|
24
|
-
class << self
|
|
25
|
-
attr_reader :less_sec
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
DIC = [
|
|
29
|
-
[60, :seconds, :second],
|
|
30
|
-
[60, :minutes, :minute],
|
|
31
|
-
[24, :hours, :hour],
|
|
32
|
-
[1000, :days, :day]
|
|
33
|
-
].freeze
|
|
34
|
-
|
|
35
|
-
def initialize
|
|
36
|
-
@sta = Time.now
|
|
37
|
-
end
|
|
38
|
-
|
|
39
|
-
def read
|
|
40
|
-
humanize(Time.now - @sta)
|
|
41
|
-
end
|
|
42
|
-
|
|
43
|
-
def humanize(sec)
|
|
44
|
-
return '' if sec.nil?
|
|
45
|
-
return Timer.less_sec if sec < 1
|
|
46
|
-
|
|
47
|
-
DIC.map do |cnt, nms, nm1|
|
|
48
|
-
next if sec <= 0
|
|
49
|
-
|
|
50
|
-
sec, n = sec.divmod(cnt)
|
|
51
|
-
"#{n.to_i} #{n.to_i != 1 ? nms : nm1}"
|
|
52
|
-
end.compact.reverse.join(' ')
|
|
53
|
-
end
|
|
54
|
-
end
|
|
55
|
-
|
|
56
|
-
# Adds natural sort method. This converts something like "Filename 10" into a
|
|
57
|
-
# simple array with floats in place of numbers [ "Filename", 10.0 ]. See:
|
|
58
|
-
# https://stackoverflow.com/q/4078906
|
|
59
|
-
class String
|
|
60
|
-
def naturalized
|
|
61
|
-
scan(/[^\d.]+|[\d.]+/).collect { |f| f.match(/\d+(\.\d+)?/) ? f.to_f : f }
|
|
62
|
-
end
|
|
63
|
-
end
|
data/lib/transcode/version.rb
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
# vi:
|
|
4
|
-
# SPDX-FileCopyrightText: 2020-
|
|
3
|
+
# vi: et lbr sw=2 ts=2 tw=79 wrap
|
|
4
|
+
# SPDX-FileCopyrightText: 2020-2026 David Rabkin
|
|
5
5
|
# SPDX-License-Identifier: 0BSD
|
|
6
6
|
|
|
7
7
|
module Transcode
|
|
8
|
-
VERSION = '1.0.
|
|
9
|
-
DATE = '
|
|
8
|
+
VERSION = '1.0.7'
|
|
9
|
+
DATE = '2026-09-13'
|
|
10
10
|
end
|
data/lib/transcode.rb
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
# vi:
|
|
4
|
-
# SPDX-FileCopyrightText: 2018-
|
|
3
|
+
# vi: et lbr sw=2 ts=2 tw=79 wrap
|
|
4
|
+
# SPDX-FileCopyrightText: 2018-2026 David Rabkin
|
|
5
5
|
# SPDX-License-Identifier: 0BSD
|
|
6
6
|
|
|
7
7
|
require_relative 'transcode/transcoder'
|
metadata
CHANGED
|
@@ -1,15 +1,59 @@
|
|
|
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.7
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- David Rabkin
|
|
8
8
|
bindir: bin
|
|
9
9
|
cert_chain: []
|
|
10
|
-
date:
|
|
11
|
-
dependencies:
|
|
12
|
-
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
11
|
+
dependencies:
|
|
12
|
+
- !ruby/object:Gem::Dependency
|
|
13
|
+
name: ellipsized
|
|
14
|
+
requirement: !ruby/object:Gem::Requirement
|
|
15
|
+
requirements:
|
|
16
|
+
- - "~>"
|
|
17
|
+
- !ruby/object:Gem::Version
|
|
18
|
+
version: '0.3'
|
|
19
|
+
type: :runtime
|
|
20
|
+
prerelease: false
|
|
21
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
22
|
+
requirements:
|
|
23
|
+
- - "~>"
|
|
24
|
+
- !ruby/object:Gem::Version
|
|
25
|
+
version: '0.3'
|
|
26
|
+
- !ruby/object:Gem::Dependency
|
|
27
|
+
name: terminal-table
|
|
28
|
+
requirement: !ruby/object:Gem::Requirement
|
|
29
|
+
requirements:
|
|
30
|
+
- - "~>"
|
|
31
|
+
- !ruby/object:Gem::Version
|
|
32
|
+
version: '4.0'
|
|
33
|
+
type: :runtime
|
|
34
|
+
prerelease: false
|
|
35
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
36
|
+
requirements:
|
|
37
|
+
- - "~>"
|
|
38
|
+
- !ruby/object:Gem::Version
|
|
39
|
+
version: '4.0'
|
|
40
|
+
- !ruby/object:Gem::Dependency
|
|
41
|
+
name: video_transcoding
|
|
42
|
+
requirement: !ruby/object:Gem::Requirement
|
|
43
|
+
requirements:
|
|
44
|
+
- - "~>"
|
|
45
|
+
- !ruby/object:Gem::Version
|
|
46
|
+
version: '0.25'
|
|
47
|
+
type: :runtime
|
|
48
|
+
prerelease: false
|
|
49
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
50
|
+
requirements:
|
|
51
|
+
- - "~>"
|
|
52
|
+
- !ruby/object:Gem::Version
|
|
53
|
+
version: '0.25'
|
|
54
|
+
description: |2
|
|
55
|
+
Transcode wraps Lisa Melton's Video Transcoding and converts whole
|
|
56
|
+
directories of video files in one run.
|
|
13
57
|
email: david@rabkin.co.il
|
|
14
58
|
executables:
|
|
15
59
|
- transcode
|
|
@@ -18,41 +62,25 @@ extra_rdoc_files:
|
|
|
18
62
|
- LICENSE
|
|
19
63
|
- README.adoc
|
|
20
64
|
files:
|
|
21
|
-
- ".github/dependabot.yml"
|
|
22
|
-
- ".github/styles/config/vocabularies/Base/accept.txt"
|
|
23
|
-
- ".github/workflows/actionlint.yml"
|
|
24
|
-
- ".github/workflows/rake.yml"
|
|
25
|
-
- ".github/workflows/reuse.yml"
|
|
26
|
-
- ".github/workflows/rubocop.yml"
|
|
27
|
-
- ".github/workflows/typos.yml"
|
|
28
|
-
- ".github/workflows/vale.yml"
|
|
29
|
-
- ".github/workflows/yamllint.yml"
|
|
30
|
-
- ".gitignore"
|
|
31
|
-
- ".travis.yml"
|
|
32
|
-
- ".vale.ini"
|
|
33
|
-
- Gemfile
|
|
34
|
-
- Gemfile.lock
|
|
35
65
|
- LICENSE
|
|
36
|
-
- LICENSES/0BSD.txt
|
|
37
66
|
- README.adoc
|
|
38
|
-
- REUSE.toml
|
|
39
|
-
- Rakefile
|
|
40
|
-
- _typos.toml
|
|
41
|
-
- appveyor.yml
|
|
42
67
|
- bin/transcode
|
|
43
68
|
- lib/transcode.rb
|
|
44
69
|
- lib/transcode/configurator.rb
|
|
45
70
|
- lib/transcode/reporter.rb
|
|
71
|
+
- lib/transcode/string.rb
|
|
72
|
+
- lib/transcode/timer.rb
|
|
46
73
|
- lib/transcode/transcoder.rb
|
|
47
74
|
- lib/transcode/utils.rb
|
|
48
75
|
- lib/transcode/version.rb
|
|
49
|
-
- test/test_utils.rb
|
|
50
|
-
- transcode.gemspec
|
|
51
76
|
homepage: https://github.com/rdavid/transcode
|
|
52
77
|
licenses:
|
|
53
78
|
- 0BSD
|
|
54
79
|
metadata:
|
|
80
|
+
bug_tracker_uri: https://github.com/rdavid/transcode/issues
|
|
81
|
+
homepage_uri: https://github.com/rdavid/transcode
|
|
55
82
|
rubygems_mfa_required: 'true'
|
|
83
|
+
source_code_uri: https://github.com/rdavid/transcode
|
|
56
84
|
rdoc_options: []
|
|
57
85
|
require_paths:
|
|
58
86
|
- lib
|
|
@@ -69,5 +97,5 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
69
97
|
requirements: []
|
|
70
98
|
rubygems_version: 3.6.9
|
|
71
99
|
specification_version: 4
|
|
72
|
-
summary:
|
|
100
|
+
summary: Tool to transcode batches of video files
|
|
73
101
|
test_files: []
|
data/.github/dependabot.yml
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
# SPDX-FileCopyrightText: 2023-2025 David Rabkin
|
|
2
|
-
# SPDX-License-Identifier: 0BSD
|
|
3
|
-
---
|
|
4
|
-
version: 2
|
|
5
|
-
updates:
|
|
6
|
-
- package-ecosystem: github-actions
|
|
7
|
-
directory: /
|
|
8
|
-
schedule:
|
|
9
|
-
interval: daily
|
|
10
|
-
- package-ecosystem: bundler
|
|
11
|
-
directory: /
|
|
12
|
-
schedule:
|
|
13
|
-
interval: daily
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
# SPDX-FileCopyrightText: 2025 David Rabkin
|
|
2
|
-
# SPDX-License-Identifier: 0BSD
|
|
3
|
-
---
|
|
4
|
-
name: actionlint
|
|
5
|
-
'on':
|
|
6
|
-
push:
|
|
7
|
-
branches:
|
|
8
|
-
- master
|
|
9
|
-
pull_request:
|
|
10
|
-
branches:
|
|
11
|
-
- master
|
|
12
|
-
env:
|
|
13
|
-
URL: https://raw.githubusercontent.com/rhysd/actionlint/main/scripts/download-actionlint.bash # yamllint disable-line
|
|
14
|
-
jobs:
|
|
15
|
-
actionlint:
|
|
16
|
-
timeout-minutes: 15
|
|
17
|
-
runs-on: ubuntu-24.04
|
|
18
|
-
steps:
|
|
19
|
-
- uses: actions/checkout@v4
|
|
20
|
-
- name: Download actionlint
|
|
21
|
-
id: get_actionlint
|
|
22
|
-
run: bash <(curl "$URL")
|
|
23
|
-
- name: Check workflow files
|
|
24
|
-
run: ${{ steps.get_actionlint.outputs.executable }} -color
|
data/.github/workflows/rake.yml
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
# SPDX-FileCopyrightText: 2025 David Rabkin
|
|
2
|
-
# SPDX-License-Identifier: 0BSD
|
|
3
|
-
---
|
|
4
|
-
name: rake
|
|
5
|
-
'on':
|
|
6
|
-
push:
|
|
7
|
-
branches:
|
|
8
|
-
- master
|
|
9
|
-
pull_request:
|
|
10
|
-
branches:
|
|
11
|
-
- master
|
|
12
|
-
jobs:
|
|
13
|
-
rake:
|
|
14
|
-
strategy:
|
|
15
|
-
fail-fast: false
|
|
16
|
-
matrix:
|
|
17
|
-
os:
|
|
18
|
-
- macos-13
|
|
19
|
-
- macos-14
|
|
20
|
-
- macos-15
|
|
21
|
-
- ubuntu-22.04
|
|
22
|
-
- ubuntu-24.04
|
|
23
|
-
- windows-2022
|
|
24
|
-
- windows-2025
|
|
25
|
-
ruby:
|
|
26
|
-
- 3.2
|
|
27
|
-
- 3.3
|
|
28
|
-
- 3.4
|
|
29
|
-
name: Rake on ${{ matrix.os }} / Ruby ${{ matrix.ruby }}
|
|
30
|
-
runs-on: ${{ matrix.os }}
|
|
31
|
-
steps:
|
|
32
|
-
- uses: actions/checkout@v4
|
|
33
|
-
- uses: ruby/setup-ruby@v1
|
|
34
|
-
with:
|
|
35
|
-
ruby-version: ${{ matrix.ruby }}
|
|
36
|
-
bundler-cache: true
|
|
37
|
-
- run: bundle exec rake
|
data/.github/workflows/reuse.yml
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
# SPDX-FileCopyrightText: 2025 David Rabkin
|
|
2
|
-
# SPDX-License-Identifier: 0BSD
|
|
3
|
-
---
|
|
4
|
-
name: reuse
|
|
5
|
-
'on':
|
|
6
|
-
push:
|
|
7
|
-
branches:
|
|
8
|
-
- master
|
|
9
|
-
pull_request:
|
|
10
|
-
branches:
|
|
11
|
-
- master
|
|
12
|
-
jobs:
|
|
13
|
-
reuse:
|
|
14
|
-
timeout-minutes: 15
|
|
15
|
-
runs-on: ubuntu-24.04
|
|
16
|
-
steps:
|
|
17
|
-
- uses: actions/checkout@v4
|
|
18
|
-
- uses: fsfe/reuse-action@v5
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
# SPDX-FileCopyrightText: 2025 David Rabkin
|
|
2
|
-
# SPDX-License-Identifier: 0BSD
|
|
3
|
-
---
|
|
4
|
-
name: rubocop
|
|
5
|
-
'on':
|
|
6
|
-
push:
|
|
7
|
-
branches:
|
|
8
|
-
- master
|
|
9
|
-
pull_request:
|
|
10
|
-
branches:
|
|
11
|
-
- master
|
|
12
|
-
jobs:
|
|
13
|
-
rubocop:
|
|
14
|
-
timeout-minutes: 15
|
|
15
|
-
runs-on: ubuntu-24.04
|
|
16
|
-
steps:
|
|
17
|
-
- uses: actions/checkout@v4
|
|
18
|
-
- uses: andrewmcodes/rubocop-linter-action@v3.3.0
|
|
19
|
-
env:
|
|
20
|
-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
21
|
-
with:
|
|
22
|
-
exit_on_failure: true
|
data/.github/workflows/typos.yml
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
# SPDX-FileCopyrightText: 2025 David Rabkin
|
|
2
|
-
# SPDX-License-Identifier: 0BSD
|
|
3
|
-
---
|
|
4
|
-
name: typos
|
|
5
|
-
'on':
|
|
6
|
-
push:
|
|
7
|
-
branches:
|
|
8
|
-
- master
|
|
9
|
-
pull_request:
|
|
10
|
-
branches:
|
|
11
|
-
- master
|
|
12
|
-
jobs:
|
|
13
|
-
typos:
|
|
14
|
-
timeout-minutes: 15
|
|
15
|
-
runs-on: ubuntu-24.04
|
|
16
|
-
steps:
|
|
17
|
-
- uses: actions/checkout@v4
|
|
18
|
-
- uses: crate-ci/typos@v1.34.0
|
data/.github/workflows/vale.yml
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
# SPDX-FileCopyrightText: 2025 David Rabkin
|
|
2
|
-
# SPDX-License-Identifier: 0BSD
|
|
3
|
-
---
|
|
4
|
-
name: vale
|
|
5
|
-
'on':
|
|
6
|
-
push:
|
|
7
|
-
branches:
|
|
8
|
-
- master
|
|
9
|
-
pull_request:
|
|
10
|
-
branches:
|
|
11
|
-
- master
|
|
12
|
-
jobs:
|
|
13
|
-
vale:
|
|
14
|
-
timeout-minutes: 15
|
|
15
|
-
runs-on: ubuntu-24.04
|
|
16
|
-
steps:
|
|
17
|
-
- uses: actions/checkout@v4
|
|
18
|
-
- run: sudo apt-get install asciidoctor
|
|
19
|
-
- uses: errata-ai/vale-action@reviewdog
|
|
20
|
-
with:
|
|
21
|
-
fail_on_error: true
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
# SPDX-FileCopyrightText: 2025 David Rabkin
|
|
2
|
-
# SPDX-License-Identifier: 0BSD
|
|
3
|
-
---
|
|
4
|
-
name: yamllint
|
|
5
|
-
'on':
|
|
6
|
-
push:
|
|
7
|
-
branches:
|
|
8
|
-
- master
|
|
9
|
-
pull_request:
|
|
10
|
-
branches:
|
|
11
|
-
- master
|
|
12
|
-
jobs:
|
|
13
|
-
yamllint:
|
|
14
|
-
timeout-minutes: 15
|
|
15
|
-
runs-on: ubuntu-24.04
|
|
16
|
-
steps:
|
|
17
|
-
- uses: actions/checkout@v4
|
|
18
|
-
- uses: ibiqlik/action-yamllint@v3
|
|
19
|
-
with:
|
|
20
|
-
file_or_dir: ./.github/*.yml ./.github/workflows/*.yml
|
|
21
|
-
strict: true
|
data/.gitignore
DELETED
data/.travis.yml
DELETED
data/.vale.ini
DELETED
data/Gemfile
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
# vi:ts=2 sw=2 tw=79 et lbr wrap
|
|
4
|
-
# SPDX-FileCopyrightText: 2020-2025 David Rabkin
|
|
5
|
-
# SPDX-License-Identifier: 0BSD
|
|
6
|
-
|
|
7
|
-
source 'https://rubygems.org'
|
|
8
|
-
gem 'ellipsized'
|
|
9
|
-
gem 'minitest'
|
|
10
|
-
gem 'rake'
|
|
11
|
-
gem 'rubocop'
|
|
12
|
-
gem 'terminal-table'
|
|
13
|
-
gem 'video_transcoding'
|
data/Gemfile.lock
DELETED
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
GEM
|
|
2
|
-
remote: https://rubygems.org/
|
|
3
|
-
specs:
|
|
4
|
-
ast (2.4.3)
|
|
5
|
-
ellipsized (0.3.0)
|
|
6
|
-
json (2.13.2)
|
|
7
|
-
language_server-protocol (3.17.0.5)
|
|
8
|
-
lint_roller (1.1.0)
|
|
9
|
-
minitest (5.25.5)
|
|
10
|
-
parallel (1.27.0)
|
|
11
|
-
parser (3.3.9.0)
|
|
12
|
-
ast (~> 2.4.1)
|
|
13
|
-
racc
|
|
14
|
-
prism (1.4.0)
|
|
15
|
-
racc (1.8.1)
|
|
16
|
-
rainbow (3.1.1)
|
|
17
|
-
rake (13.3.0)
|
|
18
|
-
regexp_parser (2.11.0)
|
|
19
|
-
rubocop (1.79.1)
|
|
20
|
-
json (~> 2.3)
|
|
21
|
-
language_server-protocol (~> 3.17.0.2)
|
|
22
|
-
lint_roller (~> 1.1.0)
|
|
23
|
-
parallel (~> 1.10)
|
|
24
|
-
parser (>= 3.3.0.2)
|
|
25
|
-
rainbow (>= 2.2.2, < 4.0)
|
|
26
|
-
regexp_parser (>= 2.9.3, < 3.0)
|
|
27
|
-
rubocop-ast (>= 1.46.0, < 2.0)
|
|
28
|
-
ruby-progressbar (~> 1.7)
|
|
29
|
-
unicode-display_width (>= 2.4.0, < 4.0)
|
|
30
|
-
rubocop-ast (1.46.0)
|
|
31
|
-
parser (>= 3.3.7.2)
|
|
32
|
-
prism (~> 1.4)
|
|
33
|
-
ruby-progressbar (1.13.0)
|
|
34
|
-
terminal-table (4.0.0)
|
|
35
|
-
unicode-display_width (>= 1.1.1, < 4)
|
|
36
|
-
unicode-display_width (3.1.4)
|
|
37
|
-
unicode-emoji (~> 4.0, >= 4.0.4)
|
|
38
|
-
unicode-emoji (4.0.4)
|
|
39
|
-
video_transcoding (0.25.3)
|
|
40
|
-
|
|
41
|
-
PLATFORMS
|
|
42
|
-
arm64-darwin-24
|
|
43
|
-
ruby
|
|
44
|
-
|
|
45
|
-
DEPENDENCIES
|
|
46
|
-
ellipsized
|
|
47
|
-
minitest
|
|
48
|
-
rake
|
|
49
|
-
rubocop
|
|
50
|
-
terminal-table
|
|
51
|
-
video_transcoding
|
|
52
|
-
|
|
53
|
-
BUNDLED WITH
|
|
54
|
-
2.7.1
|
data/LICENSES/0BSD.txt
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
Copyright 2020-2025 David Rabkin
|
|
2
|
-
|
|
3
|
-
Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted.
|
|
4
|
-
|
|
5
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
data/REUSE.toml
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
# SPDX-FileCopyrightText: 2025 David Rabkin
|
|
2
|
-
# SPDX-License-Identifier: 0BSD
|
|
3
|
-
version = 1
|
|
4
|
-
[[annotations]]
|
|
5
|
-
path = [
|
|
6
|
-
".github/styles/**",
|
|
7
|
-
".gitignore",
|
|
8
|
-
".vale.ini",
|
|
9
|
-
"Gemfile.lock",
|
|
10
|
-
"README.adoc",
|
|
11
|
-
]
|
|
12
|
-
precedence = "override"
|
|
13
|
-
SPDX-FileCopyrightText = "2025 David Rabkin"
|
|
14
|
-
SPDX-License-Identifier = "0BSD"
|
data/Rakefile
DELETED
data/_typos.toml
DELETED
data/appveyor.yml
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
# SPDX-FileCopyrightText: 2023-2025 David Rabkin
|
|
2
|
-
# SPDX-License-Identifier: 0BSD
|
|
3
|
-
---
|
|
4
|
-
version: '{build}'
|
|
5
|
-
skip_tags: true
|
|
6
|
-
clone_depth: 10
|
|
7
|
-
branches:
|
|
8
|
-
only:
|
|
9
|
-
- master
|
|
10
|
-
except:
|
|
11
|
-
- gh-pages
|
|
12
|
-
os: Windows Server 2012
|
|
13
|
-
environment:
|
|
14
|
-
matrix:
|
|
15
|
-
- ruby_version: "26-x64"
|
|
16
|
-
install:
|
|
17
|
-
- ps: |
|
|
18
|
-
$Env:PATH = "C:\Ruby${Env:ruby_version}\bin;${Env:PATH}"
|
|
19
|
-
- bundle config --local path vendor/bundle
|
|
20
|
-
- ruby -v
|
|
21
|
-
- bundle -v
|
|
22
|
-
build_script:
|
|
23
|
-
- bundle update
|
|
24
|
-
- bundle install
|
|
25
|
-
test_script:
|
|
26
|
-
- bundle exec rake --quiet
|
|
27
|
-
cache:
|
|
28
|
-
- vendor/bundle
|
data/test/test_utils.rb
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
# vi:ts=2 sw=2 tw=79 et lbr wrap
|
|
4
|
-
# SPDX-FileCopyrightText: 2020-2025 David Rabkin
|
|
5
|
-
# SPDX-License-Identifier: 0BSD
|
|
6
|
-
|
|
7
|
-
require 'minitest/autorun'
|
|
8
|
-
require_relative '../lib/transcode/utils'
|
|
9
|
-
|
|
10
|
-
class TestUtils < Minitest::Test
|
|
11
|
-
def setup
|
|
12
|
-
@tim = Timer.new
|
|
13
|
-
end
|
|
14
|
-
|
|
15
|
-
def test_timer
|
|
16
|
-
assert_equal(Timer.less_sec, @tim.read)
|
|
17
|
-
sleep(1)
|
|
18
|
-
assert_equal('1 second', @tim.read)
|
|
19
|
-
sleep(1)
|
|
20
|
-
assert_equal('2 seconds', @tim.read)
|
|
21
|
-
end
|
|
22
|
-
|
|
23
|
-
def test_trim
|
|
24
|
-
s = Utils.sep
|
|
25
|
-
assert_equal("ni#{s}bo", Utils.trim('ninesymbo', 5))
|
|
26
|
-
assert_equal("te#{s}ls", Utils.trim('tensymbols', 5))
|
|
27
|
-
assert_equal("nin#{s}bo", Utils.trim('ninesymbo', 6))
|
|
28
|
-
assert_equal("ten#{s}ls", Utils.trim('tensymbols', 6))
|
|
29
|
-
end
|
|
30
|
-
end
|
data/transcode.gemspec
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
# SPDX-FileCopyrightText: 2023-2025 David Rabkin
|
|
4
|
-
# SPDX-License-Identifier: 0BSD
|
|
5
|
-
|
|
6
|
-
$LOAD_PATH.unshift File.expand_path("#{File.dirname(__FILE__)}/lib")
|
|
7
|
-
|
|
8
|
-
require 'transcode'
|
|
9
|
-
|
|
10
|
-
Gem::Specification.new do |s|
|
|
11
|
-
s.required_rubygems_version = Gem::Requirement.new('>= 0') if s.respond_to? :required_rubygems_version=
|
|
12
|
-
s.required_ruby_version = '>=3.2'
|
|
13
|
-
s.name = 'transcode'
|
|
14
|
-
s.version = Transcode::VERSION
|
|
15
|
-
s.date = Transcode::DATE
|
|
16
|
-
s.summary = 'Tools to transcode batch of video files'
|
|
17
|
-
s.description = <<-HERE
|
|
18
|
-
Transcode is a wrapper on Video Transcoding.
|
|
19
|
-
HERE
|
|
20
|
-
s.license = '0BSD'
|
|
21
|
-
s.author = 'David Rabkin'
|
|
22
|
-
s.email = 'david@rabkin.co.il'
|
|
23
|
-
s.homepage = 'https://github.com/rdavid/transcode'
|
|
24
|
-
s.files = `git ls-files`.split($RS)
|
|
25
|
-
s.executables = s.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
|
26
|
-
s.extra_rdoc_files = ['LICENSE', 'README.adoc']
|
|
27
|
-
s.metadata['rubygems_mfa_required'] = 'true'
|
|
28
|
-
end
|