evideo 0.3.3 → 0.3.4

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: 5d2da7219a807d559d92570adf0ad08c5a9296f171544ad043d5c8e5cfbc85b8
4
- data.tar.gz: 38c755d56f4da1acb2d156c67a42c22b65f16767162df68a84e28d3ad5548ed1
3
+ metadata.gz: 9f8ae06d07be97ed6d678bc47439e0d4f631243351eb2286f3d847b6f5634b16
4
+ data.tar.gz: 57e79d419857ea67ca2b2da1739f38c81045d6e693290cff148be8316012cc9e
5
5
  SHA512:
6
- metadata.gz: 323140bb95173af244df13f265267b9aa837ee5b8b1cfff3e23148ce20bf83cea69e0a578a517560848acaa29a1eb5aeb2e1cf1b38126cf911099b40e2dca4c7
7
- data.tar.gz: 9448e43f81f485e69efd89887da88d563674240d773be2d7678851a03a17338ffe1cf58b3afaa892de0922fc4332b763069da0c056fa6148f7f0c26a0fb066e7
6
+ metadata.gz: 866eedd399b2b0cb7f8b4fcbad71127442ab960175c957b5054cb27371ddddb24c300156016a8a88c420940ce262ef05aa1583e5b09b246218ec5eff113b009c
7
+ data.tar.gz: 8f9f3d2a38a0be9a725704e71412c4eab6a15d6c4cc5d4003f767faa5e905599fcdc61098b21385bd779d66ca6fe21c96c1976edd7c664db0fd4a1cd927f20f5
data/.rubocop.yml CHANGED
@@ -1,12 +1,70 @@
1
+ ---
1
2
  AllCops:
2
- TargetRubyVersion: 3.1
3
+ TargetRubyVersion: 3.3
3
4
  EnabledByDefault: true
5
+ NewCops: enable # Automatically enable new cops introduced in updates
4
6
 
7
+ Metrics/ClassLength:
8
+ Enabled: false
9
+
10
+ Metrics/ParameterLists:
11
+ Enabled: false
12
+
13
+ Metrics/MethodLength:
14
+ Max: 25
15
+
16
+ Metrics/AbcSize:
17
+ Max: 40
18
+
19
+ # Formatting Rules
20
+ Layout/LineLength:
21
+ Max: 185
22
+ AllowHeredoc: true
23
+ AllowURI: true
24
+
25
+ Layout/IndentationWidth:
26
+ Width: 2
27
+
28
+ Layout/SpaceInsideHashLiteralBraces:
29
+ EnforcedStyle: no_space
30
+
31
+ Layout/SingleLineBlockChain:
32
+ Enabled: false
33
+
34
+ Layout/SpaceInsideParens:
35
+ Enabled: true
36
+
37
+ # Style Preferences
5
38
  Style/Copyright:
6
- Enabled: false
39
+ Enabled: false
7
40
 
8
- Lint/ConstantResolution:
9
- Enabled: false
41
+ Style/Documentation:
42
+ Enabled: false
43
+
44
+ Style/RequireOrder:
45
+ Enabled: false
10
46
 
11
47
  Style/ConstantVisibility:
12
- Enabled: false
48
+ Enabled: false
49
+
50
+ Style/OptionHash:
51
+ Enabled: false
52
+
53
+ Style/StringLiterals:
54
+ EnforcedStyle: single_quotes
55
+
56
+ Style/NumericLiterals:
57
+ MinDigits: 5
58
+
59
+ Style/ParallelAssignment:
60
+ Enabled: false
61
+
62
+ # Linting
63
+ Lint/UselessAssignment:
64
+ Enabled: true
65
+
66
+ Lint/AmbiguousOperatorPrecedence:
67
+ Enabled: true
68
+
69
+ Lint/ConstantResolution:
70
+ Enabled: false
data/Gemfile.lock CHANGED
@@ -1,78 +1,124 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- evideo (0.3.3)
4
+ evideo (0.3.4)
5
5
  thor
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
9
9
  specs:
10
- ast (2.4.2)
10
+ ast (2.4.3)
11
11
  backport (1.2.0)
12
- benchmark (0.2.1)
13
- diff-lcs (1.5.0)
14
- e2mmap (0.1.0)
15
- jaro_winkler (1.5.6)
16
- json (2.6.3)
17
- kramdown (2.4.0)
18
- rexml
12
+ benchmark (0.4.0)
13
+ bigdecimal (3.1.9)
14
+ concurrent-ruby (1.3.5)
15
+ diff-lcs (1.6.0)
16
+ dry-configurable (1.3.0)
17
+ dry-core (~> 1.1)
18
+ zeitwerk (~> 2.6)
19
+ dry-core (1.1.0)
20
+ concurrent-ruby (~> 1.0)
21
+ logger
22
+ zeitwerk (~> 2.6)
23
+ dry-inflector (1.2.0)
24
+ dry-initializer (3.2.0)
25
+ dry-logic (1.6.0)
26
+ bigdecimal
27
+ concurrent-ruby (~> 1.0)
28
+ dry-core (~> 1.1)
29
+ zeitwerk (~> 2.6)
30
+ dry-schema (1.13.4)
31
+ concurrent-ruby (~> 1.0)
32
+ dry-configurable (~> 1.0, >= 1.0.1)
33
+ dry-core (~> 1.0, < 2)
34
+ dry-initializer (~> 3.0)
35
+ dry-logic (>= 1.4, < 2)
36
+ dry-types (>= 1.7, < 2)
37
+ zeitwerk (~> 2.6)
38
+ dry-types (1.8.2)
39
+ bigdecimal (~> 3.0)
40
+ concurrent-ruby (~> 1.0)
41
+ dry-core (~> 1.0)
42
+ dry-inflector (~> 1.0)
43
+ dry-logic (~> 1.4)
44
+ zeitwerk (~> 2.6)
45
+ jaro_winkler (1.6.0)
46
+ json (2.10.2)
47
+ kramdown (2.5.1)
48
+ rexml (>= 3.3.9)
19
49
  kramdown-parser-gfm (1.1.0)
20
50
  kramdown (~> 2.0)
21
- kwalify (0.7.2)
22
- language_server-protocol (3.17.0.3)
23
- nokogiri (1.15.3-x86_64-linux)
51
+ language_server-protocol (3.17.0.4)
52
+ lint_roller (1.1.0)
53
+ logger (1.6.6)
54
+ nokogiri (1.18.5-x86_64-linux-gnu)
24
55
  racc (~> 1.4)
25
- parallel (1.23.0)
26
- parser (3.2.2.3)
56
+ observer (0.1.2)
57
+ ostruct (0.6.1)
58
+ parallel (1.26.3)
59
+ parser (3.3.7.2)
27
60
  ast (~> 2.4.1)
28
61
  racc
29
- racc (1.7.1)
62
+ racc (1.8.1)
30
63
  rainbow (3.1.1)
31
- rake (13.0.6)
32
- rbs (2.8.4)
33
- reek (6.1.4)
34
- kwalify (~> 0.7.0)
35
- parser (~> 3.2.0)
64
+ rake (13.2.1)
65
+ rbs (3.9.0)
66
+ logger
67
+ reek (6.4.0)
68
+ dry-schema (~> 1.13.0)
69
+ logger (~> 1.6)
70
+ parser (~> 3.3.0)
36
71
  rainbow (>= 2.0, < 4.0)
37
- regexp_parser (2.8.1)
38
- reverse_markdown (2.1.1)
72
+ rexml (~> 3.1)
73
+ regexp_parser (2.10.0)
74
+ reverse_markdown (3.0.0)
39
75
  nokogiri
40
- rexml (3.2.6)
41
- rubocop (1.55.1)
76
+ rexml (3.4.1)
77
+ rubocop (1.74.0)
42
78
  json (~> 2.3)
43
- language_server-protocol (>= 3.17.0)
79
+ language_server-protocol (~> 3.17.0.2)
80
+ lint_roller (~> 1.1.0)
44
81
  parallel (~> 1.10)
45
- parser (>= 3.2.2.3)
82
+ parser (>= 3.3.0.2)
46
83
  rainbow (>= 2.2.2, < 4.0)
47
- regexp_parser (>= 1.8, < 3.0)
48
- rexml (>= 3.2.5, < 4.0)
49
- rubocop-ast (>= 1.28.1, < 2.0)
84
+ regexp_parser (>= 2.9.3, < 3.0)
85
+ rubocop-ast (>= 1.38.0, < 2.0)
50
86
  ruby-progressbar (~> 1.7)
51
- unicode-display_width (>= 2.4.0, < 3.0)
52
- rubocop-ast (1.29.0)
53
- parser (>= 3.2.1.0)
87
+ unicode-display_width (>= 2.4.0, < 4.0)
88
+ rubocop-ast (1.41.0)
89
+ parser (>= 3.3.7.2)
90
+ rubocop-rake (0.7.1)
91
+ lint_roller (~> 1.1)
92
+ rubocop (>= 1.72.1)
54
93
  ruby-progressbar (1.13.0)
55
- rufo (0.16.2)
56
- solargraph (0.49.0)
94
+ solargraph (0.52.0)
57
95
  backport (~> 1.2)
58
96
  benchmark
59
97
  bundler (~> 2.0)
60
98
  diff-lcs (~> 1.4)
61
- e2mmap
62
- jaro_winkler (~> 1.5)
99
+ jaro_winkler (~> 1.6)
63
100
  kramdown (~> 2.3)
64
101
  kramdown-parser-gfm (~> 1.1)
102
+ logger (~> 1.6)
103
+ observer (~> 0.1)
104
+ ostruct (~> 0.6)
65
105
  parser (~> 3.0)
66
- rbs (~> 2.0)
67
- reverse_markdown (~> 2.0)
106
+ rbs (~> 3.0)
107
+ reverse_markdown (>= 2.0, < 4)
68
108
  rubocop (~> 1.38)
69
109
  thor (~> 1.0)
70
110
  tilt (~> 2.0)
71
111
  yard (~> 0.9, >= 0.9.24)
72
- thor (1.2.2)
73
- tilt (2.2.0)
74
- unicode-display_width (2.4.2)
75
- yard (0.9.34)
112
+ yard-solargraph (~> 0.1)
113
+ thor (1.3.2)
114
+ tilt (2.6.0)
115
+ unicode-display_width (3.1.4)
116
+ unicode-emoji (~> 4.0, >= 4.0.4)
117
+ unicode-emoji (4.0.4)
118
+ yard (0.9.37)
119
+ yard-solargraph (0.1.0)
120
+ yard (~> 0.9)
121
+ zeitwerk (2.7.2)
76
122
 
77
123
  PLATFORMS
78
124
  x86_64-linux
@@ -83,9 +129,9 @@ DEPENDENCIES
83
129
  rake
84
130
  reek
85
131
  rubocop
86
- rufo
132
+ rubocop-rake
87
133
  solargraph
88
134
  yard
89
135
 
90
136
  BUNDLED WITH
91
- 2.3.7
137
+ 2.5.3
data/evideo.gemspec CHANGED
@@ -1,22 +1,22 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- lib = File.expand_path('lib', __dir__)
3
+ lib = File.expand_path("lib", __dir__)
4
4
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
- require 'evideo/version'
5
+ require "evideo/version"
6
6
 
7
7
  Gem::Specification.new do |spec|
8
- spec.name = 'evideo'
9
- spec.version = Evideo::VERSION
10
- spec.authors = ['Hernâni Rodrigues Vaz']
11
- spec.email = ['hernanirvaz@gmail.com']
12
- spec.homepage = 'https://github.com/hernanilr/evideo'
13
- spec.license = 'MIT'
14
- spec.summary = 'Processa ficheiros video.'
8
+ spec.name = "evideo"
9
+ spec.version = Evideo::VERSION
10
+ spec.authors = ["Hernâni Rodrigues Vaz"]
11
+ spec.email = ["hernanirvaz@gmail.com"]
12
+ spec.homepage = "https://github.com/hernanilr/evideo"
13
+ spec.license = "MIT"
14
+ spec.summary = "Processa ficheiros video."
15
15
  spec.description = "#{spec.summary} Pode alterar bitrate, framerate, height, aspect ratio e elimina metadata."
16
16
 
17
- spec.required_ruby_version = Gem::Requirement.new('~> 3.1')
18
- spec.metadata['homepage_uri'] = spec.homepage
19
- spec.metadata['yard.run'] = 'yard'
17
+ spec.required_ruby_version = Gem::Requirement.new("~> 3.1")
18
+ spec.metadata["homepage_uri"] = spec.homepage
19
+ spec.metadata["yard.run"] = "yard"
20
20
 
21
21
  # Specify which files should be added to the gem when it is released.
22
22
  # The `git ls-files -z` loads the files in the RubyGem that have been
@@ -25,17 +25,17 @@ Gem::Specification.new do |spec|
25
25
  Dir.chdir(File.expand_path(__dir__)) do
26
26
  `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
27
27
  end
28
- spec.bindir = 'exe'
29
- spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
30
- spec.require_paths = ['lib']
28
+ spec.bindir = "exe"
29
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
30
+ spec.require_paths = ["lib"]
31
31
 
32
- spec.add_development_dependency('bundler')
33
- spec.add_development_dependency('rake')
34
- spec.add_development_dependency('reek')
35
- spec.add_development_dependency('rubocop')
36
- spec.add_development_dependency('rufo')
37
- spec.add_development_dependency('solargraph')
38
- spec.add_development_dependency('yard')
32
+ spec.add_development_dependency("bundler")
33
+ spec.add_development_dependency("rake")
34
+ spec.add_development_dependency("reek")
35
+ spec.add_development_dependency("rubocop")
36
+ spec.add_development_dependency("rubocop-rake")
37
+ spec.add_development_dependency("solargraph")
38
+ spec.add_development_dependency("yard")
39
39
 
40
- spec.add_dependency('thor')
40
+ spec.add_dependency("thor")
41
41
  end
@@ -50,12 +50,10 @@ module Evideo
50
50
  # @return [true, false] pastas com video final ok
51
51
  def opastas?
52
52
  ary = ops[:d]
53
- if pos == ary.size then false
54
- elsif ovideo? then true
55
- else
56
- # proxima pasta
57
- @pos += 1
58
- opastas?
53
+ if pos == ary.size then false elsif ovideo? then true else
54
+ # proxima pasta
55
+ @pos += 1
56
+ opastas?
59
57
  end
60
58
  end
61
59
 
@@ -68,9 +66,12 @@ module Evideo
68
66
  # @note final video dimensions hd480=852x480, hd720=1280x720, hd1080=1920x1080
69
67
  # @return [String] dimensions do comando processar video
70
68
  def fdimensions
71
- if iheight < 480 then ' -s hd480'
72
- elsif iheight <= 720 then ' -s hd720'
73
- else ' -s hd1080'
69
+ if iheight < 480
70
+ ' -s hd480'
71
+ elsif iheight <= 720
72
+ ' -s hd720'
73
+ else
74
+ ' -s hd1080'
74
75
  end
75
76
  end
76
77
 
@@ -96,9 +97,9 @@ module Evideo
96
97
  # @return [String] comando mpeg
97
98
  def cmd_mpeg(base)
98
99
  oout = "#{base}.out"
99
- "ffmpeg -loglevel quiet -hide_banner -i #{inome} -y -an #{fparams}#{fcuts} "\
100
- '-metadata title= -metadata artist= -metadata comment= -metadata major_brand= -metadata compatible_brands= '\
101
- "#{base}.mp4 >#{oout} 2>&1;[ -s #{oout} ] || rm #{oout}"
100
+ "ffmpeg -loglevel quiet -hide_banner -i #{inome} -y -an #{fparams}#{fcuts} " \
101
+ '-metadata title= -metadata artist= -metadata comment= -metadata major_brand= -metadata compatible_brands= ' \
102
+ "#{base}.mp4 >#{oout} 2>&1;[ -s #{oout} ] || rm #{oout}"
102
103
  end
103
104
  end
104
105
  end
@@ -2,5 +2,5 @@
2
2
 
3
3
  # analizar/processar videos para arquivo uniformizado
4
4
  module Evideo
5
- VERSION = '0.3.3'
5
+ VERSION = '0.3.4'
6
6
  end
data/lib/evideo.rb CHANGED
@@ -1,10 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "thor"
4
- require "evideo/vars1"
5
- require "evideo/vars2"
6
- require "evideo/processa"
7
- require "evideo/version"
3
+ require 'thor'
4
+ require 'evideo/vars'
5
+ require 'evideo/processa'
6
+ require 'evideo/version'
8
7
 
9
8
  # (see Evideo)
10
9
  module Evideo
@@ -13,17 +12,17 @@ module Evideo
13
12
 
14
13
  # CLI para analisar/processar videos
15
14
  class CLI < Thor
16
- class_option :d, banner: "DIR", type: :array, desc: "Onde procurar videos", default: ADI
17
- class_option :i, banner: "IN", default: "ftv", desc: "Pasta inicial"
18
- class_option :o, banner: "OUT", default: "out", desc: "Pasta final"
15
+ class_option :d, banner: 'DIR', type: :array, desc: 'Onde procurar videos', default: ADI
16
+ class_option :i, banner: 'IN', default: 'ftv', desc: 'Pasta inicial'
17
+ class_option :o, banner: 'OUT', default: 'out', desc: 'Pasta final'
19
18
 
20
- # TODO convert jpg -> mp4
21
- #ffmpeg -pattern_type glob -r 0.15 -i '*.jpg' -c:v libx264 -pix_fmt yuv420p -s 720x480 ../../lily95.mp4
19
+ # TODO: convert jpg -> mp4
20
+ # ffmpeg -pattern_type glob -r 0.15 -i '*.jpg' -c:v libx264 -pix_fmt yuv420p -s 720x480 ../../lily95.mp4
22
21
 
23
- desc "conv", "converte videos"
24
- option :x, type: :boolean, default: false, desc: "executa/mostra comando converte videos"
25
- option :s, type: :numeric, default: 0, desc: "Segundos cortados no inicio do video final 0=sem cortes"
26
- option :t, type: :numeric, default: 0, desc: "Segundos duracao video final 0=sem cortes"
22
+ desc 'conv', 'converte videos'
23
+ option :x, type: :boolean, default: false, desc: 'executa/mostra comando converte videos'
24
+ option :s, type: :numeric, default: 0, desc: 'Segundos cortados no inicio do video final 0=sem cortes'
25
+ option :t, type: :numeric, default: 0, desc: 'Segundos duracao video final 0=sem cortes'
27
26
  # converte videos
28
27
  def conv
29
28
  # cria pasta final para videos processados
@@ -34,7 +33,7 @@ module Evideo
34
33
  end
35
34
  end
36
35
 
37
- desc "test", "testa videos"
36
+ desc 'test', 'testa videos'
38
37
  # testa videos
39
38
  def test
40
39
  Dir.glob("#{ipasta}/*.???").sort.each do |file|
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: evideo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.3
4
+ version: 0.3.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hernâni Rodrigues Vaz
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-08-02 00:00:00.000000000 Z
11
+ date: 2025-03-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -67,7 +67,7 @@ dependencies:
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
69
  - !ruby/object:Gem::Dependency
70
- name: rufo
70
+ name: rubocop-rake
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
73
  - - ">="
@@ -147,8 +147,6 @@ files:
147
147
  - exe/evideo
148
148
  - lib/evideo.rb
149
149
  - lib/evideo/processa.rb
150
- - lib/evideo/vars1.rb
151
- - lib/evideo/vars2.rb
152
150
  - lib/evideo/version.rb
153
151
  homepage: https://github.com/hernanilr/evideo
154
152
  licenses:
@@ -156,7 +154,7 @@ licenses:
156
154
  metadata:
157
155
  homepage_uri: https://github.com/hernanilr/evideo
158
156
  yard.run: yard
159
- post_install_message:
157
+ post_install_message:
160
158
  rdoc_options: []
161
159
  require_paths:
162
160
  - lib
@@ -171,8 +169,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
171
169
  - !ruby/object:Gem::Version
172
170
  version: '0'
173
171
  requirements: []
174
- rubygems_version: 3.3.7
175
- signing_key:
172
+ rubygems_version: 3.4.20
173
+ signing_key:
176
174
  specification_version: 4
177
175
  summary: Processa ficheiros video.
178
176
  test_files: []
data/lib/evideo/vars1.rb DELETED
@@ -1,95 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # (see Evideo)
4
- module Evideo
5
- # parametros video :tempo, :bitrate - Duration: 01:01:08.50, start: 0.000000, bitrate: 2228 kb/s
6
- RE1 = /duration:\s+(\d\d:\d\d:\d\d).*bitrate:\s+(\d+)\s+kb/i.freeze
7
- # parametros video :height, :fps -
8
- # Stream #0:0: Video: h264 (Main), yuv420p(tv, bt709, progressive), 1280x720
9
- # [SAR 1:1 DAR 16:9], 23.98 fps, 23.98 tbr, 1k tbn, 180k tbc (default)
10
- RE2 = /stream.*video:.*x\s*(\d+).*\s+(\d+\.*\d*)\s+fps/i.freeze
11
- # parametros video :ratio - display_aspect_ratio=16:9
12
- RE3 = /display_aspect_ratio\s*=\s*(\d+:\d+)$/i.freeze
13
- # parametros video :audio - Stream #0:1(eng): Audio: aac (LC), 48000 Hz, stereo, fltp (default)
14
- RE4 = /stream.*audio:.*\s+(\d+)\s+hz/i.freeze
15
-
16
- # permite analizar string output do comando sonda video
17
- class Video
18
- # @return [String] base ficheiro video
19
- attr_reader :bas
20
- # @return [String] extensao ficheiro video
21
- attr_reader :ext
22
- # @return [Thor::CoreExt::HashWithIndifferentAccess] opcoes trabalho
23
- attr_reader :ops
24
-
25
- # @param [String] ficheiro video a processar
26
- # @param [Thor::CoreExt::HashWithIndifferentAccess] opcoes trabalho
27
- # @option opcoes [Array<String>] :d (/home/eu/lust,/media/eu/hrv2,/media/eu/hrv2/lust) pastas onde procurar videos
28
- # @option opcoes [String] :i (ftv) pasta inicial dos videos
29
- # @option opcoes [String] :o (out) pasta final dos videos
30
- # @option opcoes [Boolean] :s (false) 10 segundos cortados no inicio do video final
31
- # @option opcoes [Integer] :t (0) segundos duracao video final 0=sem cortes
32
- # @return [Video] videos processados para arquivo uniformizado
33
- def initialize(ficheiro, opcoes)
34
- @ext = File.extname(ficheiro)
35
- @bas = File.basename(ficheiro, ext)
36
- @ops = opcoes
37
- @iopcao = {}
38
- end
39
-
40
- # @return [String] texto probe do video inicial
41
- def iprobe
42
- @iprobe ||= `#{cmd_prob(inome)}`
43
- end
44
-
45
- # @return [Array<String>] parametros video inicial [:tempo, :bitrate]
46
- def i1scan
47
- @i1scan ||= iprobe.scan(RE1).flatten
48
- end
49
-
50
- # @return [Array<String>] parametros video inicial [:height, :fps]
51
- def i2scan
52
- @i2scan ||= iprobe.scan(RE2).flatten
53
- end
54
-
55
- # @return [String] parametro video inicial :tempo hh:mm:ss
56
- def itempo
57
- @iopcao[:tempo] ||= (i1scan[0] || '00:00:00')
58
- end
59
-
60
- # @return [Integer] parametro video inicial :bitrate kb/s
61
- def ibitrate
62
- @iopcao[:bitrate] ||= Integer(i1scan[1] || 0)
63
- end
64
-
65
- # @return [Integer] parametro video inicial :height
66
- def iheight
67
- @iopcao[:height] ||= Integer(i2scan[0] || 0)
68
- end
69
-
70
- # @return [Float] parametro video inicial :fps frame_rate
71
- def ifps
72
- @iopcao[:fps] ||= Float(i2scan[1] || 0)
73
- end
74
-
75
- # @return [String] parametro video inicial aspect :ratio 16:9
76
- def iratio
77
- @iopcao[:ratio] ||= (iprobe.scan(RE3).flatten[0] || '0:1')
78
- end
79
-
80
- # @return [Integer] parametro video inicial :audio Hz
81
- def iaudio
82
- @iopcao[:audio] ||= Integer(iprobe.scan(RE4).flatten[0] || 0)
83
- end
84
-
85
- # @return [String] ficheiro inicial absoluto
86
- def inome
87
- "#{ops[:d][0]}/#{ops[:i]}/#{bas}#{ext}"
88
- end
89
-
90
- # @return [String] mostra dados do ficheiro video inicial
91
- def ishow
92
- "# r:#{ibitrate} h:#{iheight} #{iratio}"
93
- end
94
- end
95
- end
data/lib/evideo/vars2.rb DELETED
@@ -1,83 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'time'
4
-
5
- # (see Evideo)
6
- module Evideo
7
- # permite analizar string output do comando sonda video
8
- class Video
9
- # @return [Time] tempo no ruby standard library com precisao
10
- def self.to_t(tempo, pre = 8)
11
- Time.parse(tempo[0, pre])
12
- end
13
-
14
- # inicia variaveis do video final
15
- def oinit
16
- @oopcao = {}
17
- @oprobe = nil
18
- @o1scan = nil
19
- @o2scan = nil
20
- end
21
-
22
- # @return [String] texto probe do video final
23
- def oprobe
24
- return '' unless File.exist?(onome)
25
-
26
- @oprobe ||= `#{cmd_prob(onome)}`
27
- end
28
-
29
- # @return [Array<String>] parametros video final [:tempo, :bitrate]
30
- def o1scan
31
- @o1scan ||= oprobe.scan(RE1).flatten
32
- end
33
-
34
- # @return [Array<String>] parametros video final [:height, :fps]
35
- def o2scan
36
- @o2scan ||= oprobe.scan(RE2).flatten
37
- end
38
-
39
- # @return [String] parametro video final :tempo hh:mm:ss
40
- def otempo
41
- @oopcao[:tempo] ||= (o1scan[0] || '00:00:00')
42
- end
43
-
44
- # @return [Integer] parametro video final :bitrate kb/s
45
- def obitrate
46
- @oopcao[:bitrate] ||= Integer(o1scan[1] || 0)
47
- end
48
-
49
- # @return [Integer] parametro video final :height
50
- def oheight
51
- @oopcao[:height] ||= Integer(o2scan[0] || 0)
52
- end
53
-
54
- # @return [Float] parametro video final :fps frame_rate
55
- def ofps
56
- @oopcao[:fps] ||= Float(o2scan[1] || 0)
57
- end
58
-
59
- # @return [String] parametro video final aspect :ratio 16:9
60
- def oratio
61
- @oopcao[:ratio] ||= (oprobe.scan(RE3).flatten[0] || '0:1')
62
- end
63
-
64
- # @return [Integer] posicao array pastas onde procurar videos finais
65
- def pos
66
- # -1 #{ops[:d][0]}/#{ops[:i]}/#{ops[:o]}"
67
- # 0 #{ops[:d][pos]}/#{ops[:o]}"
68
- # 1 #{ops[:d][pos]}/#{ops[:o]}"
69
- @pos ||= -1
70
- end
71
-
72
- # @return [String] video final absoluto
73
- def onome
74
- dir = ops[:d]
75
- (pos == -1 ? "#{dir[0]}/#{ops[:i]}" : dir[pos]) + "/#{ops[:o]}/#{bas.downcase}.mp4"
76
- end
77
-
78
- # @return [String] mostra dados do ficheiro video final
79
- def oshow
80
- "# r:#{obitrate} h:#{oheight} #{oratio} #{ops[:d][pos]}/#{ops[:o]}"
81
- end
82
- end
83
- end