evideo 0.3.3 → 0.3.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 +4 -4
- data/.reek.yml +6 -0
- data/.rubocop.yml +63 -5
- data/Gemfile.lock +90 -44
- data/evideo.gemspec +23 -23
- data/lib/evideo/processa.rb +13 -12
- data/lib/evideo/{vars1.rb → vars.rb} +80 -6
- data/lib/evideo/version.rb +1 -1
- data/lib/evideo.rb +14 -15
- metadata +9 -9
- data/lib/evideo/vars2.rb +0 -83
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 80e2757406d355ada861d1d14143a88a1c4eb976f1e61cab29a40cce80741f3d
|
4
|
+
data.tar.gz: 8e11636b98d5e9d0d502e9c4d94e1399a1b4ec4a8d2950a9320a35b21a80670b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5246a64a744003e52e015bce39726f1ed4f7f4969921a96f22d6d4ba3ed0202f11d1022534343a876b35abc74d2ae3a40598972b4b8533fbe6992cd6c6c80271
|
7
|
+
data.tar.gz: 3b7ff053f4d77497a917176d3837028c0aef062eb9bb06431864fe96004989375219775ddae11ad246b2c5c14fc81cb1b46a3d92aeb8b28c6231f3230e34f58c
|
data/.reek.yml
ADDED
data/.rubocop.yml
CHANGED
@@ -1,12 +1,70 @@
|
|
1
|
+
---
|
1
2
|
AllCops:
|
2
|
-
TargetRubyVersion: 3.
|
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
|
-
|
39
|
+
Enabled: false
|
7
40
|
|
8
|
-
|
9
|
-
|
41
|
+
Style/Documentation:
|
42
|
+
Enabled: false
|
43
|
+
|
44
|
+
Style/RequireOrder:
|
45
|
+
Enabled: false
|
10
46
|
|
11
47
|
Style/ConstantVisibility:
|
12
|
-
|
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.
|
4
|
+
evideo (0.3.5)
|
5
5
|
thor
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: https://rubygems.org/
|
9
9
|
specs:
|
10
|
-
ast (2.4.
|
10
|
+
ast (2.4.3)
|
11
11
|
backport (1.2.0)
|
12
|
-
benchmark (0.
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
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
|
-
|
22
|
-
|
23
|
-
|
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
|
-
|
26
|
-
|
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.
|
62
|
+
racc (1.8.1)
|
30
63
|
rainbow (3.1.1)
|
31
|
-
rake (13.
|
32
|
-
rbs (
|
33
|
-
|
34
|
-
|
35
|
-
|
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
|
-
|
38
|
-
|
72
|
+
rexml (~> 3.1)
|
73
|
+
regexp_parser (2.10.0)
|
74
|
+
reverse_markdown (3.0.0)
|
39
75
|
nokogiri
|
40
|
-
rexml (3.
|
41
|
-
rubocop (1.
|
76
|
+
rexml (3.4.1)
|
77
|
+
rubocop (1.74.0)
|
42
78
|
json (~> 2.3)
|
43
|
-
language_server-protocol (
|
79
|
+
language_server-protocol (~> 3.17.0.2)
|
80
|
+
lint_roller (~> 1.1.0)
|
44
81
|
parallel (~> 1.10)
|
45
|
-
parser (>= 3.
|
82
|
+
parser (>= 3.3.0.2)
|
46
83
|
rainbow (>= 2.2.2, < 4.0)
|
47
|
-
regexp_parser (>=
|
48
|
-
|
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, <
|
52
|
-
rubocop-ast (1.
|
53
|
-
parser (>= 3.
|
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
|
-
|
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
|
-
|
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 (~>
|
67
|
-
reverse_markdown (
|
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
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
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
|
-
|
132
|
+
rubocop-rake
|
87
133
|
solargraph
|
88
134
|
yard
|
89
135
|
|
90
136
|
BUNDLED WITH
|
91
|
-
2.
|
137
|
+
2.4.19
|
data/evideo.gemspec
CHANGED
@@ -1,22 +1,22 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
lib = File.expand_path(
|
3
|
+
lib = File.expand_path("lib", __dir__)
|
4
4
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
5
|
-
require
|
5
|
+
require "evideo/version"
|
6
6
|
|
7
7
|
Gem::Specification.new do |spec|
|
8
|
-
spec.name
|
9
|
-
spec.version
|
10
|
-
spec.authors
|
11
|
-
spec.email
|
12
|
-
spec.homepage
|
13
|
-
spec.license
|
14
|
-
spec.summary
|
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
|
18
|
-
spec.metadata[
|
19
|
-
spec.metadata[
|
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
|
29
|
-
spec.executables
|
30
|
-
spec.require_paths = [
|
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(
|
33
|
-
spec.add_development_dependency(
|
34
|
-
spec.add_development_dependency(
|
35
|
-
spec.add_development_dependency(
|
36
|
-
spec.add_development_dependency(
|
37
|
-
spec.add_development_dependency(
|
38
|
-
spec.add_development_dependency(
|
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(
|
40
|
+
spec.add_dependency("thor")
|
41
41
|
end
|
data/lib/evideo/processa.rb
CHANGED
@@ -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
|
-
|
55
|
-
|
56
|
-
|
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
|
72
|
-
|
73
|
-
|
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
|
-
|
101
|
-
|
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
|
@@ -3,15 +3,15 @@
|
|
3
3
|
# (see Evideo)
|
4
4
|
module Evideo
|
5
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
|
6
|
+
RE1 = /duration:\s+(\d\d:\d\d:\d\d).*bitrate:\s+(\d+)\s+kb/i
|
7
7
|
# parametros video :height, :fps -
|
8
8
|
# Stream #0:0: Video: h264 (Main), yuv420p(tv, bt709, progressive), 1280x720
|
9
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
|
10
|
+
RE2 = /stream.*video:.*x\s*(\d+).*\s+(\d+\.*\d*)\s+fps/i
|
11
11
|
# parametros video :ratio - display_aspect_ratio=16:9
|
12
|
-
RE3 = /display_aspect_ratio\s*=\s*(\d+:\d+)$/i
|
12
|
+
RE3 = /display_aspect_ratio\s*=\s*(\d+:\d+)$/i
|
13
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
|
14
|
+
RE4 = /stream.*audio:.*\s+(\d+)\s+hz/i
|
15
15
|
|
16
16
|
# permite analizar string output do comando sonda video
|
17
17
|
class Video
|
@@ -54,7 +54,7 @@ module Evideo
|
|
54
54
|
|
55
55
|
# @return [String] parametro video inicial :tempo hh:mm:ss
|
56
56
|
def itempo
|
57
|
-
@iopcao[:tempo] ||=
|
57
|
+
@iopcao[:tempo] ||= i1scan[0] || '00:00:00'
|
58
58
|
end
|
59
59
|
|
60
60
|
# @return [Integer] parametro video inicial :bitrate kb/s
|
@@ -74,7 +74,7 @@ module Evideo
|
|
74
74
|
|
75
75
|
# @return [String] parametro video inicial aspect :ratio 16:9
|
76
76
|
def iratio
|
77
|
-
@iopcao[:ratio] ||=
|
77
|
+
@iopcao[:ratio] ||= iprobe.scan(RE3).flatten[0] || '0:1'
|
78
78
|
end
|
79
79
|
|
80
80
|
# @return [Integer] parametro video inicial :audio Hz
|
@@ -91,5 +91,79 @@ module Evideo
|
|
91
91
|
def ishow
|
92
92
|
"# r:#{ibitrate} h:#{iheight} #{iratio}"
|
93
93
|
end
|
94
|
+
|
95
|
+
# @return [Time] tempo no ruby standard library com precisao
|
96
|
+
def self.to_t(tempo, pre = 8)
|
97
|
+
Time.parse(tempo[0, pre])
|
98
|
+
end
|
99
|
+
|
100
|
+
# inicia variaveis do video final
|
101
|
+
def oinit
|
102
|
+
@oopcao = {}
|
103
|
+
@oprobe = nil
|
104
|
+
@o1scan = nil
|
105
|
+
@o2scan = nil
|
106
|
+
end
|
107
|
+
|
108
|
+
# @return [String] texto probe do video final
|
109
|
+
def oprobe
|
110
|
+
return '' unless File.exist?(onome)
|
111
|
+
|
112
|
+
@oprobe ||= `#{cmd_prob(onome)}`
|
113
|
+
end
|
114
|
+
|
115
|
+
# @return [Array<String>] parametros video final [:tempo, :bitrate]
|
116
|
+
def o1scan
|
117
|
+
@o1scan ||= oprobe.scan(RE1).flatten
|
118
|
+
end
|
119
|
+
|
120
|
+
# @return [Array<String>] parametros video final [:height, :fps]
|
121
|
+
def o2scan
|
122
|
+
@o2scan ||= oprobe.scan(RE2).flatten
|
123
|
+
end
|
124
|
+
|
125
|
+
# @return [String] parametro video final :tempo hh:mm:ss
|
126
|
+
def otempo
|
127
|
+
@oopcao[:tempo] ||= o1scan[0] || '00:00:00'
|
128
|
+
end
|
129
|
+
|
130
|
+
# @return [Integer] parametro video final :bitrate kb/s
|
131
|
+
def obitrate
|
132
|
+
@oopcao[:bitrate] ||= Integer(o1scan[1] || 0)
|
133
|
+
end
|
134
|
+
|
135
|
+
# @return [Integer] parametro video final :height
|
136
|
+
def oheight
|
137
|
+
@oopcao[:height] ||= Integer(o2scan[0] || 0)
|
138
|
+
end
|
139
|
+
|
140
|
+
# @return [Float] parametro video final :fps frame_rate
|
141
|
+
def ofps
|
142
|
+
@oopcao[:fps] ||= Float(o2scan[1] || 0)
|
143
|
+
end
|
144
|
+
|
145
|
+
# @return [String] parametro video final aspect :ratio 16:9
|
146
|
+
def oratio
|
147
|
+
@oopcao[:ratio] ||= oprobe.scan(RE3).flatten[0] || '0:1'
|
148
|
+
end
|
149
|
+
|
150
|
+
# @return [Integer] posicao array pastas onde procurar videos finais
|
151
|
+
def pos
|
152
|
+
# -1 #{ops[:d][0]}/#{ops[:i]}/#{ops[:o]}"
|
153
|
+
# 0 #{ops[:d][pos]}/#{ops[:o]}"
|
154
|
+
# 1 #{ops[:d][pos]}/#{ops[:o]}"
|
155
|
+
@pos ||= -1
|
156
|
+
end
|
157
|
+
|
158
|
+
# @return [String] video final absoluto
|
159
|
+
def onome
|
160
|
+
dir = ops[:d]
|
161
|
+
(pos == -1 ? "#{dir[0]}/#{ops[:i]}" : dir[pos]) + "/#{ops[:o]}/#{bas.downcase}.mp4"
|
162
|
+
end
|
163
|
+
|
164
|
+
# @return [String] mostra dados do ficheiro video final
|
165
|
+
def oshow
|
166
|
+
"# r:#{obitrate} h:#{oheight} #{oratio} #{ops[:d][pos]}/#{ops[:o]}"
|
167
|
+
end
|
94
168
|
end
|
95
169
|
end
|
data/lib/evideo/version.rb
CHANGED
data/lib/evideo.rb
CHANGED
@@ -1,10 +1,9 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
4
|
-
require
|
5
|
-
require
|
6
|
-
require
|
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:
|
17
|
-
class_option :i, banner:
|
18
|
-
class_option :o, banner:
|
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
|
24
|
-
option :x, type: :boolean, default: false, desc:
|
25
|
-
option :s, type: :numeric, default: 0, desc:
|
26
|
-
option :t, type: :numeric, default: 0, desc:
|
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
|
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.
|
4
|
+
version: 0.3.5
|
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:
|
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:
|
70
|
+
name: rubocop-rake
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
73
|
- - ">="
|
@@ -133,6 +133,7 @@ extensions: []
|
|
133
133
|
extra_rdoc_files: []
|
134
134
|
files:
|
135
135
|
- ".gitignore"
|
136
|
+
- ".reek.yml"
|
136
137
|
- ".rubocop.yml"
|
137
138
|
- ".travis.yml"
|
138
139
|
- Gemfile
|
@@ -147,8 +148,7 @@ files:
|
|
147
148
|
- exe/evideo
|
148
149
|
- lib/evideo.rb
|
149
150
|
- lib/evideo/processa.rb
|
150
|
-
- lib/evideo/
|
151
|
-
- lib/evideo/vars2.rb
|
151
|
+
- lib/evideo/vars.rb
|
152
152
|
- lib/evideo/version.rb
|
153
153
|
homepage: https://github.com/hernanilr/evideo
|
154
154
|
licenses:
|
@@ -156,7 +156,7 @@ licenses:
|
|
156
156
|
metadata:
|
157
157
|
homepage_uri: https://github.com/hernanilr/evideo
|
158
158
|
yard.run: yard
|
159
|
-
post_install_message:
|
159
|
+
post_install_message:
|
160
160
|
rdoc_options: []
|
161
161
|
require_paths:
|
162
162
|
- lib
|
@@ -171,8 +171,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
171
171
|
- !ruby/object:Gem::Version
|
172
172
|
version: '0'
|
173
173
|
requirements: []
|
174
|
-
rubygems_version: 3.
|
175
|
-
signing_key:
|
174
|
+
rubygems_version: 3.4.20
|
175
|
+
signing_key:
|
176
176
|
specification_version: 4
|
177
177
|
summary: Processa ficheiros video.
|
178
178
|
test_files: []
|
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
|