transcode 1.0.3 → 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: b226e860131744a93fe08350592d1ea68fe654bff97d29d16ecbc0a71120aed5
4
- data.tar.gz: 5e4e5db31ef304fbe5936cf9bc549d760ae0a43df5de0b7588a4cb7d4e5bf0ab
3
+ metadata.gz: 59cae6c1f3477d89285847f141d461e564e7f926f283f9be6b013179b2a97d1b
4
+ data.tar.gz: 5e1815c63c7e4ca38c994bc7a08a008491c7c1ed3af092df04a93a7f46becbea
5
5
  SHA512:
6
- metadata.gz: aa1c762d5a4b78c11427376fb4d137609d2260ffc74ca34106d1f795fbb5d5baa837ce5eadbb620c532f138bd614e4f2e657ecc9ca843c62237e813ef2809887
7
- data.tar.gz: b259365085e5a20aa7f2544c46323f7f858b4a1604599493abf8b336cba1d697f977a7bc91d02fb8026c2021e443547588ae47bd5a57fc0c351cc1f55c33b22c
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,16 +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-present 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.11.3'
10
- gem 'pidfile', '0.3.0'
11
- gem 'rake', '13.0.1'
12
- gem 'rubocop', '0.76.0'
13
- gem 'terminal-table', '1.8.0'
14
- gem 'video_transcoding', '0.25.3'
15
-
16
- # gemspec
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 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/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-present 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-present 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-present David Rabkin
4
+ # SPDX-FileCopyrightText: 2018-2025 David Rabkin
5
+ # SPDX-License-Identifier: 0BSD
5
6
 
6
7
  require 'optparse'
7
8
 
@@ -9,6 +10,7 @@ module Transcode
9
10
  # Handles input parameters.
10
11
  class Configurator # rubocop:disable Metrics/ClassLength
11
12
  attr_reader :files
13
+
12
14
  DIC = [
13
15
  ['-a', '--act', 'Real encoding.', nil, :act],
14
16
  ['-s', '--sca', 'Scans files at the directory.', nil, :sca],
@@ -21,7 +23,7 @@ module Transcode
21
23
  ['-w', '--wid wid', 'Width of the table.', Integer, :wid]
22
24
  ].freeze
23
25
  EXT = %i[
24
- avi flv m4v mkv mp4 mpg mpeg mov ts webm vob wmv
26
+ avi flv m2ts m4v mkv mp4 mpg mpeg mov ts webm vob wmv
25
27
  ].map(&:to_s).join(',').freeze
26
28
 
27
29
  def add(opt)
@@ -63,7 +65,7 @@ module Transcode
63
65
  validate_tit
64
66
  validate_val(aud, :aud)
65
67
  validate_val(sub, :sub)
66
- 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
67
69
  end
68
70
 
69
71
  def validate_dir(dir, isw)
@@ -79,7 +81,7 @@ module Transcode
79
81
  raise "#{bad.join(',')}: Permission denied." unless bad.empty?
80
82
  end
81
83
 
82
- def validate_tit # rubocop:disable Metrics/AbcSize
84
+ def validate_tit
83
85
  if tit.nil?
84
86
  @options[:tit] = Array.new(files.size, '0')
85
87
  return
@@ -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-present 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-present 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-present 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-present David Rabkin
4
+ # SPDX-FileCopyrightText: 2020-2025 David Rabkin
5
+ # SPDX-License-Identifier: 0BSD
5
6
 
6
7
  module Transcode
7
- VERSION = '1.0.3'
8
- DATE = '2020-11-04'
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-present 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
- s.license = 'BSD-2-Clause'
20
+ s.license = '0BSD'
17
21
  s.author = 'David Rabkin'
18
- s.email = 'pub@rabkin.co.il'
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.txt', 'README.md']
23
- s.require_paths = ['lib']
24
- s.add_runtime_dependency 'pidfile', '0.3.0'
25
- s.add_runtime_dependency 'terminal-table', '1.8.0'
26
- s.add_runtime_dependency 'video_transcoding', '0.25.3'
27
- s.add_development_dependency 'minitest', '5.11.3'
28
- s.add_development_dependency 'rake', '13.0.1'
29
- s.add_development_dependency 'rubocop', '0.76.0'
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.3
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: 2020-11-04 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: 1.8.0
34
- type: :runtime
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - '='
39
- - !ruby/object:Gem::Version
40
- version: 1.8.0
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.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
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.1
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.1
83
- - !ruby/object:Gem::Dependency
84
- name: rubocop
85
- requirement: !ruby/object:Gem::Requirement
86
- requirements:
87
- - - '='
88
- - !ruby/object:Gem::Version
89
- version: 0.76.0
90
- type: :development
91
- prerelease: false
92
- version_requirements: !ruby/object:Gem::Requirement
93
- requirements:
94
- - - '='
95
- - !ruby/object:Gem::Version
96
- version: 0.76.0
97
- description: " Transcode is a wraper on Video Transcoding.\n"
98
- email: pub@rabkin.co.il
10
+ date: 2025-08-04 00:00:00.000000000 Z
11
+ dependencies: []
12
+ description: " Transcode is a wrapper on Video Transcoding.\n"
13
+ email: david@rabkin.co.il
99
14
  executables:
100
15
  - transcode
101
16
  extensions: []
102
17
  extra_rdoc_files:
103
- - LICENSE.txt
104
- - README.md
18
+ - LICENSE
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
107
- - LICENSE.txt
108
- - README.md
34
+ - Gemfile.lock
35
+ - LICENSE
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
- - BSD-2-Clause
122
- metadata: {}
123
- post_install_message:
53
+ - 0BSD
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.1.4
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/LICENSE.txt DELETED
@@ -1,25 +0,0 @@
1
- BSD 2-Clause License
2
-
3
- Copyright (c) 2020, David Rabkin
4
- All rights reserved.
5
-
6
- Redistribution and use in source and binary forms, with or without
7
- modification, are permitted provided that the following conditions are met:
8
-
9
- 1. Redistributions of source code must retain the above copyright notice, this
10
- list of conditions and the following disclaimer.
11
-
12
- 2. Redistributions in binary form must reproduce the above copyright notice,
13
- this list of conditions and the following disclaimer in the documentation
14
- and/or other materials provided with the distribution.
15
-
16
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17
- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18
- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19
- DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
20
- FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21
- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22
- SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
23
- CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24
- OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25
- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
data/README.md DELETED
@@ -1,66 +0,0 @@
1
- # Transcode
2
- Tool to transcode batch of video files.
3
-
4
- [![Build
5
- Status](https://travis-ci.org/rdavid/transcode.svg)](https://travis-ci.org/rdavid/transcode)
6
- [![Build
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)
9
- [![Gem
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)
14
- [![License](https://img.shields.io/github/license/rdavid/transcode)](https://github.com/rdavid/transcode/blob/master/LICENSE.txt)
15
-
16
- * [About](#about)
17
- * [Installation](#installation)
18
- * [Usage](#usage)
19
- * [License](#license)
20
-
21
- ## About
22
- Hi, I'm [David Rabkin](http://davi.drabk.in). I created this tool to
23
- enhance [Don Melton](http://donmelton.com/)'s [Video
24
- Transcoding](https://github.com/donmelton/video_transcoding/). It applies
25
- Video Trascoding to each video file in a directory.
26
-
27
- ## Installation
28
- The tool is designed to work on macOS, GNU/Linux, Windows, Unix-like OS. It is
29
- packaged as a Gem and require Ruby version 2.6 or later. See «[Installing
30
- Ruby](https://www.ruby-lang.org/en/documentation/installation/)» if you don't
31
- have the proper version on your platform.
32
-
33
- Use this command to install:
34
-
35
- gem install transcode
36
-
37
- ### Updating
38
- Use this command to update the package:
39
-
40
- gem update transcode
41
-
42
- ### Requirements
43
- See Video Transcoding's [requirements](https://github.com/donmelton/video_transcoding/blob/master/README.md?ts=2#requirements).
44
-
45
- ## Usage
46
- transcode [options]
47
- -a, --act Real encoding.
48
- -s, --sca Scans files at the directory.
49
- -m, --mp3 Converts files to mp3.
50
- -d, --dir dir Directory to transcode.
51
- -i, --tit tit Specific title by number.
52
- -o, --out out Directory to output.
53
- -u, --aud aud Audio stream numbers.
54
- -t, --sub sub Subtitle stream numbers.
55
- -w, --wid wid Width of the table.
56
- -v, --version Show version.
57
-
58
- ### Example
59
- transcode -d <source> -o <destination> -u 1,3,1 -t 2,1,3
60
-
61
- It converts three files from source with certain audio and subtitle streams.
62
- Inspect first with `-s` option to see audio and subtitle streams.
63
-
64
- ## License
65
- Transcode is copyright [David Rabkin](http://davi.drabk.in) and
66
- available under a [2-Claus BSD license](https://github.com/rdavid/transcode/blob/master/LICENSE).