transcode 1.0.4 → 1.0.5

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d4db3c2397750b7490970b538deef35b83273aa18abf3cacb6317554d8699ff9
4
- data.tar.gz: 424304c05b94a61ca4793286144ffb7fe346e7793b2901695930452c0c53143b
3
+ metadata.gz: 59cae6c1f3477d89285847f141d461e564e7f926f283f9be6b013179b2a97d1b
4
+ data.tar.gz: 5e1815c63c7e4ca38c994bc7a08a008491c7c1ed3af092df04a93a7f46becbea
5
5
  SHA512:
6
- metadata.gz: 12de94cf64c1041f8f89b7bb6d07d0208c3a872ea6f24d013379e99c94589702c828eeac6790553995392a03b0897daa8fef7e78544ffd1cb36f4c83af2f1eff
7
- data.tar.gz: c32c3e54669ca56f79a154caba49d51ad665819325d0e341515a51edbafcf29691d3750116e22bc846c949b5dd1015f1e8627ce3ac5102efba83990bcd635b67
6
+ metadata.gz: fa67a8127e8181097a8a1229c590c8e159af9b63175294f69400db2fb923a71763b21449538d056d1574302ea3ba384f80e4c5a9ba68c921989496458f0dda21
7
+ data.tar.gz: 0465be0d07c458f038eecb0dc9cd5a5a38da1eb9fc54e0a5fc586bbe27fe98869a180de539fe135e9820be945bc3e2cdee2326b1fc2f5dee9c1055cde7b7c317
@@ -0,0 +1,13 @@
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
@@ -0,0 +1,5 @@
1
+ Rabkin
2
+ Shellbase
3
+ transcode
4
+ Transcode
5
+ Transcoding
@@ -0,0 +1,24 @@
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
@@ -0,0 +1,37 @@
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
@@ -0,0 +1,18 @@
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
@@ -0,0 +1,22 @@
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
@@ -0,0 +1,18 @@
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
@@ -0,0 +1,21 @@
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
@@ -0,0 +1,21 @@
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 ADDED
@@ -0,0 +1,13 @@
1
+ *.gem
2
+ .bundle/
3
+ .DS_Store
4
+ .github/styles/.vale-config
5
+ .github/styles/alex
6
+ .github/styles/Google
7
+ .github/styles/Joblint
8
+ .github/styles/proselint
9
+ .github/styles/Readability
10
+ .github/styles/write-good
11
+ .idea/
12
+ coverage/
13
+ rdoc/
data/.travis.yml ADDED
@@ -0,0 +1,14 @@
1
+ # SPDX-FileCopyrightText: 2023-2025 David Rabkin
2
+ # SPDX-License-Identifier: 0BSD
3
+ ---
4
+ language: ruby
5
+ rvm:
6
+ - ~>3.2
7
+ branches:
8
+ only:
9
+ - master
10
+ install:
11
+ - bundle install
12
+ script:
13
+ - set -e
14
+ - bundle exec rake
data/.vale.ini ADDED
@@ -0,0 +1,7 @@
1
+ MinAlertLevel = suggestion
2
+ Packages = Google, proselint, write-good, alex, Readability, Joblint
3
+ StylesPath = .github/styles
4
+ Vocab = Base
5
+
6
+ [*.adoc]
7
+ BasedOnStyles = Vale, Google, proselint, write-good, alex, Readability, Joblint
data/Gemfile CHANGED
@@ -1,14 +1,13 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # vi:ts=2 sw=2 tw=79 et lbr wrap
4
- # Copyright 2020-2023 by David Rabkin
4
+ # SPDX-FileCopyrightText: 2020-2025 David Rabkin
5
+ # SPDX-License-Identifier: 0BSD
5
6
 
6
7
  source 'https://rubygems.org'
7
- ruby '>2.6'
8
-
9
- gem 'minitest', '5.18.0'
10
- gem 'pidfile', '0.3.0'
11
- gem 'rake', '13.0.6'
12
- gem 'rubocop', '1.50.2'
13
- gem 'terminal-table', '3.0.2'
14
- gem 'video_transcoding', '0.25.3'
8
+ gem 'ellipsized'
9
+ gem 'minitest'
10
+ gem 'rake'
11
+ gem 'rubocop'
12
+ gem 'terminal-table'
13
+ gem 'video_transcoding'
data/Gemfile.lock ADDED
@@ -0,0 +1,54 @@
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/LICENSE CHANGED
@@ -1,12 +1,5 @@
1
- Copyright 2020 by David Rabkin
1
+ Copyright 2020-2025 David Rabkin
2
2
 
3
- Permission to use, copy, modify, and/or distribute this software for any
4
- purpose with or without fee is hereby granted.
3
+ Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted.
5
4
 
6
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
7
- WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
8
- MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
9
- ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
10
- WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
11
- ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
12
- OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
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/LICENSES/0BSD.txt ADDED
@@ -0,0 +1,5 @@
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/README.adoc ADDED
@@ -0,0 +1,101 @@
1
+ // Settings:
2
+ :toc: macro
3
+ :!toc-title:
4
+ // URLs:
5
+ :img-build: https://ci.appveyor.com/api/projects/status/yqxb43ltxrjj776a?svg=true
6
+ :img-gem: https://badge.fury.io/rb/transcode.svg
7
+ :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=blue&labelColor=gray&logo=freebsd&logoColor=lightgray&style=flat
9
+ :img-rake: https://github.com/rdavid/transcode/actions/workflows/rake.yml/badge.svg
10
+ :url-build: https://ci.appveyor.com/project/rdavid/transcode
11
+ :url-cv: http://cv.rabkin.co.il
12
+ :url-gem: https://badge.fury.io/rb/transcode
13
+ :url-hoc: https://hitsofcode.com/view/github/rdavid/transcode?branch=master
14
+ :url-license: https://github.com/rdavid/transcode/blob/master/LICENSES/0BSD.txt
15
+ :url-melton: https://lisamelton.net
16
+ :url-rake: https://github.com/rdavid/transcode/actions/workflows/rake.yml
17
+ :url-reuse: https://github.com/fsfe/reuse-action
18
+ :url-requirements: https://github.com/lisamelton/video_transcoding/blob/master/README.md?ts=2#requirements
19
+ :url-ruby: https://www.ruby-lang.org/en/documentation/installation
20
+ :url-video: https://github.com/lisamelton/video_transcoding
21
+ :url-vale: https://vale.sh
22
+ :url-yamllint: https://github.com/adrienverge/yamllint
23
+
24
+ = Transcode
25
+
26
+ image:{img-rake}[rake,link={url-rake}]
27
+ image:{img-build}[build,link={url-build}]
28
+ image:{img-gem}[gem version,link={url-gem}]
29
+ image:{img-hoc}[hits of code,link={url-hoc}]
30
+ image:{img-license}[license,link={url-license}]
31
+
32
+ toc::[]
33
+
34
+ == About
35
+
36
+ Transcode is a tool designed for transcoding multiple video files.
37
+ It builds upon {url-melton}[Lisa Melton's] Video Transcoding and applies
38
+ this technique to each video file within a directory.
39
+
40
+ == Installation
41
+
42
+ The tool is designed to work on macOS, GNU/Linux, Windows, Unix-like OS.
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.
46
+
47
+ Use this command to install:
48
+
49
+ [,sh]
50
+ ----
51
+ gem install transcode
52
+ ----
53
+
54
+ == Updating
55
+
56
+ Use this command to update the package:
57
+
58
+ [,sh]
59
+ ----
60
+ gem update transcode
61
+ ----
62
+
63
+ == Requirements
64
+
65
+ See Video Transcoding's {url-requirements}[requirements].
66
+
67
+ == Usage
68
+
69
+ [,sh]
70
+ ----
71
+ transcode [options]
72
+ -a, --act Real encoding.
73
+ -s, --sca Scans files at the directory.
74
+ -m, --mp3 Converts files to mp3.
75
+ -d, --dir dir Directory to transcode.
76
+ -i, --tit tit Specific title by number.
77
+ -o, --out out Directory to output.
78
+ -u, --aud aud Audio stream numbers.
79
+ -t, --sub sub Subtitle stream numbers.
80
+ -w, --wid wid Width of the table.
81
+ -v, --version Shows version.
82
+ ----
83
+
84
+ == Example
85
+
86
+ [,sh]
87
+ ----
88
+ transcode \
89
+ --aud 1,3,1 \
90
+ --dir [source] \
91
+ --out [destination] \
92
+ --sub 2,1,3
93
+ ----
94
+
95
+ It converts three files from source with certain audio and subtitle streams.
96
+ Inspect first with `--sca` option to see audio and subtitle streams.
97
+
98
+ == License
99
+
100
+ `transcode` is copyright {url-cv}[David Rabkin] and available under a
101
+ {url-license}[Zero-Clause BSD license].
data/REUSE.toml ADDED
@@ -0,0 +1,14 @@
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 CHANGED
@@ -1,7 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # vi:ts=2 sw=2 tw=79 et lbr wrap
4
- # Copyright 2020 by David Rabkin
4
+ # SPDX-FileCopyrightText: 2020-2025 David Rabkin
5
+ # SPDX-License-Identifier: 0BSD
5
6
 
6
7
  task default: %w[test]
7
8
 
data/_typos.toml ADDED
@@ -0,0 +1,4 @@
1
+ # SPDX-FileCopyrightText: 2023-2025 David Rabkin
2
+ # SPDX-License-Identifier: 0BSD
3
+ [default.extend-words]
4
+ nin = "nin"
data/appveyor.yml CHANGED
@@ -1,3 +1,5 @@
1
+ # SPDX-FileCopyrightText: 2023-2025 David Rabkin
2
+ # SPDX-License-Identifier: 0BSD
1
3
  ---
2
4
  version: '{build}'
3
5
  skip_tags: true
data/bin/transcode CHANGED
@@ -2,10 +2,9 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  # vi:ts=2 sw=2 tw=79 et lbr wrap
5
- # Copyright 2018-2023 by David Rabkin
5
+ # SPDX-FileCopyrightText: 2018-2025 David Rabkin
6
+ # SPDX-License-Identifier: 0BSD
6
7
 
7
- require 'pidfile'
8
8
  require_relative '../lib/transcode'
9
9
 
10
- PidFile.new
11
10
  Transcode::Transcoder.new.do
@@ -1,7 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # vi:ts=2 sw=2 tw=79 et lbr wrap
4
- # Copyright 2018-2023 by David Rabkin
4
+ # SPDX-FileCopyrightText: 2018-2025 David Rabkin
5
+ # SPDX-License-Identifier: 0BSD
5
6
 
6
7
  require 'optparse'
7
8
 
@@ -64,7 +65,7 @@ module Transcode
64
65
  validate_tit
65
66
  validate_val(aud, :aud)
66
67
  validate_val(sub, :sub)
67
- raise "Width of the table should exeeds 14 symbols: #{wid}." if wid < 15
68
+ raise "Width of the table should exceeds 14 symbols: #{wid}." if wid < 15
68
69
  end
69
70
 
70
71
  def validate_dir(dir, isw)
@@ -1,7 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # vi:ts=2 sw=2 tw=79 et lbr wrap
4
- # Copyright 2018-2023 by David Rabkin
4
+ # SPDX-FileCopyrightText: 2018-2025 David Rabkin
5
+ # SPDX-License-Identifier: 0BSD
5
6
 
6
7
  require 'terminal-table'
7
8
  require_relative 'utils'
@@ -63,7 +64,7 @@ module Transcode
63
64
  def stat
64
65
  out = ''
65
66
  @sta.each do |k, v|
66
- out += ' ' + v.to_s + ' ' + k.to_s + ',' if v.positive?
67
+ out += " #{v} #{k}," if v.positive?
67
68
  end
68
69
  out.chop
69
70
  end
@@ -1,7 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # vi:ts=2 sw=2 tw=79 et lbr wrap
4
- # Copyright 2018-2023 by David Rabkin
4
+ # SPDX-FileCopyrightText: 2018-2025 David Rabkin
5
+ # SPDX-License-Identifier: 0BSD
5
6
 
6
7
  require 'English'
7
8
  require 'shellwords'
@@ -62,7 +63,7 @@ module Transcode
62
63
  "transcode-video --scan #{file.shellescape}"
63
64
  end
64
65
 
65
- def do # rubocop:disable Metrics/AbcSize
66
+ def do
66
67
  if @cfg.mp3?
67
68
  @cfg.files.each { |f| @rep.add(f, @cfg.act? ? run(mp3_cmd(f)) : true) }
68
69
  elsif @cfg.sca?
@@ -1,20 +1,19 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # vi:ts=2 sw=2 tw=79 et lbr wrap
4
- # Copyright 2018-2023 by David Rabkin
4
+ # SPDX-FileCopyrightText: 2018-2025 David Rabkin
5
+ # SPDX-License-Identifier: 0BSD
6
+
7
+ require 'ellipsized'
5
8
 
6
9
  # All methods are static.
7
10
  class Utils
8
11
  @sep = '~'
9
12
  class << self
10
13
  attr_accessor :sep
11
- def trim(src, lim)
12
- return '' if src.nil? || lim.nil?
13
- return src if src.length <= lim
14
14
 
15
- beg = fin = (lim - @sep.length) / 2
16
- beg -= 1 if lim.odd?
17
- src[0..beg] + @sep + src[-fin..-1]
15
+ def trim(src, lim)
16
+ src.ellipsized(lim, @sep, :center)
18
17
  end
19
18
  end
20
19
  end
@@ -56,9 +55,9 @@ end
56
55
 
57
56
  # Adds natural sort method. This converts something like "Filename 10" into a
58
57
  # simple array with floats in place of numbers [ "Filename", 10.0 ]. See:
59
- # https://stackoverflow.com/questions/4078906/is-there-a-natural-sort-by-method-for-ruby
58
+ # https://stackoverflow.com/q/4078906
60
59
  class String
61
60
  def naturalized
62
- scan(/[^\d\.]+|[\d\.]+/).collect { |f| f.match(/\d+(\.\d+)?/) ? f.to_f : f }
61
+ scan(/[^\d.]+|[\d.]+/).collect { |f| f.match(/\d+(\.\d+)?/) ? f.to_f : f }
63
62
  end
64
63
  end
@@ -1,9 +1,10 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # vi:ts=2 sw=2 tw=79 et lbr wrap
4
- # Copyright 2020-2023 by David Rabkin
4
+ # SPDX-FileCopyrightText: 2020-2025 David Rabkin
5
+ # SPDX-License-Identifier: 0BSD
5
6
 
6
7
  module Transcode
7
- VERSION = '1.0.4'
8
- DATE = '2023-04-22'
8
+ VERSION = '1.0.5'
9
+ DATE = '2025-08-04'
9
10
  end
data/lib/transcode.rb CHANGED
@@ -1,7 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # vi:ts=2 sw=2 tw=79 et lbr wrap
4
- # Copyright 2018-2023 by David Rabkin
4
+ # SPDX-FileCopyrightText: 2018-2025 David Rabkin
5
+ # SPDX-License-Identifier: 0BSD
5
6
 
6
7
  require_relative 'transcode/transcoder'
7
8
  require_relative 'transcode/version'
@@ -0,0 +1,30 @@
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 CHANGED
@@ -1,30 +1,28 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- $LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__) + '/lib')
3
+ # SPDX-FileCopyrightText: 2023-2025 David Rabkin
4
+ # SPDX-License-Identifier: 0BSD
5
+
6
+ $LOAD_PATH.unshift File.expand_path("#{File.dirname(__FILE__)}/lib")
4
7
 
5
8
  require 'transcode'
6
9
 
7
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'
8
13
  s.name = 'transcode'
9
14
  s.version = Transcode::VERSION
10
15
  s.date = Transcode::DATE
11
- s.required_ruby_version = '>2.6'
12
- s.summary = 'Tools to transcode batch of video files.'
16
+ s.summary = 'Tools to transcode batch of video files'
13
17
  s.description = <<-HERE
14
- Transcode is a wraper on Video Transcoding.
18
+ Transcode is a wrapper on Video Transcoding.
15
19
  HERE
16
20
  s.license = '0BSD'
17
21
  s.author = 'David Rabkin'
18
22
  s.email = 'david@rabkin.co.il'
19
23
  s.homepage = 'https://github.com/rdavid/transcode'
20
- s.files = Dir['{bin,lib}/**/*'] + Dir['[A-Z]*'] + ['transcode.gemspec']
21
- s.executables = ['transcode']
22
- s.extra_rdoc_files = ['LICENSE', 'README.md']
23
- s.require_paths = ['lib']
24
- s.add_runtime_dependency 'pidfile', '0.3.0'
25
- s.add_runtime_dependency 'terminal-table', '3.0.2'
26
- s.add_runtime_dependency 'video_transcoding', '0.25.3'
27
- s.add_development_dependency 'minitest', '5.18.0'
28
- s.add_development_dependency 'rake', '13.0.6'
29
- s.add_development_dependency 'rubocop', '1.50.2'
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'
30
28
  end
metadata CHANGED
@@ -1,112 +1,43 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: transcode
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.4
4
+ version: 1.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Rabkin
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2023-04-22 00:00:00.000000000 Z
12
- dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: pidfile
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - '='
18
- - !ruby/object:Gem::Version
19
- version: 0.3.0
20
- type: :runtime
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - '='
25
- - !ruby/object:Gem::Version
26
- version: 0.3.0
27
- - !ruby/object:Gem::Dependency
28
- name: terminal-table
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - '='
32
- - !ruby/object:Gem::Version
33
- version: 3.0.2
34
- type: :runtime
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - '='
39
- - !ruby/object:Gem::Version
40
- version: 3.0.2
41
- - !ruby/object:Gem::Dependency
42
- name: video_transcoding
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - '='
46
- - !ruby/object:Gem::Version
47
- version: 0.25.3
48
- type: :runtime
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - '='
53
- - !ruby/object:Gem::Version
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.18.0
62
- type: :development
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - '='
67
- - !ruby/object:Gem::Version
68
- version: 5.18.0
69
- - !ruby/object:Gem::Dependency
70
- name: rake
71
- requirement: !ruby/object:Gem::Requirement
72
- requirements:
73
- - - '='
74
- - !ruby/object:Gem::Version
75
- version: 13.0.6
76
- type: :development
77
- prerelease: false
78
- version_requirements: !ruby/object:Gem::Requirement
79
- requirements:
80
- - - '='
81
- - !ruby/object:Gem::Version
82
- version: 13.0.6
83
- - !ruby/object:Gem::Dependency
84
- name: rubocop
85
- requirement: !ruby/object:Gem::Requirement
86
- requirements:
87
- - - '='
88
- - !ruby/object:Gem::Version
89
- version: 1.50.2
90
- type: :development
91
- prerelease: false
92
- version_requirements: !ruby/object:Gem::Requirement
93
- requirements:
94
- - - '='
95
- - !ruby/object:Gem::Version
96
- version: 1.50.2
97
- description: " Transcode is a wraper on Video Transcoding.\n"
10
+ date: 2025-08-04 00:00:00.000000000 Z
11
+ dependencies: []
12
+ description: " Transcode is a wrapper on Video Transcoding.\n"
98
13
  email: david@rabkin.co.il
99
14
  executables:
100
15
  - transcode
101
16
  extensions: []
102
17
  extra_rdoc_files:
103
18
  - LICENSE
104
- - README.md
19
+ - README.adoc
105
20
  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"
106
33
  - Gemfile
34
+ - Gemfile.lock
107
35
  - LICENSE
108
- - README.md
36
+ - LICENSES/0BSD.txt
37
+ - README.adoc
38
+ - REUSE.toml
109
39
  - Rakefile
40
+ - _typos.toml
110
41
  - appveyor.yml
111
42
  - bin/transcode
112
43
  - lib/transcode.rb
@@ -115,28 +46,28 @@ files:
115
46
  - lib/transcode/transcoder.rb
116
47
  - lib/transcode/utils.rb
117
48
  - lib/transcode/version.rb
49
+ - test/test_utils.rb
118
50
  - transcode.gemspec
119
51
  homepage: https://github.com/rdavid/transcode
120
52
  licenses:
121
53
  - 0BSD
122
- metadata: {}
123
- post_install_message:
54
+ metadata:
55
+ rubygems_mfa_required: 'true'
124
56
  rdoc_options: []
125
57
  require_paths:
126
58
  - lib
127
59
  required_ruby_version: !ruby/object:Gem::Requirement
128
60
  requirements:
129
- - - ">"
61
+ - - ">="
130
62
  - !ruby/object:Gem::Version
131
- version: '2.6'
63
+ version: '3.2'
132
64
  required_rubygems_version: !ruby/object:Gem::Requirement
133
65
  requirements:
134
66
  - - ">="
135
67
  - !ruby/object:Gem::Version
136
68
  version: '0'
137
69
  requirements: []
138
- rubygems_version: 3.4.8
139
- signing_key:
70
+ rubygems_version: 3.6.9
140
71
  specification_version: 4
141
- summary: Tools to transcode batch of video files.
72
+ summary: Tools to transcode batch of video files
142
73
  test_files: []
data/README.md DELETED
@@ -1,76 +0,0 @@
1
- # Transcode
2
-
3
- [![build](https://ci.appveyor.com/api/projects/status/yqxb43ltxrjj776a?svg=true)](https://ci.appveyor.com/project/rdavid/transcode)
4
- [![linters](https://github.com/rdavid/transcode/actions/workflows/lint.yml/badge.svg)](https://github.com/rdavid/transcode/actions/workflows/lint.yml)
5
- [![ruby](https://github.com/rdavid/transcode/actions/workflows/ruby.yml/badge.svg)](https://github.com/rdavid/transcode/actions/workflows/ruby.yml)
6
- [![gem version](https://badge.fury.io/rb/transcode.svg)](https://badge.fury.io/rb/transcode)
7
- [![maintainability](https://api.codeclimate.com/v1/badges/5e21a1c1f8a3923584e3/maintainability)](https://codeclimate.com/github/rdavid/transcode/maintainability)
8
- [![hits of code](https://hitsofcode.com/github/rdavid/transcode?branch=master&label=hits%20of%20code)](https://hitsofcode.com/view/github/rdavid/transcode)
9
- [![license](https://img.shields.io/github/license/rdavid/transcode?color=blue&labelColor=gray&logo=freebsd&logoColor=lightgray&style=flat)](https://github.com/rdavid/transcode/blob/master/LICENSE)
10
-
11
- * [About](#about)
12
- * [Installation](#installation)
13
- * [Usage](#usage)
14
- * [License](#license)
15
-
16
- ## About
17
-
18
- `transcode` is a tool to transcode multiple video files. It enhances
19
- [Don Melton](http://donmelton.com/)'s [Video
20
- Transcoding](https://github.com/donmelton/video_transcoding/). It applies
21
- Video Trascoding to each video file in a directory.
22
-
23
- ## Installation
24
-
25
- The tool is designed to work on macOS, GNU/Linux, Windows, Unix-like OS. It is
26
- packaged as a Gem and require Ruby version 2.6 or later. See “[Installing
27
- Ruby](https://www.ruby-lang.org/en/documentation/installation/)” if you don't
28
- have the proper version on your platform.
29
-
30
- Use this command to install:
31
-
32
- ```sh
33
- gem install transcode
34
- ```
35
-
36
- ### Updating
37
-
38
- Use this command to update the package:
39
-
40
- ```sh
41
- gem update transcode
42
- ```
43
-
44
- ### Requirements
45
-
46
- See Video Transcoding's [requirements](https://github.com/donmelton/video_transcoding/blob/master/README.md?ts=2#requirements).
47
-
48
- ### Usage
49
-
50
- ```sh
51
- transcode [options]
52
- -a, --act Real encoding.
53
- -s, --sca Scans files at the directory.
54
- -m, --mp3 Converts files to mp3.
55
- -d, --dir dir Directory to transcode.
56
- -i, --tit tit Specific title by number.
57
- -o, --out out Directory to output.
58
- -u, --aud aud Audio stream numbers.
59
- -t, --sub sub Subtitle stream numbers.
60
- -w, --wid wid Width of the table.
61
- -v, --version Shows version.
62
- ```
63
-
64
- ### Example
65
-
66
- ```sh
67
- transcode -d <source> -o <destination> -u 1,3,1 -t 2,1,3
68
- ```
69
-
70
- It converts three files from source with certain audio and subtitle streams.
71
- Inspect first with `-s` option to see audio and subtitle streams.
72
-
73
- ## License
74
-
75
- `transcode` is copyright [David Rabkin](http://cv.rabkin.co.il) and
76
- available under a [Zero-Claus BSD license](https://github.com/rdavid/transcode/blob/master/LICENSE).